cc-team-viewer 1.4.28 → 1.4.30
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.
|
@@ -55,7 +55,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
55
55
|
`);else if(w._keyframe)b(w);else{var _=g.reduce(function(R,N){var O;return(N==null||(O=N.visit)===null||O===void 0?void 0:O.call(N,R))||R},w);Object.keys(_).forEach(function(R){var N=_[R];if($t(N)==="object"&&N&&(R!=="animationName"||!N._keyframe)&&!CN(N)){var O=!1,I=R.trim(),P=!1;(o||i)&&c?I.startsWith("@")?O=!0:I==="&"?I=zy("",c,f):I=zy(R,c,f):o&&!c&&(I==="&"||I==="")&&(I="",P=!0);var M=e(N,n,{root:P,injectHash:O,parentSelectors:[].concat(Ze(l),[I])}),k=de(M,2),A=k[0],j=k[1];v=J(J({},v),j),h+="".concat(I).concat(A)}else{let V=function(H,W){var z=H.replace(/[A-Z]/g,function(G){return"-".concat(G.toLowerCase())}),K=W;!eN[H]&&typeof K=="number"&&K!==0&&(K="".concat(K,"px")),H==="animationName"&&W!==null&&W!==void 0&&W._keyframe&&(b(W),K=W.getName(c)),h+="".concat(z,":").concat(K,";")};var D,L=(D=N==null?void 0:N.value)!==null&&D!==void 0?D:N;$t(N)==="object"&&N!==null&&N!==void 0&&N[xC]&&Array.isArray(L)?L.forEach(function(H){V(R,H)}):V(R,L)}})}}),o?u&&(h&&(h="@layer ".concat(u.name," {").concat(h,"}")),u.dependencies&&(v["@layer ".concat(u.name)]=u.dependencies.map(function(E){return"@layer ".concat(E,", ").concat(u.name,";")}).join(`
|
|
56
56
|
`))):h="{".concat(h,"}"),[h,v]};function SC(e,t){return oc("".concat(e.join("%")).concat(t))}function EN(){return null}var CC="style";function Ag(e,t){var n=e.token,r=e.path,o=e.hashId,i=e.layer,l=e.nonce,c=e.clientOnly,u=e.order,f=u===void 0?0:u,m=d.useContext(Sc),g=m.autoClear;m.mock;var h=m.defaultCache,v=m.hashPriority,b=m.container,x=m.ssrInline,S=m.transformers,E=m.linters,w=m.cache,_=m.layer,R=n._tokenKey,N=[R];_&&N.push("layer"),N.push.apply(N,Ze(r));var O=Mg,I=Gh(CC,N,function(){var j=N.join("|");if(yN(j)){var D=xN(j),L=de(D,2),V=L[0],H=L[1];if(V)return[V,R,H,{},c,f]}var W=t(),z=wN(W,{hashId:o,hashPriority:v,layer:_?i:void 0,path:r.join("-"),transformers:S,linters:E}),K=de(z,2),G=K[0],B=K[1],U=cd(G),q=SC(N,U);return[U,R,q,B,c,f]},function(j,D){var L=de(j,3),V=L[2];(D||g)&&Mg&&ac(V,{mark:ta,attachTo:b})},function(j){var D=de(j,4),L=D[0];D[1];var V=D[2],H=D[3];if(O&&L!==bC){var W={mark:ta,prepend:_?!1:"queue",attachTo:b,priority:f},z=typeof l=="function"?l():l;z&&(W.csp={nonce:z});var K=[],G=[];Object.keys(H).forEach(function(U){U.startsWith("@layer")?K.push(U):G.push(U)}),K.forEach(function(U){Pa(cd(H[U]),"_layer-".concat(U),J(J({},W),{},{prepend:!0}))});var B=Pa(L,V,W);B[ci]=w.instanceId,B.setAttribute(Gs,R),G.forEach(function(U){Pa(cd(H[U]),"_effect-".concat(U),W)})}}),P=de(I,3),M=P[0],k=P[1],A=P[2];return function(j){var D;return!x||O||!h?D=d.createElement(EN,null):D=d.createElement("style",ze({},Y(Y({},Gs,k),ta,A),{dangerouslySetInnerHTML:{__html:M}})),d.createElement(d.Fragment,null,D,j)}}var _N=function(t,n,r){var o=de(t,6),i=o[0],l=o[1],c=o[2],u=o[3],f=o[4],m=o[5],g=r||{},h=g.plain;if(f)return null;var v=i,b={"data-rc-order":"prependQueue","data-rc-priority":"".concat(m)};return v=Sd(i,l,c,b,h),u&&Object.keys(u).forEach(function(x){if(!n[x]){n[x]=!0;var S=cd(u[x]),E=Sd(S,l,"_effect-".concat(x),b,h);x.startsWith("@layer")?v=E+v:v+=E}}),[m,c,v]},wC="cssVar",$N=function(t,n){var r=t.key,o=t.prefix,i=t.unitless,l=t.ignore,c=t.token,u=t.scope,f=u===void 0?"":u,m=d.useContext(Sc),g=m.cache.instanceId,h=m.container,v=c._tokenKey,b=[].concat(Ze(t.path),[r,f,v]),x=Gh(wC,b,function(){var S=n(),E=uC(S,r,{prefix:o,unitless:i,ignore:l,scope:f}),w=de(E,2),_=w[0],R=w[1],N=SC(b,R);return[_,R,N,r]},function(S){var E=de(S,3),w=E[2];Mg&&ac(w,{mark:ta,attachTo:h})},function(S){var E=de(S,3),w=E[1],_=E[2];if(w){var R=Pa(w,_,{mark:ta,prepend:"queue",attachTo:h,priority:-999});R[ci]=g,R.setAttribute(Gs,r)}});return x},NN=function(t,n,r){var o=de(t,4),i=o[1],l=o[2],c=o[3],u=r||{},f=u.plain;if(!i)return null;var m=-999,g={"data-rc-order":"prependQueue","data-rc-priority":"".concat(m)},h=Sd(i,c,l,g,f);return[m,l,h]};Y(Y(Y({},CC,_N),dC,J4),wC,NN);var rn=(function(){function e(t,n){yr(this,e),Y(this,"name",void 0),Y(this,"style",void 0),Y(this,"_keyframe",!0),this.name=t,this.style=n}return xr(e,[{key:"getName",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return n?"".concat(n,"-").concat(this.name):this.name}}]),e})();function xs(e){return e.notSplit=!0,e}xs(["borderTop","borderBottom"]),xs(["borderTop"]),xs(["borderBottom"]),xs(["borderLeft","borderRight"]),xs(["borderLeft"]),xs(["borderRight"]);var Xh=d.createContext({});function EC(e){return oC(e)||eC(e)||Hh(e)||aC()}function ma(e,t){for(var n=e,r=0;r<t.length;r+=1){if(n==null)return;n=n[t[r]]}return n}function _C(e,t,n,r){if(!t.length)return n;var o=EC(t),i=o[0],l=o.slice(1),c;return!e&&typeof i=="number"?c=[]:Array.isArray(e)?c=Ze(e):c=J({},e),r&&n===void 0&&l.length===1?delete c[i][l[0]]:c[i]=_C(c[i],l,n,r),c}function Qo(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return t.length&&r&&n===void 0&&!ma(e,t.slice(0,-1))?e:_C(e,t,n,r)}function RN(e){return $t(e)==="object"&&e!==null&&Object.getPrototypeOf(e)===Object.prototype}function Dy(e){return Array.isArray(e)?[]:{}}var ON=typeof Reflect>"u"?Object.keys:Reflect.ownKeys;function Ls(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=Dy(t[0]);return t.forEach(function(o){function i(l,c){var u=new Set(c),f=ma(o,l),m=Array.isArray(f);if(m||RN(f)){if(!u.has(f)){u.add(f);var g=ma(r,l);m?r=Qo(r,l,[]):(!g||$t(g)!=="object")&&(r=Qo(r,l,Dy(f))),ON(f).forEach(function(h){i([].concat(Ze(l),[h]),u)})}}else r=Qo(r,l,f)}i([])}),r}function IN(){}const TN=d.createContext({}),lf=()=>{const e=()=>{};return e.deprecated=IN,e},MN=d.createContext(void 0);var $C={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"},PN={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0},kN=J(J({},PN),{},{locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"OK",clear:"Clear",week:"Week",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",dateFormat:"M/D/YYYY",dateTimeFormat:"M/D/YYYY HH:mm:ss",previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"});const NC={placeholder:"Select time",rangePlaceholder:["Start time","End time"]},Fy={lang:Object.assign({placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"]},kN),timePickerLocale:Object.assign({},NC)},bo="${label} is not a valid ${type}",mi={locale:"en",Pagination:$C,DatePicker:Fy,TimePicker:NC,Calendar:Fy,global:{placeholder:"Please select",close:"Close"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckAll:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Tour:{Next:"Next",Previous:"Previous",Finish:"Finish"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",deselectAll:"Deselect all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand",collapse:"Collapse"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:bo,method:bo,array:bo,object:bo,number:bo,date:bo,boolean:bo,integer:bo,float:bo,regexp:bo,email:bo,url:bo,hex:bo},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},Image:{preview:"Preview"},QRCode:{expired:"QR code expired",refresh:"Refresh",scanned:"Scanned"},ColorPicker:{presetEmpty:"Empty",transparent:"Transparent",singleColor:"Single",gradientColor:"Gradient"}};let ud=Object.assign({},mi.Modal),dd=[];const Hy=()=>dd.reduce((e,t)=>Object.assign(Object.assign({},e),t),mi.Modal);function jN(e){if(e){const t=Object.assign({},e);return dd.push(t),ud=Hy(),()=>{dd=dd.filter(n=>n!==t),ud=Hy()}}ud=Object.assign({},mi.Modal)}function RC(){return ud}const Yh=d.createContext(void 0),Da=(e,t)=>{const n=d.useContext(Yh),r=d.useMemo(()=>{var i;const l=t||mi[e],c=(i=n==null?void 0:n[e])!==null&&i!==void 0?i:{};return Object.assign(Object.assign({},typeof l=="function"?l():l),c||{})},[e,t,n]),o=d.useMemo(()=>{const i=n==null?void 0:n.locale;return n!=null&&n.exist&&!i?mi.locale:i},[n]);return[r,o]},AN="internalMark",LN=e=>{const{locale:t={},children:n,_ANT_MARK__:r}=e;d.useEffect(()=>jN(t==null?void 0:t.Modal),[t]);const o=d.useMemo(()=>Object.assign(Object.assign({},t),{exist:!0}),[t]);return d.createElement(Yh.Provider,{value:o},n)},Qh={blue:"#1677FF",purple:"#722ED1",cyan:"#13C2C2",green:"#52C41A",magenta:"#EB2F96",pink:"#EB2F96",red:"#F5222D",orange:"#FA8C16",yellow:"#FADB14",volcano:"#FA541C",geekblue:"#2F54EB",gold:"#FAAD14",lime:"#A0D911"},lc=Object.assign(Object.assign({},Qh),{colorPrimary:"#1677ff",colorSuccess:"#52c41a",colorWarning:"#faad14",colorError:"#ff4d4f",colorInfo:"#1677ff",colorLink:"",colorTextBase:"",colorBgBase:"",fontFamily:`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
57
57
|
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
58
|
-
'Noto Color Emoji'`,fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0}),Or=Math.round;function Rp(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(o=>parseFloat(o));for(let o=0;o<3;o+=1)r[o]=t(r[o]||0,n[o]||"",o);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const Vy=(e,t,n)=>n===0?e:e/100;function Al(e,t){const n=t||255;return e>n?n:e<0?0:e}class $n{constructor(t){Y(this,"isValid",!0),Y(this,"r",0),Y(this,"g",0),Y(this,"b",0),Y(this,"a",1),Y(this,"_h",void 0),Y(this,"_s",void 0),Y(this,"_l",void 0),Y(this,"_v",void 0),Y(this,"_max",void 0),Y(this,"_min",void 0),Y(this,"_brightness",void 0);function n(o){return o[0]in t&&o[1]in t&&o[2]in t}if(t)if(typeof t=="string"){let i=function(l){return o.startsWith(l)};var r=i;const o=t.trim();/^#?[A-F\d]{3,8}$/i.test(o)?this.fromHexString(o):i("rgb")?this.fromRgbString(o):i("hsl")?this.fromHslString(o):(i("hsv")||i("hsb"))&&this.fromHsvString(o)}else if(t instanceof $n)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._s=t._s,this._l=t._l,this._v=t._v;else if(n("rgb"))this.r=Al(t.r),this.g=Al(t.g),this.b=Al(t.b),this.a=typeof t.a=="number"?Al(t.a,1):1;else if(n("hsl"))this.fromHsl(t);else if(n("hsv"))this.fromHsv(t);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t))}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const n=this.toHsv();return n.h=t,this._c(n)}getLuminance(){function t(i){const l=i/255;return l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4)}const n=t(this.r),r=t(this.g),o=t(this.b);return .2126*n+.7152*r+.0722*o}getHue(){if(typeof this._h>"u"){const t=this.getMax()-this.getMin();t===0?this._h=0:this._h=Or(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/t+2:(this.r-this.g)/t+4))}return this._h}getSaturation(){if(typeof this._s>"u"){const t=this.getMax()-this.getMin();t===0?this._s=0:this._s=t/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(t=10){const n=this.getHue(),r=this.getSaturation();let o=this.getLightness()-t/100;return o<0&&(o=0),this._c({h:n,s:r,l:o,a:this.a})}lighten(t=10){const n=this.getHue(),r=this.getSaturation();let o=this.getLightness()+t/100;return o>1&&(o=1),this._c({h:n,s:r,l:o,a:this.a})}mix(t,n=50){const r=this._c(t),o=n/100,i=c=>(r[c]-this[c])*o+this[c],l={r:Or(i("r")),g:Or(i("g")),b:Or(i("b")),a:Or(i("a")*100)/100};return this._c(l)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const n=this._c(t),r=this.a+n.a*(1-this.a),o=i=>Or((this[i]*this.a+n[i]*n.a*(1-this.a))/r);return this._c({r:o("r"),g:o("g"),b:o("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const n=(this.r||0).toString(16);t+=n.length===2?n:"0"+n;const r=(this.g||0).toString(16);t+=r.length===2?r:"0"+r;const o=(this.b||0).toString(16);if(t+=o.length===2?o:"0"+o,typeof this.a=="number"&&this.a>=0&&this.a<1){const i=Or(this.a*255).toString(16);t+=i.length===2?i:"0"+i}return t}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),n=Or(this.getSaturation()*100),r=Or(this.getLightness()*100);return this.a!==1?`hsla(${t},${n}%,${r}%,${this.a})`:`hsl(${t},${n}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(t,n,r){const o=this.clone();return o[t]=Al(n,r),o}_c(t){return new this.constructor(t)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(t){const n=t.replace("#","");function r(o,i){return parseInt(n[o]+n[i||o],16)}n.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=n[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=n[6]?r(6,7)/255:1)}fromHsl({h:t,s:n,l:r,a:o}){if(this._h=t%360,this._s=n,this._l=r,this.a=typeof o=="number"?o:1,n<=0){const h=Or(r*255);this.r=h,this.g=h,this.b=h}let i=0,l=0,c=0;const u=t/60,f=(1-Math.abs(2*r-1))*n,m=f*(1-Math.abs(u%2-1));u>=0&&u<1?(i=f,l=m):u>=1&&u<2?(i=m,l=f):u>=2&&u<3?(l=f,c=m):u>=3&&u<4?(l=m,c=f):u>=4&&u<5?(i=m,c=f):u>=5&&u<6&&(i=f,c=m);const g=r-f/2;this.r=Or((i+g)*255),this.g=Or((l+g)*255),this.b=Or((c+g)*255)}fromHsv({h:t,s:n,v:r,a:o}){this._h=t%360,this._s=n,this._v=r,this.a=typeof o=="number"?o:1;const i=Or(r*255);if(this.r=i,this.g=i,this.b=i,n<=0)return;const l=t/60,c=Math.floor(l),u=l-c,f=Or(r*(1-n)*255),m=Or(r*(1-n*u)*255),g=Or(r*(1-n*(1-u))*255);switch(c){case 0:this.g=g,this.b=f;break;case 1:this.r=m,this.b=f;break;case 2:this.r=f,this.b=g;break;case 3:this.r=f,this.g=m;break;case 4:this.r=g,this.g=f;break;case 5:default:this.g=f,this.b=m;break}}fromHsvString(t){const n=Rp(t,Vy);this.fromHsv({h:n[0],s:n[1],v:n[2],a:n[3]})}fromHslString(t){const n=Rp(t,Vy);this.fromHsl({h:n[0],s:n[1],l:n[2],a:n[3]})}fromRgbString(t){const n=Rp(t,(r,o)=>o.includes("%")?Or(r/100*255):r);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}}var Lu=2,Wy=.16,BN=.05,zN=.05,DN=.15,OC=5,IC=4,FN=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function Uy(e,t,n){var r;return Math.round(e.h)>=60&&Math.round(e.h)<=240?r=n?Math.round(e.h)-Lu*t:Math.round(e.h)+Lu*t:r=n?Math.round(e.h)+Lu*t:Math.round(e.h)-Lu*t,r<0?r+=360:r>=360&&(r-=360),r}function Gy(e,t,n){if(e.h===0&&e.s===0)return e.s;var r;return n?r=e.s-Wy*t:t===IC?r=e.s+Wy:r=e.s+BN*t,r>1&&(r=1),n&&t===OC&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(r*100)/100}function qy(e,t,n){var r;return n?r=e.v+zN*t:r=e.v-DN*t,r=Math.max(0,Math.min(1,r)),Math.round(r*100)/100}function Di(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[],r=new $n(e),o=r.toHsv(),i=OC;i>0;i-=1){var l=new $n({h:Uy(o,i,!0),s:Gy(o,i,!0),v:qy(o,i,!0)});n.push(l)}n.push(r);for(var c=1;c<=IC;c+=1){var u=new $n({h:Uy(o,c),s:Gy(o,c),v:qy(o,c)});n.push(u)}return t.theme==="dark"?FN.map(function(f){var m=f.index,g=f.amount;return new $n(t.backgroundColor||"#141414").mix(n[m],g).toHexString()}):n.map(function(f){return f.toHexString()})}var Op={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},Lg=["#fff1f0","#ffccc7","#ffa39e","#ff7875","#ff4d4f","#f5222d","#cf1322","#a8071a","#820014","#5c0011"];Lg.primary=Lg[5];var Bg=["#fff2e8","#ffd8bf","#ffbb96","#ff9c6e","#ff7a45","#fa541c","#d4380d","#ad2102","#871400","#610b00"];Bg.primary=Bg[5];var zg=["#fff7e6","#ffe7ba","#ffd591","#ffc069","#ffa940","#fa8c16","#d46b08","#ad4e00","#873800","#612500"];zg.primary=zg[5];var Cd=["#fffbe6","#fff1b8","#ffe58f","#ffd666","#ffc53d","#faad14","#d48806","#ad6800","#874d00","#613400"];Cd.primary=Cd[5];var Dg=["#feffe6","#ffffb8","#fffb8f","#fff566","#ffec3d","#fadb14","#d4b106","#ad8b00","#876800","#614700"];Dg.primary=Dg[5];var Fg=["#fcffe6","#f4ffb8","#eaff8f","#d3f261","#bae637","#a0d911","#7cb305","#5b8c00","#3f6600","#254000"];Fg.primary=Fg[5];var Hg=["#f6ffed","#d9f7be","#b7eb8f","#95de64","#73d13d","#52c41a","#389e0d","#237804","#135200","#092b00"];Hg.primary=Hg[5];var Vg=["#e6fffb","#b5f5ec","#87e8de","#5cdbd3","#36cfc9","#13c2c2","#08979c","#006d75","#00474f","#002329"];Vg.primary=Vg[5];var wd=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];wd.primary=wd[5];var Wg=["#f0f5ff","#d6e4ff","#adc6ff","#85a5ff","#597ef7","#2f54eb","#1d39c4","#10239e","#061178","#030852"];Wg.primary=Wg[5];var Ug=["#f9f0ff","#efdbff","#d3adf7","#b37feb","#9254de","#722ed1","#531dab","#391085","#22075e","#120338"];Ug.primary=Ug[5];var Gg=["#fff0f6","#ffd6e7","#ffadd2","#ff85c0","#f759ab","#eb2f96","#c41d7f","#9e1068","#780650","#520339"];Gg.primary=Gg[5];var qg=["#a6a6a6","#999999","#8c8c8c","#808080","#737373","#666666","#404040","#1a1a1a","#000000","#000000"];qg.primary=qg[5];var Ip={red:Lg,volcano:Bg,orange:zg,gold:Cd,yellow:Dg,lime:Fg,green:Hg,cyan:Vg,blue:wd,geekblue:Wg,purple:Ug,magenta:Gg,grey:qg};function TC(e,{generateColorPalettes:t,generateNeutralColorPalettes:n}){const{colorSuccess:r,colorWarning:o,colorError:i,colorInfo:l,colorPrimary:c,colorBgBase:u,colorTextBase:f}=e,m=t(c),g=t(r),h=t(o),v=t(i),b=t(l),x=n(u,f),S=e.colorLink||e.colorInfo,E=t(S),w=new $n(v[1]).mix(new $n(v[3]),50).toHexString();return Object.assign(Object.assign({},x),{colorPrimaryBg:m[1],colorPrimaryBgHover:m[2],colorPrimaryBorder:m[3],colorPrimaryBorderHover:m[4],colorPrimaryHover:m[5],colorPrimary:m[6],colorPrimaryActive:m[7],colorPrimaryTextHover:m[8],colorPrimaryText:m[9],colorPrimaryTextActive:m[10],colorSuccessBg:g[1],colorSuccessBgHover:g[2],colorSuccessBorder:g[3],colorSuccessBorderHover:g[4],colorSuccessHover:g[4],colorSuccess:g[6],colorSuccessActive:g[7],colorSuccessTextHover:g[8],colorSuccessText:g[9],colorSuccessTextActive:g[10],colorErrorBg:v[1],colorErrorBgHover:v[2],colorErrorBgFilledHover:w,colorErrorBgActive:v[3],colorErrorBorder:v[3],colorErrorBorderHover:v[4],colorErrorHover:v[5],colorError:v[6],colorErrorActive:v[7],colorErrorTextHover:v[8],colorErrorText:v[9],colorErrorTextActive:v[10],colorWarningBg:h[1],colorWarningBgHover:h[2],colorWarningBorder:h[3],colorWarningBorderHover:h[4],colorWarningHover:h[4],colorWarning:h[6],colorWarningActive:h[7],colorWarningTextHover:h[8],colorWarningText:h[9],colorWarningTextActive:h[10],colorInfoBg:b[1],colorInfoBgHover:b[2],colorInfoBorder:b[3],colorInfoBorderHover:b[4],colorInfoHover:b[4],colorInfo:b[6],colorInfoActive:b[7],colorInfoTextHover:b[8],colorInfoText:b[9],colorInfoTextActive:b[10],colorLinkHover:E[4],colorLink:E[6],colorLinkActive:E[7],colorBgMask:new $n("#000").setA(.45).toRgbString(),colorWhite:"#fff"})}const HN=e=>{let t=e,n=e,r=e,o=e;return e<6&&e>=5?t=e+1:e<16&&e>=6?t=e+2:e>=16&&(t=16),e<7&&e>=5?n=4:e<8&&e>=7?n=5:e<14&&e>=8?n=6:e<16&&e>=14?n=7:e>=16&&(n=8),e<6&&e>=2?r=1:e>=6&&(r=2),e>4&&e<8?o=4:e>=8&&(o=6),{borderRadius:e,borderRadiusXS:r,borderRadiusSM:n,borderRadiusLG:t,borderRadiusOuter:o}};function VN(e){const{motionUnit:t,motionBase:n,borderRadius:r,lineWidth:o}=e;return Object.assign({motionDurationFast:`${(n+t).toFixed(1)}s`,motionDurationMid:`${(n+t*2).toFixed(1)}s`,motionDurationSlow:`${(n+t*3).toFixed(1)}s`,lineWidthBold:o+1},HN(r))}const WN=e=>{const{controlHeight:t}=e;return{controlHeightSM:t*.75,controlHeightXS:t*.5,controlHeightLG:t*1.25}};function fd(e){return(e+8)/e}function UN(e){const t=Array.from({length:10}).map((n,r)=>{const o=r-1,i=e*Math.pow(Math.E,o/5),l=r>1?Math.floor(i):Math.ceil(i);return Math.floor(l/2)*2});return t[1]=e,t.map(n=>({size:n,lineHeight:fd(n)}))}const GN=e=>{const t=UN(e),n=t.map(m=>m.size),r=t.map(m=>m.lineHeight),o=n[1],i=n[0],l=n[2],c=r[1],u=r[0],f=r[2];return{fontSizeSM:i,fontSize:o,fontSizeLG:l,fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:c,lineHeightLG:f,lineHeightSM:u,fontHeight:Math.round(c*o),fontHeightLG:Math.round(f*l),fontHeightSM:Math.round(u*i),lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};function qN(e){const{sizeUnit:t,sizeStep:n}=e;return{sizeXXL:t*(n+8),sizeXL:t*(n+4),sizeLG:t*(n+2),sizeMD:t*(n+1),sizeMS:t*n,size:t*n,sizeSM:t*(n-1),sizeXS:t*(n-2),sizeXXS:t*(n-3)}}const Mo=(e,t)=>new $n(e).setA(t).toRgbString(),Ll=(e,t)=>new $n(e).darken(t).toHexString(),KN=e=>{const t=Di(e);return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[4],6:t[5],7:t[6],8:t[4],9:t[5],10:t[6]}},XN=(e,t)=>{const n=e||"#fff",r=t||"#000";return{colorBgBase:n,colorTextBase:r,colorText:Mo(r,.88),colorTextSecondary:Mo(r,.65),colorTextTertiary:Mo(r,.45),colorTextQuaternary:Mo(r,.25),colorFill:Mo(r,.15),colorFillSecondary:Mo(r,.06),colorFillTertiary:Mo(r,.04),colorFillQuaternary:Mo(r,.02),colorBgSolid:Mo(r,1),colorBgSolidHover:Mo(r,.75),colorBgSolidActive:Mo(r,.95),colorBgLayout:Ll(n,4),colorBgContainer:Ll(n,0),colorBgElevated:Ll(n,0),colorBgSpotlight:Mo(r,.85),colorBgBlur:"transparent",colorBorder:Ll(n,15),colorBorderSecondary:Ll(n,6)}};function MC(e){Op.pink=Op.magenta,Ip.pink=Ip.magenta;const t=Object.keys(Qh).map(n=>{const r=e[n]===Op[n]?Ip[n]:Di(e[n]);return Array.from({length:10},()=>1).reduce((o,i,l)=>(o[`${n}-${l+1}`]=r[l],o[`${n}${l+1}`]=r[l],o),{})}).reduce((n,r)=>(n=Object.assign(Object.assign({},n),r),n),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e),t),TC(e,{generateColorPalettes:KN,generateNeutralColorPalettes:XN})),GN(e.fontSize)),qN(e)),WN(e)),VN(e))}const PC=Tg(MC),Ed={token:lc,override:{override:lc},hashed:!0},kC=Q.createContext(Ed),cc="ant",cf="anticon",YN=["outlined","borderless","filled","underlined"],QN=(e,t)=>t||(e?`${cc}-${e}`:cc),At=d.createContext({getPrefixCls:QN,iconPrefixCls:cf}),{Consumer:gY}=At,Ky={};function Tr(e){const t=d.useContext(At),{getPrefixCls:n,direction:r,getPopupContainer:o}=t,i=t[e];return Object.assign(Object.assign({classNames:Ky,styles:Ky},i),{getPrefixCls:n,direction:r,getPopupContainer:o})}const ZN=`-ant-${Date.now()}-${Math.random()}`;function JN(e,t){const n={},r=(l,c)=>{let u=l.clone();return u=(c==null?void 0:c(u))||u,u.toRgbString()},o=(l,c)=>{const u=new $n(l),f=Di(u.toRgbString());n[`${c}-color`]=r(u),n[`${c}-color-disabled`]=f[1],n[`${c}-color-hover`]=f[4],n[`${c}-color-active`]=f[6],n[`${c}-color-outline`]=u.clone().setA(.2).toRgbString(),n[`${c}-color-deprecated-bg`]=f[0],n[`${c}-color-deprecated-border`]=f[2]};if(t.primaryColor){o(t.primaryColor,"primary");const l=new $n(t.primaryColor),c=Di(l.toRgbString());c.forEach((f,m)=>{n[`primary-${m+1}`]=f}),n["primary-color-deprecated-l-35"]=r(l,f=>f.lighten(35)),n["primary-color-deprecated-l-20"]=r(l,f=>f.lighten(20)),n["primary-color-deprecated-t-20"]=r(l,f=>f.tint(20)),n["primary-color-deprecated-t-50"]=r(l,f=>f.tint(50)),n["primary-color-deprecated-f-12"]=r(l,f=>f.setA(f.a*.12));const u=new $n(c[0]);n["primary-color-active-deprecated-f-30"]=r(u,f=>f.setA(f.a*.3)),n["primary-color-active-deprecated-d-02"]=r(u,f=>f.darken(2))}return t.successColor&&o(t.successColor,"success"),t.warningColor&&o(t.warningColor,"warning"),t.errorColor&&o(t.errorColor,"error"),t.infoColor&&o(t.infoColor,"info"),`
|
|
58
|
+
'Noto Color Emoji'`,fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0}),Or=Math.round;function Rp(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(o=>parseFloat(o));for(let o=0;o<3;o+=1)r[o]=t(r[o]||0,n[o]||"",o);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const Vy=(e,t,n)=>n===0?e:e/100;function Al(e,t){const n=t||255;return e>n?n:e<0?0:e}class $n{constructor(t){Y(this,"isValid",!0),Y(this,"r",0),Y(this,"g",0),Y(this,"b",0),Y(this,"a",1),Y(this,"_h",void 0),Y(this,"_s",void 0),Y(this,"_l",void 0),Y(this,"_v",void 0),Y(this,"_max",void 0),Y(this,"_min",void 0),Y(this,"_brightness",void 0);function n(o){return o[0]in t&&o[1]in t&&o[2]in t}if(t)if(typeof t=="string"){let i=function(l){return o.startsWith(l)};var r=i;const o=t.trim();/^#?[A-F\d]{3,8}$/i.test(o)?this.fromHexString(o):i("rgb")?this.fromRgbString(o):i("hsl")?this.fromHslString(o):(i("hsv")||i("hsb"))&&this.fromHsvString(o)}else if(t instanceof $n)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._s=t._s,this._l=t._l,this._v=t._v;else if(n("rgb"))this.r=Al(t.r),this.g=Al(t.g),this.b=Al(t.b),this.a=typeof t.a=="number"?Al(t.a,1):1;else if(n("hsl"))this.fromHsl(t);else if(n("hsv"))this.fromHsv(t);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t))}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const n=this.toHsv();return n.h=t,this._c(n)}getLuminance(){function t(i){const l=i/255;return l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4)}const n=t(this.r),r=t(this.g),o=t(this.b);return .2126*n+.7152*r+.0722*o}getHue(){if(typeof this._h>"u"){const t=this.getMax()-this.getMin();t===0?this._h=0:this._h=Or(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/t+2:(this.r-this.g)/t+4))}return this._h}getSaturation(){if(typeof this._s>"u"){const t=this.getMax()-this.getMin();t===0?this._s=0:this._s=t/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(t=10){const n=this.getHue(),r=this.getSaturation();let o=this.getLightness()-t/100;return o<0&&(o=0),this._c({h:n,s:r,l:o,a:this.a})}lighten(t=10){const n=this.getHue(),r=this.getSaturation();let o=this.getLightness()+t/100;return o>1&&(o=1),this._c({h:n,s:r,l:o,a:this.a})}mix(t,n=50){const r=this._c(t),o=n/100,i=c=>(r[c]-this[c])*o+this[c],l={r:Or(i("r")),g:Or(i("g")),b:Or(i("b")),a:Or(i("a")*100)/100};return this._c(l)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const n=this._c(t),r=this.a+n.a*(1-this.a),o=i=>Or((this[i]*this.a+n[i]*n.a*(1-this.a))/r);return this._c({r:o("r"),g:o("g"),b:o("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const n=(this.r||0).toString(16);t+=n.length===2?n:"0"+n;const r=(this.g||0).toString(16);t+=r.length===2?r:"0"+r;const o=(this.b||0).toString(16);if(t+=o.length===2?o:"0"+o,typeof this.a=="number"&&this.a>=0&&this.a<1){const i=Or(this.a*255).toString(16);t+=i.length===2?i:"0"+i}return t}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),n=Or(this.getSaturation()*100),r=Or(this.getLightness()*100);return this.a!==1?`hsla(${t},${n}%,${r}%,${this.a})`:`hsl(${t},${n}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(t,n,r){const o=this.clone();return o[t]=Al(n,r),o}_c(t){return new this.constructor(t)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(t){const n=t.replace("#","");function r(o,i){return parseInt(n[o]+n[i||o],16)}n.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=n[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=n[6]?r(6,7)/255:1)}fromHsl({h:t,s:n,l:r,a:o}){if(this._h=t%360,this._s=n,this._l=r,this.a=typeof o=="number"?o:1,n<=0){const h=Or(r*255);this.r=h,this.g=h,this.b=h}let i=0,l=0,c=0;const u=t/60,f=(1-Math.abs(2*r-1))*n,m=f*(1-Math.abs(u%2-1));u>=0&&u<1?(i=f,l=m):u>=1&&u<2?(i=m,l=f):u>=2&&u<3?(l=f,c=m):u>=3&&u<4?(l=m,c=f):u>=4&&u<5?(i=m,c=f):u>=5&&u<6&&(i=f,c=m);const g=r-f/2;this.r=Or((i+g)*255),this.g=Or((l+g)*255),this.b=Or((c+g)*255)}fromHsv({h:t,s:n,v:r,a:o}){this._h=t%360,this._s=n,this._v=r,this.a=typeof o=="number"?o:1;const i=Or(r*255);if(this.r=i,this.g=i,this.b=i,n<=0)return;const l=t/60,c=Math.floor(l),u=l-c,f=Or(r*(1-n)*255),m=Or(r*(1-n*u)*255),g=Or(r*(1-n*(1-u))*255);switch(c){case 0:this.g=g,this.b=f;break;case 1:this.r=m,this.b=f;break;case 2:this.r=f,this.b=g;break;case 3:this.r=f,this.g=m;break;case 4:this.r=g,this.g=f;break;case 5:default:this.g=f,this.b=m;break}}fromHsvString(t){const n=Rp(t,Vy);this.fromHsv({h:n[0],s:n[1],v:n[2],a:n[3]})}fromHslString(t){const n=Rp(t,Vy);this.fromHsl({h:n[0],s:n[1],l:n[2],a:n[3]})}fromRgbString(t){const n=Rp(t,(r,o)=>o.includes("%")?Or(r/100*255):r);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}}var Lu=2,Wy=.16,BN=.05,zN=.05,DN=.15,OC=5,IC=4,FN=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function Uy(e,t,n){var r;return Math.round(e.h)>=60&&Math.round(e.h)<=240?r=n?Math.round(e.h)-Lu*t:Math.round(e.h)+Lu*t:r=n?Math.round(e.h)+Lu*t:Math.round(e.h)-Lu*t,r<0?r+=360:r>=360&&(r-=360),r}function Gy(e,t,n){if(e.h===0&&e.s===0)return e.s;var r;return n?r=e.s-Wy*t:t===IC?r=e.s+Wy:r=e.s+BN*t,r>1&&(r=1),n&&t===OC&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(r*100)/100}function qy(e,t,n){var r;return n?r=e.v+zN*t:r=e.v-DN*t,r=Math.max(0,Math.min(1,r)),Math.round(r*100)/100}function Di(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[],r=new $n(e),o=r.toHsv(),i=OC;i>0;i-=1){var l=new $n({h:Uy(o,i,!0),s:Gy(o,i,!0),v:qy(o,i,!0)});n.push(l)}n.push(r);for(var c=1;c<=IC;c+=1){var u=new $n({h:Uy(o,c),s:Gy(o,c),v:qy(o,c)});n.push(u)}return t.theme==="dark"?FN.map(function(f){var m=f.index,g=f.amount;return new $n(t.backgroundColor||"#141414").mix(n[m],g).toHexString()}):n.map(function(f){return f.toHexString()})}var Op={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},Lg=["#fff1f0","#ffccc7","#ffa39e","#ff7875","#ff4d4f","#f5222d","#cf1322","#a8071a","#820014","#5c0011"];Lg.primary=Lg[5];var Bg=["#fff2e8","#ffd8bf","#ffbb96","#ff9c6e","#ff7a45","#fa541c","#d4380d","#ad2102","#871400","#610b00"];Bg.primary=Bg[5];var zg=["#fff7e6","#ffe7ba","#ffd591","#ffc069","#ffa940","#fa8c16","#d46b08","#ad4e00","#873800","#612500"];zg.primary=zg[5];var Cd=["#fffbe6","#fff1b8","#ffe58f","#ffd666","#ffc53d","#faad14","#d48806","#ad6800","#874d00","#613400"];Cd.primary=Cd[5];var Dg=["#feffe6","#ffffb8","#fffb8f","#fff566","#ffec3d","#fadb14","#d4b106","#ad8b00","#876800","#614700"];Dg.primary=Dg[5];var Fg=["#fcffe6","#f4ffb8","#eaff8f","#d3f261","#bae637","#a0d911","#7cb305","#5b8c00","#3f6600","#254000"];Fg.primary=Fg[5];var Hg=["#f6ffed","#d9f7be","#b7eb8f","#95de64","#73d13d","#52c41a","#389e0d","#237804","#135200","#092b00"];Hg.primary=Hg[5];var Vg=["#e6fffb","#b5f5ec","#87e8de","#5cdbd3","#36cfc9","#13c2c2","#08979c","#006d75","#00474f","#002329"];Vg.primary=Vg[5];var wd=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];wd.primary=wd[5];var Wg=["#f0f5ff","#d6e4ff","#adc6ff","#85a5ff","#597ef7","#2f54eb","#1d39c4","#10239e","#061178","#030852"];Wg.primary=Wg[5];var Ug=["#f9f0ff","#efdbff","#d3adf7","#b37feb","#9254de","#722ed1","#531dab","#391085","#22075e","#120338"];Ug.primary=Ug[5];var Gg=["#fff0f6","#ffd6e7","#ffadd2","#ff85c0","#f759ab","#eb2f96","#c41d7f","#9e1068","#780650","#520339"];Gg.primary=Gg[5];var qg=["#a6a6a6","#999999","#8c8c8c","#808080","#737373","#666666","#404040","#1a1a1a","#000000","#000000"];qg.primary=qg[5];var Ip={red:Lg,volcano:Bg,orange:zg,gold:Cd,yellow:Dg,lime:Fg,green:Hg,cyan:Vg,blue:wd,geekblue:Wg,purple:Ug,magenta:Gg,grey:qg};function TC(e,{generateColorPalettes:t,generateNeutralColorPalettes:n}){const{colorSuccess:r,colorWarning:o,colorError:i,colorInfo:l,colorPrimary:c,colorBgBase:u,colorTextBase:f}=e,m=t(c),g=t(r),h=t(o),v=t(i),b=t(l),x=n(u,f),S=e.colorLink||e.colorInfo,E=t(S),w=new $n(v[1]).mix(new $n(v[3]),50).toHexString();return Object.assign(Object.assign({},x),{colorPrimaryBg:m[1],colorPrimaryBgHover:m[2],colorPrimaryBorder:m[3],colorPrimaryBorderHover:m[4],colorPrimaryHover:m[5],colorPrimary:m[6],colorPrimaryActive:m[7],colorPrimaryTextHover:m[8],colorPrimaryText:m[9],colorPrimaryTextActive:m[10],colorSuccessBg:g[1],colorSuccessBgHover:g[2],colorSuccessBorder:g[3],colorSuccessBorderHover:g[4],colorSuccessHover:g[4],colorSuccess:g[6],colorSuccessActive:g[7],colorSuccessTextHover:g[8],colorSuccessText:g[9],colorSuccessTextActive:g[10],colorErrorBg:v[1],colorErrorBgHover:v[2],colorErrorBgFilledHover:w,colorErrorBgActive:v[3],colorErrorBorder:v[3],colorErrorBorderHover:v[4],colorErrorHover:v[5],colorError:v[6],colorErrorActive:v[7],colorErrorTextHover:v[8],colorErrorText:v[9],colorErrorTextActive:v[10],colorWarningBg:h[1],colorWarningBgHover:h[2],colorWarningBorder:h[3],colorWarningBorderHover:h[4],colorWarningHover:h[4],colorWarning:h[6],colorWarningActive:h[7],colorWarningTextHover:h[8],colorWarningText:h[9],colorWarningTextActive:h[10],colorInfoBg:b[1],colorInfoBgHover:b[2],colorInfoBorder:b[3],colorInfoBorderHover:b[4],colorInfoHover:b[4],colorInfo:b[6],colorInfoActive:b[7],colorInfoTextHover:b[8],colorInfoText:b[9],colorInfoTextActive:b[10],colorLinkHover:E[4],colorLink:E[6],colorLinkActive:E[7],colorBgMask:new $n("#000").setA(.45).toRgbString(),colorWhite:"#fff"})}const HN=e=>{let t=e,n=e,r=e,o=e;return e<6&&e>=5?t=e+1:e<16&&e>=6?t=e+2:e>=16&&(t=16),e<7&&e>=5?n=4:e<8&&e>=7?n=5:e<14&&e>=8?n=6:e<16&&e>=14?n=7:e>=16&&(n=8),e<6&&e>=2?r=1:e>=6&&(r=2),e>4&&e<8?o=4:e>=8&&(o=6),{borderRadius:e,borderRadiusXS:r,borderRadiusSM:n,borderRadiusLG:t,borderRadiusOuter:o}};function VN(e){const{motionUnit:t,motionBase:n,borderRadius:r,lineWidth:o}=e;return Object.assign({motionDurationFast:`${(n+t).toFixed(1)}s`,motionDurationMid:`${(n+t*2).toFixed(1)}s`,motionDurationSlow:`${(n+t*3).toFixed(1)}s`,lineWidthBold:o+1},HN(r))}const WN=e=>{const{controlHeight:t}=e;return{controlHeightSM:t*.75,controlHeightXS:t*.5,controlHeightLG:t*1.25}};function fd(e){return(e+8)/e}function UN(e){const t=Array.from({length:10}).map((n,r)=>{const o=r-1,i=e*Math.pow(Math.E,o/5),l=r>1?Math.floor(i):Math.ceil(i);return Math.floor(l/2)*2});return t[1]=e,t.map(n=>({size:n,lineHeight:fd(n)}))}const GN=e=>{const t=UN(e),n=t.map(m=>m.size),r=t.map(m=>m.lineHeight),o=n[1],i=n[0],l=n[2],c=r[1],u=r[0],f=r[2];return{fontSizeSM:i,fontSize:o,fontSizeLG:l,fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:c,lineHeightLG:f,lineHeightSM:u,fontHeight:Math.round(c*o),fontHeightLG:Math.round(f*l),fontHeightSM:Math.round(u*i),lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};function qN(e){const{sizeUnit:t,sizeStep:n}=e;return{sizeXXL:t*(n+8),sizeXL:t*(n+4),sizeLG:t*(n+2),sizeMD:t*(n+1),sizeMS:t*n,size:t*n,sizeSM:t*(n-1),sizeXS:t*(n-2),sizeXXS:t*(n-3)}}const Mo=(e,t)=>new $n(e).setA(t).toRgbString(),Ll=(e,t)=>new $n(e).darken(t).toHexString(),KN=e=>{const t=Di(e);return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[4],6:t[5],7:t[6],8:t[4],9:t[5],10:t[6]}},XN=(e,t)=>{const n=e||"#fff",r=t||"#000";return{colorBgBase:n,colorTextBase:r,colorText:Mo(r,.88),colorTextSecondary:Mo(r,.65),colorTextTertiary:Mo(r,.45),colorTextQuaternary:Mo(r,.25),colorFill:Mo(r,.15),colorFillSecondary:Mo(r,.06),colorFillTertiary:Mo(r,.04),colorFillQuaternary:Mo(r,.02),colorBgSolid:Mo(r,1),colorBgSolidHover:Mo(r,.75),colorBgSolidActive:Mo(r,.95),colorBgLayout:Ll(n,4),colorBgContainer:Ll(n,0),colorBgElevated:Ll(n,0),colorBgSpotlight:Mo(r,.85),colorBgBlur:"transparent",colorBorder:Ll(n,15),colorBorderSecondary:Ll(n,6)}};function MC(e){Op.pink=Op.magenta,Ip.pink=Ip.magenta;const t=Object.keys(Qh).map(n=>{const r=e[n]===Op[n]?Ip[n]:Di(e[n]);return Array.from({length:10},()=>1).reduce((o,i,l)=>(o[`${n}-${l+1}`]=r[l],o[`${n}${l+1}`]=r[l],o),{})}).reduce((n,r)=>(n=Object.assign(Object.assign({},n),r),n),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e),t),TC(e,{generateColorPalettes:KN,generateNeutralColorPalettes:XN})),GN(e.fontSize)),qN(e)),WN(e)),VN(e))}const PC=Tg(MC),Ed={token:lc,override:{override:lc},hashed:!0},kC=Q.createContext(Ed),cc="ant",cf="anticon",YN=["outlined","borderless","filled","underlined"],QN=(e,t)=>t||(e?`${cc}-${e}`:cc),At=d.createContext({getPrefixCls:QN,iconPrefixCls:cf}),{Consumer:fY}=At,Ky={};function Tr(e){const t=d.useContext(At),{getPrefixCls:n,direction:r,getPopupContainer:o}=t,i=t[e];return Object.assign(Object.assign({classNames:Ky,styles:Ky},i),{getPrefixCls:n,direction:r,getPopupContainer:o})}const ZN=`-ant-${Date.now()}-${Math.random()}`;function JN(e,t){const n={},r=(l,c)=>{let u=l.clone();return u=(c==null?void 0:c(u))||u,u.toRgbString()},o=(l,c)=>{const u=new $n(l),f=Di(u.toRgbString());n[`${c}-color`]=r(u),n[`${c}-color-disabled`]=f[1],n[`${c}-color-hover`]=f[4],n[`${c}-color-active`]=f[6],n[`${c}-color-outline`]=u.clone().setA(.2).toRgbString(),n[`${c}-color-deprecated-bg`]=f[0],n[`${c}-color-deprecated-border`]=f[2]};if(t.primaryColor){o(t.primaryColor,"primary");const l=new $n(t.primaryColor),c=Di(l.toRgbString());c.forEach((f,m)=>{n[`primary-${m+1}`]=f}),n["primary-color-deprecated-l-35"]=r(l,f=>f.lighten(35)),n["primary-color-deprecated-l-20"]=r(l,f=>f.lighten(20)),n["primary-color-deprecated-t-20"]=r(l,f=>f.tint(20)),n["primary-color-deprecated-t-50"]=r(l,f=>f.tint(50)),n["primary-color-deprecated-f-12"]=r(l,f=>f.setA(f.a*.12));const u=new $n(c[0]);n["primary-color-active-deprecated-f-30"]=r(u,f=>f.setA(f.a*.3)),n["primary-color-active-deprecated-d-02"]=r(u,f=>f.darken(2))}return t.successColor&&o(t.successColor,"success"),t.warningColor&&o(t.warningColor,"warning"),t.errorColor&&o(t.errorColor,"error"),t.infoColor&&o(t.infoColor,"info"),`
|
|
59
59
|
:root {
|
|
60
60
|
${Object.keys(n).map(l=>`--${e}-${l}: ${n[l]};`).join(`
|
|
61
61
|
`)}
|
|
@@ -425,7 +425,7 @@ Skill 描述未找到。请确保已经使用过该 skill,以便 cc-team-viewe
|
|
|
425
425
|
|
|
426
426
|
`;r&&(o+=`${r}
|
|
427
427
|
|
|
428
|
-
`),t.push({type:"markdown",text:o});const i=(e==null?void 0:e.input_schema)||(e==null?void 0:e.parameters)||null;return i&&t.push({type:"json",label:"Parameters",data:i}),t}function ZH(e){var t;if(typeof e=="string")return e.slice(0,60).replace(/\n/g," ");if(Array.isArray(e)){for(const n of e)if((n==null?void 0:n.type)==="text"&&((t=n.text)!=null&&t.trim()))return n.text.trim().slice(0,60).replace(/\n/g," ")}return""}function JH(e){var r;const t=[];let n=0;for(;n<e.length;){const o=e[n];if((o==null?void 0:o.role)!=="user"){n++;continue}const i=((r=e[n+1])==null?void 0:r.role)==="assistant"?e[n+1]:null;t.push({id:`turn__${n}`,isTurn:!0,turnIndex:t.length,timestamp:o._timestamp||null,assistantTimestamp:(i==null?void 0:i._timestamp)||null,userBlocks:Ah(o==null?void 0:o.content),assistantBlocks:i?Ah(i.content):null,preview:ZH(o==null?void 0:o.content)}),n+=i?2:1}return t}function Lh(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return null}}function eV({text:e,compact:t}){const n=di(e);return t?C.jsx("div",{className:yt.textBlockCompact,children:C.jsx("div",{className:`chat-md ${yt.markdownBody}`,dangerouslySetInnerHTML:{__html:n}})}):C.jsxs("div",{className:yt.textBlock,children:[C.jsx("div",{className:yt.textBlockBar,children:C.jsx("span",{className:`${yt.blockTag} ${yt.blockTagText}`,children:"text"})}),C.jsx("div",{className:`chat-md ${yt.textBlockBody}`,dangerouslySetInnerHTML:{__html:n}})]})}function tV({block:e}){const[t,n]=d.useState(!0),r=e.text.length>60?e.text.slice(0,60).replace(/\n/g," ")+"…":e.text.replace(/\n/g," "),o=di(e.text);return C.jsxs("div",{className:yt.thinkingBlock,children:[C.jsxs("div",{className:yt.thinkingHeader,onClick:()=>n(i=>!i),children:[t?C.jsx(Ta,{className:yt.arrow}):C.jsx(Co,{className:yt.arrow}),C.jsx("span",{className:`${yt.blockTag} ${yt.blockTagThinking}`,children:"thinking"}),!t&&C.jsx("span",{className:yt.thinkingPreview,children:r})]}),t&&C.jsx("div",{className:yt.thinkingBody,children:C.jsx("div",{className:`chat-md ${yt.markdownBody}`,dangerouslySetInnerHTML:{__html:o}})})]})}function Zd({blocks:e,compact:t}){return!e||e.length===0?null:C.jsx(C.Fragment,{children:e.map((n,r)=>C.jsx(nV,{block:n,compact:t},r))})}function nV({block:e,compact:t}){var n;return e.type==="separator"?C.jsx("hr",{className:yt.blockSeparator}):e.type==="markdown"?(n=e.text)!=null&&n.trim()?C.jsx(eV,{text:e.text,compact:t}):null:e.type==="thinking"?C.jsx(tV,{block:e}):e.type==="tool_use"?C.jsxs("div",{className:yt.toolBlock,children:[C.jsxs("div",{className:yt.toolBlockHeader,children:[C.jsx("span",{className:yt.blockTag,children:"tool_use"}),C.jsx("span",{className:yt.toolName,children:e.name}),e.id&&C.jsx("span",{className:yt.toolId,children:e.id})]}),C.jsx("div",{className:yt.toolBlockBody,children:C.jsx(Qd,{data:e.input,defaultExpand:"root"})})]}):e.type==="tool_result"?C.jsxs("div",{className:`${yt.toolBlock} ${e.is_error?yt.toolBlockError:yt.toolBlockResult}`,children:[C.jsxs("div",{className:yt.toolBlockHeader,children:[C.jsx("span",{className:`${yt.blockTag} ${e.is_error?yt.blockTagError:yt.blockTagResult}`,children:"tool_result"}),e.tool_use_id&&C.jsx("span",{className:yt.toolId,children:e.tool_use_id}),e.is_error&&C.jsx("span",{className:yt.errorLabel,children:"error"})]}),C.jsx("div",{className:yt.toolBlockBody,children:C.jsx(Zd,{blocks:e.content,compact:!0})})]}):e.type==="json"?C.jsxs("div",{className:yt.jsonBlock,children:[e.label&&C.jsx("div",{className:yt.jsonBlockLabel,children:e.label}),C.jsx(Qd,{data:e.data,defaultExpand:"root"})]}):null}function rV({turn:e}){const t=e.timestamp?Lh(e.timestamp):null,n=e.assistantTimestamp?Lh(e.assistantTimestamp):null;return C.jsxs("div",{children:[C.jsxs("div",{className:yt.roleHeader,children:[C.jsx("span",{className:`${yt.roleBadge} ${yt.role_user}`,children:"user"}),C.jsx("span",{className:yt.roleLabel,children:`Turn ${e.turnIndex+1}`}),t&&C.jsx("span",{className:yt.contentTime,children:t})]}),C.jsx(Zd,{blocks:e.userBlocks}),e.assistantBlocks&&C.jsxs(C.Fragment,{children:[C.jsx("div",{className:yt.turnDivider}),C.jsxs("div",{className:yt.roleHeader,children:[C.jsx("span",{className:`${yt.roleBadge} ${yt.role_assistant}`,children:"assistant"}),n&&C.jsx("span",{className:yt.contentTime,children:n})]}),C.jsx(Zd,{blocks:e.assistantBlocks})]})]})}function oV({title:e,items:t,historyItems:n,onSelect:r,selectedId:o}){const[i,l]=d.useState(!0),[c,u]=d.useState(!1),f=t.length+((n==null?void 0:n.length)||0);function m(g){const h=o===g.id;return C.jsxs("div",{className:`${yt.item} ${h?yt.itemActive:""}`,onClick:()=>r(g),children:[C.jsxs("div",{className:yt.itemContent,children:[C.jsx("span",{className:yt.itemLabel,children:g.label}),g.sublabel&&!h&&C.jsx("div",{className:yt.itemSublabel,children:g.sublabel})]}),g.time&&C.jsx("span",{className:yt.itemTime,children:g.time})]},g.id)}return C.jsxs("div",{className:yt.section,children:[C.jsxs("div",{className:yt.sectionHeader,onClick:()=>l(g=>!g),children:[i?C.jsx(Ta,{className:yt.arrow}):C.jsx(Co,{className:yt.arrow}),C.jsx("span",{className:yt.sectionTitle,children:e}),C.jsx("span",{className:yt.sectionCount,children:f})]}),i&&C.jsxs("div",{className:yt.sectionBody,children:[n&&n.length>0&&C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:yt.historyToggle,onClick:()=>u(g=>!g),children:[c?C.jsx(Ta,{className:yt.arrow}):C.jsx(Co,{className:yt.arrow}),C.jsxs("span",{className:yt.historyToggleLabel,children:["历史"," (",n.length,")"]})]}),c&&n.map(m)]}),t.map(m)]})]})}function aV({body:e,response:t}){const[n,r]=d.useState(null),o=d.useMemo(()=>{if(!Array.isArray(e==null?void 0:e.messages))return[];const u=JH(e.messages);if(u.length===0)return u;const f=u[u.length-1],m=t!=null&&t.content?Ah(t.content):null;return[...u.slice(0,-1),{...f,assistantBlocks:m??f.assistantBlocks}]},[e,t]);if(d.useEffect(()=>{o.length>0?r(o[o.length-1]):r(null)},[e,t]),!e||typeof e!="object")return C.jsx("div",{className:yt.emptyWrap,children:C.jsx(lo,{description:"无数据"})});const i=[],l=YH(e.system);if(l!=null&&i.push({key:"system",title:"系统提示",items:[{id:"system__0",label:"系统提示",blocks:l}]}),o.length>0){const u=h=>({...h,label:`轮次 ${h.turnIndex+1}`,time:h.timestamp?Lh(h.timestamp):null,sublabel:h.preview||void 0}),f=h=>({...h,label:"当前轮次",sublabel:h.preview||void 0}),m=o.slice(0,-1).map(u),g=f(o[o.length-1]);i.push({key:"messages",title:"消息",historyItems:m.length>0?m:void 0,items:[g]})}if(Array.isArray(e.tools)&&e.tools.length>0&&i.push({key:"tools",title:"工具",items:e.tools.map((u,f)=>({id:`tool__${f}`,label:(u==null?void 0:u.name)||`Tool ${f}`,blocks:QH(u)}))}),i.length===0)return C.jsx("div",{className:yt.emptyWrap,children:C.jsx(lo,{description:"无字段"})});const c=n!=null&&n.isTurn?o.find(u=>u.id===n.id)??null:n;return C.jsxs("div",{className:yt.root,children:[C.jsx("div",{className:yt.sidebar,children:i.map(u=>C.jsx(oV,{title:u.title,items:u.items,historyItems:u.historyItems,selectedId:c==null?void 0:c.id,onSelect:f=>r(f)},u.key))}),C.jsx("div",{className:yt.content,children:c==null?C.jsx("div",{className:yt.contentEmpty,children:C.jsx(KH,{type:"secondary",children:"选择 Prompt"})}):C.jsx("div",{className:yt.contentInner,children:c.isTurn?C.jsx(rV,{turn:c}):C.jsxs(C.Fragment,{children:[c.role&&C.jsxs("div",{className:yt.roleHeader,children:[C.jsx("span",{className:`${yt.roleBadge} ${yt[`role_${c.role}`]||""}`,children:c.role}),C.jsx("span",{className:yt.roleLabel,children:c.label})]}),C.jsx(Zd,{blocks:c.blocks})]})},c.id)})]})}const iV="_container_i6t4e_1",sV="_emptyState_i6t4e_9",lV="_urlSection_i6t4e_16",cV="_urlLeft_i6t4e_23",uV="_tokenStatsBox_i6t4e_28",dV="_tokenGrid_i6t4e_35",fV="_tokenRows_i6t4e_45",mV="_tokenRow_i6t4e_45",pV="_tokenRowBorder_i6t4e_53",gV="_tokenLabel_i6t4e_57",hV="_tokenTd_i6t4e_64",vV="_tokenHitRate_i6t4e_73",bV="_tokenHitRateLabel_i6t4e_86",yV="_urlText_i6t4e_96",xV="_metaText_i6t4e_103",SV="_headersContainer_i6t4e_107",CV="_headerRow_i6t4e_111",wV="_headerKey_i6t4e_117",EV="_headerValue_i6t4e_122",_V="_streamingBox_i6t4e_127",$V="_rawTextPre_i6t4e_140",NV="_tabContent_i6t4e_153",RV="_bodyLabel_i6t4e_161",OV="_bodyHeader_i6t4e_165",IV="_diffSection_i6t4e_172",TV="_diffToggle_i6t4e_176",MV="_diffIcon_i6t4e_182",PV="_reminderSelect_i6t4e_208",Wt={container:iV,emptyState:sV,urlSection:lV,urlLeft:cV,tokenStatsBox:uV,tokenGrid:dV,tokenRows:fV,tokenRow:mV,tokenRowBorder:pV,tokenLabel:gV,tokenTd:hV,tokenHitRate:vV,tokenHitRateLabel:bV,urlText:yV,metaText:xV,headersContainer:SV,headerRow:CV,headerKey:wV,headerValue:EV,streamingBox:_V,rawTextPre:$V,tabContent:NV,bodyLabel:RV,bodyHeader:OV,diffSection:IV,diffToggle:TV,diffIcon:MV,reminderSelect:PV},{Text:ao,Paragraph:kV}=Ho;class jV extends Q.Component{constructor(t){super(t),this.state={bodyViewMode:{request:"json",response:"json",diff:"json"},diffExpanded:!1,requestHeadersExpanded:!1,responseHeadersExpanded:!1,diffTooltipDismissed:!1,reminderFilters:null}}componentDidMount(){fetch("/api/preferences").then(t=>t.json()).then(t=>{t.diffTooltipDismissed&&this.setState({diffTooltipDismissed:!0})}).catch(()=>{})}dismissDiffTooltip(){this.setState({diffTooltipDismissed:!0}),fetch("/api/preferences",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({diffTooltipDismissed:!0})}).catch(()=>{})}shouldComponentUpdate(t,n){if(t.request!==this.props.request){const r=ka(t.request);this.setState({diffExpanded:r&&!!t.expandDiff,requestHeadersExpanded:!1,responseHeadersExpanded:!1,reminderFilters:null})}return t.request!==this.props.request||t.currentTab!==this.props.currentTab||t.onTabChange!==this.props.onTabChange||t.selectedIndex!==this.props.selectedIndex||t.expandDiff!==this.props.expandDiff||n.bodyViewMode!==this.state.bodyViewMode||n.diffExpanded!==this.state.diffExpanded||n.requestHeadersExpanded!==this.state.requestHeadersExpanded||n.responseHeadersExpanded!==this.state.responseHeadersExpanded||n.diffTooltipDismissed!==this.state.diffTooltipDismissed||n.reminderFilters!==this.state.reminderFilters}toggleBodyViewMode(t){this.setState(n=>({bodyViewMode:{...n.bodyViewMode,[t]:n.bodyViewMode[t]==="json"?"text":"json"}}))}copyBody(t){var l;const{request:n}=this.props;if(!n)return;let r;if(t==="diff"?r=this._lastDiffResult:r=t==="request"?n.body:(l=n.response)==null?void 0:l.body,r==null)return;const o=typeof r=="object"?zi(r):r,i=typeof o=="string"?o:JSON.stringify(o,null,2);navigator.clipboard.writeText(i).then(()=>Av.success("复制成功"))}renderHeaders(t){return!t||Object.keys(t).length===0?C.jsx(ao,{type:"secondary",children:"无 Headers"}):C.jsx("div",{className:Wt.headersContainer,children:Object.entries(t).map(([n,r])=>C.jsxs("div",{className:Wt.headerRow,children:[C.jsx(ao,{code:!0,className:Wt.headerKey,children:n}),n==="authorization"&&C.jsx(Li,{doc:"TranslateContextPollution"}),C.jsx(ao,{type:"secondary",className:Wt.headerValue,children:String(r)})]},n))})}getRequestExpandNode(t,n){if(n!=="request"||!t||typeof t!="object")return;const{request:r,requests:o,selectedIndex:i}=this.props;if(!r)return;const l=o&&i!=null?o[i+1]:null,{type:c}=yc(r,l);let u=null;if(this.state.reminderFilters==="claudeMd"&&Array.isArray(t.messages)){u=new Set,u.add(t.messages);for(const g of t.messages){if(!g||typeof g!="object")continue;const h=g.content;if(typeof h=="string")Wd(h)&&u.add(g);else if(Array.isArray(h)){let v=!1;for(const b of h)b&&b.type==="text"&&Wd(b.text)&&(u.add(b),v=!0);v&&(u.add(g),u.add(h))}}}let f=null;if(this.state.reminderFilters==="skills"&&Array.isArray(t.messages)){f=new Set,f.add(t.messages);for(const g of t.messages){if(!g||typeof g!="object")continue;const h=g.content;if(typeof h=="string")Ud(h)&&f.add(g);else if(Array.isArray(h)){let v=!1;for(const b of h)b&&b.type==="text"&&Ud(b.text)&&(f.add(b),v=!0);v&&(f.add(g),f.add(h))}}}const m=u||f;if(c==="Preflight"){const g=new Set,h=v=>{v&&typeof v=="object"&&(g.add(v),Array.isArray(v)?v.forEach(h):Object.values(v).forEach(h))};return Array.isArray(t.messages)&&h(t.messages),Array.isArray(t.system)&&t.system.length>=3&&h(t.system[2]),(v,b,x)=>!!(v<2||g.has(b)||m&&m.has(b)||v===1&&x==="system")}if(c==="MainAgent"&&Array.isArray(t.messages)&&t.messages.length===1){const g=t.messages[0],h=g&&Array.isArray(g.content)?g.content:null,v=h&&h.length>0?h[h.length-1]:null,b=new Set,x=S=>{S&&typeof S=="object"&&(b.add(S),Array.isArray(S)?S.forEach(x):Object.values(S).forEach(x))};return v&&x(v),b.add(t.messages),g&&typeof g=="object"&&b.add(g),h&&b.add(h),(S,E,w)=>!!(S<2||b.has(E)||m&&m.has(E))}if(m)return(g,h,v)=>!!(g<2||m.has(h))}renderBody(t,n){const{bodyViewMode:r}=this.state;if(t==null)return C.jsx(ao,{type:"secondary",children:"无 Body"});if(typeof t=="string"&&t.includes("Streaming Response"))return C.jsx("div",{className:Wt.streamingBox,children:C.jsx(ao,{type:"secondary",children:"流式响应 — 此请求使用了 SSE 流式传输,响应内容无法完整捕获。"})});const o=typeof t=="object"?zi(t):t,i=r[n]==="json",l=this.getRequestExpandNode(o,n);return C.jsx("div",{children:i?C.jsx(Qd,{data:o,defaultExpand:n==="response"?"all":"root",expandNode:l}):C.jsx("pre",{className:Wt.rawTextPre,children:typeof o=="string"?o:JSON.stringify(o,null,2)})})}getPrevMainAgentRequest(){const{requests:t,selectedIndex:n}=this.props;if(!t||n==null)return null;for(let r=n-1;r>=0;r--)if(ka(t[r]))return t[r];return null}computeDiff(t,n){if(t==null||n==null||typeof t!="object"||typeof n!="object")return null;const r={},o=new Set([...Object.keys(t),...Object.keys(n)]);for(const i of o)if(!i.startsWith("_"))if(!(i in t))r[i]=n[i];else if(i in n){const l=JSON.stringify(t[i]),c=JSON.stringify(n[i]);l!==c&&(i==="messages"&&Array.isArray(t[i])&&Array.isArray(n[i])&&n[i].length>t[i].length?r[i]=n[i].slice(t[i].length):r[i]=n[i])}else continue;return Object.keys(r).length?r:null}render(){var h,v,b;const{request:t,currentTab:n,onTabChange:r}=this.props;if(!t)return C.jsx("div",{className:Wt.emptyState,children:C.jsx(lo,{description:"选择一个请求查看详情"})});const o=new Date(t.timestamp).toLocaleString("zh-CN"),i=t.response&&t.response.status<400;let l=null;if(ka(t)){const x=this.getPrevMainAgentRequest();if(x){const S=JSON.stringify(t.body).length,E=JSON.stringify(x.body).length;if(S<E)l=C.jsxs("div",{className:Wt.diffSection,children:[C.jsxs(va,{title:this.state.diffTooltipDismissed?null:C.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[C.jsx("span",{style:{flex:1},children:"为了避免看冗长的全文,所以为大家简化���示了 MainAgent 的增量部分,通常只有 message 增加"}),C.jsx(gi,{style:{cursor:"pointer",fontSize:10,marginTop:2,flexShrink:0},onClick:_=>{_.stopPropagation(),this.dismissDiffTooltip()}})]}),placement:"top",color:"#000",overlayStyle:{maxWidth:340},overlayInnerStyle:{fontSize:12,color:"#999"},children:[" ",C.jsxs(ao,{strong:!0,className:Wt.diffToggle,onClick:()=>this.setState(_=>({diffExpanded:!_.diffExpanded})),children:["Body Diff JSON ",C.jsx(Li,{doc:"BodyDiffJSON"})," ",this.state.diffExpanded?C.jsx(Ta,{className:Wt.diffIcon}):C.jsx(Co,{className:Wt.diffIcon})]})]}),this.state.diffExpanded&&C.jsx(ao,{type:"secondary",children:"请求体大小减小,可能使用了 /clear、/compact 或 session 发生了变化"})]});else{const _=zi(this.computeDiff(x.body,t.body));_&&(this._lastDiffResult=_,l=C.jsxs("div",{className:Wt.diffSection,children:[C.jsxs(va,{title:this.state.diffTooltipDismissed?null:C.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[C.jsx("span",{style:{flex:1},children:"为了避免看冗长的全文,所以为大家简化���示了 MainAgent 的增量部分,通常只有 message 增加"}),C.jsx(gi,{style:{cursor:"pointer",fontSize:10,marginTop:2,flexShrink:0},onClick:R=>{R.stopPropagation(),this.dismissDiffTooltip()}})]}),placement:"top",color:"#000",overlayStyle:{maxWidth:340},overlayInnerStyle:{fontSize:12,color:"#999"},children:[" ",C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[C.jsxs(ao,{strong:!0,className:Wt.diffToggle,onClick:()=>this.setState(R=>({diffExpanded:!R.diffExpanded})),children:["Body Diff JSON ",C.jsx(Li,{doc:"BodyDiffJSON"})," ",this.state.diffExpanded?C.jsx(Ta,{className:Wt.diffIcon}):C.jsx(Co,{className:Wt.diffIcon})]}),this.state.diffExpanded&&C.jsxs(Ma,{size:"small",style:{marginLeft:"auto"},children:[C.jsx(br,{size:"small",icon:this.state.bodyViewMode.diff==="json"?C.jsx(tg,{}):C.jsx(gg,{}),onClick:()=>this.toggleBodyViewMode("diff"),children:this.state.bodyViewMode.diff==="json"?"Text":"JSON"}),C.jsx(br,{size:"small",icon:C.jsx(ec,{}),onClick:()=>this.copyBody("diff"),children:"复制"})]})]})]}),this.state.diffExpanded&&C.jsx(C.Fragment,{children:this.state.bodyViewMode.diff==="json"?C.jsx(Qd,{data:_,defaultExpand:"all"}):C.jsx("pre",{className:Wt.rawTextPre,children:JSON.stringify(_,null,2)})})]}))}}}const c=pz(t.body),u=gz(t.body),f=[{key:"request",label:"Request",children:C.jsxs("div",{className:Wt.tabContent,children:[C.jsxs("div",{className:Wt.diffSection,children:[C.jsxs(ao,{strong:!0,className:Wt.diffToggle,onClick:()=>this.setState(x=>({requestHeadersExpanded:!x.requestHeadersExpanded})),children:["Headers ",this.state.requestHeadersExpanded?C.jsx(Ta,{className:Wt.diffIcon}):C.jsx(Co,{className:Wt.diffIcon})]}),this.state.requestHeadersExpanded&&this.renderHeaders(t.headers)]}),l,C.jsxs("div",{children:[C.jsxs("div",{className:Wt.bodyHeader,children:[C.jsx(ao,{strong:!0,className:Wt.bodyLabel,children:"Body"}),C.jsxs(Ma,{size:"small",children:[(c||u)&&C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[C.jsx("span",{style:{color:"#888",fontSize:12,fontFamily:"monospace"},children:"system-reminder:"}),C.jsx(Yi,{size:"small",className:Wt.reminderSelect,placeholder:"filter",value:this.state.reminderFilters||void 0,onChange:x=>this.setState({reminderFilters:x||null}),options:[{label:"CLAUDE.md",value:"claudeMd",disabled:!c},{label:"Skills",value:"skills",disabled:!u}],popupMatchSelectWidth:!1,allowClear:!0})]}),C.jsx(br,{size:"small",icon:this.state.bodyViewMode.request==="json"?C.jsx(tg,{}):C.jsx(gg,{}),onClick:()=>this.toggleBodyViewMode("request"),children:this.state.bodyViewMode.request==="json"?"Text":"JSON"}),C.jsx(br,{size:"small",icon:C.jsx(ec,{}),onClick:()=>this.copyBody("request"),children:"复制"})]})]}),this.renderBody(t.body,"request")]})]})},{key:"response",label:"Response",children:C.jsx("div",{className:Wt.tabContent,children:t.response?C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:Wt.diffSection,children:[C.jsxs(ao,{strong:!0,className:Wt.diffToggle,onClick:()=>this.setState(x=>({responseHeadersExpanded:!x.responseHeadersExpanded})),children:["Headers ",this.state.responseHeadersExpanded?C.jsx(Ta,{className:Wt.diffIcon}):C.jsx(Co,{className:Wt.diffIcon})]}),this.state.responseHeadersExpanded&&this.renderHeaders(t.response.headers)]}),C.jsxs("div",{children:[C.jsxs("div",{className:Wt.bodyHeader,children:[C.jsx(ao,{strong:!0,className:Wt.bodyLabel,children:"Body"}),C.jsxs(Ma,{size:"small",children:[C.jsx(br,{size:"small",icon:this.state.bodyViewMode.response==="json"?C.jsx(tg,{}):C.jsx(gg,{}),onClick:()=>this.toggleBodyViewMode("response"),children:this.state.bodyViewMode.response==="json"?"Text":"JSON"}),C.jsx(br,{size:"small",icon:C.jsx(ec,{}),onClick:()=>this.copyBody("response"),children:"复制"})]})]}),this.renderBody(t.response.body,"response")]})]}):C.jsx(lo,{description:"响应数据未捕获"})})},{key:"context",label:"Context",children:C.jsx("div",{className:Wt.tabContent,style:{height:"calc(100vh - 220px)",minHeight:400},children:C.jsx(aV,{body:t.body,response:(h=t.response)==null?void 0:h.body})})}],m=(b=(v=t.response)==null?void 0:v.body)==null?void 0:b.usage,g=m?(()=>{const x=m.input_tokens||0,S=m.output_tokens||0,E=m.cache_creation_input_tokens||0,w=m.cache_read_input_tokens||0,_=x+E+w,R=_>0?(w/_*100).toFixed(1):"0.0";return{input:_,output:S,cacheCreate:E,cacheRead:w,hitRate:R}})():null;return C.jsxs("div",{className:Wt.container,children:[C.jsxs("div",{className:Wt.urlSection,children:[C.jsxs("div",{className:Wt.urlLeft,children:[C.jsx(kV,{className:Wt.urlText,ellipsis:{rows:2,expandable:!0},children:t.url}),C.jsxs(Ma,{size:"small",wrap:!0,children:[C.jsx(So,{color:t.method==="POST"?"blue":"green",children:t.method}),C.jsxs(ao,{type:"secondary",className:Wt.metaText,children:["🕐 ",o]}),t.duration&&C.jsxs(ao,{type:"secondary",className:Wt.metaText,children:["⏱️ ",t.duration,"ms"]}),t.response&&C.jsxs(So,{color:i?"success":"error",children:["HTTP ",t.response.status]})]})]}),g&&C.jsx("div",{className:Wt.tokenStatsBox,children:C.jsxs("div",{className:Wt.tokenGrid,children:[C.jsxs("div",{className:Wt.tokenRows,children:[C.jsxs("div",{className:Wt.tokenRow,children:[C.jsx("span",{className:Wt.tokenLabel,children:"Token"}),C.jsxs("span",{className:Wt.tokenTd,children:["input: ",hr(g.input)]}),C.jsxs("span",{className:Wt.tokenTd,children:["output: ",hr(g.output)]})]}),C.jsxs("div",{className:`${Wt.tokenRow} ${Wt.tokenRowBorder}`,children:[C.jsx("span",{className:Wt.tokenLabel,children:"Cache"}),C.jsxs("span",{className:Wt.tokenTd,children:["create: ",hr(g.cacheCreate)]}),C.jsxs("span",{className:Wt.tokenTd,children:["read: ",hr(g.cacheRead)]})]})]}),C.jsxs("div",{className:Wt.tokenHitRate,children:[C.jsxs("div",{children:[g.hitRate,"%"]}),C.jsx("div",{className:Wt.tokenHitRateLabel,children:"命中率"})]})]})})]}),C.jsx(yE,{activeKey:n,onChange:r,items:f,size:"small"})]})}}const AV="_resizer_yamj2_1",LV={resizer:AV};class BV extends Q.Component{constructor(t){super(t),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this)}handleMouseDown(t){t.preventDefault(),document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}handleMouseMove(t){this.props.onResize&&this.props.onResize(t.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 C.jsx("div",{onMouseDown:this.handleMouseDown,className:LV.resizer})}}const zV="_guideContainer_1vqkk_1",DV="_guideContent_1vqkk_9",FV="_guideTitle_1vqkk_14",HV="_mainContainer_1vqkk_61",VV="_leftPanel_1vqkk_67",WV="_leftPanelHeader_1vqkk_76",UV="_leftPanelCount_1vqkk_85",GV="_leftPanelBody_1vqkk_91",qV="_rightPanel_1vqkk_96",Ia={guideContainer:zV,guideContent:DV,guideTitle:FV,mainContainer:HV,leftPanel:VV,leftPanelHeader:WV,leftPanelCount:UV,leftPanelBody:GV,rightPanel:qV};function KV({requests:e,selectedIndex:t,currentTab:n,scrollCenter:r,onSelectRequest:o,onScrollDone:i,onTabChange:l,onViewInChat:c,expandDiff:u,leftPanelWidth:f,onResize:m,onBackToTeam:g}){const h=t!==null?e[t]:null;return console.log("[RawView] requests.length:",e.length),e.length===0?C.jsx("div",{className:Ia.guideContainer,children:C.jsx("div",{className:Ia.guideContent,children:C.jsx("h2",{className:Ia.guideTitle,children:"无数据"})})}):C.jsxs("div",{className:Ia.mainContainer,children:[C.jsxs("div",{className:Ia.leftPanel,style:{width:f},children:[C.jsxs("div",{className:Ia.leftPanelHeader,children:[C.jsx(br,{type:"text",size:"small",onClick:g,style:{marginRight:8},children:"← 监控"}),C.jsx("span",{children:"请求列表"}),C.jsx("span",{className:Ia.leftPanelCount,children:`总请求数: ${e.length}`})]}),C.jsx("div",{className:Ia.leftPanelBody,children:C.jsx(MF,{requests:e,selectedIndex:t,scrollCenter:r,onSelect:o,onScrollDone:i})})]}),C.jsx(BV,{onResize:m}),C.jsx("div",{className:Ia.rightPanel,children:C.jsx(jV,{request:h,requests:e,selectedIndex:t,currentTab:n,onTabChange:l,onViewInChat:c,expandDiff:u})})]})}const XV=["system-reminder","local-command-caveat","project-reminder","important-instruction-reminders","file-modified-reminder","todo-reminder","user-prompt-submit-hook","local-command-stdout","command-name","task-notification","environment_details","context"];function YV(e){if(!e)return{segments:[]};const t=new RegExp("<("+XV.join("|")+")\\b[^>]*>([\\s\\S]*?)</\\1>","gi"),n=[];let r=0,o;for(;(o=t.exec(e))!==null;){if(o.index>r){const i=e.slice(r,o.index).trim();i&&n.push({type:"text",content:i})}n.push({type:"system-tag",tag:o[1],content:o[2].trim()}),r=o.index+o[0].length}if(r<e.length){const i=e.slice(r).trim();i&&n.push({type:"text",content:i})}return{segments:n}}function QV(e){const{segments:t}=YV(e);return t.length===0?{segments:[]}:{segments:t}}class ZV{diff(t,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const i=this.castInput(t,r),l=this.castInput(n,r),c=this.removeEmpty(this.tokenize(i,r)),u=this.removeEmpty(this.tokenize(l,r));return this.diffWithOptionsObj(c,u,r,o)}diffWithOptionsObj(t,n,r,o){var i;const l=w=>{if(w=this.postProcess(w,r),o){setTimeout(function(){o(w)},0);return}else return w},c=n.length,u=t.length;let f=1,m=c+u;r.maxEditLength!=null&&(m=Math.min(m,r.maxEditLength));const g=(i=r.timeout)!==null&&i!==void 0?i:1/0,h=Date.now()+g,v=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(v[0],n,t,0,r);if(v[0].oldPos+1>=u&&b+1>=c)return l(this.buildValues(v[0].lastComponent,n,t));let x=-1/0,S=1/0;const E=()=>{for(let w=Math.max(x,-f);w<=Math.min(S,f);w+=2){let _;const R=v[w-1],N=v[w+1];R&&(v[w-1]=void 0);let O=!1;if(N){const P=N.oldPos-w;O=N&&0<=P&&P<c}const I=R&&R.oldPos+1<u;if(!O&&!I){v[w]=void 0;continue}if(!I||O&&R.oldPos<N.oldPos?_=this.addToPath(N,!0,!1,0,r):_=this.addToPath(R,!1,!0,1,r),b=this.extractCommon(_,n,t,w,r),_.oldPos+1>=u&&b+1>=c)return l(this.buildValues(_.lastComponent,n,t))||!0;v[w]=_,_.oldPos+1>=u&&(S=Math.min(S,w-1)),b+1>=c&&(x=Math.max(x,w+1))}f++};if(o)(function w(){setTimeout(function(){if(f>m||Date.now()>h)return o(void 0);E()||w()},0)})();else for(;f<=m&&Date.now()<=h;){const w=E();if(w)return w}}addToPath(t,n,r,o,i){const l=t.lastComponent;return l&&!i.oneChangePerToken&&l.added===n&&l.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:l.count+1,added:n,removed:r,previousComponent:l.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:l}}}extractCommon(t,n,r,o,i){const l=n.length,c=r.length;let u=t.oldPos,f=u-o,m=0;for(;f+1<l&&u+1<c&&this.equals(r[u+1],n[f+1],i);)f++,u++,m++,i.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return m&&!i.oneChangePerToken&&(t.lastComponent={count:m,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=u,f}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const o=[];let i;for(;t;)o.push(t),i=t.previousComponent,delete t.previousComponent,t=i;o.reverse();const l=o.length;let c=0,u=0,f=0;for(;c<l;c++){const m=o[c];if(m.removed)m.value=this.join(r.slice(f,f+m.count)),f+=m.count;else{if(!m.added&&this.useLongestToken){let g=n.slice(u,u+m.count);g=g.map(function(h,v){const b=r[f+v];return b.length>h.length?b:h}),m.value=this.join(g)}else m.value=this.join(n.slice(u,u+m.count));u+=m.count,m.added||(f+=m.count)}}return o}}class JV extends ZV{constructor(){super(...arguments),this.tokenize=nW}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
428
|
+
`),t.push({type:"markdown",text:o});const i=(e==null?void 0:e.input_schema)||(e==null?void 0:e.parameters)||null;return i&&t.push({type:"json",label:"Parameters",data:i}),t}function ZH(e){var t;if(typeof e=="string")return e.slice(0,60).replace(/\n/g," ");if(Array.isArray(e)){for(const n of e)if((n==null?void 0:n.type)==="text"&&((t=n.text)!=null&&t.trim()))return n.text.trim().slice(0,60).replace(/\n/g," ")}return""}function JH(e){var r;const t=[];let n=0;for(;n<e.length;){const o=e[n];if((o==null?void 0:o.role)!=="user"){n++;continue}const i=((r=e[n+1])==null?void 0:r.role)==="assistant"?e[n+1]:null;t.push({id:`turn__${n}`,isTurn:!0,turnIndex:t.length,timestamp:o._timestamp||null,assistantTimestamp:(i==null?void 0:i._timestamp)||null,userBlocks:Ah(o==null?void 0:o.content),assistantBlocks:i?Ah(i.content):null,preview:ZH(o==null?void 0:o.content)}),n+=i?2:1}return t}function Lh(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return null}}function eV({text:e,compact:t}){const n=di(e);return t?C.jsx("div",{className:yt.textBlockCompact,children:C.jsx("div",{className:`chat-md ${yt.markdownBody}`,dangerouslySetInnerHTML:{__html:n}})}):C.jsxs("div",{className:yt.textBlock,children:[C.jsx("div",{className:yt.textBlockBar,children:C.jsx("span",{className:`${yt.blockTag} ${yt.blockTagText}`,children:"text"})}),C.jsx("div",{className:`chat-md ${yt.textBlockBody}`,dangerouslySetInnerHTML:{__html:n}})]})}function tV({block:e}){const[t,n]=d.useState(!0),r=e.text.length>60?e.text.slice(0,60).replace(/\n/g," ")+"…":e.text.replace(/\n/g," "),o=di(e.text);return C.jsxs("div",{className:yt.thinkingBlock,children:[C.jsxs("div",{className:yt.thinkingHeader,onClick:()=>n(i=>!i),children:[t?C.jsx(Ta,{className:yt.arrow}):C.jsx(Co,{className:yt.arrow}),C.jsx("span",{className:`${yt.blockTag} ${yt.blockTagThinking}`,children:"thinking"}),!t&&C.jsx("span",{className:yt.thinkingPreview,children:r})]}),t&&C.jsx("div",{className:yt.thinkingBody,children:C.jsx("div",{className:`chat-md ${yt.markdownBody}`,dangerouslySetInnerHTML:{__html:o}})})]})}function Zd({blocks:e,compact:t}){return!e||e.length===0?null:C.jsx(C.Fragment,{children:e.map((n,r)=>C.jsx(nV,{block:n,compact:t},r))})}function nV({block:e,compact:t}){var n;return e.type==="separator"?C.jsx("hr",{className:yt.blockSeparator}):e.type==="markdown"?(n=e.text)!=null&&n.trim()?C.jsx(eV,{text:e.text,compact:t}):null:e.type==="thinking"?C.jsx(tV,{block:e}):e.type==="tool_use"?C.jsxs("div",{className:yt.toolBlock,children:[C.jsxs("div",{className:yt.toolBlockHeader,children:[C.jsx("span",{className:yt.blockTag,children:"tool_use"}),C.jsx("span",{className:yt.toolName,children:e.name}),e.id&&C.jsx("span",{className:yt.toolId,children:e.id})]}),C.jsx("div",{className:yt.toolBlockBody,children:C.jsx(Qd,{data:e.input,defaultExpand:"root"})})]}):e.type==="tool_result"?C.jsxs("div",{className:`${yt.toolBlock} ${e.is_error?yt.toolBlockError:yt.toolBlockResult}`,children:[C.jsxs("div",{className:yt.toolBlockHeader,children:[C.jsx("span",{className:`${yt.blockTag} ${e.is_error?yt.blockTagError:yt.blockTagResult}`,children:"tool_result"}),e.tool_use_id&&C.jsx("span",{className:yt.toolId,children:e.tool_use_id}),e.is_error&&C.jsx("span",{className:yt.errorLabel,children:"error"})]}),C.jsx("div",{className:yt.toolBlockBody,children:C.jsx(Zd,{blocks:e.content,compact:!0})})]}):e.type==="json"?C.jsxs("div",{className:yt.jsonBlock,children:[e.label&&C.jsx("div",{className:yt.jsonBlockLabel,children:e.label}),C.jsx(Qd,{data:e.data,defaultExpand:"root"})]}):null}function rV({turn:e}){const t=e.timestamp?Lh(e.timestamp):null,n=e.assistantTimestamp?Lh(e.assistantTimestamp):null;return C.jsxs("div",{children:[C.jsxs("div",{className:yt.roleHeader,children:[C.jsx("span",{className:`${yt.roleBadge} ${yt.role_user}`,children:"user"}),C.jsx("span",{className:yt.roleLabel,children:`Turn ${e.turnIndex+1}`}),t&&C.jsx("span",{className:yt.contentTime,children:t})]}),C.jsx(Zd,{blocks:e.userBlocks}),e.assistantBlocks&&C.jsxs(C.Fragment,{children:[C.jsx("div",{className:yt.turnDivider}),C.jsxs("div",{className:yt.roleHeader,children:[C.jsx("span",{className:`${yt.roleBadge} ${yt.role_assistant}`,children:"assistant"}),n&&C.jsx("span",{className:yt.contentTime,children:n})]}),C.jsx(Zd,{blocks:e.assistantBlocks})]})]})}function oV({title:e,items:t,historyItems:n,onSelect:r,selectedId:o}){const[i,l]=d.useState(!0),[c,u]=d.useState(!1),f=t.length+((n==null?void 0:n.length)||0);function m(g){const h=o===g.id;return C.jsxs("div",{className:`${yt.item} ${h?yt.itemActive:""}`,onClick:()=>r(g),children:[C.jsxs("div",{className:yt.itemContent,children:[C.jsx("span",{className:yt.itemLabel,children:g.label}),g.sublabel&&!h&&C.jsx("div",{className:yt.itemSublabel,children:g.sublabel})]}),g.time&&C.jsx("span",{className:yt.itemTime,children:g.time})]},g.id)}return C.jsxs("div",{className:yt.section,children:[C.jsxs("div",{className:yt.sectionHeader,onClick:()=>l(g=>!g),children:[i?C.jsx(Ta,{className:yt.arrow}):C.jsx(Co,{className:yt.arrow}),C.jsx("span",{className:yt.sectionTitle,children:e}),C.jsx("span",{className:yt.sectionCount,children:f})]}),i&&C.jsxs("div",{className:yt.sectionBody,children:[n&&n.length>0&&C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:yt.historyToggle,onClick:()=>u(g=>!g),children:[c?C.jsx(Ta,{className:yt.arrow}):C.jsx(Co,{className:yt.arrow}),C.jsxs("span",{className:yt.historyToggleLabel,children:["历史"," (",n.length,")"]})]}),c&&n.map(m)]}),t.map(m)]})]})}function aV({body:e,response:t}){const[n,r]=d.useState(null),o=d.useMemo(()=>{if(!Array.isArray(e==null?void 0:e.messages))return[];const u=JH(e.messages);if(u.length===0)return u;const f=u[u.length-1],m=t!=null&&t.content?Ah(t.content):null;return[...u.slice(0,-1),{...f,assistantBlocks:m??f.assistantBlocks}]},[e,t]);if(d.useEffect(()=>{o.length>0&&n===null&&r(o[o.length-1])},[o.length]),!e||typeof e!="object")return C.jsx("div",{className:yt.emptyWrap,children:C.jsx(lo,{description:"无数据"})});const i=[],l=YH(e.system);if(l!=null&&i.push({key:"system",title:"系统提示",items:[{id:"system__0",label:"系统提示",blocks:l}]}),o.length>0){const u=h=>({...h,label:`轮次 ${h.turnIndex+1}`,time:h.timestamp?Lh(h.timestamp):null,sublabel:h.preview||void 0}),f=h=>({...h,label:"当前轮次",sublabel:h.preview||void 0}),m=o.slice(0,-1).map(u),g=f(o[o.length-1]);i.push({key:"messages",title:"消息",historyItems:m.length>0?m:void 0,items:[g]})}if(Array.isArray(e.tools)&&e.tools.length>0&&i.push({key:"tools",title:"工具",items:e.tools.map((u,f)=>({id:`tool__${f}`,label:(u==null?void 0:u.name)||`Tool ${f}`,blocks:QH(u)}))}),i.length===0)return C.jsx("div",{className:yt.emptyWrap,children:C.jsx(lo,{description:"无字段"})});const c=n!=null&&n.isTurn?o.find(u=>u.id===n.id)??null:n;return C.jsxs("div",{className:yt.root,children:[C.jsx("div",{className:yt.sidebar,children:i.map(u=>C.jsx(oV,{title:u.title,items:u.items,historyItems:u.historyItems,selectedId:c==null?void 0:c.id,onSelect:f=>r(f)},u.key))}),C.jsx("div",{className:yt.content,children:c==null?C.jsx("div",{className:yt.contentEmpty,children:C.jsx(KH,{type:"secondary",children:"选择 Prompt"})}):C.jsx("div",{className:yt.contentInner,children:c.isTurn?C.jsx(rV,{turn:c}):C.jsxs(C.Fragment,{children:[c.role&&C.jsxs("div",{className:yt.roleHeader,children:[C.jsx("span",{className:`${yt.roleBadge} ${yt[`role_${c.role}`]||""}`,children:c.role}),C.jsx("span",{className:yt.roleLabel,children:c.label})]}),C.jsx(Zd,{blocks:c.blocks})]})},c.id)})]})}const iV="_container_i6t4e_1",sV="_emptyState_i6t4e_9",lV="_urlSection_i6t4e_16",cV="_urlLeft_i6t4e_23",uV="_tokenStatsBox_i6t4e_28",dV="_tokenGrid_i6t4e_35",fV="_tokenRows_i6t4e_45",mV="_tokenRow_i6t4e_45",pV="_tokenRowBorder_i6t4e_53",gV="_tokenLabel_i6t4e_57",hV="_tokenTd_i6t4e_64",vV="_tokenHitRate_i6t4e_73",bV="_tokenHitRateLabel_i6t4e_86",yV="_urlText_i6t4e_96",xV="_metaText_i6t4e_103",SV="_headersContainer_i6t4e_107",CV="_headerRow_i6t4e_111",wV="_headerKey_i6t4e_117",EV="_headerValue_i6t4e_122",_V="_streamingBox_i6t4e_127",$V="_rawTextPre_i6t4e_140",NV="_tabContent_i6t4e_153",RV="_bodyLabel_i6t4e_161",OV="_bodyHeader_i6t4e_165",IV="_diffSection_i6t4e_172",TV="_diffToggle_i6t4e_176",MV="_diffIcon_i6t4e_182",PV="_reminderSelect_i6t4e_208",Wt={container:iV,emptyState:sV,urlSection:lV,urlLeft:cV,tokenStatsBox:uV,tokenGrid:dV,tokenRows:fV,tokenRow:mV,tokenRowBorder:pV,tokenLabel:gV,tokenTd:hV,tokenHitRate:vV,tokenHitRateLabel:bV,urlText:yV,metaText:xV,headersContainer:SV,headerRow:CV,headerKey:wV,headerValue:EV,streamingBox:_V,rawTextPre:$V,tabContent:NV,bodyLabel:RV,bodyHeader:OV,diffSection:IV,diffToggle:TV,diffIcon:MV,reminderSelect:PV},{Text:ao,Paragraph:kV}=Ho;class jV extends Q.Component{constructor(t){super(t),this.state={bodyViewMode:{request:"json",response:"json",diff:"json"},diffExpanded:!1,requestHeadersExpanded:!1,responseHeadersExpanded:!1,diffTooltipDismissed:!1,reminderFilters:null}}componentDidMount(){fetch("/api/preferences").then(t=>t.json()).then(t=>{t.diffTooltipDismissed&&this.setState({diffTooltipDismissed:!0})}).catch(()=>{})}dismissDiffTooltip(){this.setState({diffTooltipDismissed:!0}),fetch("/api/preferences",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({diffTooltipDismissed:!0})}).catch(()=>{})}shouldComponentUpdate(t,n){if(t.request!==this.props.request){const r=ka(t.request);this.setState({diffExpanded:r&&!!t.expandDiff,requestHeadersExpanded:!1,responseHeadersExpanded:!1,reminderFilters:null})}return t.request!==this.props.request||t.currentTab!==this.props.currentTab||t.onTabChange!==this.props.onTabChange||t.selectedIndex!==this.props.selectedIndex||t.expandDiff!==this.props.expandDiff||n.bodyViewMode!==this.state.bodyViewMode||n.diffExpanded!==this.state.diffExpanded||n.requestHeadersExpanded!==this.state.requestHeadersExpanded||n.responseHeadersExpanded!==this.state.responseHeadersExpanded||n.diffTooltipDismissed!==this.state.diffTooltipDismissed||n.reminderFilters!==this.state.reminderFilters}toggleBodyViewMode(t){this.setState(n=>({bodyViewMode:{...n.bodyViewMode,[t]:n.bodyViewMode[t]==="json"?"text":"json"}}))}copyBody(t){var l;const{request:n}=this.props;if(!n)return;let r;if(t==="diff"?r=this._lastDiffResult:r=t==="request"?n.body:(l=n.response)==null?void 0:l.body,r==null)return;const o=typeof r=="object"?zi(r):r,i=typeof o=="string"?o:JSON.stringify(o,null,2);navigator.clipboard.writeText(i).then(()=>Av.success("复制成功"))}renderHeaders(t){return!t||Object.keys(t).length===0?C.jsx(ao,{type:"secondary",children:"无 Headers"}):C.jsx("div",{className:Wt.headersContainer,children:Object.entries(t).map(([n,r])=>C.jsxs("div",{className:Wt.headerRow,children:[C.jsx(ao,{code:!0,className:Wt.headerKey,children:n}),n==="authorization"&&C.jsx(Li,{doc:"TranslateContextPollution"}),C.jsx(ao,{type:"secondary",className:Wt.headerValue,children:String(r)})]},n))})}getRequestExpandNode(t,n){if(n!=="request"||!t||typeof t!="object")return;const{request:r,requests:o,selectedIndex:i}=this.props;if(!r)return;const l=o&&i!=null?o[i+1]:null,{type:c}=yc(r,l);let u=null;if(this.state.reminderFilters==="claudeMd"&&Array.isArray(t.messages)){u=new Set,u.add(t.messages);for(const g of t.messages){if(!g||typeof g!="object")continue;const h=g.content;if(typeof h=="string")Wd(h)&&u.add(g);else if(Array.isArray(h)){let v=!1;for(const b of h)b&&b.type==="text"&&Wd(b.text)&&(u.add(b),v=!0);v&&(u.add(g),u.add(h))}}}let f=null;if(this.state.reminderFilters==="skills"&&Array.isArray(t.messages)){f=new Set,f.add(t.messages);for(const g of t.messages){if(!g||typeof g!="object")continue;const h=g.content;if(typeof h=="string")Ud(h)&&f.add(g);else if(Array.isArray(h)){let v=!1;for(const b of h)b&&b.type==="text"&&Ud(b.text)&&(f.add(b),v=!0);v&&(f.add(g),f.add(h))}}}const m=u||f;if(c==="Preflight"){const g=new Set,h=v=>{v&&typeof v=="object"&&(g.add(v),Array.isArray(v)?v.forEach(h):Object.values(v).forEach(h))};return Array.isArray(t.messages)&&h(t.messages),Array.isArray(t.system)&&t.system.length>=3&&h(t.system[2]),(v,b,x)=>!!(v<2||g.has(b)||m&&m.has(b)||v===1&&x==="system")}if(c==="MainAgent"&&Array.isArray(t.messages)&&t.messages.length===1){const g=t.messages[0],h=g&&Array.isArray(g.content)?g.content:null,v=h&&h.length>0?h[h.length-1]:null,b=new Set,x=S=>{S&&typeof S=="object"&&(b.add(S),Array.isArray(S)?S.forEach(x):Object.values(S).forEach(x))};return v&&x(v),b.add(t.messages),g&&typeof g=="object"&&b.add(g),h&&b.add(h),(S,E,w)=>!!(S<2||b.has(E)||m&&m.has(E))}if(m)return(g,h,v)=>!!(g<2||m.has(h))}renderBody(t,n){const{bodyViewMode:r}=this.state;if(t==null)return C.jsx(ao,{type:"secondary",children:"无 Body"});if(typeof t=="string"&&t.includes("Streaming Response"))return C.jsx("div",{className:Wt.streamingBox,children:C.jsx(ao,{type:"secondary",children:"流式响应 — 此请求使用了 SSE 流式传输,响应内容无法完整捕获。"})});const o=typeof t=="object"?zi(t):t,i=r[n]==="json",l=this.getRequestExpandNode(o,n);return C.jsx("div",{children:i?C.jsx(Qd,{data:o,defaultExpand:n==="response"?"all":"root",expandNode:l}):C.jsx("pre",{className:Wt.rawTextPre,children:typeof o=="string"?o:JSON.stringify(o,null,2)})})}getPrevMainAgentRequest(){const{requests:t,selectedIndex:n}=this.props;if(!t||n==null)return null;for(let r=n-1;r>=0;r--)if(ka(t[r]))return t[r];return null}computeDiff(t,n){if(t==null||n==null||typeof t!="object"||typeof n!="object")return null;const r={},o=new Set([...Object.keys(t),...Object.keys(n)]);for(const i of o)if(!i.startsWith("_"))if(!(i in t))r[i]=n[i];else if(i in n){const l=JSON.stringify(t[i]),c=JSON.stringify(n[i]);l!==c&&(i==="messages"&&Array.isArray(t[i])&&Array.isArray(n[i])&&n[i].length>t[i].length?r[i]=n[i].slice(t[i].length):r[i]=n[i])}else continue;return Object.keys(r).length?r:null}render(){var h,v,b;const{request:t,currentTab:n,onTabChange:r}=this.props;if(!t)return C.jsx("div",{className:Wt.emptyState,children:C.jsx(lo,{description:"选择一个请求查看详情"})});const o=new Date(t.timestamp).toLocaleString("zh-CN"),i=t.response&&t.response.status<400;let l=null;if(ka(t)){const x=this.getPrevMainAgentRequest();if(x){const S=JSON.stringify(t.body).length,E=JSON.stringify(x.body).length;if(S<E)l=C.jsxs("div",{className:Wt.diffSection,children:[C.jsxs(va,{title:this.state.diffTooltipDismissed?null:C.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[C.jsx("span",{style:{flex:1},children:"为了避免看冗长的全文,所以为大家简化���示了 MainAgent 的增量部分,通常只有 message 增加"}),C.jsx(gi,{style:{cursor:"pointer",fontSize:10,marginTop:2,flexShrink:0},onClick:_=>{_.stopPropagation(),this.dismissDiffTooltip()}})]}),placement:"top",color:"#000",overlayStyle:{maxWidth:340},overlayInnerStyle:{fontSize:12,color:"#999"},children:[" ",C.jsxs(ao,{strong:!0,className:Wt.diffToggle,onClick:()=>this.setState(_=>({diffExpanded:!_.diffExpanded})),children:["Body Diff JSON ",C.jsx(Li,{doc:"BodyDiffJSON"})," ",this.state.diffExpanded?C.jsx(Ta,{className:Wt.diffIcon}):C.jsx(Co,{className:Wt.diffIcon})]})]}),this.state.diffExpanded&&C.jsx(ao,{type:"secondary",children:"请求体大小减小,可能使用了 /clear、/compact 或 session 发生了变化"})]});else{const _=zi(this.computeDiff(x.body,t.body));_&&(this._lastDiffResult=_,l=C.jsxs("div",{className:Wt.diffSection,children:[C.jsxs(va,{title:this.state.diffTooltipDismissed?null:C.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[C.jsx("span",{style:{flex:1},children:"为了避免看冗长的全文,所以为大家简化���示了 MainAgent 的增量部分,通常只有 message 增加"}),C.jsx(gi,{style:{cursor:"pointer",fontSize:10,marginTop:2,flexShrink:0},onClick:R=>{R.stopPropagation(),this.dismissDiffTooltip()}})]}),placement:"top",color:"#000",overlayStyle:{maxWidth:340},overlayInnerStyle:{fontSize:12,color:"#999"},children:[" ",C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[C.jsxs(ao,{strong:!0,className:Wt.diffToggle,onClick:()=>this.setState(R=>({diffExpanded:!R.diffExpanded})),children:["Body Diff JSON ",C.jsx(Li,{doc:"BodyDiffJSON"})," ",this.state.diffExpanded?C.jsx(Ta,{className:Wt.diffIcon}):C.jsx(Co,{className:Wt.diffIcon})]}),this.state.diffExpanded&&C.jsxs(Ma,{size:"small",style:{marginLeft:"auto"},children:[C.jsx(br,{size:"small",icon:this.state.bodyViewMode.diff==="json"?C.jsx(tg,{}):C.jsx(gg,{}),onClick:()=>this.toggleBodyViewMode("diff"),children:this.state.bodyViewMode.diff==="json"?"Text":"JSON"}),C.jsx(br,{size:"small",icon:C.jsx(ec,{}),onClick:()=>this.copyBody("diff"),children:"复制"})]})]})]}),this.state.diffExpanded&&C.jsx(C.Fragment,{children:this.state.bodyViewMode.diff==="json"?C.jsx(Qd,{data:_,defaultExpand:"all"}):C.jsx("pre",{className:Wt.rawTextPre,children:JSON.stringify(_,null,2)})})]}))}}}const c=pz(t.body),u=gz(t.body),f=[{key:"request",label:"Request",children:C.jsxs("div",{className:Wt.tabContent,children:[C.jsxs("div",{className:Wt.diffSection,children:[C.jsxs(ao,{strong:!0,className:Wt.diffToggle,onClick:()=>this.setState(x=>({requestHeadersExpanded:!x.requestHeadersExpanded})),children:["Headers ",this.state.requestHeadersExpanded?C.jsx(Ta,{className:Wt.diffIcon}):C.jsx(Co,{className:Wt.diffIcon})]}),this.state.requestHeadersExpanded&&this.renderHeaders(t.headers)]}),l,C.jsxs("div",{children:[C.jsxs("div",{className:Wt.bodyHeader,children:[C.jsx(ao,{strong:!0,className:Wt.bodyLabel,children:"Body"}),C.jsxs(Ma,{size:"small",children:[(c||u)&&C.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[C.jsx("span",{style:{color:"#888",fontSize:12,fontFamily:"monospace"},children:"system-reminder:"}),C.jsx(Yi,{size:"small",className:Wt.reminderSelect,placeholder:"filter",value:this.state.reminderFilters||void 0,onChange:x=>this.setState({reminderFilters:x||null}),options:[{label:"CLAUDE.md",value:"claudeMd",disabled:!c},{label:"Skills",value:"skills",disabled:!u}],popupMatchSelectWidth:!1,allowClear:!0})]}),C.jsx(br,{size:"small",icon:this.state.bodyViewMode.request==="json"?C.jsx(tg,{}):C.jsx(gg,{}),onClick:()=>this.toggleBodyViewMode("request"),children:this.state.bodyViewMode.request==="json"?"Text":"JSON"}),C.jsx(br,{size:"small",icon:C.jsx(ec,{}),onClick:()=>this.copyBody("request"),children:"复制"})]})]}),this.renderBody(t.body,"request")]})]})},{key:"response",label:"Response",children:C.jsx("div",{className:Wt.tabContent,children:t.response?C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:Wt.diffSection,children:[C.jsxs(ao,{strong:!0,className:Wt.diffToggle,onClick:()=>this.setState(x=>({responseHeadersExpanded:!x.responseHeadersExpanded})),children:["Headers ",this.state.responseHeadersExpanded?C.jsx(Ta,{className:Wt.diffIcon}):C.jsx(Co,{className:Wt.diffIcon})]}),this.state.responseHeadersExpanded&&this.renderHeaders(t.response.headers)]}),C.jsxs("div",{children:[C.jsxs("div",{className:Wt.bodyHeader,children:[C.jsx(ao,{strong:!0,className:Wt.bodyLabel,children:"Body"}),C.jsxs(Ma,{size:"small",children:[C.jsx(br,{size:"small",icon:this.state.bodyViewMode.response==="json"?C.jsx(tg,{}):C.jsx(gg,{}),onClick:()=>this.toggleBodyViewMode("response"),children:this.state.bodyViewMode.response==="json"?"Text":"JSON"}),C.jsx(br,{size:"small",icon:C.jsx(ec,{}),onClick:()=>this.copyBody("response"),children:"复制"})]})]}),this.renderBody(t.response.body,"response")]})]}):C.jsx(lo,{description:"响应数据未捕获"})})},{key:"context",label:"Context",children:C.jsx("div",{className:Wt.tabContent,style:{height:"calc(100vh - 220px)",minHeight:400},children:C.jsx(aV,{body:t.body,response:(h=t.response)==null?void 0:h.body})})}],m=(b=(v=t.response)==null?void 0:v.body)==null?void 0:b.usage,g=m?(()=>{const x=m.input_tokens||0,S=m.output_tokens||0,E=m.cache_creation_input_tokens||0,w=m.cache_read_input_tokens||0,_=x+E+w,R=_>0?(w/_*100).toFixed(1):"0.0";return{input:_,output:S,cacheCreate:E,cacheRead:w,hitRate:R}})():null;return C.jsxs("div",{className:Wt.container,children:[C.jsxs("div",{className:Wt.urlSection,children:[C.jsxs("div",{className:Wt.urlLeft,children:[C.jsx(kV,{className:Wt.urlText,ellipsis:{rows:2,expandable:!0},children:t.url}),C.jsxs(Ma,{size:"small",wrap:!0,children:[C.jsx(So,{color:t.method==="POST"?"blue":"green",children:t.method}),C.jsxs(ao,{type:"secondary",className:Wt.metaText,children:["🕐 ",o]}),t.duration&&C.jsxs(ao,{type:"secondary",className:Wt.metaText,children:["⏱️ ",t.duration,"ms"]}),t.response&&C.jsxs(So,{color:i?"success":"error",children:["HTTP ",t.response.status]})]})]}),g&&C.jsx("div",{className:Wt.tokenStatsBox,children:C.jsxs("div",{className:Wt.tokenGrid,children:[C.jsxs("div",{className:Wt.tokenRows,children:[C.jsxs("div",{className:Wt.tokenRow,children:[C.jsx("span",{className:Wt.tokenLabel,children:"Token"}),C.jsxs("span",{className:Wt.tokenTd,children:["input: ",hr(g.input)]}),C.jsxs("span",{className:Wt.tokenTd,children:["output: ",hr(g.output)]})]}),C.jsxs("div",{className:`${Wt.tokenRow} ${Wt.tokenRowBorder}`,children:[C.jsx("span",{className:Wt.tokenLabel,children:"Cache"}),C.jsxs("span",{className:Wt.tokenTd,children:["create: ",hr(g.cacheCreate)]}),C.jsxs("span",{className:Wt.tokenTd,children:["read: ",hr(g.cacheRead)]})]})]}),C.jsxs("div",{className:Wt.tokenHitRate,children:[C.jsxs("div",{children:[g.hitRate,"%"]}),C.jsx("div",{className:Wt.tokenHitRateLabel,children:"命中率"})]})]})})]}),C.jsx(yE,{activeKey:n,onChange:r,items:f,size:"small"})]})}}const AV="_resizer_yamj2_1",LV={resizer:AV};class BV extends Q.Component{constructor(t){super(t),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this)}handleMouseDown(t){t.preventDefault(),document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}handleMouseMove(t){this.props.onResize&&this.props.onResize(t.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 C.jsx("div",{onMouseDown:this.handleMouseDown,className:LV.resizer})}}const zV="_guideContainer_1vqkk_1",DV="_guideContent_1vqkk_9",FV="_guideTitle_1vqkk_14",HV="_mainContainer_1vqkk_61",VV="_leftPanel_1vqkk_67",WV="_leftPanelHeader_1vqkk_76",UV="_leftPanelCount_1vqkk_85",GV="_leftPanelBody_1vqkk_91",qV="_rightPanel_1vqkk_96",Ia={guideContainer:zV,guideContent:DV,guideTitle:FV,mainContainer:HV,leftPanel:VV,leftPanelHeader:WV,leftPanelCount:UV,leftPanelBody:GV,rightPanel:qV};function KV({requests:e,selectedIndex:t,currentTab:n,scrollCenter:r,onSelectRequest:o,onScrollDone:i,onTabChange:l,onViewInChat:c,expandDiff:u,leftPanelWidth:f,onResize:m,onBackToTeam:g}){const h=t!==null?e[t]:null;return console.log("[RawView] requests.length:",e.length),e.length===0?C.jsx("div",{className:Ia.guideContainer,children:C.jsx("div",{className:Ia.guideContent,children:C.jsx("h2",{className:Ia.guideTitle,children:"无数据"})})}):C.jsxs("div",{className:Ia.mainContainer,children:[C.jsxs("div",{className:Ia.leftPanel,style:{width:f},children:[C.jsxs("div",{className:Ia.leftPanelHeader,children:[C.jsx(br,{type:"text",size:"small",onClick:g,style:{marginRight:8},children:"← 监控"}),C.jsx("span",{children:"请求列表"}),C.jsx("span",{className:Ia.leftPanelCount,children:`总请求数: ${e.length}`})]}),C.jsx("div",{className:Ia.leftPanelBody,children:C.jsx(MF,{requests:e,selectedIndex:t,scrollCenter:r,onSelect:o,onScrollDone:i})})]}),C.jsx(BV,{onResize:m}),C.jsx("div",{className:Ia.rightPanel,children:C.jsx(jV,{request:h,requests:e,selectedIndex:t,currentTab:n,onTabChange:l,onViewInChat:c,expandDiff:u})})]})}const XV=["system-reminder","local-command-caveat","project-reminder","important-instruction-reminders","file-modified-reminder","todo-reminder","user-prompt-submit-hook","local-command-stdout","command-name","task-notification","environment_details","context"];function YV(e){if(!e)return{segments:[]};const t=new RegExp("<("+XV.join("|")+")\\b[^>]*>([\\s\\S]*?)</\\1>","gi"),n=[];let r=0,o;for(;(o=t.exec(e))!==null;){if(o.index>r){const i=e.slice(r,o.index).trim();i&&n.push({type:"text",content:i})}n.push({type:"system-tag",tag:o[1],content:o[2].trim()}),r=o.index+o[0].length}if(r<e.length){const i=e.slice(r).trim();i&&n.push({type:"text",content:i})}return{segments:n}}function QV(e){const{segments:t}=YV(e);return t.length===0?{segments:[]}:{segments:t}}class ZV{diff(t,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const i=this.castInput(t,r),l=this.castInput(n,r),c=this.removeEmpty(this.tokenize(i,r)),u=this.removeEmpty(this.tokenize(l,r));return this.diffWithOptionsObj(c,u,r,o)}diffWithOptionsObj(t,n,r,o){var i;const l=w=>{if(w=this.postProcess(w,r),o){setTimeout(function(){o(w)},0);return}else return w},c=n.length,u=t.length;let f=1,m=c+u;r.maxEditLength!=null&&(m=Math.min(m,r.maxEditLength));const g=(i=r.timeout)!==null&&i!==void 0?i:1/0,h=Date.now()+g,v=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(v[0],n,t,0,r);if(v[0].oldPos+1>=u&&b+1>=c)return l(this.buildValues(v[0].lastComponent,n,t));let x=-1/0,S=1/0;const E=()=>{for(let w=Math.max(x,-f);w<=Math.min(S,f);w+=2){let _;const R=v[w-1],N=v[w+1];R&&(v[w-1]=void 0);let O=!1;if(N){const P=N.oldPos-w;O=N&&0<=P&&P<c}const I=R&&R.oldPos+1<u;if(!O&&!I){v[w]=void 0;continue}if(!I||O&&R.oldPos<N.oldPos?_=this.addToPath(N,!0,!1,0,r):_=this.addToPath(R,!1,!0,1,r),b=this.extractCommon(_,n,t,w,r),_.oldPos+1>=u&&b+1>=c)return l(this.buildValues(_.lastComponent,n,t))||!0;v[w]=_,_.oldPos+1>=u&&(S=Math.min(S,w-1)),b+1>=c&&(x=Math.max(x,w+1))}f++};if(o)(function w(){setTimeout(function(){if(f>m||Date.now()>h)return o(void 0);E()||w()},0)})();else for(;f<=m&&Date.now()<=h;){const w=E();if(w)return w}}addToPath(t,n,r,o,i){const l=t.lastComponent;return l&&!i.oneChangePerToken&&l.added===n&&l.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:l.count+1,added:n,removed:r,previousComponent:l.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:l}}}extractCommon(t,n,r,o,i){const l=n.length,c=r.length;let u=t.oldPos,f=u-o,m=0;for(;f+1<l&&u+1<c&&this.equals(r[u+1],n[f+1],i);)f++,u++,m++,i.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return m&&!i.oneChangePerToken&&(t.lastComponent={count:m,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=u,f}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const o=[];let i;for(;t;)o.push(t),i=t.previousComponent,delete t.previousComponent,t=i;o.reverse();const l=o.length;let c=0,u=0,f=0;for(;c<l;c++){const m=o[c];if(m.removed)m.value=this.join(r.slice(f,f+m.count)),f+=m.count;else{if(!m.added&&this.useLongestToken){let g=n.slice(u,u+m.count);g=g.map(function(h,v){const b=r[f+v];return b.length>h.length?b:h}),m.value=this.join(g)}else m.value=this.join(n.slice(u,u+m.count));u+=m.count,m.added||(f+=m.count)}}return o}}class JV extends ZV{constructor(){super(...arguments),this.tokenize=nW}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
429
429
|
`))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
|
|
430
430
|
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
|
431
431
|
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
@@ -444,5 +444,5 @@ https://github.com/highlightjs/highlight.js/issues/2277`),nn=he,Mt=Le),ot===void
|
|
|
444
444
|
]`,b={scope:"string",variants:[m,f,g,h]},x={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},S=["false","null","true"],E=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],w=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],R={keyword:E,literal:(L=>{const V=[];return L.forEach(H=>{V.push(H),H.toLowerCase()===H?V.push(H.toUpperCase()):V.push(H.toLowerCase())}),V})(S),built_in:w},N=L=>L.map(V=>V.replace(/\|\d+$/,"")),O={variants:[{match:[/new/,t.concat(v,"+"),t.concat("(?!",N(w).join("\\b|"),"\\b)"),o],scope:{1:"keyword",4:"title.class"}}]},I=t.concat(r,"\\b(?!\\()"),P={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),I],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[o,t.concat(/::/,t.lookahead(/(?!class\b)/)),I],scope:{1:"title.class",3:"variable.constant"}},{match:[o,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[o,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},M={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},k={relevance:0,begin:/\(/,end:/\)/,keywords:R,contains:[M,l,P,e.C_BLOCK_COMMENT_MODE,b,x,O]},A={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",N(E).join("\\b|"),"|",N(w).join("\\b|"),"\\b)"),r,t.concat(v,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[k]};k.contains.push(A);const j=[M,P,e.C_BLOCK_COMMENT_MODE,b,x,O],D={begin:t.concat(/#\[\s*\\?/,t.either(o,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:S,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:S,keyword:["new","array"]},contains:["self",...j]},...j,{scope:"meta",variants:[{match:o},{match:i}]}]};return{case_insensitive:!1,keywords:R,contains:[D,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},c,{scope:"variable.language",match:/\$this\b/},l,A,P,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},O,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:R,contains:["self",D,l,P,e.C_BLOCK_COMMENT_MODE,b,x]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},b,x]}}function bG(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),o=t.concat(r,/(::\w+)*/),l={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},c={className:"doctag",begin:"@[A-Za-z]+"},u={begin:"#<",end:">"},f=[e.COMMENT("#","$",{contains:[c]}),e.COMMENT("^=begin","^=end",{contains:[c],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],m={className:"subst",begin:/#\{/,end:/\}/,keywords:l},g={className:"string",contains:[e.BACKSLASH_ESCAPE,m],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,m]})]}]},h="[1-9](_?[0-9])*|0",v="[0-9](_?[0-9])*",b={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${v}))?([eE][+-]?(${v})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},x={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:l}]},O=[g,{variants:[{match:[/class\s+/,o,/\s+<\s+/,o]},{match:[/\b(class|module)\s+/,o]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:l},{match:[/(include|extend)\s+/,o],scope:{2:"title.class"},keywords:l},{relevance:0,match:[o,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[x]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[g,{begin:n}],relevance:0},b,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:l},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,m],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(u,f),relevance:0}].concat(u,f);m.contains=O,x.contains=O;const k=[{begin:/^\s*=>/,starts:{end:"$",contains:O}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:l,contains:O}}];return f.unshift(u),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:l,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(k).concat(f).concat(O)}}function D_(e){return e?typeof e=="string"?e:e.source:null}function Wl(e){return Fn("(?=",e,")")}function Fn(...e){return e.map(n=>D_(n)).join("")}function yG(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Kr(...e){return"("+(yG(e).capture?"":"?:")+e.map(r=>D_(r)).join("|")+")"}const Qv=e=>Fn(/\b/,e,/\w$/.test(e)?/\b/:/\B/),xG=["Protocol","Type"].map(Qv),kS=["init","self"].map(Qv),SG=["Any","Self"],xg=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],jS=["false","nil","true"],CG=["assignment","associativity","higherThan","left","lowerThan","none","right"],wG=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],AS=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],F_=Kr(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),H_=Kr(F_,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Sg=Fn(F_,H_,"*"),V_=Kr(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),ef=Kr(V_,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),da=Fn(V_,ef,"*"),ed=Fn(/[A-Z]/,ef,"*"),EG=["attached","autoclosure",Fn(/convention\(/,Kr("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Fn(/objc\(/,da,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],_G=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function $G(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],o={match:[/\./,Kr(...xG,...kS)],className:{2:"keyword"}},i={match:Fn(/\./,Kr(...xg)),relevance:0},l=xg.filter(ie=>typeof ie=="string").concat(["_|0"]),c=xg.filter(ie=>typeof ie!="string").concat(SG).map(Qv),u={variants:[{className:"keyword",match:Kr(...c,...kS)}]},f={$pattern:Kr(/\b\w+/,/#\w+/),keyword:l.concat(wG),literal:jS},m=[o,i,u],g={match:Fn(/\./,Kr(...AS)),relevance:0},h={className:"built_in",match:Fn(/\b/,Kr(...AS),/(?=\()/)},v=[g,h],b={match:/->/,relevance:0},x={className:"operator",relevance:0,variants:[{match:Sg},{match:`\\.(\\.|${H_})+`}]},S=[b,x],E="([0-9]_*)+",w="([0-9a-fA-F]_*)+",_={className:"number",relevance:0,variants:[{match:`\\b(${E})(\\.(${E}))?([eE][+-]?(${E}))?\\b`},{match:`\\b0x(${w})(\\.(${w}))?([pP][+-]?(${E}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},R=(ie="")=>({className:"subst",variants:[{match:Fn(/\\/,ie,/[0\\tnr"']/)},{match:Fn(/\\/,ie,/u\{[0-9a-fA-F]{1,8}\}/)}]}),N=(ie="")=>({className:"subst",match:Fn(/\\/,ie,/[\t ]*(?:[\r\n]|\r\n)/)}),O=(ie="")=>({className:"subst",label:"interpol",begin:Fn(/\\/,ie,/\(/),end:/\)/}),I=(ie="")=>({begin:Fn(ie,/"""/),end:Fn(/"""/,ie),contains:[R(ie),N(ie),O(ie)]}),P=(ie="")=>({begin:Fn(ie,/"/),end:Fn(/"/,ie),contains:[R(ie),O(ie)]}),M={className:"string",variants:[I(),I("#"),I("##"),I("###"),P(),P("#"),P("##"),P("###")]},k=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],A={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:k},j=ie=>{const ve=Fn(ie,/\//),$e=Fn(/\//,ie);return{begin:ve,end:$e,contains:[...k,{scope:"comment",begin:`#(?!.*${$e})`,end:/$/}]}},D={scope:"regexp",variants:[j("###"),j("##"),j("#"),A]},L={match:Fn(/`/,da,/`/)},V={className:"variable",match:/\$\d+/},H={className:"variable",match:`\\$${ef}+`},W=[L,V,H],z={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:_G,contains:[...S,_,M]}]}},K={scope:"keyword",match:Fn(/@/,Kr(...EG),Wl(Kr(/\(/,/\s+/)))},G={scope:"meta",match:Fn(/@/,da)},B=[z,K,G],U={match:Wl(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Fn(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,ef,"+")},{className:"type",match:ed,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Fn(/\s+&\s+/,Wl(ed)),relevance:0}]},q={begin:/</,end:/>/,keywords:f,contains:[...r,...m,...B,b,U]};U.contains.push(q);const X={match:Fn(da,/\s*:/),keywords:"_|0",relevance:0},Z={begin:/\(/,end:/\)/,relevance:0,keywords:f,contains:["self",X,...r,D,...m,...v,...S,_,M,...W,...B,U]},te={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,U]},pe={begin:Kr(Wl(Fn(da,/\s*:/)),Wl(Fn(da,/\s+/,da,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:da}]},le={begin:/\(/,end:/\)/,keywords:f,contains:[pe,...r,...m,...S,_,M,...B,U,Z],endsParent:!0,illegal:/["']/},fe={match:[/(func|macro)/,/\s+/,Kr(L.match,da,Sg)],className:{1:"keyword",3:"title.function"},contains:[te,le,t],illegal:[/\[/,/%/]},we={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[te,le,t],illegal:/\[|%/},ce={match:[/operator/,/\s+/,Sg],className:{1:"keyword",3:"title"}},me={begin:[/precedencegroup/,/\s+/,ed],className:{1:"keyword",3:"title"},contains:[U],keywords:[...CG,...jS],end:/}/},be={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Se={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ge={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,da,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:f,contains:[te,...m,{begin:/:/,end:/\{/,keywords:f,contains:[{scope:"title.class.inherited",match:ed},...m],relevance:0}]};for(const ie of M.variants){const ve=ie.contains.find(Te=>Te.label==="interpol");ve.keywords=f;const $e=[...m,...v,...S,_,M,...W];ve.contains=[...$e,{begin:/\(/,end:/\)/,contains:["self",...$e]}]}return{name:"Swift",keywords:f,contains:[...r,fe,we,be,Se,ge,ce,me,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},D,...m,...v,...S,_,M,...W,...B,U,Z]}}var As="[0-9](_*[0-9])*",td=`\\.(${As})`,nd="[0-9a-fA-F](_*[0-9a-fA-F])*",NG={className:"number",variants:[{begin:`(\\b(${As})((${td})|\\.)?|(${td}))[eE][+-]?(${As})[fFdD]?\\b`},{begin:`\\b(${As})((${td})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${td})[fFdD]?\\b`},{begin:`\\b(${As})[fFdD]\\b`},{begin:`\\b0[xX]((${nd})\\.?|(${nd})?\\.(${nd}))[pP][+-]?(${As})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${nd})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function RG(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},o={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},l={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,o]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,i,o]}]};o.contains.push(l);const c={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},u={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(l,{className:"string"}),"self"]}]},f=NG,m=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),g={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},h=g;return h.variants[1].contains=[g],g.variants[1].contains=[h],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,m,n,r,c,u,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[g,e.C_LINE_COMMENT_MODE,m],relevance:0},e.C_LINE_COMMENT_MODE,m,c,u,l,e.C_NUMBER_MODE]},m]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},c,u]},l,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
445
445
|
`},f]}}const OG=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),IG=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],TG=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],MG=[...IG,...TG],PG=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),kG=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),jG=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),AG=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function LG(e){const t=e.regex,n=OG(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},o="and or not only",i=/@-?\w[\w]*(-\w+)*/,l="[a-zA-Z-][a-zA-Z0-9_-]*",c=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+l,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+kG.join("|")+")"},{begin:":(:)?("+jG.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+AG.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...c,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...c,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:o,attribute:PG.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...c,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+MG.join("|")+")\\b"}]}}const BG=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),zG=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],DG=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],FG=[...zG,...DG],HG=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),VG=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),WG=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),UG=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function GG(e){const t=BG(e),n=WG,r=VG,o="@[a-z-]+",i="and or not only",c={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+FG.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},c,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+UG.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,c,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:o,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:HG.join(" ")},contains:[{begin:o,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},c,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function qG(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,o={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},l=e.inherit(i,{begin:/\(/,end:/\)/}),c=e.inherit(e.APOS_STRING_MODE,{className:"string"}),u=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),f={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[o]},{begin:/'/,end:/'/,contains:[o]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,u,c,l,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,l,u,c]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},o,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[u]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[f],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[f],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:f}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function KG(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],o={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,o,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function XG(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},o={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},l={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,o]},c=e.inherit(l,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},v={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},b={begin:/\{/,end:/\}/,contains:[v],illegal:"\\n",relevance:0},x={begin:"\\[",end:"\\]",contains:[v],illegal:"\\n",relevance:0},S=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},b,x,i,l],E=[...S];return E.pop(),E.push(c),v.contains=E,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:S}}function YG(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},o={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},l={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},c=/[A-Za-z][A-Za-z0-9+.-]*/,u={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,c,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},f={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},m={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},g=e.inherit(f,{contains:[]}),h=e.inherit(m,{contains:[]});f.contains.push(h),m.contains.push(g);let v=[n,u];return[f,m,g,h].forEach(E=>{E.contains=E.contains.concat(v)}),v=v.concat(f,m),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:v},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:v}]}]},n,i,f,m,{className:"quote",begin:"^>\\s+",contains:v,end:"$"},o,r,u,l,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function QG(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const o={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),l={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},c={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,o]};o.contains.push(c);const u={match:/\\"/},f={className:"string",begin:/'/,end:/'/},m={match:/\\'/},g={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],v=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),b={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},x=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],S=["true","false"],E={match:/(\/[a-z._-]+)+/},w=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],_=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],R=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],N=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:x,literal:S,built_in:[...w,..._,"set","shopt",...R,...N]},contains:[v,e.SHEBANG(),b,g,i,l,E,c,u,f,m,n]}}function ZG(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},o={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],l=["double precision","large object","with timezone","without timezone"],c=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],u=["add","asc","collation","desc","final","first","last","view"],f=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],m=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],g=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],v=m,b=[...f,...u].filter(N=>!m.includes(N)),x={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},S={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},E={match:t.concat(/\b/,t.either(...v),/\s*\(/),relevance:0,keywords:{built_in:v}};function w(N){return t.concat(/\b/,t.either(...N.map(O=>O.replace(/\s+/,"\\s+"))),/\b/)}const _={scope:"keyword",match:w(h),relevance:0};function R(N,{exceptions:O,when:I}={}){const P=I;return O=O||[],N.map(M=>M.match(/\|\d+$/)||O.includes(M)?M:P(M)?`${M}|0`:M)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:R(b,{when:N=>N.length<3}),literal:i,type:c,built_in:g},contains:[{scope:"type",match:w(l)},_,E,x,r,o,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,S]}}const JG="_fileContentView_1ti8s_1",eq="_header_1ti8s_8",tq="_headerLeft_1ti8s_18",nq="_backBtn_1ti8s_26",rq="_filePath_1ti8s_47",oq="_fileSize_1ti8s_55",aq="_contentContainer_1ti8s_61",iq="_codeBlock_1ti8s_68",sq="_lineNumberCol_1ti8s_76",lq="_lineNumberRow_1ti8s_84",cq="_codeCol_1ti8s_94",uq="_codeContent_1ti8s_100",dq="_lineContentRow_1ti8s_121",fq="_loading_1ti8s_126",mq="_error_1ti8s_135",Er={fileContentView:JG,header:eq,headerLeft:tq,backBtn:nq,filePath:rq,fileSize:oq,contentContainer:aq,codeBlock:iq,lineNumberCol:sq,lineNumberRow:lq,codeCol:cq,codeContent:uq,lineContentRow:dq,loading:fq,error:mq};mr.registerLanguage("javascript",lG);mr.registerLanguage("typescript",uG);mr.registerLanguage("python",dG);mr.registerLanguage("java",fG);mr.registerLanguage("cpp",mG);mr.registerLanguage("csharp",pG);mr.registerLanguage("go",gG);mr.registerLanguage("rust",hG);mr.registerLanguage("php",vG);mr.registerLanguage("ruby",bG);mr.registerLanguage("swift",$G);mr.registerLanguage("kotlin",RG);mr.registerLanguage("css",LG);mr.registerLanguage("scss",GG);mr.registerLanguage("xml",qG);mr.registerLanguage("json",KG);mr.registerLanguage("yaml",XG);mr.registerLanguage("markdown",YG);mr.registerLanguage("bash",QG);mr.registerLanguage("sql",ZG);const pq={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",java:"java",c:"cpp",cpp:"cpp",cc:"cpp",cxx:"cpp",h:"cpp",hpp:"cpp",cs:"csharp",go:"go",rs:"rust",php:"php",rb:"ruby",swift:"swift",kt:"kotlin",css:"css",scss:"scss",sass:"scss",less:"css",html:"xml",htm:"xml",xml:"xml",svg:"xml",json:"json",yml:"yaml",yaml:"yaml",md:"markdown",markdown:"markdown",sh:"bash",bash:"bash",zsh:"bash",sql:"sql"};function gq(e){var n;const t=(n=e.split(".").pop())==null?void 0:n.toLowerCase();return pq[t]||null}function hq(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function vq({filePath:e,onClose:t}){const[n,r]=d.useState(null),[o,i]=d.useState(null),[l,c]=d.useState(0),u=d.useRef(!0),f=d.useRef(null),m=d.useRef(null),g=d.useRef(null),h=d.useRef(null);return d.useEffect(()=>(u.current=!0,r(null),i(null),fetch(`/api/file-content?path=${encodeURIComponent(e)}`).then(v=>v.ok?v.json():v.json().then(b=>{throw new Error(b.error||"Failed to load")}).catch(()=>{throw new Error(`HTTP ${v.status}`)})).then(v=>{u.current&&(r(v.content),c(v.size))}).catch(v=>{u.current&&i(`文件加载错误: ${v.message}`)}),()=>{u.current=!1}),[e]),d.useEffect(()=>{if(n&&f.current){const v=gq(e),b=n.split(`
|
|
446
446
|
`);if(v)try{const S=mr.highlight(n,{language:v}).value.split(`
|
|
447
|
-
`);m.current.innerHTML=S.map((E,w)=>`<div class="${Er.lineNumberRow}">${w+1}</div>`).join(""),f.current.innerHTML=S.map(E=>`<div class="${Er.lineContentRow}">${E||" "}</div>`).join("")}catch{m.current.innerHTML=b.map((x,S)=>`<div class="${Er.lineNumberRow}">${S+1}</div>`).join(""),f.current.innerHTML=b.map(x=>`<div class="${Er.lineContentRow}">${x||" "}</div>`).join("")}else m.current.innerHTML=b.map((x,S)=>`<div class="${Er.lineNumberRow}">${S+1}</div>`).join(""),f.current.innerHTML=b.map(x=>`<div class="${Er.lineContentRow}">${x||" "}</div>`).join("")}},[n,e]),d.useEffect(()=>{const v=g.current,b=h.current;if(!v||!b)return;const x=()=>{b.scrollTop=v.scrollTop};return v.addEventListener("scroll",x),()=>v.removeEventListener("scroll",x)}),C.jsxs("div",{className:Er.fileContentView,children:[C.jsxs("div",{className:Er.header,children:[C.jsxs("div",{className:Er.headerLeft,children:[C.jsx("button",{className:Er.backBtn,onClick:t,title:"返回对话",children:C.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:C.jsx("polyline",{points:"15 18 9 12 15 6"})})}),C.jsx("span",{className:Er.filePath,children:e})]}),l>0&&C.jsx("span",{className:Er.fileSize,children:hq(l)})]}),C.jsxs("div",{className:Er.contentContainer,children:[o&&C.jsx("div",{className:Er.error,children:o}),!n&&!o&&C.jsx("div",{className:Er.loading,children:"加载中..."}),n&&C.jsxs("div",{className:Er.codeBlock,children:[C.jsx("div",{className:Er.lineNumberCol,ref:h,children:C.jsx("div",{ref:m})}),C.jsx("div",{className:Er.codeCol,ref:g,children:C.jsx("pre",{className:Er.codeContent,children:C.jsx("code",{ref:f})})})]})]})]})}const bq="_centerEmpty_8tuwm_1",yq="_container_8tuwm_8",xq="_sessionDividerText_8tuwm_18",Sq="_lastResponseLabel_8tuwm_23",Cq="_splitContainer_8tuwm_27",wq="_chatSection_8tuwm_34",Eq="_messageListWrap_8tuwm_192",_q="_stickyBottomBtn_8tuwm_200",$q="_navSidebar_8tuwm_369",Nq="_navBtn_8tuwm_381",Rq="_navBtnActive_8tuwm_401",qr={centerEmpty:bq,container:yq,sessionDividerText:xq,lastResponseLabel:Sq,splitContainer:Cq,chatSection:wq,messageListWrap:Eq,stickyBottomBtn:_q,navSidebar:$q,navBtn:Nq,navBtnActive:Rq},{Text:LS}=Ho,Oq=20;function Iq(){return 100+Math.random()*50}function BS(e){var o;const t={};for(const i of e)if(i.role==="assistant"&&Array.isArray(i.content))for(const l of i.content)l.type==="tool_use"&&(t[l.id]=l);const n={},r={};for(const i of e)if(i.role==="user"&&Array.isArray(i.content)){for(const l of i.content)if(l.type==="tool_result"){const c=t[l.tool_use_id];let u="工具返回",f=null,m=null;if(c)if(f=c.name,m=c.input,c.name==="Task"&&c.input){const h=c.input.subagent_type||"",v=c.input.description||"";u=`SubAgent: ${h}${v?" — "+v:""}`}else u=`${c.name} 返回`;const g=u_(l);n[l.tool_use_id]={label:u,toolName:f,toolInput:m,resultText:g},c&&c.name==="Read"&&((o=c.input)!=null&&o.file_path)&&(r[c.input.file_path]=g)}}return{toolUseMap:t,toolResultMap:n,readContentMap:r}}class Tq extends Q.Component{constructor(n){super(n);Lt(this,"handleStickToBottom",()=>{this.setState({stickyBottom:!0},()=>{const n=this.containerRef.current;n&&(n.scrollTop=n.scrollHeight)})});Lt(this,"handleToggleExpandPath",n=>{this.setState(r=>{const o=new Set(r.fileExplorerExpandedPaths);return o.has(n)?o.delete(n):o.add(n),{fileExplorerExpandedPaths:o}})});this.containerRef=Q.createRef(),this.splitContainerRef=Q.createRef(),this.innerSplitRef=Q.createRef(),this.state={visibleCount:0,loading:!1,allItems:[],highlightTs:null,highlightFading:!1,stickyBottom:!0,fileExplorerOpen:!0,currentFile:null,fileExplorerExpandedPaths:new Set},this._queueTimer=null,this._prevItemsLen=0,this._scrollTargetIdx=null,this._scrollTargetRef=Q.createRef(),this._scrollFadeTimer=null}componentDidMount(){this.startRender(),this._bindStickyScroll()}componentDidUpdate(n){var i,l,c,u;const r=n.mainAgentSessions!==this.props.mainAgentSessions||((i=n.mainAgentSessions)==null?void 0:i.length)!==((l=this.props.mainAgentSessions)==null?void 0:l.length),o=n.requests!==this.props.requests||((c=n.requests)==null?void 0:c.length)!==((u=this.props.requests)==null?void 0:u.length);if(r||o)this.startRender();else if(n.collapseToolResults!==this.props.collapseToolResults||n.expandThinking!==this.props.expandThinking){const f=this.buildAllItems();this.setState({allItems:f,visibleCount:f.length})}if(!n.scrollToTimestamp&&this.props.scrollToTimestamp){const f=this.buildAllItems();this.setState({allItems:f,visibleCount:f.length},()=>this.scrollToBottom())}this._rebindStickyEl()}componentWillUnmount(){this._queueTimer&&clearTimeout(this._queueTimer),this._fadeClearTimer&&clearTimeout(this._fadeClearTimer),this._unbindScrollFade(),this._unbindStickyScroll()}startRender(){this._queueTimer&&clearTimeout(this._queueTimer);const n=this.buildAllItems(),r=this._prevItemsLen;this._prevItemsLen=n.length;const o=n.length-r;if(o<=0||r>0&&o<=3){this.setState({allItems:n,visibleCount:n.length,loading:!1},()=>this.scrollToBottom());return}if(n.length>Oq)this.setState({allItems:n,visibleCount:0,loading:!0}),this._queueTimer=setTimeout(()=>{this.setState({visibleCount:n.length,loading:!1},()=>this.scrollToBottom())},300);else{const i=Math.max(0,r);this.setState({allItems:n,visibleCount:i,loading:!1}),this.queueNext(i,n.length)}}queueNext(n,r){n>=r||(this._queueTimer=setTimeout(()=>{this.setState({visibleCount:n+1},()=>{this.scrollToBottom(),this.queueNext(n+1,r)})},Iq()))}_isNearBottom(){const n=this.containerRef.current;return n?n.scrollHeight-n.scrollTop-n.clientHeight<=30:!0}scrollToBottom(){if(this._scrollTargetRef.current){const n=this._scrollTargetRef.current,r=this.containerRef.current;r&&n.offsetHeight>r.clientHeight?n.scrollIntoView({block:"start",behavior:"instant"}):n.scrollIntoView({block:"center",behavior:"instant"});const o=this.props.scrollToTimestamp;this._scrollTargetRef=Q.createRef(),o&&(this.setState({highlightTs:o,highlightFading:!1}),this._bindScrollFade()),this.props.onScrollTsDone&&this.props.onScrollTsDone();return}if(this.state.stickyBottom){const n=this.containerRef.current;n&&(n.scrollTop=n.scrollHeight)}}_bindStickyScroll(){this._stickyScrollRafId=null,this._onStickyScroll=()=>{this._stickyScrollLock||this._stickyScrollRafId||(this._stickyScrollRafId=requestAnimationFrame(()=>{this._stickyScrollRafId=null;const n=this.containerRef.current;if(!n)return;const r=n.scrollHeight-n.scrollTop-n.clientHeight;this.state.stickyBottom&&r>30?this.setState({stickyBottom:!1}):!this.state.stickyBottom&&r<=5&&this.setState({stickyBottom:!0})}))},this._rebindStickyEl()}_rebindStickyEl(){const n=this.containerRef.current;n!==this._stickyBoundEl&&(this._stickyBoundEl&&this._stickyBoundEl.removeEventListener("scroll",this._onStickyScroll),this._stickyBoundEl=n,n&&n.addEventListener("scroll",this._onStickyScroll,{passive:!0}))}_unbindStickyScroll(){this._stickyBoundEl&&this._onStickyScroll&&(this._stickyBoundEl.removeEventListener("scroll",this._onStickyScroll),this._stickyBoundEl=null),this._stickyScrollRafId&&(cancelAnimationFrame(this._stickyScrollRafId),this._stickyScrollRafId=null)}_bindScrollFade(){this._unbindScrollFade();const n=this.containerRef.current;n&&(this._scrollFadeIgnoreFirst=!0,this._onScrollFade=()=>{if(this._scrollFadeIgnoreFirst){this._scrollFadeIgnoreFirst=!1;return}this.setState({highlightFading:!0}),this._fadeClearTimer=setTimeout(()=>{this.setState({highlightTs:null,highlightFading:!1})},2e3),this._unbindScrollFade()},n.addEventListener("scroll",this._onScrollFade,{passive:!0}))}_unbindScrollFade(){this._onScrollFade&&this.containerRef.current&&(this.containerRef.current.removeEventListener("scroll",this._onScrollFade),this._onScrollFade=null)}renderSessionMessages(n,r,o,i){var b;const{userProfile:l,collapseToolResults:c,expandThinking:u,onViewRequest:f}=this.props,{toolUseMap:m,toolResultMap:g,readContentMap:h}=BS(n),v=[];for(let x=0;x<n.length;x++){const S=n[x],E=S.content,w=S._timestamp||null,_=w?i[w]:void 0,R=_!=null&&f?{requestIndex:_,onViewRequest:f}:{};if(S.role==="user"){if(Array.isArray(E)){const N=E.find(I=>I.type==="text"&&/^\[SUGGESTION MODE:/i.test((I.text||"").trim())),O=E.filter(I=>I.type==="tool_result");if(N&&O.length>0){let I=null,P={};for(const M of O){const k=m[M.tool_use_id];if(k&&k.name==="AskUserQuestion"&&((b=k.input)!=null&&b.questions)){I=k.input.questions;const A=u_(M);try{P=JSON.parse(A).answers||{}}catch{}break}}I&&v.push(C.jsx(Ao,{role:"user-selection",questions:I,answers:P,timestamp:w,userProfile:l,...R},`${r}-selection-${x}`))}else{const{commands:I,textBlocks:P,skillBlocks:M}=l_(E);for(let k=0;k<I.length;k++)v.push(C.jsx(Ao,{role:"user",text:I[k],timestamp:w,userProfile:l,modelInfo:o,...R},`${r}-cmd-${x}-${k}`));for(const k of M){const A=k.text.match(/^#\s+(.+)$/m),j=A?A[1]:"Skill";v.push(C.jsx(Ao,{role:"skill-loaded",text:k.text,skillName:j,timestamp:w,...R},`${r}-skill-${x}`))}for(let k=0;k<P.length;k++){const A=/^Implement the following plan:/i.test((P[k].text||"").trim());v.push(C.jsx(Ao,{role:A?"plan-prompt":"user",text:P[k].text,timestamp:w,userProfile:l,modelInfo:o,...R},`${r}-user-${x}-${k}`))}}}else if(typeof E=="string"&&!Dv(E)){const N=/^Implement the following plan:/i.test(E.trim());v.push(C.jsx(Ao,{role:N?"plan-prompt":"user",text:E,timestamp:w,userProfile:l,modelInfo:o,...R},`${r}-user-${x}`))}}else S.role==="assistant"&&(Array.isArray(E)?v.push(C.jsx(Ao,{role:"assistant",content:E,toolResultMap:g,readContentMap:h,timestamp:w,modelInfo:o,collapseToolResults:c,expandThinking:u,...R},`${r}-asst-${x}`)):typeof E=="string"&&v.push(C.jsx(Ao,{role:"assistant",content:[{type:"text",text:E}],toolResultMap:g,readContentMap:h,timestamp:w,modelInfo:o,collapseToolResults:c,expandThinking:u,...R},`${r}-asst-${x}`)))}return v}buildItemsFromRequests(n,r,o,i,l){const c=[];wS(null);const u=l?(l.id||l.name||"").split("@")[0].toLowerCase():null;for(let f=0;f<n.length;f++){const m=n[f];if(!m.body||!m.body.messages)continue;if(u){const h=(m.teamMember||"").split("@")[0].toLowerCase();if(h&&h!==u)continue}const g=m.body.messages||[];for(const h of g)h.role==="user"?c.push(C.jsx(Ao,{role:"user",content:h.content,timestamp:m.timestamp,collapseToolResults:r,expandThinking:o,requestIndex:f,onViewRequest:i},`req-${f}-user`)):h.role==="assistant"&&c.push(C.jsx(Ao,{role:"assistant",content:h.content,timestamp:m.timestamp,collapseToolResults:r,expandThinking:o,requestIndex:f,onViewRequest:i},`req-${f}-assistant`))}return c}buildAllItems(){var x,S,E,w;const{mainAgentSessions:n,requests:r,collapseToolResults:o,expandThinking:i,onViewRequest:l}=this.props;if((!n||n.length===0)&&r&&r.length>0)return this.buildItemsFromRequests(r,o,i,l);const c={};if(r)for(let _=0;_<r.length;_++)ka(r[_])&&r[_].timestamp&&(c[r[_].timestamp]=_);let u=null;if(r){for(let _=r.length-1;_>=0;_--)if(ka(r[_])&&((x=r[_].body)!=null&&x.model)){u=r[_].body.model;break}}const f=wS(u),m=[],g={},h=[];if(r)for(let _=0;_<r.length;_++){const R=r[_];if(!R.timestamp)continue;const N=yc(R,r[_+1]);if(N.type==="SubAgent"){const O=(E=(S=R.response)==null?void 0:S.body)==null?void 0:E.content;if(Array.isArray(O)&&O.length>0){const I=BS(((w=R.body)==null?void 0:w.messages)||[]).toolResultMap;h.push({timestamp:R.timestamp,content:O,toolResultMap:I,label:Gd(N.type,N.subType),requestIndex:_})}}}let v=0;n.forEach((_,R)=>{var O,I,P,M;R>0&&m.push(C.jsx(Qx,{style:{borderColor:"#333",margin:"16px 0"},children:C.jsx(LS,{className:qr.sessionDividerText,children:"Session"})},`session-div-${R}`));const N=this.renderSessionMessages(_.messages,`s${R}`,f,c);for(const k of N){const A=k.props.timestamp;for(;v<h.length&&A&&h[v].timestamp<=A;){const j=h[v];j.timestamp&&(g[j.timestamp]=m.length),m.push(C.jsx(Ao,{role:"sub-agent-chat",content:j.content,toolResultMap:j.toolResultMap,label:j.label,timestamp:j.timestamp,collapseToolResults:o,expandThinking:i,requestIndex:j.requestIndex,onViewRequest:l},`sub-chat-${v}`)),v++}A&&(g[A]=m.length),m.push(k)}for(;v<h.length;){const k=h[v],A=R<n.length-1&&((I=(O=n[R+1].messages)==null?void 0:O[0])==null?void 0:I._timestamp);if(A&&k.timestamp>A)break;k.timestamp&&(g[k.timestamp]=m.length),m.push(C.jsx(Ao,{role:"sub-agent-chat",content:k.content,toolResultMap:k.toolResultMap,label:k.label,timestamp:k.timestamp,collapseToolResults:o,expandThinking:i,requestIndex:k.requestIndex,onViewRequest:l},`sub-chat-${v}`)),v++}if(R===n.length-1&&((M=(P=_.response)==null?void 0:P.body)!=null&&M.content)){const k=_.response.body.content;Array.isArray(k)&&(m.push(C.jsx(Q.Fragment,{children:C.jsx(Qx,{style:{borderColor:"#2a2a2a",margin:"8px 0"},children:C.jsx(LS,{type:"secondary",className:qr.lastResponseLabel,children:"Last Response"})})},"resp-divider")),_.entryTimestamp&&(g[_.entryTimestamp]=m.length),m.push(C.jsx(Ao,{role:"assistant",content:k,timestamp:_.entryTimestamp,modelInfo:f,collapseToolResults:o,expandThinking:i,toolResultMap:{}},"resp-asst")))}});const{scrollToTimestamp:b}=this.props;return this._scrollTargetIdx=b&&g[b]!=null?g[b]:null,this._tsItemMap=g,m}render(){const{mainAgentSessions:n,cliMode:r}=this.props,{allItems:o,visibleCount:i,loading:l}=this.state,c=!n||n.length===0;if(c&&!r)return C.jsx("div",{className:qr.centerEmpty,children:C.jsx(lo,{description:"暂无 MainAgent 对话数据"})});if(l&&!r)return C.jsx("div",{className:qr.centerEmpty,children:C.jsx(Vi,{size:"large"})});const u=this._scrollTargetIdx,{highlightTs:f,highlightFading:m}=this.state,g=f&&this._tsItemMap&&this._tsItemMap[f]!=null?this._tsItemMap[f]:null,h=o.slice(0,i),{stickyBottom:v}=this.state,b=v?null:C.jsxs("button",{className:qr.stickyBottomBtn,onClick:this.handleStickToBottom,children:[C.jsx("span",{children:"置底"}),C.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:C.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),x=c||l?C.jsxs("div",{className:qr.messageListWrap,children:[C.jsx("div",{ref:this.containerRef,className:qr.container,children:!r||l?C.jsx("div",{className:qr.centerEmpty,children:l?C.jsx(Vi,{size:"large"}):C.jsx(lo,{description:"暂无 MainAgent 对话数据"})}):null}),b]}):C.jsxs("div",{className:qr.messageListWrap,children:[C.jsx("div",{ref:this.containerRef,className:qr.container,children:h.map((S,E)=>{const w=E===u,_=E===g;let R=S;return _&&(R=Q.cloneElement(R,{highlight:m?"fading":"active"})),w?C.jsx("div",{ref:this._scrollTargetRef,children:R},S.key+"-anchor"):R})}),b]});return r?C.jsxs("div",{ref:this.splitContainerRef,className:qr.splitContainer,children:[C.jsx("div",{className:qr.navSidebar,children:C.jsx("button",{className:this.state.fileExplorerOpen?qr.navBtnActive:qr.navBtn,onClick:()=>this.setState({fileExplorerOpen:!0,currentFile:null}),title:"文件浏览",children:C.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:C.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 2h9a2 2 0 0 1 2 2z"})})})}),C.jsxs("div",{style:{flex:1,display:"flex",minWidth:0,position:"relative"},ref:this.innerSplitRef,children:[this.state.fileExplorerOpen&&C.jsx(tG,{onClose:()=>this.setState({fileExplorerOpen:!1}),onFileClick:S=>this.setState({currentFile:S}),expandedPaths:this.state.fileExplorerExpandedPaths,onToggleExpand:this.handleToggleExpandPath,currentFile:this.state.currentFile}),C.jsx("div",{className:qr.chatSection,style:{flex:1,minWidth:0,display:"flex"},children:C.jsx("div",{style:{flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:this.state.currentFile?C.jsx(vq,{filePath:this.state.currentFile,onClose:()=>this.setState({currentFile:null})}):x})})]})]}):x}}function Mq(e,t){var m;const n=t.body.messages,r=t.response,o=((m=t.body.metadata)==null?void 0:m.user_id)||null,i=t.timestamp||null,l=t.teamMember||null;if(e.length===0)return[{userId:o,messages:n,response:r,entryTimestamp:i,teamMember:l}];const c=e[e.length-1],u=c.messages?c.messages.length:0,f=u>0&&n.length<u*.5&&u-n.length>4;if(o&&o===c.userId&&!f){const g=[...e];return g[g.length-1]={...c,messages:n,response:r,entryTimestamp:i,teamMember:l||c.teamMember},g}else return[...e,{userId:o,messages:n,response:r,entryTimestamp:i,teamMember:l}]}function Pq(e,t=!1){let n=[];for(const r of e)(t?r.body&&Array.isArray(r.body.messages):ka(r)&&r.body&&Array.isArray(r.body.messages))&&(n=Mq(n,r));return n}function kq({requests:e,userProfile:t,collapseToolResults:n,expandThinking:r,onViewRequest:o,chatScrollToTs:i,onScrollTsDone:l,cliMode:c,onBackToTeam:u}){const f=d.useMemo(()=>Pq(e,!0),[e]);return console.log("[ChatViewPage] requests.length:",e.length,"sessions.length:",f.length),C.jsxs("div",{style:{display:"flex",height:"100%",flexDirection:"column"},children:[C.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid #303030",display:"flex",alignItems:"center"},children:[C.jsx(br,{type:"text",size:"small",onClick:u,children:"← 监控"}),C.jsx("span",{style:{marginLeft:12,fontWeight:500},children:"对话视图"})]}),C.jsx(Tq,{requests:e,mainAgentSessions:f,userProfile:t,collapseToolResults:n,expandThinking:r,onViewRequest:o,scrollToTimestamp:i,onScrollTsDone:l,cliMode:c})]})}const jq="_cyberCharacter_n8txo_8",Aq="_hovered_n8txo_15",Lq="_selected_n8txo_19",Bq="_unreadBadge_n8txo_26",zq="_unreadCount_n8txo_52",Dq="_pulse_n8txo_59",Fq="_hologramContainer_n8txo_86",Hq="_outerRing_n8txo_96",Vq="_innerRing_n8txo_114",Wq="_cyberCore_n8txo_142",Uq="_cyberIcon_n8txo_178",Gq="_dataFlow_n8txo_197",qq="_glowEffect_n8txo_220",Kq="_nameTag_n8txo_248",Xq="_contextBadge_n8txo_272",Yq="_statusIndicator_n8txo_293",Qq="_statusIcon_n8txo_314",Zq="_statusText_n8txo_320",Jq="_statusPulse_n8txo_377",eK="_contextBar_n8txo_403",tK="_contextBarBg_n8txo_419",nK="_contextBarFill_n8txo_428",rK="_shimmer_n8txo_1",oK="_contextText_n8txo_466",aK="_dataHint_n8txo_478",iK="_dataIcon_n8txo_506",sK="_dataCount_n8txo_512",er={cyberCharacter:jq,hovered:Aq,selected:Lq,unreadBadge:Bq,"badge-glow":"_badge-glow_n8txo_1",unreadCount:zq,pulse:Dq,"cyber-pulse":"_cyber-pulse_n8txo_1",hologramContainer:Fq,outerRing:Hq,"cyber-rotate":"_cyber-rotate_n8txo_1",innerRing:Vq,"cyber-rotate-reverse":"_cyber-rotate-reverse_n8txo_1",cyberCore:Wq,"cyber-node":"_cyber-node_n8txo_173",cyberIcon:Uq,"icon-pulse":"_icon-pulse_n8txo_1",dataFlow:Gq,"data-flow":"_data-flow_n8txo_1",glowEffect:qq,"glow-pulse":"_glow-pulse_n8txo_1",nameTag:Kq,contextBadge:Xq,statusIndicator:Yq,statusIcon:Qq,statusText:Zq,"status-active":"_status-active_n8txo_325","status-working":"_status-working_n8txo_336","status-idle":"_status-idle_n8txo_347","status-error":"_status-error_n8txo_356","error-pulse":"_error-pulse_n8txo_1",statusPulse:Jq,"status-pulse":"_status-pulse_n8txo_1",contextBar:eK,contextBarBg:tK,contextBarFill:nK,shimmer:rK,"context-danger":"_context-danger_n8txo_451","context-warning":"_context-warning_n8txo_456","context-safe":"_context-safe_n8txo_461",contextText:oK,dataHint:aK,"hint-float":"_hint-float_n8txo_1",dataIcon:iK,dataCount:sK,"selected-glow":"_selected-glow_n8txo_1"},zS={"team-lead":"⬡",subagent:"◈",worker:"⬢",explorer:"◉",analyst:"⌬",tester:"⌘",reviewer:"⌖",mainagent:"⬡",agent:"◈"},DS={active:"▶",working:"◍",idle:"◌",error:"⚠"};class W_ extends Q.Component{constructor(){super(...arguments);Lt(this,"state",{isHovered:!1});Lt(this,"handleClick",()=>{const{character:n,onSelect:r}=this.props;r(n)});Lt(this,"handleMouseEnter",()=>{this.setState({isHovered:!0})});Lt(this,"handleMouseLeave",()=>{this.setState({isHovered:!1})})}getMessageCount(){var i,l;const{character:n}=this.props,r=((i=n.messages)==null?void 0:i.filter(c=>!c.read).length)||0,o=((l=n.messages)==null?void 0:l.length)||0;return{unread:r,total:o}}getContextPercent(){var r;const{character:n}=this.props;return((r=n.contextInfo)==null?void 0:r.contextPercent)||null}getContextBadgeStyle(){const n=this.getContextPercent();return n===null?"":n>60?"danger":n>40?"warning":"safe"}getCharacterTypeClass(){const{character:n}=this.props;return"cyber-node"}getCyberColor(){const{character:n}=this.props;return{"team-lead":"#fbbf24",mainagent:"#fbbf24",subagent:"#00fff7",agent:"#00fff7",worker:"#00ff88",explorer:"#bf00ff",analyst:"#ff00ff",tester:"#00a8ff",reviewer:"#ff6600"}[n.type]||"#00fff7"}render(){const{character:n,isSelected:r}=this.props,{isHovered:o}=this.state,{unread:i,total:l}=this.getMessageCount(),c=this.getCharacterTypeClass(),u=this.getCyberColor(),f=this.getContextPercent(),m=zS[n.type]||zS.subagent,g=DS[n.status]||DS.idle;return C.jsxs("div",{className:`${er.cyberCharacter} ${r?er.selected:""} ${o?er.hovered:""}`,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,style:{"--cyber-color":u},children:[i>0&&C.jsxs("div",{className:er.unreadBadge,children:[C.jsx("span",{className:er.unreadCount,children:i}),C.jsx("div",{className:er.pulse})]}),C.jsxs("div",{className:er.hologramContainer,children:[C.jsx("div",{className:er.outerRing}),C.jsx("div",{className:er.innerRing}),C.jsx("div",{className:`${er.cyberCore} ${er[c]}`,children:C.jsx("span",{className:er.cyberIcon,children:m})}),C.jsx("div",{className:er.dataFlow}),C.jsx("div",{className:er.glowEffect})]}),C.jsx("div",{className:er.nameTag,children:n.name}),f!==null&&C.jsxs("span",{className:er.contextBadge,style:{background:f>60?"rgba(239, 68, 68, 0.3)":f>40?"rgba(251, 191, 36, 0.3)":"rgba(0, 255, 247, 0.2)",color:f>60?"#ef4444":f>40?"#fbbf24":"#00fff7",border:`1px solid ${f>60?"#ef4444":f>40?"#fbbf24":"#00fff7"}44`,boxShadow:f>60?"0 0 8px rgba(239, 68, 68, 0.3)":f>40?"0 0 8px rgba(251, 191, 36, 0.3)":"0 0 8px rgba(0, 255, 247, 0.2)"},children:[f,"%"]}),C.jsxs("div",{className:`${er.statusIndicator} ${er[`status-${n.status}`]}`,children:[C.jsx("span",{className:er.statusIcon,children:g}),C.jsx("span",{className:er.statusText,children:n.status==="active"?"ACTIVE":n.status==="working"?"PROCESSING":"STANDBY"}),n.status==="active"&&C.jsx("div",{className:er.statusPulse})]}),o&&l>0&&C.jsxs("div",{className:er.dataHint,children:[C.jsx("span",{className:er.dataIcon,children:"⌬"}),C.jsx("span",{className:er.dataCount,children:l})]})]})}}const lK="_messageEnvelope_12k2o_1",cK="_particles_12k2o_9",uK="_particle_12k2o_9",Cg={messageEnvelope:lK,particles:cK,particle:uK};class dK extends Q.Component{constructor(n){super(n);Lt(this,"animate",()=>{const r=performance.now()-this.startTime,o=this.props.duration||1500,i=Math.min(r/o,1),l=i<.5?2*i*i:1-Math.pow(-2*i+2,2)/2;this.setState({progress:l}),i<1?requestAnimationFrame(this.animate):setTimeout(()=>{this.setState({opacity:0}),setTimeout(()=>this.props.onComplete(),300)},200)});this.state={progress:0,opacity:1}}componentDidMount(){this.props.duration,this.startTime=performance.now(),this.animate()}render(){const{from:n,to:r}=this.props,{progress:o,opacity:i}=this.state,l=n.x+(r.x-n.x)*o,c=n.y+(r.y-n.y)*o,u=Math.atan2(r.y-n.y,r.x-n.x)*180/Math.PI;return C.jsxs("div",{className:Cg.messageEnvelope,style:{left:l,top:c,opacity:i,transform:`rotate(${u}deg)`},children:[C.jsxs("svg",{viewBox:"0 0 40 30",width:"32",height:"24",children:[C.jsx("rect",{x:"2",y:"5",width:"36",height:"20",rx:"2",fill:"#fbbf24",stroke:"#f59e0b",strokeWidth:"1.5"}),C.jsx("path",{d:"M 2 5 L 20 17 L 38 5",fill:"none",stroke:"#f59e0b",strokeWidth:"1.5"}),C.jsx("path",{d:"M 2 5 L 20 17 L 2 25",fill:"#fcd34d",opacity:"0.5"}),C.jsx("path",{d:"M 38 5 L 20 17 L 38 25",fill:"#eab308",opacity:"0.3"}),C.jsx("circle",{cx:"20",cy:"15",r:"3",fill:"#ef4444",opacity:"0.8"})]}),o<.8&&C.jsx("div",{className:Cg.particles,children:Array.from({length:5}).map((f,m)=>{const g=m*.1,h=Math.max(0,o-g)/(1-g);return C.jsx("div",{className:Cg.particle,style:{animationDelay:`${g}s`,opacity:1-h}},m)})})]})}}const fK="_panel_1c46t_5",mK="_header_1c46t_52",pK="_headerLeft_1c46t_72",gK="_avatar_1c46t_100",hK="_title_1c46t_129",vK="_name_1c46t_133",bK="_meta_1c46t_144",yK="_messageCount_1c46t_151",xK="_closeButton_1c46t_159",SK="_actionButtons_1c46t_184",CK="_actionButton_1c46t_184",wK="_stats_1c46t_205",EK="_statItem_1c46t_225",_K="_statValue_1c46t_229",$K="_statLabel_1c46t_238",NK="_messageList_1c46t_250",RK="_messageListHeader_1c46t_257",OK="_messageListCount_1c46t_272",IK="_emptyState_1c46t_284",TK="_list_1c46t_303",MK="_messageItem_1c46t_327",PK="_messageHeader_1c46t_357",kK="_messageSender_1c46t_363",jK="_messageTime_1c46t_374",AK="_messageStatus_1c46t_380",LK="_messageSummary_1c46t_386",BK="_messageContent_1c46t_394",zK="_messageBody_1c46t_398",yn={panel:fK,header:mK,headerLeft:pK,avatar:gK,title:hK,name:vK,meta:bK,messageCount:yK,closeButton:xK,actionButtons:SK,actionButton:CK,stats:wK,statItem:EK,statValue:_K,statLabel:$K,messageList:NK,messageListHeader:RK,messageListCount:OK,emptyState:IK,list:TK,messageItem:MK,messageHeader:PK,messageSender:kK,messageTime:jK,messageStatus:AK,messageSummary:LK,messageContent:BK,messageBody:zK},{Text:bY,Paragraph:DK}=Ho;function FK(e){try{const t=JSON.parse(e);return t.type==="task_assignment"||t.type==="idle_notification"?{isSystem:!1,text:e}:t.type==="shutdown_request"?{isSystem:!0,text:`[请求关闭] ${t.content||""}`,type:"shutdown"}:t.type==="shutdown_response"?{isSystem:!0,text:`[关闭响应] ${t.approve?"已批准":"已拒绝"}`,type:"shutdown"}:t.type==="plan_approval_request"?{isSystem:!0,text:"[计划审批请求]",type:"plan"}:t.type?{isSystem:!0,text:`[${t.type}]`,type:t.type}:{isSystem:!1,text:e}}catch{return{isSystem:!1,text:e}}}class U_ extends Q.Component{render(){const{character:t,visible:n,onClose:r,onViewNetworkRequests:o,onViewConversation:i,sessionMode:l,sessionId:c}=this.props;if(!n||!t)return null;const u=t.messages||[],f=u.filter(g=>!FK(g.text).isSystem),m=C.jsxs("div",{className:yn.panel,style:{position:"fixed",top:"64px",right:"0",left:"auto",bottom:"0",width:"420px",height:"calc(100vh - 64px)",zIndex:1e3},children:[C.jsxs("div",{className:yn.header,children:[C.jsxs("div",{className:yn.headerLeft,children:[C.jsx("div",{className:yn.avatar,style:{background:t.color},children:t.avatar||t.name.charAt(0)}),C.jsxs("div",{className:yn.title,children:[C.jsx("h2",{className:yn.name,children:t.name}),C.jsxs("div",{className:yn.meta,children:[C.jsx(So,{color:t.status==="active"?"green":"default",children:t.status==="active"?"工作中":"空闲"}),C.jsxs("span",{className:yn.messageCount,children:[f.length," 条消息"]})]})]})]}),C.jsx("button",{className:yn.closeButton,onClick:r,children:"✕"})]}),C.jsxs("div",{className:yn.actionButtons,children:[C.jsx(br,{type:"primary",icon:C.jsx(AB,{}),onClick:()=>{l&&c?window.location.hash=`/raw?session=${c}&agent=${encodeURIComponent(t.name)}`:o==null||o(t)},className:yn.actionButton,children:"查看请求"}),C.jsx(br,{icon:C.jsx(XE,{}),onClick:()=>{l&&c?window.location.hash=`/chat?session=${c}&agent=${encodeURIComponent(t.name)}`:i==null||i(t)},className:yn.actionButton,children:"查看对话"})]}),C.jsxs("div",{className:yn.stats,children:[C.jsxs("div",{className:yn.statItem,children:[C.jsx("div",{className:yn.statValue,children:f.length}),C.jsx("div",{className:yn.statLabel,children:"消息"})]}),C.jsxs("div",{className:yn.statItem,children:[C.jsx("div",{className:yn.statValue,children:new Set(f.map(g=>g.from)).size}),C.jsx("div",{className:yn.statLabel,children:"参与者"})]}),C.jsxs("div",{className:yn.statItem,children:[C.jsx("div",{className:yn.statValue,children:u.filter(g=>!g.read).length}),C.jsx("div",{className:yn.statLabel,children:"未读"})]})]}),C.jsxs("div",{className:yn.messageList,children:[C.jsxs("div",{className:yn.messageListHeader,children:[C.jsx("span",{children:"消息记录"}),C.jsx("span",{className:yn.messageListCount,children:f.length})]}),f.length===0?C.jsxs("div",{className:yn.emptyState,children:[C.jsx(GB,{style:{fontSize:48,color:"#333"}}),C.jsx("p",{children:"暂无消息记录"})]}):C.jsx(gc,{className:yn.list,dataSource:[...f].reverse(),renderItem:(g,h)=>{const v=g.read!==!1,b=g.timestamp||new Date().toISOString(),x=g.color||"#888";return C.jsxs(gc.Item,{className:yn.messageItem,children:[C.jsxs("div",{className:yn.messageHeader,children:[C.jsxs("div",{className:yn.messageSender,children:[C.jsx(QB,{style:{marginRight:4,color:x,fontSize:11}}),C.jsx("span",{style:{color:x,fontWeight:500},children:g.from})]}),C.jsxs("div",{className:yn.messageStatus,children:[C.jsx("span",{className:yn.messageTime,children:new Date(b).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),!v&&C.jsx(jd,{status:"processing"})]})]}),g.summary&&C.jsx("div",{className:yn.messageSummary,children:g.summary}),C.jsx("div",{className:yn.messageContent,children:C.jsx(DK,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:yn.messageBody,style:{color:"#ccc",fontSize:13,margin:0},children:g.text})})]},h)}})]})]});return ja.createPortal(m,document.body)}}function Zv(e){const{onFullReload:t,onLogUpdate:n,onUpdateInfo:r,onTeamStats:o,onSessionsUpdate:i,team:l,session:c,projectSessions:u}=e,f=d.useRef(null),m=d.useRef(null),g=d.useRef(t),h=d.useRef(n),v=d.useRef(r),b=d.useRef(o),x=d.useRef(i);g.current=t,h.current=n,v.current=r,b.current=o,x.current=i;const S=d.useCallback(()=>{if(!l&&!c&&!u){console.log("[useSSE] No team, session or projectSessions parameter, skipping connection");return}f.current&&f.current.close();let E;if(l?E=`/events?team=${encodeURIComponent(l)}`:c?E=`/events?session=${encodeURIComponent(c)}`:u&&(E=`/events?projectSessions=${encodeURIComponent(u)}`),console.log("[useSSE] Connecting to:",E),f.current){const _=f.current;if(_.readyState===EventSource.OPEN||_.readyState===EventSource.CONNECTING){console.log("[useSSE] Already connected or connecting, skipping");return}_.close()}const w=new EventSource(E);f.current=w,w.onmessage=_=>{},w.addEventListener("update_completed",_=>{var R;try{const N=JSON.parse(_.data);(R=v.current)==null||R.call(v,{type:"completed",version:N.version})}catch{}}),w.addEventListener("update_major_available",_=>{var R;try{const N=JSON.parse(_.data);(R=v.current)==null||R.call(v,{type:"major",version:N.version})}catch{}}),w.addEventListener("full_reload",_=>{var R;try{const N=JSON.parse(_.data);(R=g.current)==null||R.call(g,N)}catch{}}),w.addEventListener("log_update",_=>{var R;try{const N=JSON.parse(_.data);(R=h.current)==null||R.call(h,N)}catch{}}),w.addEventListener("team_stats",_=>{var R;try{const N=JSON.parse(_.data);(R=b.current)==null||R.call(b,N)}catch{}}),w.addEventListener("sessions_update",_=>{var R;try{const N=JSON.parse(_.data);(R=x.current)==null||R.call(x,N)}catch{}}),w.onerror=()=>{console.log("[useSSE] Connection error, reconnecting in 3s..."),w.close(),f.current=null,m.current=setTimeout(S,3e3)}},[l,c,u]);return d.useEffect(()=>{if(!(!l&&!c&&!u))return console.log("[useSSE] Effect running, team:",l,"session:",c,"projectSessions:",u),S(),()=>{console.log("[useSSE] Cleanup"),f.current&&f.current.close(),m.current&&clearTimeout(m.current)}},[S,l,c,u]),{eventSource:f.current}}const HK="_sidebar_9l9yw_1",VK="_header_9l9yw_12",WK="_count_9l9yw_28",UK="_loading_9l9yw_37",GK="_sessionList_9l9yw_43",qK="_empty_9l9yw_49",KK="_sessionItem_9l9yw_56",XK="_sessionId_9l9yw_79",YK="_userMessage_9l9yw_86",QK="_sessionInfo_9l9yw_98",ZK="_time_9l9yw_111",Yo={sidebar:HK,header:VK,count:WK,loading:UK,sessionList:GK,empty:qK,sessionItem:KK,sessionId:XK,userMessage:YK,sessionInfo:QK,time:ZK};function JK(e){if(!e)return"";const t=new Date(e),r=new Date-t,o=Math.floor(r/6e4),i=Math.floor(r/36e5),l=Math.floor(r/864e5);return o<1?"刚刚":o<60?`${o}m 前`:i<24?`${i}h 前`:l<7?`${l}d 前`:t.toLocaleDateString("zh-CN",{month:"short",day:"numeric"})}function eX({projectId:e,onSelectSession:t}){const[n,r]=d.useState([]),[o,i]=d.useState(!0),l=d.useRef(null);d.useEffect(()=>{console.log("[SessionSidebar] Component mounted"),console.log("[SessionSidebar] projectId:",e),console.log("[SessionSidebar] onSelectSession type:",typeof t),l.current&&console.log("[SessionSidebar] Container ref found:",l.current);const u=f=>{const m=f.target.closest("[data-session-id]");if(m){const g=m.getAttribute("data-session-id"),h=n.find(v=>v.id===g);h&&(console.log("[SessionSidebar] Native click event triggered for session:",g),c(h))}};return l.current&&(l.current.addEventListener("click",u),console.log("[SessionSidebar] Native click listener attached")),()=>{console.log("[SessionSidebar] Component unmounted"),l.current&&l.current.removeEventListener("click",u)}},[e,t,n]),Zv({projectSessions:e,onSessionsUpdate:u=>{r(u.sessions||[]),i(!1)}});const c=u=>{console.log("[SessionSidebar] Session clicked:",u.id),console.log("[SessionSidebar] Session object:",u),console.log("[SessionSidebar] onSelectSession function:",typeof t);try{t(u)}catch(m){console.error("[SessionSidebar] Error calling onSelectSession:",m)}const f=`/session-monitor?session=${u.id}`;console.log("[SessionSidebar] Setting hash to:",f);try{window.location.hash=f}catch(m){console.error("[SessionSidebar] Error setting hash:",m)}};return C.jsxs("div",{className:Yo.sidebar,ref:l,children:[C.jsxs("div",{className:Yo.header,children:[C.jsx("h3",{children:"Sessions"}),C.jsx("span",{className:Yo.count,children:n.length})]}),o?C.jsx("div",{className:Yo.loading,children:"Loading..."}):C.jsx("div",{className:Yo.sessionList,children:n.length===0?C.jsx("div",{className:Yo.empty,children:"No sessions"}):n.map(u=>C.jsxs("div",{className:Yo.sessionItem,onClick:f=>{console.log("[SessionSidebar] Click event fired",f.target),c(u)},"data-session-id":u.id,children:[u.lastUserMessage&&C.jsx("div",{className:Yo.userMessage,children:u.lastUserMessage}),C.jsx("div",{className:Yo.sessionId,children:u.id}),C.jsxs("div",{className:Yo.sessionInfo,children:[C.jsx("span",{className:Yo.time,children:JK(u.lastTimestamp)}),C.jsxs("span",{children:[u.requestCount," requests"]}),u.agents.length>0&&C.jsxs("span",{children:[u.agents.length," agents"]})]})]},u.id))})]})}const tX="_container_fx2ff_8",nX="_grass_fx2ff_30",rX="_decoration1_fx2ff_41",oX="_decoration2_fx2ff_52",aX="_decoration3_fx2ff_63",iX="_decoration4_fx2ff_74",sX="_background_fx2ff_90",lX="_grid_fx2ff_100",cX="_particles_fx2ff_113",uX="_backgroundParticle_fx2ff_121",dX="_hint_fx2ff_151",fX="_stats_fx2ff_160",mX="_stat_fx2ff_160",pX="_statLabel_fx2ff_183",gX="_statValue_fx2ff_191",hX="_statDivider_fx2ff_200",vX="_loadingState_fx2ff_208",bX="_emptyState_fx2ff_223",yX="_spinner_fx2ff_236",xX="_emptyIcon_fx2ff_260",SX="_errorText_fx2ff_281",CX="_teamSelector_fx2ff_289",wX="_selectorTitle_fx2ff_299",EX="_teamList_fx2ff_313",_X="_teamCard_fx2ff_323",$X="_teamCardName_fx2ff_358",NX="_teamCardIcon_fx2ff_371",RX="_teamCardInfo_fx2ff_376",OX="_teamCardMeta_fx2ff_384",IX="_backButton_fx2ff_397",TX="_teamName_fx2ff_422",MX="_teamIcon_fx2ff_444",PX="_emptyDetail_fx2ff_449",kX="_teamDivider_fx2ff_456",jX="_activeBadge_fx2ff_462",AX="_createdAt_fx2ff_488",LX="_sunOrbit_fx2ff_736",BX="_sunOrbitInner_fx2ff_748",kt={container:tX,grass:nX,decoration1:rX,decoration2:oX,decoration3:aX,decoration4:iX,background:sX,grid:lX,particles:cX,backgroundParticle:uX,hint:dX,stats:fX,stat:mX,statLabel:pX,statValue:gX,statDivider:hX,loadingState:vX,emptyState:bX,spinner:yX,emptyIcon:xX,errorText:SX,teamSelector:CX,selectorTitle:wX,teamList:EX,teamCard:_X,teamCardName:$X,teamCardIcon:NX,teamCardInfo:RX,teamCardMeta:OX,backButton:IX,teamName:TX,teamIcon:MX,emptyDetail:PX,teamDivider:kX,activeBadge:jX,createdAt:AX,sunOrbit:LX,sunOrbitInner:BX},zX=(e,t)=>({"team-lead":"#fbbf24",subagent:"#3b82f6",worker:"#22c55e",explorer:"#8b5cf6",analyst:"#ec4899",tester:"#06b6d4",reviewer:"#f59e0b"})[e],FS=e=>({"team-lead":"🤠",subagent:"👤",worker:"🔧",explorer:"🔍",analyst:"📊",tester:"🧪",reviewer:"👁️"})[e]||"👤";class DX extends Q.Component{constructor(){super(...arguments);Lt(this,"state",{teams:[],currentTeam:null,characters:[],memberRequests:{},messageAnimations:[],selectedCharacter:null,containerSize:{width:window.innerWidth,height:window.innerHeight-100},loading:!0,error:null,teamStats:null,memberGroups:[],teamMessages:[]});Lt(this,"containerRef",Q.createRef());Lt(this,"resizeObserver",null);Lt(this,"_lastNotifiedMemberRequests",null);Lt(this,"_loadedTeamId",null);Lt(this,"refreshTeamStats",async n=>{if(console.log("[refreshTeamStats] Called with team:",(n==null?void 0:n.id)||(n==null?void 0:n.name)),console.trace("[refreshTeamStats] Stack trace"),!n||!n.id){console.log("[refreshTeamStats] Skipping - invalid team:",n);return}try{const r=await fetch(`/api/teams/${n.id}/stats`);if(r.ok){const o=await r.json();this.setState({teamStats:o});const i=n.id||n.name,{onTeamDataChange:l}=this.props;l&&l(i,{stats:o})}}catch(r){console.error("Failed to refresh team stats:",r)}});Lt(this,"refreshTeamMessages",async n=>{try{const r=await fetch(`/api/teams/${n.id}/inbox`);if(r.ok){const i=(await r.json()).messages||[];this.setState(u=>({characters:u.characters.map(m=>{const g=i.filter(h=>h._member===m.name);return{...m,messages:g}}),teamMessages:i}));const l=n.id||n.name,{onTeamDataChange:c}=this.props;c&&c(l,{inbox:i})}}catch(r){console.error("Failed to refresh team messages:",r)}});Lt(this,"loadTeams",async()=>{try{const o=(await(await fetch("/api/teams")).json()).teams||[];this.setState({teams:o,loading:!1},()=>{if(this.props.selectedTeam){const i=this.props.selectedTeam.id||this.props.selectedTeam.name,l=o.find(c=>c.id===i||c.name===i);l&&this.selectTeamWithoutNavigation(l)}})}catch(n){console.error("Failed to load teams:",n),this.setState({loading:!1,error:n.message})}});Lt(this,"handleSessionSelect",n=>{console.log("[handleSessionSelect] Called, session:",n)});Lt(this,"handleSelectTeam",async n=>{const r=n.id||n.name;console.log("[handleSelectTeam] Called, teamId:",r,"_loadedTeamId:",this._loadedTeamId);const{teamData:o,onTeamDataChange:i}=this.props,l=o==null?void 0:o[r];if((l==null?void 0:l.stats)&&(l==null?void 0:l.inbox)!==void 0){console.log("[handleSelectTeam] Using cached data from global state:",l),this._loadedTeamId=r,this.setState({currentTeam:n,teamStats:l.stats,teamMessages:l.inbox||[]},()=>{this.initializeCharacters(),window.location.hash=`/monitor?team=${encodeURIComponent(r)}`});return}if(this._loadedTeamId===r){console.log("[handleSelectTeam] Team already loaded (component level), skipping API requests"),this.setState({currentTeam:n},()=>{this.initializeCharacters(),window.location.hash=`/monitor?team=${encodeURIComponent(r)}`});return}console.log("[handleSelectTeam] First load, fetching stats and inbox...");let u=null;try{const m=await fetch(`/api/teams/${n.id}/stats`);m.ok&&(u=await m.json())}catch(m){console.error("Failed to load team stats:",m)}let f=[];try{const m=await fetch(`/api/teams/${n.id}/inbox`);m.ok&&(f=(await m.json()).messages||[])}catch(m){console.error("Failed to load team inbox:",m)}this._loadedTeamId=r,i&&(u||f)&&i(r,{stats:u,inbox:f}),this.setState({currentTeam:n,teamStats:u,teamMessages:f},()=>{this.initializeCharacters(),window.location.hash=`/monitor?team=${encodeURIComponent(r)}`})});Lt(this,"selectTeamWithoutNavigation",async n=>{const r=n.id||n.name,{teamData:o,onTeamDataChange:i}=this.props,l=o==null?void 0:o[r];if((l==null?void 0:l.stats)&&(l==null?void 0:l.inbox)!==void 0){console.log("[selectTeamWithoutNavigation] Using cached data from global state:",l),this._loadedTeamId=r,this.setState({currentTeam:n,teamStats:l.stats,teamMessages:l.inbox||[]},()=>{this.initializeCharacters()});return}if(this._loadedTeamId===r){console.log("[selectTeamWithoutNavigation] Team already loaded (component level), skipping API requests"),this.setState({currentTeam:n},()=>{this.initializeCharacters()});return}console.log("[selectTeamWithoutNavigation] First load, fetching stats and inbox...");let u=null;try{const m=await fetch(`/api/teams/${n.id}/stats`);m.ok&&(u=await m.json())}catch(m){console.error("Failed to load team stats:",m)}let f=[];try{const m=await fetch(`/api/teams/${n.id}/inbox`);m.ok&&(f=(await m.json()).messages||[])}catch(m){console.error("Failed to load team inbox:",m)}this._loadedTeamId=r,i&&(u||f)&&i(r,{stats:u,inbox:f}),this.setState({currentTeam:n,teamStats:u,teamMessages:f},()=>{this.initializeCharacters()})});Lt(this,"handleBackToSelector",()=>{this.setState({currentTeam:null,characters:[],memberGroups:[],teamStats:null}),window.location.hash="/team"});Lt(this,"handleResize",()=>{if(this.containerRef.current){const{width:n,height:r}=this.containerRef.current.getBoundingClientRect();this.setState({containerSize:{width:n,height:r}}),this.updateCharacterPositions(n,r)}});Lt(this,"handleWindowResize",()=>{this.handleResize()});Lt(this,"handleSelectCharacter",n=>{this.setState(r=>({selectedCharacter:{...n,messages:n.messages.map(o=>({...o,read:!0}))},characters:r.characters.map(o=>o.id===n.id?{...o,messages:o.messages.map(i=>({...i,read:!0}))}:o)}))});Lt(this,"handleCloseDetail",()=>{this.setState({selectedCharacter:null})});Lt(this,"handleViewNetworkRequests",n=>{var i,l;const r=new URLSearchParams;((i=this.state.currentTeam)!=null&&i.id||(l=this.state.currentTeam)!=null&&l.name)&&r.set("team",this.state.currentTeam.id||this.state.currentTeam.name),n!=null&&n.name&&r.set("member",n.name);const o=r.toString();window.location.hash="/raw"+(o?"?"+o:"")});Lt(this,"handleViewConversation",n=>{var i,l;const r=new URLSearchParams;((i=this.state.currentTeam)!=null&&i.id||(l=this.state.currentTeam)!=null&&l.name)&&r.set("team",this.state.currentTeam.id||this.state.currentTeam.name),n!=null&&n.name&&r.set("member",n.name);const o=r.toString();window.location.hash="/chat"+(o?"?"+o:"")});Lt(this,"handleBackToTeam",()=>{this.setState({selectedCharacter:null});const n=this.state.currentTeam,r=(n==null?void 0:n.id)||(n==null?void 0:n.name);window.location.hash=r?`/monitor?team=${encodeURIComponent(r)}`:"/monitor"});Lt(this,"handleAnimationComplete",n=>{this.setState(r=>({messageAnimations:r.messageAnimations.filter(o=>o.id!==n)}))})}componentDidMount(){this.state.teams.length>0?this.loadTeams():this.loadTeams(),this.containerRef.current&&(this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.containerRef.current)),window.addEventListener("resize",this.handleWindowResize)}componentWillUnmount(){this.resizeObserver&&this.containerRef.current&&this.resizeObserver.unobserve(this.containerRef.current),window.removeEventListener("resize",this.handleWindowResize)}getMemberPrefixes(n){const r=[n],o=[/-[a-z\d]+$/i,/-[a-z]+-\d+$/i,/-[a-z]+[A-Z].*$/i];for(const i of o){const l=n.replace(i,"");l&&l!==n&&!r.includes(l)&&r.push(l)}return r}groupMembersByPrefix(n){const r=n.find(u=>u.name==="team-lead"||u.agentType==="team-lead"),i=n.filter(u=>u.name!=="team-lead"&&u.agentType!=="team-lead").map(u=>({member:u,prefixes:this.getMemberPrefixes(u.name)})),l={};i.forEach(({prefixes:u})=>{u.forEach(f=>{l[f]=(l[f]||0)+1})});const c={};return i.forEach(({member:u,prefixes:f})=>{let m=u.name;for(const g of f)if(l[g]>1){m=g;break}c[m]||(c[m]=[]),c[m].push(u)}),{teamLead:r,groups:c}}initializeCharacters(){var E;let n,r;if(this.containerRef.current){const w=this.containerRef.current.getBoundingClientRect();n=w.width,r=w.height}else({width:n,height:r}=this.state.containerSize);const{currentTeam:o,teamMessages:i}=this.state;if(console.log("=== initializeCharacters START ==="),console.log("currentTeam:",o),console.log("containerSize:",{width:n,height:r}),!o||!o.members||o.members.length===0){console.log("No currentTeam or members, returning");return}const l=n/2,c=r/2,{teamLead:u,groups:f}=this.groupMembersByPrefix(o.members),m=Object.keys(f).sort(),g=m.length;console.log("=== Team Layout Debug ==="),console.log("teamLead:",u==null?void 0:u.name),console.log("groups:",f),console.log("groupNames:",m),console.log("groupCount:",g),console.log("centerX:",l,"centerY:",c);const h=[],v=[];if(u){console.log("Adding team-lead (Sun)...");const w=(E=o.memberList)==null?void 0:E.find(O=>O.name===u.name),_=(w==null?void 0:w.unread)||0,R=i.filter(O=>O._member===u.name),N={id:u.agentId,name:u.name,type:"team-lead",color:zX("team-lead"),x:l-50,y:c-50,status:_>0?"active":"idle",mood:"idle",messages:R,avatar:FS(u.agentType),unreadCount:_};v.push(N),console.log("Added team-lead (Sun):",N)}const b=Math.min(n,r),x=Math.max(b*.32,220);m.forEach((w,_)=>{const R=f[w],N=R.length,I=2*Math.PI/g*_-Math.PI/2,P=l+x*Math.cos(I),M=c+x*Math.sin(I);console.log(`
|
|
448
|
-
Group "${w}" (Planet #${_}):`),console.log(" Orbit position:",{x:P.toFixed(0),y:M.toFixed(0),angle:I.toFixed(2)}),console.log(" Members:",R.map(V=>V.name));let k=[];const A=Math.max(100,N*40);if(N>1){const V=2*Math.PI/N;R.forEach((H,W)=>{const z=W*V-Math.PI/2,K=P+A*Math.cos(z),G=M+A*Math.sin(z);k.push({x:K,y:G})})}else k.push({x:P,y:M});const j=[{primary:"#00fff7",secondary:"#00a8ff",name:"CYAN"},{primary:"#bf00ff",secondary:"#ff00ff",name:"PURPLE"},{primary:"#00ff88",secondary:"#00a8ff",name:"GREEN"},{primary:"#ff6600",secondary:"#ff00ff",name:"ORANGE"}],D=j[_%j.length],L=280;h.push({name:w,x:P,y:M,width:L,height:L,color:D,memberCount:N,orbitRadius:A}),R.forEach((V,H)=>{var U;const W=(U=o.memberList)==null?void 0:U.find(q=>q.name===V.name),z=(W==null?void 0:W.unread)||0,K=i.filter(q=>q._member===V.name),G=k[H],B={id:V.agentId,name:V.name,type:V.agentType||"subagent",color:D.primary,x:G.x,y:G.y,status:z>0?"active":"idle",mood:"idle",messages:K,avatar:FS(V.agentType),unreadCount:z};v.push(B)})});const S={teamLead:(u==null?void 0:u.name)||"none",groups:m,groupCount:g,characters:v.map(w=>({name:w.name,x:w.x,y:w.y,type:w.type})),memberGroups:h};window.__TEAM_DEBUG__=S,console.log("Debug info stored in window.__TEAM_DEBUG__"),console.log("=== initializeCharacters END ==="),this.setState({characters:v,memberGroups:h})}updateCharacterPositions(n,r){if(!n||!r)return;const{currentTeam:o,containerSize:i}=this.state;if(!o||!o.members||o.members.length===0||i&&i.width===n&&i.height===r)return;const l=n/2,c=r/2,{teamLead:u,groups:f}=this.groupMembersByPrefix(o.members),m=Object.keys(f).sort(),g=m.length,h=[],v=[],b=Math.min(n,r),x=Math.max(b*.22,150);if(u){const S=this.state.characters.find(E=>E.type==="team-lead");S&&h.push({...S,x:l-50,y:c-50})}m.forEach((S,E)=>{const w=f[S],_=w.length,N=2*Math.PI/g*E-Math.PI/2,O=l+x*Math.cos(N),I=c+x*Math.sin(N);let P=[];const M=85;if(_>1){const D=2*Math.PI/_;w.forEach((L,V)=>{const H=V*D-Math.PI/2,W=O+M*Math.cos(H),z=I+M*Math.sin(H);P.push({x:W,y:z})})}else P.push({x:O,y:I});const k=[{primary:"#00fff7",secondary:"#00a8ff",name:"CYAN"},{primary:"#bf00ff",secondary:"#ff00ff",name:"PURPLE"},{primary:"#00ff88",secondary:"#00a8ff",name:"GREEN"},{primary:"#ff6600",secondary:"#ff00ff",name:"ORANGE"}],A=k[E%k.length],j=280;v.push({name:S,x:O,y:I,width:j,height:j,color:A,memberCount:_,orbitRadius:M}),w.forEach(D=>{const L=this.state.characters.find(V=>V.name===D.name);if(L){const V=w.findIndex(H=>H.name===D.name);h.push({...L,x:P[V].x,y:P[V].y})}})}),this.setState({characters:h,memberGroups:v,containerSize:{width:n,height:r}})}componentDidUpdate(n,r){var o,i;if(this.props.selectedTeam&&this.props.selectedTeam!==n.selectedTeam){const l=this.props.selectedTeam;if(!this.state.currentTeam||this.state.currentTeam.id!==l.id){const c=this.state.teams.find(u=>u.id===l.id||u.name===l.id);c&&this.selectTeamWithoutNavigation(c)}}if(n.requests!==this.props.requests){this.updateCharactersFromRequests(),this.checkForNewMessages(n.requests,this.props.requests);const l=((o=n.requests)==null?void 0:o.length)||0,c=((i=this.props.requests)==null?void 0:i.length)||0,u=l>0&&c>l;this.state.currentTeam&&this.state.currentTeam.id&&u&&this.refreshTeamStats(this.state.currentTeam)}this.props.viewMode==="monitor"&&this.state.characters.length>0&&r.characters.length===0&&this.updateCharactersFromRequests(),this.props.viewMode==="monitor"&&n.viewMode!=="monitor"&&(this.state.currentTeam&&this.state.characters.length===0?this.initializeCharacters():this.updateCharactersFromRequests())}updateCharactersFromRequests(){const{requests:n,onMemberRequestsChange:r}=this.props;this.setState(o=>{const i={};o.characters.forEach(f=>{const m=f.name.toLowerCase(),g=n.filter(h=>{var S,E,w,_,R,N;if(f.type==="team-lead"){const O=h.teamMember||"";return!O||O===""||O.toLowerCase()===m||((E=(S=h.body)==null?void 0:S.metadata)==null?void 0:E.agent_id)===f.id}if((h.teamMember||"").split("@")[0].toLowerCase()===m||((_=(w=h.body)==null?void 0:w.metadata)==null?void 0:_.agent_id)===f.id)return!0;const x=(R=h.body)!=null&&R.system&&typeof((N=h.body)==null?void 0:N.system)=="string"?h.body.system.toLowerCase():"";return!!(x.includes(m)&&x.includes("teammate"))});i[f.name]=g});const l=o.characters.map(f=>{var R,N,O,I;const m=i[f.name]||[];let g=null;for(let P=m.length-1;P>=0;P--){const M=m[P];if((R=M.response)!=null&&R.body&&typeof M.response.body=="object"){g=M;break}}let h=null;const v=(N=g==null?void 0:g.response)==null?void 0:N.body;if(v&&typeof v=="object"&&v.usage){const P=v.usage,M=P.input_tokens||0,k=P.cache_read_input_tokens||0,A=P.cache_creation_input_tokens||0,j=M+k+A,D=2e5;let L=0;j>0&&(L=Math.round(j/D*100)),h={inputTokens:M,cacheRead:k,cacheCreate:A,totalInput:j,contextPercent:L}}let b=null;for(let P=m.length-1;P>=0;P--){const M=m[P];if((O=M.response)!=null&&O.body&&M.timestamp){b=new Date(M.timestamp).getTime();break}}const x=b&&Date.now()-b<1e4;let S="idle";x&&(S="working"),m.some(P=>{var M,k;return(k=(M=P.response)==null?void 0:M.body)==null?void 0:k.error})&&(S="error");const E=x?"active":"idle",w=((I=f.contextInfo)==null?void 0:I.contextPercent)??null,_=(h==null?void 0:h.contextPercent)??null;return f.status===E&&f.mood===S&&w===_?f:{...f,status:E,mood:S,contextInfo:h}}),c=l.some((f,m)=>f!==o.characters[m]),u=Object.keys(i).some(f=>JSON.stringify(i[f])!==JSON.stringify(o.memberRequests[f]||[]));if(!c&&!u)return null;if(r&&typeof r=="function"){const f=JSON.stringify(i),m=this._lastNotifiedMemberRequests?JSON.stringify(this._lastNotifiedMemberRequests):null;f!==m&&(this._lastNotifiedMemberRequests=i,console.log("[TeamView] Notifying memberRequests:",Object.keys(i),Object.entries(i).map(([g,h])=>`${g}: ${h.length}`).join(", ")),r(i))}return{characters:l,memberRequests:i}})}checkForNewMessages(n,r){if(!n||n.length===0)return;r.slice(n.length).forEach(i=>{this.triggerMessageAnimation(i)})}triggerMessageAnimation(n){const{characters:r}=this.state,o=r.find(l=>{var u,f,m;return(((u=n.url)==null?void 0:u.toLowerCase())||"").includes(l.name.toLowerCase())||((m=(f=n.body)==null?void 0:f.metadata)==null?void 0:m.agent_id)===l.id}),i=r.find(l=>l.type==="team-lead")||r[0];if(o&&i&&o.id!==i.id){const l={id:Date.now()+Math.random(),from:{x:o.x+50,y:o.y+50},to:{x:i.x+50,y:i.y+50}};this.setState(c=>({messageAnimations:[...c.messageAnimations,l]})),this.setState(c=>({characters:c.characters.map(u=>u.id===i.id?{...u,mood:"working"}:u)})),setTimeout(()=>{this.setState(c=>({characters:c.characters.map(u=>u.id===i.id?{...u,mood:"idle"}:u)}))},1500)}}render(){const{characters:n,messageAnimations:r,selectedCharacter:o,loading:i,error:l,currentTeam:c,teams:u,teamStats:f,memberGroups:m}=this.state,{requests:g,viewMode:h,teamData:v,onTeamDataChange:b}=this.props;return i?C.jsx("div",{className:kt.container,ref:this.containerRef,children:C.jsxs("div",{className:kt.loadingState,children:[C.jsx("div",{className:kt.spinner}),C.jsx("p",{children:"加载团队配置中..."})]})}):h==="team"?C.jsxs("div",{className:kt.container,ref:this.containerRef,children:[C.jsx(eX,{projectId:this.props.projectName,onSelectSession:this.handleSessionSelect}),C.jsxs("div",{className:kt.teamSelector,children:[C.jsxs("div",{className:kt.selectorTitle,children:[C.jsx("span",{className:kt.teamIcon,children:"👥"}),"选择要观察的团队"]}),C.jsx("div",{className:kt.teamList,children:u.length===0?C.jsxs("div",{className:kt.emptyState,children:[C.jsx("div",{className:kt.emptyIcon,children:"📭"}),C.jsx("h3",{children:"暂无可用团队"}),C.jsx("p",{children:"请先创建团队,在 claude code 中显式声明需要他创建团队并添加成员"}),C.jsx("div",{className:kt.hint,children:"团队配置存储在 ~/.claude/teams/"})]}):u.map(x=>{var S;return C.jsxs("div",{className:kt.teamCard,onClick:()=>this.handleSelectTeam(x),children:[C.jsxs("div",{className:kt.teamCardName,children:[C.jsx("span",{className:kt.teamCardIcon,children:"👥"}),x.name,x.isActive&&C.jsx("span",{className:kt.activeBadge,children:"活跃中"})]}),C.jsx("div",{className:kt.teamCardInfo,children:x.description||"暂无描述"}),C.jsxs("div",{className:kt.teamCardMeta,children:[((S=x.members)==null?void 0:S.length)||0," 成员",x.createdAt&&C.jsxs("span",{className:kt.createdAt,children:["创建于 ",new Date(x.createdAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})]})]})]},x.id||x.name)})})]})]}):l?C.jsx("div",{className:kt.container,ref:this.containerRef,children:C.jsxs("div",{className:kt.emptyState,children:[C.jsx("div",{className:kt.emptyIcon,children:"👥"}),C.jsx("h3",{children:"暂无团队配置"}),C.jsx("p",{children:"请先创建团队并添加成员"}),l&&C.jsxs("p",{className:kt.errorText,children:["错误: ",l]}),C.jsx("div",{className:kt.hint,children:"团队配置存储在 ~/.claude/teams/"}),c&&c.members&&c.members.length===0&&C.jsxs("p",{className:kt.emptyDetail,children:['团队 "',c.name,'" 暂无成员,请添加成员后刷新']})]})}):h==="monitor"&&n.length===0?C.jsx("div",{className:kt.container,ref:this.containerRef,children:C.jsxs("div",{className:kt.loadingState,children:[C.jsx("div",{className:kt.spinner}),C.jsx("p",{children:"加载团队数据中..."})]})}):C.jsxs("div",{className:kt.container,ref:this.containerRef,children:[C.jsx("div",{className:kt.backButton,onClick:this.handleBackToSelector,children:"← 返回团队列表"}),c&&C.jsxs("div",{className:kt.teamName,children:[C.jsx("span",{className:kt.teamIcon,children:"👥"}),c.name,C.jsx("span",{className:kt.teamDivider,children:"|"}),n.length," 成员"]}),C.jsxs("div",{className:kt.background,children:[C.jsx("div",{className:kt.grid}),C.jsx("div",{className:kt.particles,children:Array.from({length:15}).map((x,S)=>C.jsx("div",{className:kt.backgroundParticle,style:{left:`${Math.random()*100}%`,top:`${Math.random()*100}%`,animationDelay:`${Math.random()*5}s`,animationDuration:`${5+Math.random()*5}s`}},S))})]}),C.jsx("div",{className:kt.grass}),C.jsx("div",{className:kt.decoration1,children:"🌳"}),C.jsx("div",{className:kt.decoration2,children:"🌲"}),C.jsx("div",{className:kt.decoration3,children:"🌻"}),C.jsx("div",{className:kt.decoration4,children:"🪨"}),C.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:1},children:[m.length>0&&C.jsxs(C.Fragment,{children:[C.jsx("div",{className:kt.sunOrbit,style:{width:"75%",height:"75%",maxWidth:"700px",maxHeight:"700px"}}),C.jsx("div",{className:kt.sunOrbitInner,style:{width:"45%",height:"45%",maxWidth:"400px",maxHeight:"400px"}})]}),m.map((x,S)=>{const E=x.color||{primary:"#00fff7",secondary:"#00a8ff"},w=x.orbitRadius||85;return C.jsxs("div",{style:{position:"absolute",left:x.x,top:x.y,transform:"translate(-50%, -50%)",zIndex:5,width:x.width,height:x.height},children:[C.jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:w*2,height:w*2,border:`1px dashed ${E.primary}66`,borderRadius:"50%",opacity:.6,animation:"orbit-pulse 3s ease-in-out infinite"}}),C.jsx("div",{style:{position:"absolute",bottom:"-30px",left:"50%",transform:"translateX(-50%)",background:`linear-gradient(135deg, ${E.primary}22 0%, ${E.secondary}22 100%)`,border:`1px solid ${E.primary}`,borderRadius:"6px",padding:"6px 14px",fontSize:"11px",fontWeight:600,color:E.primary,fontFamily:"Orbitron, monospace",textTransform:"uppercase",letterSpacing:"0.1em",whiteSpace:"nowrap",boxShadow:`0 0 15px ${E.primary}33`,backdropFilter:"blur(10px)",textShadow:`0 0 8px ${E.primary}`},children:x.name})]},S)})]}),C.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:10},children:n.map(x=>C.jsx("div",{style:{position:"absolute",left:x.x,top:x.y,transform:"translate(-50%, -50%)",pointerEvents:"auto",zIndex:x.type==="team-lead"?15:10},children:C.jsx(W_,{character:x,isSelected:(o==null?void 0:o.id)===x.id,onSelect:this.handleSelectCharacter})},x.id))}),r.map(x=>C.jsx(dK,{from:x.from,to:x.to,duration:1200,onComplete:()=>this.handleAnimationComplete(x.id)},x.id)),C.jsx(U_,{character:o,visible:!!o,onClose:this.handleCloseDetail,onViewNetworkRequests:this.handleViewNetworkRequests,onViewConversation:this.handleViewConversation,onBackToTeam:this.handleBackToTeam}),C.jsx("div",{className:kt.hint,children:"点击角色查看详情 · 观察消息流动"}),C.jsxs("div",{className:kt.stats,children:[C.jsxs("div",{className:kt.stat,children:[C.jsx("span",{className:kt.statLabel,children:"成员"}),C.jsx("span",{className:kt.statValue,children:n.length})]}),C.jsx("div",{className:kt.statDivider,children:"|"}),C.jsxs("div",{className:kt.stat,children:[C.jsx("span",{className:kt.statLabel,children:"活跃"}),C.jsx("span",{className:kt.statValue,children:n.filter(x=>x.status==="active").length})]}),C.jsx("div",{className:kt.statDivider,children:"|"}),C.jsxs("div",{className:kt.stat,children:[C.jsx("span",{className:kt.statLabel,children:"消息"}),C.jsx("span",{className:kt.statValue,children:(f==null?void 0:f.messageCount)??0})]}),C.jsx("div",{className:kt.statDivider,children:"|"}),C.jsxs("div",{className:kt.stat,children:[C.jsx("span",{className:kt.statLabel,children:"请求"}),C.jsx("span",{className:kt.statValue,children:g.length})]})]})]})}}function FX({requests:e,projectName:t,selectedTeam:n,viewMode:r,onMemberRequestsChange:o,teamData:i,onTeamDataChange:l}){return C.jsx("div",{style:{display:"flex",height:"100%"},children:C.jsx(d.Suspense,{fallback:C.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"#999"},children:"加载中..."}),children:C.jsx(DX,{requests:e,projectName:t,selectedTeam:n,viewMode:r,onMemberRequestsChange:o,teamData:i,onTeamDataChange:l})})})}const HX="_container_8225t_5",VX="_header_8225t_31",WX="_backButton_8225t_56",UX="_title_8225t_77",GX="_sessionId_8225t_87",qX="_charactersArea_8225t_97",KX="_orbitRing_8225t_109",XX="_orbitRingInner_8225t_121",YX="_emptyState_8225t_157",QX="_emptyIcon_8225t_168",ca={container:HX,header:VX,backButton:WX,title:UX,sessionId:GX,charactersArea:qX,orbitRing:KX,orbitRingInner:XX,emptyState:YX,emptyIcon:QX},HS=["#fbbf24","#00fff7","#00ff88","#ff6600","#bf00ff","#ff00ff","#00a8ff","#f59e0b"];function ZX({sessionId:e,projectName:t,requests:n}){const r=d.useRef(null),[o,i]=d.useState(null),[l,c]=d.useState([]),[u,f]=d.useState({}),[m,g]=d.useState(null),[h,v]=d.useState(n||[]);Zv({session:e,onLogUpdate:w=>{console.log("[SessionView] Received log update:",w.length),v(_=>{const R=new Map;return _.forEach(N=>{const O=`${N.timestamp}|${N.url}`;R.set(O,N)}),w.forEach(N=>{const O=`${N.timestamp}|${N.url}`;R.set(O,N)}),Array.from(R.values())})},onFullReload:w=>{console.log("[SessionView] Full reload:",w.length),v(w)}});const b=d.useRef(new Map),x=d.useMemo(()=>{const w=new Map,_=h||[];console.log("[SessionView] Building characterMap from requests:",_.length),_.forEach(I=>{var M,k;if(!((M=I.response)!=null&&M.body))return;const P=I.mainAgent&&!I.agentName&&!Hd(I);if(console.log("[SessionView] Request:",(k=I.url)==null?void 0:k.slice(0,50),"mainAgent:",P,"agentName:",I.agentName),P)w.has("mainagent")||w.set("mainagent",{id:"mainagent",name:"MainAgent",type:"mainagent",color:"#fbbf24",avatar:"⬡",requests:[],status:"idle",contextInfo:null,messages:[]}),w.get("mainagent").requests.push(I);else{const A=I.agentName||Hd(I);if(A){const j=A;w.has(j)||w.set(j,{id:j,name:A,type:"agent",color:HS[w.size%HS.length],avatar:"◈",requests:[],status:"idle",contextInfo:null,messages:[]}),w.get(j).requests.push(I)}}});const R=2e5,N=Date.now(),O=300*1e3;return w.forEach((I,P)=>{var L,V;const M=I.requests||[];let k=null;for(let H=M.length-1;H>=0;H--){const W=M[H];if((L=W.response)!=null&&L.body&&typeof W.response.body=="object"){k=W;break}}let A=null;const j=(V=k==null?void 0:k.response)==null?void 0:V.body;if(j&&typeof j=="object"&&j.usage){const H=j.usage,W=H.input_tokens||0,z=H.cache_read_input_tokens||0,K=H.cache_creation_input_tokens||0,G=W+z+K;let B=0;G>0&&(B=Math.round(G/R*100)),A={inputTokens:W,cacheRead:z,cacheCreate:K,totalInput:G,contextPercent:B}}I.contextInfo=A;const D=M.length>0&&M.some(H=>{const W=new Date(H.timestamp).getTime();return N-W<O});I.status=D?"active":"idle",I.messages=M.map(H=>{var W;return{from:"system",text:`[${H.method}] ${(W=H.url)==null?void 0:W.slice(0,50)}...`,timestamp:H.timestamp,read:!0}})}),b.current=w,console.log("[SessionView] characterMap built, size:",w.size),w},[h]);d.useEffect(()=>{if(x.size>0){const w=Array.from(x.values()).sort((_,R)=>_.type==="mainagent"?-1:R.type==="mainagent"?1:0);console.log("[SessionView] Built characters from requests:",w.length),c(w)}},[x]),d.useEffect(()=>{if(!r.current||l.length===0)return;const w=()=>{const R=r.current.getBoundingClientRect(),N=R.width/2,O=R.height/2,I=l.find(A=>A.type==="mainagent"),P=l.filter(A=>A.type!=="mainagent"),M=P.length,k={};if(I&&(k[I.id]={x:N,y:O}),M>0){const A=Math.min(N,O)*.45,j=Math.max(0,(M-3)*30),L=Math.max(A,180)+j,V=2*Math.PI/M;P.forEach((H,W)=>{const z=V*W-Math.PI/2,K=N+L*Math.cos(z),G=O+L*Math.sin(z);k[H.id]={x:K,y:G}})}f(k)};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[l]),d.useEffect(()=>{S()},[e]);const S=async()=>{try{const w=await fetch(`/api/sessions/${e}/info`);if(w.ok){const _=await w.json();console.log("[SessionView] Session info loaded:",_),i(_)}else console.error("[SessionView] Failed to load session info:",w.status)}catch(w){console.error("[SessionView] Failed to load session info:",w)}},E=w=>{console.log("[SessionView] Character selected:",w);const _=b.current.get(w.id);console.log("[SessionView] charData:",_),g(_?{...w,..._,messages:w.messages||[]}:w)};return C.jsxs("div",{className:ca.container,children:[C.jsxs("div",{className:ca.header,children:[C.jsx("button",{className:ca.backButton,onClick:()=>window.location.hash="/team",children:"← 返回"}),C.jsxs("h2",{className:ca.title,children:["Session: ",C.jsx("span",{className:ca.sessionId,children:e})]})]}),C.jsxs("div",{className:ca.charactersArea,ref:r,children:[l.length>1&&C.jsxs(C.Fragment,{children:[C.jsx("div",{className:ca.orbitRing,style:{width:"90%",height:"90%",maxWidth:"700px",maxHeight:"700px"}}),C.jsx("div",{className:ca.orbitRingInner,style:{width:"60%",height:"60%",maxWidth:"450px",maxHeight:"450px"}})]}),l.length===0?C.jsxs("div",{className:ca.emptyState,children:[C.jsx("div",{className:ca.emptyIcon,children:"◌"}),C.jsx("h3",{children:"NO DATA"}),C.jsx("p",{children:"Waiting for request stream..."})]}):l.map(w=>{const _=u[w.id];return C.jsx("div",{style:{position:"absolute",left:_?_.x:"50%",top:_?_.y:"50%",transform:"translate(-50%, -50%)",zIndex:w.type==="mainagent"?10:5},children:C.jsx(W_,{character:w,isSelected:(m==null?void 0:m.id)===w.id,onSelect:E})},w.id)})]}),m&&C.jsx(U_,{character:m,visible:!!m,sessionMode:!0,sessionId:e,onClose:()=>g(null)})]})}function JX({requests:e,projectName:t,selectedSession:n,viewMode:r}){const i=new URLSearchParams(window.location.hash.split("?")[1]).get("session");return console.log("[SessionViewPage] Rendering with sessionId:",i,"selectedSession:",n),i?C.jsx("div",{style:{display:"flex",height:"100%"},children:C.jsx(d.Suspense,{fallback:C.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"#999"},children:"加载中..."}),children:C.jsx(ZX,{sessionId:i,projectName:t,requests:e})})}):C.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh",color:"#999"},children:C.jsxs("div",{children:[C.jsx("h2",{children:"No session specified"}),C.jsx("p",{children:"Please provide a session ID in the URL"})]})})}function eY(){const e=parseInt(localStorage.getItem("ccv_cacheExpireAt"),10)||null,t=localStorage.getItem("ccv_cacheType")||null,n=Date.now(),r=e&&e>n?e:null;return{cacheExpireAt:r,cacheType:r?t:null}}function tY(e,t){return t?t.toLowerCase()==="mainagent"?e.mainAgent===!0:e.agentName===t:!0}const nY="_layout_1krbo_4",rY="_header_1krbo_10",oY="_content_1krbo_31",aY="_loadingOverlay_1krbo_178",iY="_loadingText_1krbo_192",Ul={layout:nY,header:rY,content:oY,loadingOverlay:aY,loadingText:iY},sY=300,lY=800,cY=10;function uY(e,t){const[n,r]=d.useState(0),o=d.useRef(null);return d.useEffect(()=>{if(!e){r(0),o.current&&(cancelAnimationFrame(o.current),o.current=null);return}const i=performance.now(),l=Math.min(lY,Math.max(sY,t*cY)),c=()=>{const u=performance.now(),f=Math.min((u-i)/l,1);r(Math.round(f*t)),f<1?o.current=requestAnimationFrame(c):o.current=null};return o.current=requestAnimationFrame(c),()=>{o.current&&(cancelAnimationFrame(o.current),o.current=null)}},[e,t]),n}function dY(){const[e,t]=d.useState([]),[n,r]=d.useState(null),[o,i]=d.useState("team"),[l,c]=d.useState("request"),[u,f]=d.useState(380),[m,g]=d.useState(!1),[h,v]=d.useState(null),[b,x]=d.useState(""),[S,E]=d.useState(!0),[w,_]=d.useState(!0),[R,N]=d.useState(!1),[O,I]=d.useState(!1),[P,M]=d.useState(0),[k,A]=d.useState(!1),[j,D]=d.useState(null),[L,V]=d.useState(null),[H,W]=d.useState(null),[z,K]=d.useState(null),[G,B]=d.useState(!1),[U,q]=d.useState({}),[X,Z]=d.useState({}),{cacheExpireAt:te,cacheType:pe}=eY(),le=uY(O,P),fe=d.useCallback(ae=>{console.log("[handleLogUpdate] 收到新条目:",ae.length),!(!Array.isArray(ae)||ae.length===0)&&t(Ae=>{console.log("[handleLogUpdate] 更新 requests:",Ae.length,"->",Ae.length+ae.length);const Fe=new Map;return Ae.forEach(Je=>{const Ke=`${Je.timestamp}|${Je.url}`;Fe.set(Ke,Je)}),ae.forEach(Je=>{const Ke=`${Je.timestamp}|${Je.url}`;Fe.set(Ke,Je)}),Array.from(Fe.values())})},[]);Zv({team:(j==null?void 0:j.id)||(j==null?void 0:j.name)||null,session:L||null,onFullReload:ae=>{Array.isArray(ae)&&(console.log("[App useSSE] onFullReload:",ae.length,"entries"),t(ae))},onLogUpdate:fe});const we=d.useRef({hasTeam:!1,hasSession:!1});d.useEffect(()=>{const ae=(j==null?void 0:j.id)||(j==null?void 0:j.name),Ae=L,Fe=we.current,Je=Fe.hasTeam,Ke=Fe.hasSession;console.log("[App] Team/Session state change:",{previous:{hasTeam:Je,hasSession:Ke},current:{hasTeam:!!ae,hasSession:!!Ae}}),Ae&&!ae&&Je&&!Ke?(console.log("[App] Switching from TEAM mode to SESSION mode, clearing requests"),t([])):ae&&!Ae&&!Je&&Ke&&(console.log("[App] Switching from SESSION mode to TEAM mode, clearing requests"),t([])),we.current={hasTeam:!!ae,hasSession:!!Ae}},[j,L]),d.useEffect(()=>(fetch("/api/preferences").then(ae=>ae.json()).then(ae=>{ae.collapseToolResults!==void 0&&E(!!ae.collapseToolResults),ae.expandThinking!==void 0&&_(!!ae.expandThinking),ae.expandDiff!==void 0&&N(!!ae.expandDiff);const Ae=ae.filterIrrelevant!==void 0?!!ae.filterIrrelevant:!0;g(!Ae)}).catch(()=>{}),fetch("/api/user-profile").then(ae=>ae.json()).then(ae=>v(ae)).catch(()=>{}),fetch("/api/project-name").then(ae=>ae.json()).then(ae=>{console.log("[App] projectName loaded:",ae.projectName),x(ae.projectName||"")}).catch(()=>{}),fetch("/api/cli-mode").then(ae=>ae.json()).then(ae=>{ae.cliMode&&A(!0)}).catch(()=>{}),ce(),window.addEventListener("hashchange",ce),()=>{window.removeEventListener("hashchange",ce)}),[]);const ce=d.useCallback(()=>{const ae=window.location.hash.slice(1)||"/team",[Ae,Fe]=ae.split("?"),Je=new URLSearchParams(Fe||"");console.log("[App handleHashChange] Processing hash:",ae,"path:",Ae),Ae==="/raw"?i("raw"):Ae==="/chat"?i("chat"):Ae==="/monitor"?i("monitor"):Ae==="/team"?i("team"):Ae==="/session-monitor"&&(console.log("[App handleHashChange] Setting viewMode to session-monitor"),i("session-monitor"));const Ke=Je.get("session");Ke?(console.log("[App handleHashChange] Setting selectedSession:",Ke),V(Ke),D(null)):V(null);const nt=Je.get("agent");W(nt);const dt=Je.get("team");dt&&!Ke?D({id:dt,name:dt}):Ke||D(null);const tt=Je.get("scrollTs");tt&&(K(tt),i("chat"));const ht=Je.get("idx");ht&&r(parseInt(ht,10));const st=Je.get("tab");st&&c(st),Je.get("center")==="true"&&B(!0)},[]),me=d.useCallback(ae=>{r(ae),$e({idx:ae})},[]),be=d.useCallback(ae=>{c(ae),$e({tab:ae})},[]),Se=d.useCallback(ae=>{i("chat"),K(ae),$e({scrollTs:ae})},[]),ge=d.useCallback(ae=>{i("raw"),r(ae),$e({idx:ae})},[]),ie=d.useCallback(ae=>{q(ae)},[]),ve=d.useCallback((ae,Ae)=>{Z(Fe=>({...Fe,[ae]:{...Fe[ae],...Ae,loadedAt:Date.now()}}))},[]),$e=d.useCallback(ae=>{const Ae=window.location.hash.slice(1)||"/team",[Fe,Je]=Ae.split("?"),Ke=new URLSearchParams(Je||"");Object.entries(ae).forEach(([dt,tt])=>{tt==null?Ke.delete(dt):Ke.set(dt,String(tt))});const nt=Ke.toString()?`${Fe}?${Ke.toString()}`:Fe;window.location.hash=nt},[]),Te=bz(e||[]),De=m?e||[]:Te,ke=d.useMemo(()=>{const ae=window.location.hash.slice(1),[,Ae]=ae.split("?");return new URLSearchParams(Ae||"").get("member")||null},[o]),je=d.useMemo(()=>{if(!j||!ke)return e||[];const ae=ke.split("@")[0].toLowerCase(),Ae=ae==="team-lead";return(e||[]).filter(Fe=>{var nt,dt,tt,ht,st,He;if(Ae)return!Hd(Fe);const Je=Hd(Fe);if(Je&&Je.split("@")[0].toLowerCase()===ae||((dt=(nt=Fe.body)==null?void 0:nt.metadata)==null?void 0:dt.agent_id)===ke)return!0;const Ke=(tt=Fe.body)!=null&&tt.system&&typeof((ht=Fe.body)==null?void 0:ht.system)=="string"?Fe.body.system.toLowerCase():Array.isArray((st=Fe.body)==null?void 0:st.system)?(He=Fe.body)==null?void 0:He.system.map(lt=>(lt==null?void 0:lt.text)||"").join("").toLowerCase():"";return!!(Ke.includes(ae)&&Ke.includes("teammate"))})},[j,ke,e]),Pe=d.useMemo(()=>!L||!H?e||[]:(e||[]).filter(ae=>tY(ae,H)),[L,H,e]);return e.length>0&&(Te.length===0||De.length===0)&&console.log("[数据调试] requests:",e.length,"relevantRequests:",Te.length,"filteredRequests:",De.length,"showAll:",m),C.jsxs(ya,{theme:{algorithm:HL.darkAlgorithm,token:{colorBgContainer:"#111",colorBgLayout:"#0a0a0a",colorBgElevated:"#1a1a1a",colorBorder:"#2a2a2a"}},children:[O&&C.jsx("div",{className:Ul.loadingOverlay,children:C.jsxs("div",{className:Ul.loadingText,children:["Loading...(",le,")"]})}),C.jsxs(fi,{className:Ul.layout,children:[C.jsx(fi.Header,{className:Ul.header,children:C.jsx(kh,{requestCount:o==="monitor"||o==="team"?De.length:o==="session-monitor"?Pe.length:je.length,requests:o==="monitor"||o==="team"?De:o==="session-monitor"?Pe:je,viewMode:o,cacheExpireAt:te,cacheType:pe,projectName:b,collapseToolResults:S,onCollapseToolResultsChange:E,expandThinking:w,onExpandThinkingChange:_,expandDiff:R,onExpandDiffChange:N,filterIrrelevant:!m,onFilterIrrelevantChange:ae=>g(!ae),cliMode:k,selectedTeam:j})}),C.jsx(fi.Content,{className:Ul.content,children:C.jsx(fY,{viewMode:o,requests:De,allRequests:e,selectedIndex:n,currentTab:l,scrollCenter:G,chatScrollToTs:z,userProfile:h,collapseToolResults:S,expandThinking:w,expandDiff:R,leftPanelWidth:u,selectedTeam:j,selectedSession:L,currentAgent:H,projectName:b,currentMember:ke,filteredMemberRequests:je,filteredAgentRequests:Pe,onSelectRequest:me,onScrollDone:()=>B(!1),onTabChange:be,onViewInChat:Se,onViewRequest:ge,onResize:f,memberRequests:U,onMemberRequestsChange:ie,teamData:X,onTeamDataChange:ve})})]})]})}function fY(e){var L;console.log("[MainContent] props.requests.length:",(L=e.requests)==null?void 0:L.length);const{viewMode:t,requests:n,allRequests:r,selectedIndex:o,currentTab:i,scrollCenter:l,chatScrollToTs:c,userProfile:u,collapseToolResults:f,expandThinking:m,expandDiff:g,leftPanelWidth:h,selectedTeam:v,selectedSession:b,currentAgent:x,projectName:S,currentMember:E,filteredMemberRequests:w,filteredAgentRequests:_,onSelectRequest:R,onScrollDone:N,onTabChange:O,onViewInChat:I,onViewRequest:P,onResize:M,memberRequests:k,onMemberRequestsChange:A,teamData:j,onTeamDataChange:D}=e;if(t==="raw"){const V=b?_:w;return console.log("[MainContent] raw view:",{selectedSession:b,currentAgent:x,currentMember:E,memberRequestKeys:Object.keys(k),filteredCount:V.length,allRequestsCount:r.length}),C.jsx(KV,{requests:V,selectedIndex:o,currentTab:i,scrollCenter:l,onSelectRequest:R,onScrollDone:N,onTabChange:O,onViewInChat:I,expandDiff:g,leftPanelWidth:h,onResize:M,onBackToTeam:()=>{if(b)window.location.hash=`/session-monitor?session=${encodeURIComponent(b)}`;else{const H=(v==null?void 0:v.id)||(v==null?void 0:v.name);window.location.hash=H?`/monitor?team=${encodeURIComponent(H)}`:"/monitor"}}})}if(t==="chat"){const V=b?_:w;return console.log("[MainContent] chat view:",{selectedSession:b,currentAgent:x,currentMember:E,memberRequestKeys:Object.keys(k),filteredCount:V.length,allRequestsCount:r.length}),C.jsx(kq,{requests:V,userProfile:u,collapseToolResults:f,expandThinking:m,onViewRequest:P,chatScrollToTs:c,onScrollTsDone:()=>{},cliMode:!1,onBackToTeam:()=>{if(b)window.location.hash=`/session-monitor?session=${encodeURIComponent(b)}`;else{const H=(v==null?void 0:v.id)||(v==null?void 0:v.name);window.location.hash=H?`/monitor?team=${encodeURIComponent(H)}`:"/monitor"}}})}return t==="team"||t==="monitor"?C.jsx(FX,{requests:n,projectName:S,selectedTeam:v,viewMode:t,onMemberRequestsChange:A,teamData:j,onTeamDataChange:D}):t==="session-monitor"?C.jsx(JX,{requests:n,projectName:S,selectedSession:b,viewMode:t}):null}const mY=T3.createRoot(document.getElementById("root"));mY.render(C.jsx(dY,{}));
|
|
447
|
+
`);m.current.innerHTML=S.map((E,w)=>`<div class="${Er.lineNumberRow}">${w+1}</div>`).join(""),f.current.innerHTML=S.map(E=>`<div class="${Er.lineContentRow}">${E||" "}</div>`).join("")}catch{m.current.innerHTML=b.map((x,S)=>`<div class="${Er.lineNumberRow}">${S+1}</div>`).join(""),f.current.innerHTML=b.map(x=>`<div class="${Er.lineContentRow}">${x||" "}</div>`).join("")}else m.current.innerHTML=b.map((x,S)=>`<div class="${Er.lineNumberRow}">${S+1}</div>`).join(""),f.current.innerHTML=b.map(x=>`<div class="${Er.lineContentRow}">${x||" "}</div>`).join("")}},[n,e]),d.useEffect(()=>{const v=g.current,b=h.current;if(!v||!b)return;const x=()=>{b.scrollTop=v.scrollTop};return v.addEventListener("scroll",x),()=>v.removeEventListener("scroll",x)}),C.jsxs("div",{className:Er.fileContentView,children:[C.jsxs("div",{className:Er.header,children:[C.jsxs("div",{className:Er.headerLeft,children:[C.jsx("button",{className:Er.backBtn,onClick:t,title:"返回对话",children:C.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:C.jsx("polyline",{points:"15 18 9 12 15 6"})})}),C.jsx("span",{className:Er.filePath,children:e})]}),l>0&&C.jsx("span",{className:Er.fileSize,children:hq(l)})]}),C.jsxs("div",{className:Er.contentContainer,children:[o&&C.jsx("div",{className:Er.error,children:o}),!n&&!o&&C.jsx("div",{className:Er.loading,children:"加载中..."}),n&&C.jsxs("div",{className:Er.codeBlock,children:[C.jsx("div",{className:Er.lineNumberCol,ref:h,children:C.jsx("div",{ref:m})}),C.jsx("div",{className:Er.codeCol,ref:g,children:C.jsx("pre",{className:Er.codeContent,children:C.jsx("code",{ref:f})})})]})]})]})}const bq="_centerEmpty_8tuwm_1",yq="_container_8tuwm_8",xq="_sessionDividerText_8tuwm_18",Sq="_lastResponseLabel_8tuwm_23",Cq="_splitContainer_8tuwm_27",wq="_chatSection_8tuwm_34",Eq="_messageListWrap_8tuwm_192",_q="_stickyBottomBtn_8tuwm_200",$q="_navSidebar_8tuwm_369",Nq="_navBtn_8tuwm_381",Rq="_navBtnActive_8tuwm_401",qr={centerEmpty:bq,container:yq,sessionDividerText:xq,lastResponseLabel:Sq,splitContainer:Cq,chatSection:wq,messageListWrap:Eq,stickyBottomBtn:_q,navSidebar:$q,navBtn:Nq,navBtnActive:Rq},{Text:LS}=Ho,Oq=20;function Iq(){return 100+Math.random()*50}function BS(e){var o;const t={};for(const i of e)if(i.role==="assistant"&&Array.isArray(i.content))for(const l of i.content)l.type==="tool_use"&&(t[l.id]=l);const n={},r={};for(const i of e)if(i.role==="user"&&Array.isArray(i.content)){for(const l of i.content)if(l.type==="tool_result"){const c=t[l.tool_use_id];let u="工具返回",f=null,m=null;if(c)if(f=c.name,m=c.input,c.name==="Task"&&c.input){const h=c.input.subagent_type||"",v=c.input.description||"";u=`SubAgent: ${h}${v?" — "+v:""}`}else u=`${c.name} 返回`;const g=u_(l);n[l.tool_use_id]={label:u,toolName:f,toolInput:m,resultText:g},c&&c.name==="Read"&&((o=c.input)!=null&&o.file_path)&&(r[c.input.file_path]=g)}}return{toolUseMap:t,toolResultMap:n,readContentMap:r}}class Tq extends Q.Component{constructor(n){super(n);Lt(this,"handleStickToBottom",()=>{this.setState({stickyBottom:!0},()=>{const n=this.containerRef.current;n&&(n.scrollTop=n.scrollHeight)})});Lt(this,"handleToggleExpandPath",n=>{this.setState(r=>{const o=new Set(r.fileExplorerExpandedPaths);return o.has(n)?o.delete(n):o.add(n),{fileExplorerExpandedPaths:o}})});this.containerRef=Q.createRef(),this.splitContainerRef=Q.createRef(),this.innerSplitRef=Q.createRef(),this.state={visibleCount:0,loading:!1,allItems:[],highlightTs:null,highlightFading:!1,stickyBottom:!0,fileExplorerOpen:!0,currentFile:null,fileExplorerExpandedPaths:new Set},this._queueTimer=null,this._prevItemsLen=0,this._scrollTargetIdx=null,this._scrollTargetRef=Q.createRef(),this._scrollFadeTimer=null}componentDidMount(){this.startRender(),this._bindStickyScroll()}componentDidUpdate(n){var i,l,c,u;const r=n.mainAgentSessions!==this.props.mainAgentSessions||((i=n.mainAgentSessions)==null?void 0:i.length)!==((l=this.props.mainAgentSessions)==null?void 0:l.length),o=n.requests!==this.props.requests||((c=n.requests)==null?void 0:c.length)!==((u=this.props.requests)==null?void 0:u.length);if(r||o)this.startRender();else if(n.collapseToolResults!==this.props.collapseToolResults||n.expandThinking!==this.props.expandThinking){const f=this.buildAllItems();this.setState({allItems:f,visibleCount:f.length})}if(!n.scrollToTimestamp&&this.props.scrollToTimestamp){const f=this.buildAllItems();this.setState({allItems:f,visibleCount:f.length},()=>this.scrollToBottom())}this._rebindStickyEl()}componentWillUnmount(){this._queueTimer&&clearTimeout(this._queueTimer),this._fadeClearTimer&&clearTimeout(this._fadeClearTimer),this._unbindScrollFade(),this._unbindStickyScroll()}startRender(){this._queueTimer&&clearTimeout(this._queueTimer);const n=this.buildAllItems(),r=this._prevItemsLen;this._prevItemsLen=n.length;const o=n.length-r;if(o<=0||r>0&&o<=3){this.setState({allItems:n,visibleCount:n.length,loading:!1},()=>this.scrollToBottom());return}if(n.length>Oq)this.setState({allItems:n,visibleCount:0,loading:!0}),this._queueTimer=setTimeout(()=>{this.setState({visibleCount:n.length,loading:!1},()=>this.scrollToBottom())},300);else{const i=Math.max(0,r);this.setState({allItems:n,visibleCount:i,loading:!1}),this.queueNext(i,n.length)}}queueNext(n,r){n>=r||(this._queueTimer=setTimeout(()=>{this.setState({visibleCount:n+1},()=>{this.scrollToBottom(),this.queueNext(n+1,r)})},Iq()))}_isNearBottom(){const n=this.containerRef.current;return n?n.scrollHeight-n.scrollTop-n.clientHeight<=30:!0}scrollToBottom(){if(this._scrollTargetRef.current){const n=this._scrollTargetRef.current,r=this.containerRef.current;r&&n.offsetHeight>r.clientHeight?n.scrollIntoView({block:"start",behavior:"instant"}):n.scrollIntoView({block:"center",behavior:"instant"});const o=this.props.scrollToTimestamp;this._scrollTargetRef=Q.createRef(),o&&(this.setState({highlightTs:o,highlightFading:!1}),this._bindScrollFade()),this.props.onScrollTsDone&&this.props.onScrollTsDone();return}if(this.state.stickyBottom){const n=this.containerRef.current;n&&(n.scrollTop=n.scrollHeight)}}_bindStickyScroll(){this._stickyScrollRafId=null,this._onStickyScroll=()=>{this._stickyScrollLock||this._stickyScrollRafId||(this._stickyScrollRafId=requestAnimationFrame(()=>{this._stickyScrollRafId=null;const n=this.containerRef.current;if(!n)return;const r=n.scrollHeight-n.scrollTop-n.clientHeight;this.state.stickyBottom&&r>30?this.setState({stickyBottom:!1}):!this.state.stickyBottom&&r<=5&&this.setState({stickyBottom:!0})}))},this._rebindStickyEl()}_rebindStickyEl(){const n=this.containerRef.current;n!==this._stickyBoundEl&&(this._stickyBoundEl&&this._stickyBoundEl.removeEventListener("scroll",this._onStickyScroll),this._stickyBoundEl=n,n&&n.addEventListener("scroll",this._onStickyScroll,{passive:!0}))}_unbindStickyScroll(){this._stickyBoundEl&&this._onStickyScroll&&(this._stickyBoundEl.removeEventListener("scroll",this._onStickyScroll),this._stickyBoundEl=null),this._stickyScrollRafId&&(cancelAnimationFrame(this._stickyScrollRafId),this._stickyScrollRafId=null)}_bindScrollFade(){this._unbindScrollFade();const n=this.containerRef.current;n&&(this._scrollFadeIgnoreFirst=!0,this._onScrollFade=()=>{if(this._scrollFadeIgnoreFirst){this._scrollFadeIgnoreFirst=!1;return}this.setState({highlightFading:!0}),this._fadeClearTimer=setTimeout(()=>{this.setState({highlightTs:null,highlightFading:!1})},2e3),this._unbindScrollFade()},n.addEventListener("scroll",this._onScrollFade,{passive:!0}))}_unbindScrollFade(){this._onScrollFade&&this.containerRef.current&&(this.containerRef.current.removeEventListener("scroll",this._onScrollFade),this._onScrollFade=null)}renderSessionMessages(n,r,o,i){var b;const{userProfile:l,collapseToolResults:c,expandThinking:u,onViewRequest:f}=this.props,{toolUseMap:m,toolResultMap:g,readContentMap:h}=BS(n),v=[];for(let x=0;x<n.length;x++){const S=n[x],E=S.content,w=S._timestamp||null,_=w?i[w]:void 0,R=_!=null&&f?{requestIndex:_,onViewRequest:f}:{};if(S.role==="user"){if(Array.isArray(E)){const N=E.find(I=>I.type==="text"&&/^\[SUGGESTION MODE:/i.test((I.text||"").trim())),O=E.filter(I=>I.type==="tool_result");if(N&&O.length>0){let I=null,P={};for(const M of O){const k=m[M.tool_use_id];if(k&&k.name==="AskUserQuestion"&&((b=k.input)!=null&&b.questions)){I=k.input.questions;const A=u_(M);try{P=JSON.parse(A).answers||{}}catch{}break}}I&&v.push(C.jsx(Ao,{role:"user-selection",questions:I,answers:P,timestamp:w,userProfile:l,...R},`${r}-selection-${x}`))}else{const{commands:I,textBlocks:P,skillBlocks:M}=l_(E);for(let k=0;k<I.length;k++)v.push(C.jsx(Ao,{role:"user",text:I[k],timestamp:w,userProfile:l,modelInfo:o,...R},`${r}-cmd-${x}-${k}`));for(const k of M){const A=k.text.match(/^#\s+(.+)$/m),j=A?A[1]:"Skill";v.push(C.jsx(Ao,{role:"skill-loaded",text:k.text,skillName:j,timestamp:w,...R},`${r}-skill-${x}`))}for(let k=0;k<P.length;k++){const A=/^Implement the following plan:/i.test((P[k].text||"").trim());v.push(C.jsx(Ao,{role:A?"plan-prompt":"user",text:P[k].text,timestamp:w,userProfile:l,modelInfo:o,...R},`${r}-user-${x}-${k}`))}}}else if(typeof E=="string"&&!Dv(E)){const N=/^Implement the following plan:/i.test(E.trim());v.push(C.jsx(Ao,{role:N?"plan-prompt":"user",text:E,timestamp:w,userProfile:l,modelInfo:o,...R},`${r}-user-${x}`))}}else S.role==="assistant"&&(Array.isArray(E)?v.push(C.jsx(Ao,{role:"assistant",content:E,toolResultMap:g,readContentMap:h,timestamp:w,modelInfo:o,collapseToolResults:c,expandThinking:u,...R},`${r}-asst-${x}`)):typeof E=="string"&&v.push(C.jsx(Ao,{role:"assistant",content:[{type:"text",text:E}],toolResultMap:g,readContentMap:h,timestamp:w,modelInfo:o,collapseToolResults:c,expandThinking:u,...R},`${r}-asst-${x}`)))}return v}buildItemsFromRequests(n,r,o,i,l){const c=[];wS(null);const u=l?(l.id||l.name||"").split("@")[0].toLowerCase():null;for(let f=0;f<n.length;f++){const m=n[f];if(!m.body||!m.body.messages)continue;if(u){const h=(m.teamMember||"").split("@")[0].toLowerCase();if(h&&h!==u)continue}const g=m.body.messages||[];for(const h of g)h.role==="user"?c.push(C.jsx(Ao,{role:"user",content:h.content,timestamp:m.timestamp,collapseToolResults:r,expandThinking:o,requestIndex:f,onViewRequest:i},`req-${f}-user`)):h.role==="assistant"&&c.push(C.jsx(Ao,{role:"assistant",content:h.content,timestamp:m.timestamp,collapseToolResults:r,expandThinking:o,requestIndex:f,onViewRequest:i},`req-${f}-assistant`))}return c}buildAllItems(){var x,S,E,w;const{mainAgentSessions:n,requests:r,collapseToolResults:o,expandThinking:i,onViewRequest:l}=this.props;if((!n||n.length===0)&&r&&r.length>0)return this.buildItemsFromRequests(r,o,i,l);const c={};if(r)for(let _=0;_<r.length;_++)ka(r[_])&&r[_].timestamp&&(c[r[_].timestamp]=_);let u=null;if(r){for(let _=r.length-1;_>=0;_--)if(ka(r[_])&&((x=r[_].body)!=null&&x.model)){u=r[_].body.model;break}}const f=wS(u),m=[],g={},h=[];if(r)for(let _=0;_<r.length;_++){const R=r[_];if(!R.timestamp)continue;const N=yc(R,r[_+1]);if(N.type==="SubAgent"){const O=(E=(S=R.response)==null?void 0:S.body)==null?void 0:E.content;if(Array.isArray(O)&&O.length>0){const I=BS(((w=R.body)==null?void 0:w.messages)||[]).toolResultMap;h.push({timestamp:R.timestamp,content:O,toolResultMap:I,label:Gd(N.type,N.subType),requestIndex:_})}}}let v=0;n.forEach((_,R)=>{var O,I,P,M;R>0&&m.push(C.jsx(Qx,{style:{borderColor:"#333",margin:"16px 0"},children:C.jsx(LS,{className:qr.sessionDividerText,children:"Session"})},`session-div-${R}`));const N=this.renderSessionMessages(_.messages,`s${R}`,f,c);for(const k of N){const A=k.props.timestamp;for(;v<h.length&&A&&h[v].timestamp<=A;){const j=h[v];j.timestamp&&(g[j.timestamp]=m.length),m.push(C.jsx(Ao,{role:"sub-agent-chat",content:j.content,toolResultMap:j.toolResultMap,label:j.label,timestamp:j.timestamp,collapseToolResults:o,expandThinking:i,requestIndex:j.requestIndex,onViewRequest:l},`sub-chat-${v}`)),v++}A&&(g[A]=m.length),m.push(k)}for(;v<h.length;){const k=h[v],A=R<n.length-1&&((I=(O=n[R+1].messages)==null?void 0:O[0])==null?void 0:I._timestamp);if(A&&k.timestamp>A)break;k.timestamp&&(g[k.timestamp]=m.length),m.push(C.jsx(Ao,{role:"sub-agent-chat",content:k.content,toolResultMap:k.toolResultMap,label:k.label,timestamp:k.timestamp,collapseToolResults:o,expandThinking:i,requestIndex:k.requestIndex,onViewRequest:l},`sub-chat-${v}`)),v++}if(R===n.length-1&&((M=(P=_.response)==null?void 0:P.body)!=null&&M.content)){const k=_.response.body.content;Array.isArray(k)&&(m.push(C.jsx(Q.Fragment,{children:C.jsx(Qx,{style:{borderColor:"#2a2a2a",margin:"8px 0"},children:C.jsx(LS,{type:"secondary",className:qr.lastResponseLabel,children:"Last Response"})})},"resp-divider")),_.entryTimestamp&&(g[_.entryTimestamp]=m.length),m.push(C.jsx(Ao,{role:"assistant",content:k,timestamp:_.entryTimestamp,modelInfo:f,collapseToolResults:o,expandThinking:i,toolResultMap:{}},"resp-asst")))}});const{scrollToTimestamp:b}=this.props;return this._scrollTargetIdx=b&&g[b]!=null?g[b]:null,this._tsItemMap=g,m}render(){const{mainAgentSessions:n,cliMode:r}=this.props,{allItems:o,visibleCount:i,loading:l}=this.state,c=!n||n.length===0;if(c&&!r)return C.jsx("div",{className:qr.centerEmpty,children:C.jsx(lo,{description:"暂无 MainAgent 对话数据"})});if(l&&!r)return C.jsx("div",{className:qr.centerEmpty,children:C.jsx(Vi,{size:"large"})});const u=this._scrollTargetIdx,{highlightTs:f,highlightFading:m}=this.state,g=f&&this._tsItemMap&&this._tsItemMap[f]!=null?this._tsItemMap[f]:null,h=o.slice(0,i),{stickyBottom:v}=this.state,b=v?null:C.jsxs("button",{className:qr.stickyBottomBtn,onClick:this.handleStickToBottom,children:[C.jsx("span",{children:"置底"}),C.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:C.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),x=c||l?C.jsxs("div",{className:qr.messageListWrap,children:[C.jsx("div",{ref:this.containerRef,className:qr.container,children:!r||l?C.jsx("div",{className:qr.centerEmpty,children:l?C.jsx(Vi,{size:"large"}):C.jsx(lo,{description:"暂无 MainAgent 对话数据"})}):null}),b]}):C.jsxs("div",{className:qr.messageListWrap,children:[C.jsx("div",{ref:this.containerRef,className:qr.container,children:h.map((S,E)=>{const w=E===u,_=E===g;let R=S;return _&&(R=Q.cloneElement(R,{highlight:m?"fading":"active"})),w?C.jsx("div",{ref:this._scrollTargetRef,children:R},S.key+"-anchor"):R})}),b]});return r?C.jsxs("div",{ref:this.splitContainerRef,className:qr.splitContainer,children:[C.jsx("div",{className:qr.navSidebar,children:C.jsx("button",{className:this.state.fileExplorerOpen?qr.navBtnActive:qr.navBtn,onClick:()=>this.setState({fileExplorerOpen:!0,currentFile:null}),title:"文件浏览",children:C.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:C.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 2h9a2 2 0 0 1 2 2z"})})})}),C.jsxs("div",{style:{flex:1,display:"flex",minWidth:0,position:"relative"},ref:this.innerSplitRef,children:[this.state.fileExplorerOpen&&C.jsx(tG,{onClose:()=>this.setState({fileExplorerOpen:!1}),onFileClick:S=>this.setState({currentFile:S}),expandedPaths:this.state.fileExplorerExpandedPaths,onToggleExpand:this.handleToggleExpandPath,currentFile:this.state.currentFile}),C.jsx("div",{className:qr.chatSection,style:{flex:1,minWidth:0,display:"flex"},children:C.jsx("div",{style:{flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:this.state.currentFile?C.jsx(vq,{filePath:this.state.currentFile,onClose:()=>this.setState({currentFile:null})}):x})})]})]}):x}}function Mq(e,t){var m;const n=t.body.messages,r=t.response,o=((m=t.body.metadata)==null?void 0:m.user_id)||null,i=t.timestamp||null,l=t.teamMember||null;if(e.length===0)return[{userId:o,messages:n,response:r,entryTimestamp:i,teamMember:l}];const c=e[e.length-1],u=c.messages?c.messages.length:0,f=u>0&&n.length<u*.5&&u-n.length>4;if(o&&o===c.userId&&!f){const g=[...e];return g[g.length-1]={...c,messages:n,response:r,entryTimestamp:i,teamMember:l||c.teamMember},g}else return[...e,{userId:o,messages:n,response:r,entryTimestamp:i,teamMember:l}]}function Pq(e,t=!1){let n=[];for(const r of e)(t?r.body&&Array.isArray(r.body.messages):ka(r)&&r.body&&Array.isArray(r.body.messages))&&(n=Mq(n,r));return n}function kq({requests:e,userProfile:t,collapseToolResults:n,expandThinking:r,onViewRequest:o,chatScrollToTs:i,onScrollTsDone:l,cliMode:c,onBackToTeam:u}){const f=d.useMemo(()=>Pq(e,!0),[e]);return console.log("[ChatViewPage] requests.length:",e.length,"sessions.length:",f.length),C.jsxs("div",{style:{display:"flex",height:"100%",flexDirection:"column"},children:[C.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid #303030",display:"flex",alignItems:"center"},children:[C.jsx(br,{type:"text",size:"small",onClick:u,children:"← 监控"}),C.jsx("span",{style:{marginLeft:12,fontWeight:500},children:"对话视图"})]}),C.jsx(Tq,{requests:e,mainAgentSessions:f,userProfile:t,collapseToolResults:n,expandThinking:r,onViewRequest:o,scrollToTimestamp:i,onScrollTsDone:l,cliMode:c})]})}const jq="_cyberCharacter_n8txo_8",Aq="_hovered_n8txo_15",Lq="_selected_n8txo_19",Bq="_unreadBadge_n8txo_26",zq="_unreadCount_n8txo_52",Dq="_pulse_n8txo_59",Fq="_hologramContainer_n8txo_86",Hq="_outerRing_n8txo_96",Vq="_innerRing_n8txo_114",Wq="_cyberCore_n8txo_142",Uq="_cyberIcon_n8txo_178",Gq="_dataFlow_n8txo_197",qq="_glowEffect_n8txo_220",Kq="_nameTag_n8txo_248",Xq="_contextBadge_n8txo_272",Yq="_statusIndicator_n8txo_293",Qq="_statusIcon_n8txo_314",Zq="_statusText_n8txo_320",Jq="_statusPulse_n8txo_377",eK="_contextBar_n8txo_403",tK="_contextBarBg_n8txo_419",nK="_contextBarFill_n8txo_428",rK="_shimmer_n8txo_1",oK="_contextText_n8txo_466",aK="_dataHint_n8txo_478",iK="_dataIcon_n8txo_506",sK="_dataCount_n8txo_512",er={cyberCharacter:jq,hovered:Aq,selected:Lq,unreadBadge:Bq,"badge-glow":"_badge-glow_n8txo_1",unreadCount:zq,pulse:Dq,"cyber-pulse":"_cyber-pulse_n8txo_1",hologramContainer:Fq,outerRing:Hq,"cyber-rotate":"_cyber-rotate_n8txo_1",innerRing:Vq,"cyber-rotate-reverse":"_cyber-rotate-reverse_n8txo_1",cyberCore:Wq,"cyber-node":"_cyber-node_n8txo_173",cyberIcon:Uq,"icon-pulse":"_icon-pulse_n8txo_1",dataFlow:Gq,"data-flow":"_data-flow_n8txo_1",glowEffect:qq,"glow-pulse":"_glow-pulse_n8txo_1",nameTag:Kq,contextBadge:Xq,statusIndicator:Yq,statusIcon:Qq,statusText:Zq,"status-active":"_status-active_n8txo_325","status-working":"_status-working_n8txo_336","status-idle":"_status-idle_n8txo_347","status-error":"_status-error_n8txo_356","error-pulse":"_error-pulse_n8txo_1",statusPulse:Jq,"status-pulse":"_status-pulse_n8txo_1",contextBar:eK,contextBarBg:tK,contextBarFill:nK,shimmer:rK,"context-danger":"_context-danger_n8txo_451","context-warning":"_context-warning_n8txo_456","context-safe":"_context-safe_n8txo_461",contextText:oK,dataHint:aK,"hint-float":"_hint-float_n8txo_1",dataIcon:iK,dataCount:sK,"selected-glow":"_selected-glow_n8txo_1"},zS={"team-lead":"⬡",subagent:"◈",worker:"⬢",explorer:"◉",analyst:"⌬",tester:"⌘",reviewer:"⌖",mainagent:"⬡",agent:"◈"},DS={active:"▶",working:"◍",idle:"◌",error:"⚠"};class W_ extends Q.Component{constructor(){super(...arguments);Lt(this,"state",{isHovered:!1});Lt(this,"handleClick",()=>{const{character:n,onSelect:r}=this.props;r(n)});Lt(this,"handleMouseEnter",()=>{this.setState({isHovered:!0})});Lt(this,"handleMouseLeave",()=>{this.setState({isHovered:!1})})}getMessageCount(){var i,l;const{character:n}=this.props,r=((i=n.messages)==null?void 0:i.filter(c=>!c.read).length)||0,o=((l=n.messages)==null?void 0:l.length)||0;return{unread:r,total:o}}getContextPercent(){var r;const{character:n}=this.props;return((r=n.contextInfo)==null?void 0:r.contextPercent)||null}getContextBadgeStyle(){const n=this.getContextPercent();return n===null?"":n>60?"danger":n>40?"warning":"safe"}getCharacterTypeClass(){const{character:n}=this.props;return"cyber-node"}getCyberColor(){const{character:n}=this.props;return{"team-lead":"#fbbf24",mainagent:"#fbbf24",subagent:"#00fff7",agent:"#00fff7",worker:"#00ff88",explorer:"#bf00ff",analyst:"#ff00ff",tester:"#00a8ff",reviewer:"#ff6600"}[n.type]||"#00fff7"}render(){const{character:n,isSelected:r}=this.props,{isHovered:o}=this.state,{unread:i,total:l}=this.getMessageCount(),c=this.getCharacterTypeClass(),u=this.getCyberColor(),f=this.getContextPercent(),m=zS[n.type]||zS.subagent,g=DS[n.status]||DS.idle;return C.jsxs("div",{className:`${er.cyberCharacter} ${r?er.selected:""} ${o?er.hovered:""}`,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,style:{"--cyber-color":u},children:[i>0&&C.jsxs("div",{className:er.unreadBadge,children:[C.jsx("span",{className:er.unreadCount,children:i}),C.jsx("div",{className:er.pulse})]}),C.jsxs("div",{className:er.hologramContainer,children:[C.jsx("div",{className:er.outerRing}),C.jsx("div",{className:er.innerRing}),C.jsx("div",{className:`${er.cyberCore} ${er[c]}`,children:C.jsx("span",{className:er.cyberIcon,children:m})}),C.jsx("div",{className:er.dataFlow}),C.jsx("div",{className:er.glowEffect})]}),C.jsx("div",{className:er.nameTag,children:n.name}),f!==null&&C.jsxs("span",{className:er.contextBadge,style:{background:f>60?"rgba(239, 68, 68, 0.3)":f>40?"rgba(251, 191, 36, 0.3)":"rgba(0, 255, 247, 0.2)",color:f>60?"#ef4444":f>40?"#fbbf24":"#00fff7",border:`1px solid ${f>60?"#ef4444":f>40?"#fbbf24":"#00fff7"}44`,boxShadow:f>60?"0 0 8px rgba(239, 68, 68, 0.3)":f>40?"0 0 8px rgba(251, 191, 36, 0.3)":"0 0 8px rgba(0, 255, 247, 0.2)"},children:[f,"%"]}),C.jsxs("div",{className:`${er.statusIndicator} ${er[`status-${n.status}`]}`,children:[C.jsx("span",{className:er.statusIcon,children:g}),C.jsx("span",{className:er.statusText,children:n.status==="active"?"ACTIVE":n.status==="working"?"PROCESSING":"STANDBY"}),n.status==="active"&&C.jsx("div",{className:er.statusPulse})]}),o&&l>0&&C.jsxs("div",{className:er.dataHint,children:[C.jsx("span",{className:er.dataIcon,children:"⌬"}),C.jsx("span",{className:er.dataCount,children:l})]})]})}}const lK="_messageEnvelope_12k2o_1",cK="_particles_12k2o_9",uK="_particle_12k2o_9",Cg={messageEnvelope:lK,particles:cK,particle:uK};class dK extends Q.Component{constructor(n){super(n);Lt(this,"animate",()=>{const r=performance.now()-this.startTime,o=this.props.duration||1500,i=Math.min(r/o,1),l=i<.5?2*i*i:1-Math.pow(-2*i+2,2)/2;this.setState({progress:l}),i<1?requestAnimationFrame(this.animate):setTimeout(()=>{this.setState({opacity:0}),setTimeout(()=>this.props.onComplete(),300)},200)});this.state={progress:0,opacity:1}}componentDidMount(){this.props.duration,this.startTime=performance.now(),this.animate()}render(){const{from:n,to:r}=this.props,{progress:o,opacity:i}=this.state,l=n.x+(r.x-n.x)*o,c=n.y+(r.y-n.y)*o,u=Math.atan2(r.y-n.y,r.x-n.x)*180/Math.PI;return C.jsxs("div",{className:Cg.messageEnvelope,style:{left:l,top:c,opacity:i,transform:`rotate(${u}deg)`},children:[C.jsxs("svg",{viewBox:"0 0 40 30",width:"32",height:"24",children:[C.jsx("rect",{x:"2",y:"5",width:"36",height:"20",rx:"2",fill:"#fbbf24",stroke:"#f59e0b",strokeWidth:"1.5"}),C.jsx("path",{d:"M 2 5 L 20 17 L 38 5",fill:"none",stroke:"#f59e0b",strokeWidth:"1.5"}),C.jsx("path",{d:"M 2 5 L 20 17 L 2 25",fill:"#fcd34d",opacity:"0.5"}),C.jsx("path",{d:"M 38 5 L 20 17 L 38 25",fill:"#eab308",opacity:"0.3"}),C.jsx("circle",{cx:"20",cy:"15",r:"3",fill:"#ef4444",opacity:"0.8"})]}),o<.8&&C.jsx("div",{className:Cg.particles,children:Array.from({length:5}).map((f,m)=>{const g=m*.1,h=Math.max(0,o-g)/(1-g);return C.jsx("div",{className:Cg.particle,style:{animationDelay:`${g}s`,opacity:1-h}},m)})})]})}}const fK="_panel_1c46t_5",mK="_header_1c46t_52",pK="_headerLeft_1c46t_72",gK="_avatar_1c46t_100",hK="_title_1c46t_129",vK="_name_1c46t_133",bK="_meta_1c46t_144",yK="_messageCount_1c46t_151",xK="_closeButton_1c46t_159",SK="_actionButtons_1c46t_184",CK="_actionButton_1c46t_184",wK="_stats_1c46t_205",EK="_statItem_1c46t_225",_K="_statValue_1c46t_229",$K="_statLabel_1c46t_238",NK="_messageList_1c46t_250",RK="_messageListHeader_1c46t_257",OK="_messageListCount_1c46t_272",IK="_emptyState_1c46t_284",TK="_list_1c46t_303",MK="_messageItem_1c46t_327",PK="_messageHeader_1c46t_357",kK="_messageSender_1c46t_363",jK="_messageTime_1c46t_374",AK="_messageStatus_1c46t_380",LK="_messageSummary_1c46t_386",BK="_messageContent_1c46t_394",zK="_messageBody_1c46t_398",yn={panel:fK,header:mK,headerLeft:pK,avatar:gK,title:hK,name:vK,meta:bK,messageCount:yK,closeButton:xK,actionButtons:SK,actionButton:CK,stats:wK,statItem:EK,statValue:_K,statLabel:$K,messageList:NK,messageListHeader:RK,messageListCount:OK,emptyState:IK,list:TK,messageItem:MK,messageHeader:PK,messageSender:kK,messageTime:jK,messageStatus:AK,messageSummary:LK,messageContent:BK,messageBody:zK},{Text:gY,Paragraph:DK}=Ho;function FK(e){try{const t=JSON.parse(e);return t.type==="task_assignment"||t.type==="idle_notification"?{isSystem:!1,text:e}:t.type==="shutdown_request"?{isSystem:!0,text:`[请求关闭] ${t.content||""}`,type:"shutdown"}:t.type==="shutdown_response"?{isSystem:!0,text:`[关闭响应] ${t.approve?"已批准":"已拒绝"}`,type:"shutdown"}:t.type==="plan_approval_request"?{isSystem:!0,text:"[计划审批请求]",type:"plan"}:t.type?{isSystem:!0,text:`[${t.type}]`,type:t.type}:{isSystem:!1,text:e}}catch{return{isSystem:!1,text:e}}}class U_ extends Q.Component{render(){const{character:t,visible:n,onClose:r,onViewNetworkRequests:o,onViewConversation:i,sessionMode:l,sessionId:c}=this.props;if(!n||!t)return null;const u=t.messages||[],f=u.filter(g=>!FK(g.text).isSystem),m=C.jsxs("div",{className:yn.panel,style:{position:"fixed",top:"64px",right:"0",left:"auto",bottom:"0",width:"420px",height:"calc(100vh - 64px)",zIndex:1e3},children:[C.jsxs("div",{className:yn.header,children:[C.jsxs("div",{className:yn.headerLeft,children:[C.jsx("div",{className:yn.avatar,style:{background:t.color},children:t.avatar||t.name.charAt(0)}),C.jsxs("div",{className:yn.title,children:[C.jsx("h2",{className:yn.name,children:t.name}),C.jsxs("div",{className:yn.meta,children:[C.jsx(So,{color:t.status==="active"?"green":"default",children:t.status==="active"?"工作中":"空闲"}),C.jsxs("span",{className:yn.messageCount,children:[f.length," 条消息"]})]})]})]}),C.jsx("button",{className:yn.closeButton,onClick:r,children:"✕"})]}),C.jsxs("div",{className:yn.actionButtons,children:[C.jsx(br,{type:"primary",icon:C.jsx(AB,{}),onClick:()=>{l&&c?window.location.hash=`/raw?session=${c}&agent=${encodeURIComponent(t.name)}`:o==null||o(t)},className:yn.actionButton,children:"查看请求"}),C.jsx(br,{icon:C.jsx(XE,{}),onClick:()=>{l&&c?window.location.hash=`/chat?session=${c}&agent=${encodeURIComponent(t.name)}`:i==null||i(t)},className:yn.actionButton,children:"查看对话"})]}),C.jsxs("div",{className:yn.stats,children:[C.jsxs("div",{className:yn.statItem,children:[C.jsx("div",{className:yn.statValue,children:f.length}),C.jsx("div",{className:yn.statLabel,children:"消息"})]}),C.jsxs("div",{className:yn.statItem,children:[C.jsx("div",{className:yn.statValue,children:new Set(f.map(g=>g.from)).size}),C.jsx("div",{className:yn.statLabel,children:"参与者"})]}),C.jsxs("div",{className:yn.statItem,children:[C.jsx("div",{className:yn.statValue,children:u.filter(g=>!g.read).length}),C.jsx("div",{className:yn.statLabel,children:"未读"})]})]}),C.jsxs("div",{className:yn.messageList,children:[C.jsxs("div",{className:yn.messageListHeader,children:[C.jsx("span",{children:"消息记录"}),C.jsx("span",{className:yn.messageListCount,children:f.length})]}),f.length===0?C.jsxs("div",{className:yn.emptyState,children:[C.jsx(GB,{style:{fontSize:48,color:"#333"}}),C.jsx("p",{children:"暂无消息记录"})]}):C.jsx(gc,{className:yn.list,dataSource:[...f].reverse(),renderItem:(g,h)=>{const v=g.read!==!1,b=g.timestamp||new Date().toISOString(),x=g.color||"#888";return C.jsxs(gc.Item,{className:yn.messageItem,children:[C.jsxs("div",{className:yn.messageHeader,children:[C.jsxs("div",{className:yn.messageSender,children:[C.jsx(QB,{style:{marginRight:4,color:x,fontSize:11}}),C.jsx("span",{style:{color:x,fontWeight:500},children:g.from})]}),C.jsxs("div",{className:yn.messageStatus,children:[C.jsx("span",{className:yn.messageTime,children:new Date(b).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),!v&&C.jsx(jd,{status:"processing"})]})]}),g.summary&&C.jsx("div",{className:yn.messageSummary,children:g.summary}),C.jsx("div",{className:yn.messageContent,children:C.jsx(DK,{ellipsis:{rows:3,expandable:!0,symbol:"展开"},className:yn.messageBody,style:{color:"#ccc",fontSize:13,margin:0},children:g.text})})]},h)}})]})]});return ja.createPortal(m,document.body)}}function Zv(e){const{onFullReload:t,onLogUpdate:n,onUpdateInfo:r,onTeamStats:o,onSessionsUpdate:i,team:l,session:c,projectSessions:u}=e,f=d.useRef(null),m=d.useRef(null),g=d.useRef(t),h=d.useRef(n),v=d.useRef(r),b=d.useRef(o),x=d.useRef(i);g.current=t,h.current=n,v.current=r,b.current=o,x.current=i;const S=d.useCallback(()=>{if(!l&&!c&&!u){console.log("[useSSE] No team, session or projectSessions parameter, skipping connection");return}f.current&&f.current.close();let E;if(l?E=`/events?team=${encodeURIComponent(l)}`:c?E=`/events?session=${encodeURIComponent(c)}`:u&&(E=`/events?projectSessions=${encodeURIComponent(u)}`),console.log("[useSSE] Connecting to:",E),f.current){const _=f.current;if(_.readyState===EventSource.OPEN||_.readyState===EventSource.CONNECTING){console.log("[useSSE] Already connected or connecting, skipping");return}_.close()}const w=new EventSource(E);f.current=w,w.onmessage=_=>{},w.addEventListener("update_completed",_=>{var R;try{const N=JSON.parse(_.data);(R=v.current)==null||R.call(v,{type:"completed",version:N.version})}catch{}}),w.addEventListener("update_major_available",_=>{var R;try{const N=JSON.parse(_.data);(R=v.current)==null||R.call(v,{type:"major",version:N.version})}catch{}}),w.addEventListener("full_reload",_=>{var R;try{const N=JSON.parse(_.data);(R=g.current)==null||R.call(g,N)}catch{}}),w.addEventListener("log_update",_=>{var R;try{const N=JSON.parse(_.data);(R=h.current)==null||R.call(h,N)}catch{}}),w.addEventListener("team_stats",_=>{var R;try{const N=JSON.parse(_.data);(R=b.current)==null||R.call(b,N)}catch{}}),w.addEventListener("sessions_update",_=>{var R;try{const N=JSON.parse(_.data);(R=x.current)==null||R.call(x,N)}catch{}}),w.onerror=()=>{console.log("[useSSE] Connection error, reconnecting in 3s..."),w.close(),f.current=null,m.current=setTimeout(S,3e3)}},[l,c,u]);return d.useEffect(()=>{if(!(!l&&!c&&!u))return console.log("[useSSE] Effect running, team:",l,"session:",c,"projectSessions:",u),S(),()=>{console.log("[useSSE] Cleanup"),f.current&&f.current.close(),m.current&&clearTimeout(m.current)}},[S,l,c,u]),{eventSource:f.current}}const HK="_sidebar_9l9yw_1",VK="_header_9l9yw_12",WK="_count_9l9yw_28",UK="_loading_9l9yw_37",GK="_sessionList_9l9yw_43",qK="_empty_9l9yw_49",KK="_sessionItem_9l9yw_56",XK="_sessionId_9l9yw_79",YK="_userMessage_9l9yw_86",QK="_sessionInfo_9l9yw_98",ZK="_time_9l9yw_111",Yo={sidebar:HK,header:VK,count:WK,loading:UK,sessionList:GK,empty:qK,sessionItem:KK,sessionId:XK,userMessage:YK,sessionInfo:QK,time:ZK};function JK(e){if(!e)return"";const t=new Date(e),r=new Date-t,o=Math.floor(r/6e4),i=Math.floor(r/36e5),l=Math.floor(r/864e5);return o<1?"刚刚":o<60?`${o}m 前`:i<24?`${i}h 前`:l<7?`${l}d 前`:t.toLocaleDateString("zh-CN",{month:"short",day:"numeric"})}function eX({projectId:e,onSelectSession:t}){const[n,r]=d.useState([]),[o,i]=d.useState(!0),l=d.useRef(null);d.useEffect(()=>{console.log("[SessionSidebar] Component mounted"),console.log("[SessionSidebar] projectId:",e),console.log("[SessionSidebar] onSelectSession type:",typeof t),l.current&&console.log("[SessionSidebar] Container ref found:",l.current);const u=f=>{const m=f.target.closest("[data-session-id]");if(m){const g=m.getAttribute("data-session-id"),h=n.find(v=>v.id===g);h&&(console.log("[SessionSidebar] Native click event triggered for session:",g),c(h))}};return l.current&&(l.current.addEventListener("click",u),console.log("[SessionSidebar] Native click listener attached")),()=>{console.log("[SessionSidebar] Component unmounted"),l.current&&l.current.removeEventListener("click",u)}},[e,t,n]),Zv({projectSessions:e,onSessionsUpdate:u=>{r(u.sessions||[]),i(!1)}});const c=u=>{console.log("[SessionSidebar] Session clicked:",u.id),console.log("[SessionSidebar] Session object:",u),console.log("[SessionSidebar] onSelectSession function:",typeof t);try{t(u)}catch(m){console.error("[SessionSidebar] Error calling onSelectSession:",m)}const f=`/session-monitor?session=${u.id}`;console.log("[SessionSidebar] Setting hash to:",f);try{window.location.hash=f}catch(m){console.error("[SessionSidebar] Error setting hash:",m)}};return C.jsxs("div",{className:Yo.sidebar,ref:l,children:[C.jsxs("div",{className:Yo.header,children:[C.jsx("h3",{children:"Sessions"}),C.jsx("span",{className:Yo.count,children:n.length})]}),o?C.jsx("div",{className:Yo.loading,children:"Loading..."}):C.jsx("div",{className:Yo.sessionList,children:n.length===0?C.jsx("div",{className:Yo.empty,children:"No sessions"}):n.map(u=>C.jsxs("div",{className:Yo.sessionItem,onClick:f=>{console.log("[SessionSidebar] Click event fired",f.target),c(u)},"data-session-id":u.id,children:[u.lastUserMessage&&C.jsx("div",{className:Yo.userMessage,children:u.lastUserMessage}),C.jsx("div",{className:Yo.sessionId,children:u.id}),C.jsxs("div",{className:Yo.sessionInfo,children:[C.jsx("span",{className:Yo.time,children:JK(u.lastTimestamp)}),C.jsxs("span",{children:[u.requestCount," requests"]}),u.agents.length>0&&C.jsxs("span",{children:[u.agents.length," agents"]})]})]},u.id))})]})}const tX="_container_fx2ff_8",nX="_grass_fx2ff_30",rX="_decoration1_fx2ff_41",oX="_decoration2_fx2ff_52",aX="_decoration3_fx2ff_63",iX="_decoration4_fx2ff_74",sX="_background_fx2ff_90",lX="_grid_fx2ff_100",cX="_particles_fx2ff_113",uX="_backgroundParticle_fx2ff_121",dX="_hint_fx2ff_151",fX="_stats_fx2ff_160",mX="_stat_fx2ff_160",pX="_statLabel_fx2ff_183",gX="_statValue_fx2ff_191",hX="_statDivider_fx2ff_200",vX="_loadingState_fx2ff_208",bX="_emptyState_fx2ff_223",yX="_spinner_fx2ff_236",xX="_emptyIcon_fx2ff_260",SX="_errorText_fx2ff_281",CX="_teamSelector_fx2ff_289",wX="_selectorTitle_fx2ff_299",EX="_teamList_fx2ff_313",_X="_teamCard_fx2ff_323",$X="_teamCardName_fx2ff_358",NX="_teamCardIcon_fx2ff_371",RX="_teamCardInfo_fx2ff_376",OX="_teamCardMeta_fx2ff_384",IX="_backButton_fx2ff_397",TX="_teamName_fx2ff_422",MX="_teamIcon_fx2ff_444",PX="_emptyDetail_fx2ff_449",kX="_teamDivider_fx2ff_456",jX="_activeBadge_fx2ff_462",AX="_createdAt_fx2ff_488",LX="_sunOrbit_fx2ff_736",BX="_sunOrbitInner_fx2ff_748",kt={container:tX,grass:nX,decoration1:rX,decoration2:oX,decoration3:aX,decoration4:iX,background:sX,grid:lX,particles:cX,backgroundParticle:uX,hint:dX,stats:fX,stat:mX,statLabel:pX,statValue:gX,statDivider:hX,loadingState:vX,emptyState:bX,spinner:yX,emptyIcon:xX,errorText:SX,teamSelector:CX,selectorTitle:wX,teamList:EX,teamCard:_X,teamCardName:$X,teamCardIcon:NX,teamCardInfo:RX,teamCardMeta:OX,backButton:IX,teamName:TX,teamIcon:MX,emptyDetail:PX,teamDivider:kX,activeBadge:jX,createdAt:AX,sunOrbit:LX,sunOrbitInner:BX},zX=(e,t)=>({"team-lead":"#fbbf24",subagent:"#3b82f6",worker:"#22c55e",explorer:"#8b5cf6",analyst:"#ec4899",tester:"#06b6d4",reviewer:"#f59e0b"})[e],FS=e=>({"team-lead":"🤠",subagent:"👤",worker:"🔧",explorer:"🔍",analyst:"📊",tester:"🧪",reviewer:"👁️"})[e]||"👤";class DX extends Q.Component{constructor(){super(...arguments);Lt(this,"state",{teams:[],currentTeam:null,characters:[],memberRequests:{},messageAnimations:[],selectedCharacter:null,containerSize:{width:window.innerWidth,height:window.innerHeight-100},loading:!0,error:null,teamStats:null,memberGroups:[],teamMessages:[]});Lt(this,"containerRef",Q.createRef());Lt(this,"resizeObserver",null);Lt(this,"_lastNotifiedMemberRequests",null);Lt(this,"_loadedTeamId",null);Lt(this,"refreshTeamStats",async n=>{if(console.log("[refreshTeamStats] Called with team:",(n==null?void 0:n.id)||(n==null?void 0:n.name)),console.trace("[refreshTeamStats] Stack trace"),!n||!n.id){console.log("[refreshTeamStats] Skipping - invalid team:",n);return}try{const r=await fetch(`/api/teams/${n.id}/stats`);if(r.ok){const o=await r.json();this.setState({teamStats:o});const i=n.id||n.name,{onTeamDataChange:l}=this.props;l&&l(i,{stats:o})}}catch(r){console.error("Failed to refresh team stats:",r)}});Lt(this,"refreshTeamMessages",async n=>{try{const r=await fetch(`/api/teams/${n.id}/inbox`);if(r.ok){const i=(await r.json()).messages||[];this.setState(u=>({characters:u.characters.map(m=>{const g=i.filter(h=>h._member===m.name);return{...m,messages:g}}),teamMessages:i}));const l=n.id||n.name,{onTeamDataChange:c}=this.props;c&&c(l,{inbox:i})}}catch(r){console.error("Failed to refresh team messages:",r)}});Lt(this,"loadTeams",async()=>{try{const o=(await(await fetch("/api/teams")).json()).teams||[];this.setState({teams:o,loading:!1},()=>{if(this.props.selectedTeam){const i=this.props.selectedTeam.id||this.props.selectedTeam.name,l=o.find(c=>c.id===i||c.name===i);l&&this.selectTeamWithoutNavigation(l)}})}catch(n){console.error("Failed to load teams:",n),this.setState({loading:!1,error:n.message})}});Lt(this,"handleSessionSelect",n=>{console.log("[handleSessionSelect] Called, session:",n)});Lt(this,"handleSelectTeam",async n=>{const r=n.id||n.name;console.log("[handleSelectTeam] Called, teamId:",r,"_loadedTeamId:",this._loadedTeamId);const{teamData:o,onTeamDataChange:i}=this.props,l=o==null?void 0:o[r];if((l==null?void 0:l.stats)&&(l==null?void 0:l.inbox)!==void 0){console.log("[handleSelectTeam] Using cached data from global state:",l),this._loadedTeamId=r,this.setState({currentTeam:n,teamStats:l.stats,teamMessages:l.inbox||[]},()=>{this.initializeCharacters(),window.location.hash=`/monitor?team=${encodeURIComponent(r)}`});return}if(this._loadedTeamId===r){console.log("[handleSelectTeam] Team already loaded (component level), skipping API requests"),this.setState({currentTeam:n},()=>{this.initializeCharacters(),window.location.hash=`/monitor?team=${encodeURIComponent(r)}`});return}console.log("[handleSelectTeam] First load, fetching stats and inbox...");let u=null;try{const m=await fetch(`/api/teams/${n.id}/stats`);m.ok&&(u=await m.json())}catch(m){console.error("Failed to load team stats:",m)}let f=[];try{const m=await fetch(`/api/teams/${n.id}/inbox`);m.ok&&(f=(await m.json()).messages||[])}catch(m){console.error("Failed to load team inbox:",m)}this._loadedTeamId=r,i&&(u||f)&&i(r,{stats:u,inbox:f}),this.setState({currentTeam:n,teamStats:u,teamMessages:f},()=>{this.initializeCharacters(),window.location.hash=`/monitor?team=${encodeURIComponent(r)}`})});Lt(this,"selectTeamWithoutNavigation",async n=>{const r=n.id||n.name,{teamData:o,onTeamDataChange:i}=this.props,l=o==null?void 0:o[r];if((l==null?void 0:l.stats)&&(l==null?void 0:l.inbox)!==void 0){console.log("[selectTeamWithoutNavigation] Using cached data from global state:",l),this._loadedTeamId=r,this.setState({currentTeam:n,teamStats:l.stats,teamMessages:l.inbox||[]},()=>{this.initializeCharacters()});return}if(this._loadedTeamId===r){console.log("[selectTeamWithoutNavigation] Team already loaded (component level), skipping API requests"),this.setState({currentTeam:n},()=>{this.initializeCharacters()});return}console.log("[selectTeamWithoutNavigation] First load, fetching stats and inbox...");let u=null;try{const m=await fetch(`/api/teams/${n.id}/stats`);m.ok&&(u=await m.json())}catch(m){console.error("Failed to load team stats:",m)}let f=[];try{const m=await fetch(`/api/teams/${n.id}/inbox`);m.ok&&(f=(await m.json()).messages||[])}catch(m){console.error("Failed to load team inbox:",m)}this._loadedTeamId=r,i&&(u||f)&&i(r,{stats:u,inbox:f}),this.setState({currentTeam:n,teamStats:u,teamMessages:f},()=>{this.initializeCharacters()})});Lt(this,"handleBackToSelector",()=>{this.setState({currentTeam:null,characters:[],memberGroups:[],teamStats:null}),window.location.hash="/team"});Lt(this,"handleResize",()=>{if(this.containerRef.current){const{width:n,height:r}=this.containerRef.current.getBoundingClientRect();this.setState({containerSize:{width:n,height:r}}),this.updateCharacterPositions(n,r)}});Lt(this,"handleWindowResize",()=>{this.handleResize()});Lt(this,"handleSelectCharacter",n=>{this.setState(r=>({selectedCharacter:{...n,messages:n.messages.map(o=>({...o,read:!0}))},characters:r.characters.map(o=>o.id===n.id?{...o,messages:o.messages.map(i=>({...i,read:!0}))}:o)}))});Lt(this,"handleCloseDetail",()=>{this.setState({selectedCharacter:null})});Lt(this,"handleViewNetworkRequests",n=>{var i,l;const r=new URLSearchParams;((i=this.state.currentTeam)!=null&&i.id||(l=this.state.currentTeam)!=null&&l.name)&&r.set("team",this.state.currentTeam.id||this.state.currentTeam.name),n!=null&&n.name&&r.set("member",n.name);const o=r.toString();window.location.hash="/raw"+(o?"?"+o:"")});Lt(this,"handleViewConversation",n=>{var i,l;const r=new URLSearchParams;((i=this.state.currentTeam)!=null&&i.id||(l=this.state.currentTeam)!=null&&l.name)&&r.set("team",this.state.currentTeam.id||this.state.currentTeam.name),n!=null&&n.name&&r.set("member",n.name);const o=r.toString();window.location.hash="/chat"+(o?"?"+o:"")});Lt(this,"handleBackToTeam",()=>{this.setState({selectedCharacter:null});const n=this.state.currentTeam,r=(n==null?void 0:n.id)||(n==null?void 0:n.name);window.location.hash=r?`/monitor?team=${encodeURIComponent(r)}`:"/monitor"});Lt(this,"handleAnimationComplete",n=>{this.setState(r=>({messageAnimations:r.messageAnimations.filter(o=>o.id!==n)}))})}componentDidMount(){this.state.teams.length>0?this.loadTeams():this.loadTeams(),this.containerRef.current&&(this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.containerRef.current)),window.addEventListener("resize",this.handleWindowResize)}componentWillUnmount(){this.resizeObserver&&this.containerRef.current&&this.resizeObserver.unobserve(this.containerRef.current),window.removeEventListener("resize",this.handleWindowResize)}getMemberPrefixes(n){const r=[n],o=[/-[a-z\d]+$/i,/-[a-z]+-\d+$/i,/-[a-z]+[A-Z].*$/i];for(const i of o){const l=n.replace(i,"");l&&l!==n&&!r.includes(l)&&r.push(l)}return r}groupMembersByPrefix(n){const r=n.find(u=>u.name==="team-lead"||u.agentType==="team-lead"),i=n.filter(u=>u.name!=="team-lead"&&u.agentType!=="team-lead").map(u=>({member:u,prefixes:this.getMemberPrefixes(u.name)})),l={};i.forEach(({prefixes:u})=>{u.forEach(f=>{l[f]=(l[f]||0)+1})});const c={};return i.forEach(({member:u,prefixes:f})=>{let m=u.name;for(const g of f)if(l[g]>1){m=g;break}c[m]||(c[m]=[]),c[m].push(u)}),{teamLead:r,groups:c}}initializeCharacters(){var E;let n,r;if(this.containerRef.current){const w=this.containerRef.current.getBoundingClientRect();n=w.width,r=w.height}else({width:n,height:r}=this.state.containerSize);const{currentTeam:o,teamMessages:i}=this.state;if(console.log("=== initializeCharacters START ==="),console.log("currentTeam:",o),console.log("containerSize:",{width:n,height:r}),!o||!o.members||o.members.length===0){console.log("No currentTeam or members, returning");return}const l=n/2,c=r/2,{teamLead:u,groups:f}=this.groupMembersByPrefix(o.members),m=Object.keys(f).sort(),g=m.length;console.log("=== Team Layout Debug ==="),console.log("teamLead:",u==null?void 0:u.name),console.log("groups:",f),console.log("groupNames:",m),console.log("groupCount:",g),console.log("centerX:",l,"centerY:",c);const h=[],v=[];if(u){console.log("Adding team-lead (Sun)...");const w=(E=o.memberList)==null?void 0:E.find(O=>O.name===u.name),_=(w==null?void 0:w.unread)||0,R=i.filter(O=>O._member===u.name),N={id:u.agentId,name:u.name,type:"team-lead",color:zX("team-lead"),x:l-50,y:c-50,status:_>0?"active":"idle",mood:"idle",messages:R,avatar:FS(u.agentType),unreadCount:_};v.push(N),console.log("Added team-lead (Sun):",N)}const b=Math.min(n,r),x=Math.max(b*.32,220);m.forEach((w,_)=>{const R=f[w],N=R.length,I=2*Math.PI/g*_-Math.PI/2,P=l+x*Math.cos(I),M=c+x*Math.sin(I);console.log(`
|
|
448
|
+
Group "${w}" (Planet #${_}):`),console.log(" Orbit position:",{x:P.toFixed(0),y:M.toFixed(0),angle:I.toFixed(2)}),console.log(" Members:",R.map(V=>V.name));let k=[];const A=Math.max(100,N*40);if(N>1){const V=2*Math.PI/N;R.forEach((H,W)=>{const z=W*V-Math.PI/2,K=P+A*Math.cos(z),G=M+A*Math.sin(z);k.push({x:K,y:G})})}else k.push({x:P,y:M});const j=[{primary:"#00fff7",secondary:"#00a8ff",name:"CYAN"},{primary:"#bf00ff",secondary:"#ff00ff",name:"PURPLE"},{primary:"#00ff88",secondary:"#00a8ff",name:"GREEN"},{primary:"#ff6600",secondary:"#ff00ff",name:"ORANGE"}],D=j[_%j.length],L=280;h.push({name:w,x:P,y:M,width:L,height:L,color:D,memberCount:N,orbitRadius:A}),R.forEach((V,H)=>{var U;const W=(U=o.memberList)==null?void 0:U.find(q=>q.name===V.name),z=(W==null?void 0:W.unread)||0,K=i.filter(q=>q._member===V.name),G=k[H],B={id:V.agentId,name:V.name,type:V.agentType||"subagent",color:D.primary,x:G.x,y:G.y,status:z>0?"active":"idle",mood:"idle",messages:K,avatar:FS(V.agentType),unreadCount:z};v.push(B)})});const S={teamLead:(u==null?void 0:u.name)||"none",groups:m,groupCount:g,characters:v.map(w=>({name:w.name,x:w.x,y:w.y,type:w.type})),memberGroups:h};window.__TEAM_DEBUG__=S,console.log("Debug info stored in window.__TEAM_DEBUG__"),console.log("=== initializeCharacters END ==="),this.setState({characters:v,memberGroups:h})}updateCharacterPositions(n,r){if(!n||!r)return;const{currentTeam:o,containerSize:i}=this.state;if(!o||!o.members||o.members.length===0||i&&i.width===n&&i.height===r)return;const l=n/2,c=r/2,{teamLead:u,groups:f}=this.groupMembersByPrefix(o.members),m=Object.keys(f).sort(),g=m.length,h=[],v=[],b=Math.min(n,r),x=Math.max(b*.22,150);if(u){const S=this.state.characters.find(E=>E.type==="team-lead");S&&h.push({...S,x:l-50,y:c-50})}m.forEach((S,E)=>{const w=f[S],_=w.length,N=2*Math.PI/g*E-Math.PI/2,O=l+x*Math.cos(N),I=c+x*Math.sin(N);let P=[];const M=85;if(_>1){const D=2*Math.PI/_;w.forEach((L,V)=>{const H=V*D-Math.PI/2,W=O+M*Math.cos(H),z=I+M*Math.sin(H);P.push({x:W,y:z})})}else P.push({x:O,y:I});const k=[{primary:"#00fff7",secondary:"#00a8ff",name:"CYAN"},{primary:"#bf00ff",secondary:"#ff00ff",name:"PURPLE"},{primary:"#00ff88",secondary:"#00a8ff",name:"GREEN"},{primary:"#ff6600",secondary:"#ff00ff",name:"ORANGE"}],A=k[E%k.length],j=280;v.push({name:S,x:O,y:I,width:j,height:j,color:A,memberCount:_,orbitRadius:M}),w.forEach(D=>{const L=this.state.characters.find(V=>V.name===D.name);if(L){const V=w.findIndex(H=>H.name===D.name);h.push({...L,x:P[V].x,y:P[V].y})}})}),this.setState({characters:h,memberGroups:v,containerSize:{width:n,height:r}})}componentDidUpdate(n,r){var o,i;if(this.props.selectedTeam&&this.props.selectedTeam!==n.selectedTeam){const l=this.props.selectedTeam;if(!this.state.currentTeam||this.state.currentTeam.id!==l.id){const c=this.state.teams.find(u=>u.id===l.id||u.name===l.id);c&&this.selectTeamWithoutNavigation(c)}}if(n.requests!==this.props.requests){this.updateCharactersFromRequests(),this.checkForNewMessages(n.requests,this.props.requests);const l=((o=n.requests)==null?void 0:o.length)||0,c=((i=this.props.requests)==null?void 0:i.length)||0,u=l>0&&c>l;this.state.currentTeam&&this.state.currentTeam.id&&u&&this.refreshTeamStats(this.state.currentTeam)}this.props.viewMode==="monitor"&&this.state.characters.length>0&&r.characters.length===0&&this.updateCharactersFromRequests(),this.props.viewMode==="monitor"&&n.viewMode!=="monitor"&&(this.state.currentTeam&&this.state.characters.length===0?this.initializeCharacters():this.updateCharactersFromRequests())}updateCharactersFromRequests(){const{requests:n,onMemberRequestsChange:r}=this.props;this.setState(o=>{const i={};o.characters.forEach(f=>{const m=f.name.toLowerCase(),g=n.filter(h=>{var S,E,w,_,R,N;if(f.type==="team-lead"){const O=h.teamMember||"";return!O||O===""||O.toLowerCase()===m||((E=(S=h.body)==null?void 0:S.metadata)==null?void 0:E.agent_id)===f.id}if((h.teamMember||"").split("@")[0].toLowerCase()===m||((_=(w=h.body)==null?void 0:w.metadata)==null?void 0:_.agent_id)===f.id)return!0;const x=(R=h.body)!=null&&R.system&&typeof((N=h.body)==null?void 0:N.system)=="string"?h.body.system.toLowerCase():"";return!!(x.includes(m)&&x.includes("teammate"))});i[f.name]=g});const l=o.characters.map(f=>{var R,N,O,I;const m=i[f.name]||[];let g=null;for(let P=m.length-1;P>=0;P--){const M=m[P];if((R=M.response)!=null&&R.body&&typeof M.response.body=="object"){g=M;break}}let h=null;const v=(N=g==null?void 0:g.response)==null?void 0:N.body;if(v&&typeof v=="object"&&v.usage){const P=v.usage,M=P.input_tokens||0,k=P.cache_read_input_tokens||0,A=P.cache_creation_input_tokens||0,j=M+k+A,D=2e5;let L=0;j>0&&(L=Math.round(j/D*100)),h={inputTokens:M,cacheRead:k,cacheCreate:A,totalInput:j,contextPercent:L}}let b=null;for(let P=m.length-1;P>=0;P--){const M=m[P];if((O=M.response)!=null&&O.body&&M.timestamp){b=new Date(M.timestamp).getTime();break}}const x=b&&Date.now()-b<1e4;let S="idle";x&&(S="working"),m.some(P=>{var M,k;return(k=(M=P.response)==null?void 0:M.body)==null?void 0:k.error})&&(S="error");const E=x?"active":"idle",w=((I=f.contextInfo)==null?void 0:I.contextPercent)??null,_=(h==null?void 0:h.contextPercent)??null;return f.status===E&&f.mood===S&&w===_?f:{...f,status:E,mood:S,contextInfo:h}}),c=l.some((f,m)=>f!==o.characters[m]),u=Object.keys(i).some(f=>JSON.stringify(i[f])!==JSON.stringify(o.memberRequests[f]||[]));if(!c&&!u)return null;if(r&&typeof r=="function"){const f=JSON.stringify(i),m=this._lastNotifiedMemberRequests?JSON.stringify(this._lastNotifiedMemberRequests):null;f!==m&&(this._lastNotifiedMemberRequests=i,console.log("[TeamView] Notifying memberRequests:",Object.keys(i),Object.entries(i).map(([g,h])=>`${g}: ${h.length}`).join(", ")),r(i))}return{characters:l,memberRequests:i}})}checkForNewMessages(n,r){if(!n||n.length===0)return;r.slice(n.length).forEach(i=>{this.triggerMessageAnimation(i)})}triggerMessageAnimation(n){const{characters:r}=this.state,o=r.find(l=>{var u,f,m;return(((u=n.url)==null?void 0:u.toLowerCase())||"").includes(l.name.toLowerCase())||((m=(f=n.body)==null?void 0:f.metadata)==null?void 0:m.agent_id)===l.id}),i=r.find(l=>l.type==="team-lead")||r[0];if(o&&i&&o.id!==i.id){const l={id:Date.now()+Math.random(),from:{x:o.x+50,y:o.y+50},to:{x:i.x+50,y:i.y+50}};this.setState(c=>({messageAnimations:[...c.messageAnimations,l]})),this.setState(c=>({characters:c.characters.map(u=>u.id===i.id?{...u,mood:"working"}:u)})),setTimeout(()=>{this.setState(c=>({characters:c.characters.map(u=>u.id===i.id?{...u,mood:"idle"}:u)}))},1500)}}render(){const{characters:n,messageAnimations:r,selectedCharacter:o,loading:i,error:l,currentTeam:c,teams:u,teamStats:f,memberGroups:m}=this.state,{requests:g,viewMode:h,teamData:v,onTeamDataChange:b}=this.props;return i?C.jsx("div",{className:kt.container,ref:this.containerRef,children:C.jsxs("div",{className:kt.loadingState,children:[C.jsx("div",{className:kt.spinner}),C.jsx("p",{children:"加载团队配置中..."})]})}):h==="team"?C.jsxs("div",{className:kt.container,ref:this.containerRef,children:[C.jsx(eX,{projectId:this.props.projectName,onSelectSession:this.handleSessionSelect}),C.jsxs("div",{className:kt.teamSelector,children:[C.jsxs("div",{className:kt.selectorTitle,children:[C.jsx("span",{className:kt.teamIcon,children:"👥"}),"选择要观察的团队"]}),C.jsx("div",{className:kt.teamList,children:u.length===0?C.jsxs("div",{className:kt.emptyState,children:[C.jsx("div",{className:kt.emptyIcon,children:"📭"}),C.jsx("h3",{children:"暂无可用团队"}),C.jsx("p",{children:"请先创建团队,在 claude code 中显式声明需要他创建团队并添加成员"}),C.jsx("div",{className:kt.hint,children:"团队配置存储在 ~/.claude/teams/"})]}):u.map(x=>{var S;return C.jsxs("div",{className:kt.teamCard,onClick:()=>this.handleSelectTeam(x),children:[C.jsxs("div",{className:kt.teamCardName,children:[C.jsx("span",{className:kt.teamCardIcon,children:"👥"}),x.name,x.isActive&&C.jsx("span",{className:kt.activeBadge,children:"活跃中"})]}),C.jsx("div",{className:kt.teamCardInfo,children:x.description||"暂无描述"}),C.jsxs("div",{className:kt.teamCardMeta,children:[((S=x.members)==null?void 0:S.length)||0," 成员",x.createdAt&&C.jsxs("span",{className:kt.createdAt,children:["创建于 ",new Date(x.createdAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})]})]})]},x.id||x.name)})})]})]}):l?C.jsx("div",{className:kt.container,ref:this.containerRef,children:C.jsxs("div",{className:kt.emptyState,children:[C.jsx("div",{className:kt.emptyIcon,children:"👥"}),C.jsx("h3",{children:"暂无团队配置"}),C.jsx("p",{children:"请先创建团队并添加成员"}),l&&C.jsxs("p",{className:kt.errorText,children:["错误: ",l]}),C.jsx("div",{className:kt.hint,children:"团队配置存储在 ~/.claude/teams/"}),c&&c.members&&c.members.length===0&&C.jsxs("p",{className:kt.emptyDetail,children:['团队 "',c.name,'" 暂无成员,请添加成员后刷新']})]})}):h==="monitor"&&n.length===0?C.jsx("div",{className:kt.container,ref:this.containerRef,children:C.jsxs("div",{className:kt.loadingState,children:[C.jsx("div",{className:kt.spinner}),C.jsx("p",{children:"加载团队数据中..."})]})}):C.jsxs("div",{className:kt.container,ref:this.containerRef,children:[C.jsx("div",{className:kt.backButton,onClick:this.handleBackToSelector,children:"← 返回团队列表"}),c&&C.jsxs("div",{className:kt.teamName,children:[C.jsx("span",{className:kt.teamIcon,children:"👥"}),c.name,C.jsx("span",{className:kt.teamDivider,children:"|"}),n.length," 成员"]}),C.jsxs("div",{className:kt.background,children:[C.jsx("div",{className:kt.grid}),C.jsx("div",{className:kt.particles,children:Array.from({length:15}).map((x,S)=>C.jsx("div",{className:kt.backgroundParticle,style:{left:`${Math.random()*100}%`,top:`${Math.random()*100}%`,animationDelay:`${Math.random()*5}s`,animationDuration:`${5+Math.random()*5}s`}},S))})]}),C.jsx("div",{className:kt.grass}),C.jsx("div",{className:kt.decoration1,children:"🌳"}),C.jsx("div",{className:kt.decoration2,children:"🌲"}),C.jsx("div",{className:kt.decoration3,children:"🌻"}),C.jsx("div",{className:kt.decoration4,children:"🪨"}),C.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:1},children:[m.length>0&&C.jsxs(C.Fragment,{children:[C.jsx("div",{className:kt.sunOrbit,style:{width:"75%",height:"75%",maxWidth:"700px",maxHeight:"700px"}}),C.jsx("div",{className:kt.sunOrbitInner,style:{width:"45%",height:"45%",maxWidth:"400px",maxHeight:"400px"}})]}),m.map((x,S)=>{const E=x.color||{primary:"#00fff7",secondary:"#00a8ff"},w=x.orbitRadius||85;return C.jsxs("div",{style:{position:"absolute",left:x.x,top:x.y,transform:"translate(-50%, -50%)",zIndex:5,width:x.width,height:x.height},children:[C.jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:w*2,height:w*2,border:`1px dashed ${E.primary}66`,borderRadius:"50%",opacity:.6,animation:"orbit-pulse 3s ease-in-out infinite"}}),C.jsx("div",{style:{position:"absolute",bottom:"-30px",left:"50%",transform:"translateX(-50%)",background:`linear-gradient(135deg, ${E.primary}22 0%, ${E.secondary}22 100%)`,border:`1px solid ${E.primary}`,borderRadius:"6px",padding:"6px 14px",fontSize:"11px",fontWeight:600,color:E.primary,fontFamily:"Orbitron, monospace",textTransform:"uppercase",letterSpacing:"0.1em",whiteSpace:"nowrap",boxShadow:`0 0 15px ${E.primary}33`,backdropFilter:"blur(10px)",textShadow:`0 0 8px ${E.primary}`},children:x.name})]},S)})]}),C.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:10},children:n.map(x=>C.jsx("div",{style:{position:"absolute",left:x.x,top:x.y,transform:"translate(-50%, -50%)",pointerEvents:"auto",zIndex:x.type==="team-lead"?15:10},children:C.jsx(W_,{character:x,isSelected:(o==null?void 0:o.id)===x.id,onSelect:this.handleSelectCharacter})},x.id))}),r.map(x=>C.jsx(dK,{from:x.from,to:x.to,duration:1200,onComplete:()=>this.handleAnimationComplete(x.id)},x.id)),C.jsx(U_,{character:o,visible:!!o,onClose:this.handleCloseDetail,onViewNetworkRequests:this.handleViewNetworkRequests,onViewConversation:this.handleViewConversation,onBackToTeam:this.handleBackToTeam}),C.jsx("div",{className:kt.hint,children:"点击角色查看详情 · 观察消息流动"}),C.jsxs("div",{className:kt.stats,children:[C.jsxs("div",{className:kt.stat,children:[C.jsx("span",{className:kt.statLabel,children:"成员"}),C.jsx("span",{className:kt.statValue,children:n.length})]}),C.jsx("div",{className:kt.statDivider,children:"|"}),C.jsxs("div",{className:kt.stat,children:[C.jsx("span",{className:kt.statLabel,children:"活跃"}),C.jsx("span",{className:kt.statValue,children:n.filter(x=>x.status==="active").length})]}),C.jsx("div",{className:kt.statDivider,children:"|"}),C.jsxs("div",{className:kt.stat,children:[C.jsx("span",{className:kt.statLabel,children:"消息"}),C.jsx("span",{className:kt.statValue,children:(f==null?void 0:f.messageCount)??0})]}),C.jsx("div",{className:kt.statDivider,children:"|"}),C.jsxs("div",{className:kt.stat,children:[C.jsx("span",{className:kt.statLabel,children:"请求"}),C.jsx("span",{className:kt.statValue,children:g.length})]})]})]})}}function FX({requests:e,projectName:t,selectedTeam:n,viewMode:r,onMemberRequestsChange:o,teamData:i,onTeamDataChange:l}){return C.jsx("div",{style:{display:"flex",height:"100%"},children:C.jsx(d.Suspense,{fallback:C.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"#999"},children:"加载中..."}),children:C.jsx(DX,{requests:e,projectName:t,selectedTeam:n,viewMode:r,onMemberRequestsChange:o,teamData:i,onTeamDataChange:l})})})}const HX="_container_8225t_5",VX="_header_8225t_31",WX="_backButton_8225t_56",UX="_title_8225t_77",GX="_sessionId_8225t_87",qX="_charactersArea_8225t_97",KX="_orbitRing_8225t_109",XX="_orbitRingInner_8225t_121",YX="_emptyState_8225t_157",QX="_emptyIcon_8225t_168",ca={container:HX,header:VX,backButton:WX,title:UX,sessionId:GX,charactersArea:qX,orbitRing:KX,orbitRingInner:XX,emptyState:YX,emptyIcon:QX},HS=["#fbbf24","#00fff7","#00ff88","#ff6600","#bf00ff","#ff00ff","#00a8ff","#f59e0b"];function ZX({sessionId:e,projectName:t,requests:n}){const r=d.useRef(null),[o,i]=d.useState(null),[l,c]=d.useState([]),[u,f]=d.useState({}),[m,g]=d.useState(null),[h,v]=d.useState(n||[]);Zv({session:e,onLogUpdate:w=>{console.log("[SessionView] Received log update:",w.length),v(_=>{const R=new Map;return _.forEach(N=>{const O=`${N.timestamp}|${N.url}`;R.set(O,N)}),w.forEach(N=>{const O=`${N.timestamp}|${N.url}`;R.set(O,N)}),Array.from(R.values())})},onFullReload:w=>{console.log("[SessionView] Full reload:",w.length),v(w)}});const b=d.useRef(new Map),x=d.useMemo(()=>{const w=new Map,_=h||[];console.log("[SessionView] Building characterMap from requests:",_.length),_.forEach(I=>{var M,k;if(!((M=I.response)!=null&&M.body))return;const P=I.mainAgent&&!I.agentName&&!Hd(I);if(console.log("[SessionView] Request:",(k=I.url)==null?void 0:k.slice(0,50),"mainAgent:",P,"agentName:",I.agentName),P)w.has("mainagent")||w.set("mainagent",{id:"mainagent",name:"MainAgent",type:"mainagent",color:"#fbbf24",avatar:"⬡",requests:[],status:"idle",contextInfo:null,messages:[]}),w.get("mainagent").requests.push(I);else{const A=I.agentName||Hd(I);if(A){const j=A;w.has(j)||w.set(j,{id:j,name:A,type:"agent",color:HS[w.size%HS.length],avatar:"◈",requests:[],status:"idle",contextInfo:null,messages:[]}),w.get(j).requests.push(I)}}});const R=2e5,N=Date.now(),O=300*1e3;return w.forEach((I,P)=>{var L,V;const M=I.requests||[];let k=null;for(let H=M.length-1;H>=0;H--){const W=M[H];if((L=W.response)!=null&&L.body&&typeof W.response.body=="object"){k=W;break}}let A=null;const j=(V=k==null?void 0:k.response)==null?void 0:V.body;if(j&&typeof j=="object"&&j.usage){const H=j.usage,W=H.input_tokens||0,z=H.cache_read_input_tokens||0,K=H.cache_creation_input_tokens||0,G=W+z+K;let B=0;G>0&&(B=Math.round(G/R*100)),A={inputTokens:W,cacheRead:z,cacheCreate:K,totalInput:G,contextPercent:B}}I.contextInfo=A;const D=M.length>0&&M.some(H=>{const W=new Date(H.timestamp).getTime();return N-W<O});I.status=D?"active":"idle",I.messages=M.map(H=>{var W;return{from:"system",text:`[${H.method}] ${(W=H.url)==null?void 0:W.slice(0,50)}...`,timestamp:H.timestamp,read:!0}})}),b.current=w,console.log("[SessionView] characterMap built, size:",w.size),w},[h]);d.useEffect(()=>{if(x.size>0){const w=Array.from(x.values()).sort((_,R)=>_.type==="mainagent"?-1:R.type==="mainagent"?1:0);console.log("[SessionView] Built characters from requests:",w.length),c(w)}},[x]),d.useEffect(()=>{if(!r.current||l.length===0)return;const w=()=>{const R=r.current.getBoundingClientRect(),N=R.width/2,O=R.height/2,I=l.find(A=>A.type==="mainagent"),P=l.filter(A=>A.type!=="mainagent"),M=P.length,k={};if(I&&(k[I.id]={x:N,y:O}),M>0){const A=Math.min(N,O)*.45,j=Math.max(0,(M-3)*30),L=Math.max(A,180)+j,V=2*Math.PI/M;P.forEach((H,W)=>{const z=V*W-Math.PI/2,K=N+L*Math.cos(z),G=O+L*Math.sin(z);k[H.id]={x:K,y:G}})}f(k)};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[l]),d.useEffect(()=>{S()},[e]);const S=async()=>{try{const w=await fetch(`/api/sessions/${e}/info`);if(w.ok){const _=await w.json();console.log("[SessionView] Session info loaded:",_),i(_)}else console.error("[SessionView] Failed to load session info:",w.status)}catch(w){console.error("[SessionView] Failed to load session info:",w)}},E=w=>{console.log("[SessionView] Character selected:",w);const _=b.current.get(w.id);console.log("[SessionView] charData:",_),g(_?{...w,..._,messages:w.messages||[]}:w)};return C.jsxs("div",{className:ca.container,children:[C.jsxs("div",{className:ca.header,children:[C.jsx("button",{className:ca.backButton,onClick:()=>window.location.hash="/team",children:"← 返回"}),C.jsxs("h2",{className:ca.title,children:["Session: ",C.jsx("span",{className:ca.sessionId,children:e})]})]}),C.jsxs("div",{className:ca.charactersArea,ref:r,children:[l.length>1&&C.jsxs(C.Fragment,{children:[C.jsx("div",{className:ca.orbitRing,style:{width:"90%",height:"90%",maxWidth:"700px",maxHeight:"700px"}}),C.jsx("div",{className:ca.orbitRingInner,style:{width:"60%",height:"60%",maxWidth:"450px",maxHeight:"450px"}})]}),l.length===0?C.jsxs("div",{className:ca.emptyState,children:[C.jsx("div",{className:ca.emptyIcon,children:"◌"}),C.jsx("h3",{children:"NO DATA"}),C.jsx("p",{children:"Waiting for request stream..."})]}):l.map(w=>{const _=u[w.id];return C.jsx("div",{style:{position:"absolute",left:_?_.x:"50%",top:_?_.y:"50%",transform:"translate(-50%, -50%)",zIndex:w.type==="mainagent"?10:5},children:C.jsx(W_,{character:w,isSelected:(m==null?void 0:m.id)===w.id,onSelect:E})},w.id)})]}),m&&C.jsx(U_,{character:m,visible:!!m,sessionMode:!0,sessionId:e,onClose:()=>g(null)})]})}function JX({requests:e,projectName:t,selectedSession:n,viewMode:r}){const i=new URLSearchParams(window.location.hash.split("?")[1]).get("session");return console.log("[SessionViewPage] Rendering with sessionId:",i,"selectedSession:",n),i?C.jsx("div",{style:{display:"flex",height:"100%"},children:C.jsx(d.Suspense,{fallback:C.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"#999"},children:"加载中..."}),children:C.jsx(ZX,{sessionId:i,projectName:t,requests:e})})}):C.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh",color:"#999"},children:C.jsxs("div",{children:[C.jsx("h2",{children:"No session specified"}),C.jsx("p",{children:"Please provide a session ID in the URL"})]})})}function eY(){const e=parseInt(localStorage.getItem("ccv_cacheExpireAt"),10)||null,t=localStorage.getItem("ccv_cacheType")||null,n=Date.now(),r=e&&e>n?e:null;return{cacheExpireAt:r,cacheType:r?t:null}}function tY(e,t){return t?t.toLowerCase()==="mainagent"?e.mainAgent===!0:e.agentName===t:!0}const nY="_layout_1krbo_4",rY="_header_1krbo_10",oY="_content_1krbo_31",aY="_loadingOverlay_1krbo_178",iY="_loadingText_1krbo_192",Ul={layout:nY,header:rY,content:oY,loadingOverlay:aY,loadingText:iY};function sY(e,t){const[n,r]=d.useState(0),o=d.useRef(null);return d.useEffect(()=>{if(!e){r(0),o.current&&cancelAnimationFrame(o.current);return}const i=performance.now(),l=Math.min(800,Math.max(300,t*10)),c=()=>{const u=performance.now(),f=Math.min((u-i)/l,1);r(Math.round(f*t)),f<1&&(o.current=requestAnimationFrame(c))};return o.current=requestAnimationFrame(c),()=>{o.current&&cancelAnimationFrame(o.current)}},[e,t]),n}function lY(){const[e,t]=d.useState([]),[n,r]=d.useState(null),[o,i]=d.useState("team"),[l,c]=d.useState("request"),[u,f]=d.useState(380),[m,g]=d.useState(!1),[h,v]=d.useState(null),[b,x]=d.useState(""),[S,E]=d.useState(!0),[w,_]=d.useState(!0),[R,N]=d.useState(!1),[O,I]=d.useState(!1),[P,M]=d.useState(0),[k,A]=d.useState(!1),[j,D]=d.useState(null),[L,V]=d.useState(null),[H,W]=d.useState(null),[z,K]=d.useState(null),[G,B]=d.useState(!1),[U,q]=d.useState({}),[X,Z]=d.useState({}),{cacheExpireAt:te,cacheType:pe}=eY(),le=sY(O,P),fe=d.useCallback(ae=>{console.log("[handleLogUpdate] 收到新条目:",ae.length),!(!Array.isArray(ae)||ae.length===0)&&t(Ae=>{console.log("[handleLogUpdate] 更新 requests:",Ae.length,"->",Ae.length+ae.length);const Fe=new Map;return Ae.forEach(Je=>{const Ke=`${Je.timestamp}|${Je.url}`;Fe.set(Ke,Je)}),ae.forEach(Je=>{const Ke=`${Je.timestamp}|${Je.url}`;Fe.set(Ke,Je)}),Array.from(Fe.values())})},[]);Zv({team:(j==null?void 0:j.id)||(j==null?void 0:j.name)||null,session:L||null,onFullReload:ae=>{Array.isArray(ae)&&(console.log("[App useSSE] onFullReload:",ae.length,"entries"),t(ae))},onLogUpdate:fe});const we=d.useRef({hasTeam:!1,hasSession:!1});d.useEffect(()=>{const ae=(j==null?void 0:j.id)||(j==null?void 0:j.name),Ae=L,Fe=we.current,Je=Fe.hasTeam,Ke=Fe.hasSession;console.log("[App] Team/Session state change:",{previous:{hasTeam:Je,hasSession:Ke},current:{hasTeam:!!ae,hasSession:!!Ae}}),Ae&&!ae&&Je&&!Ke?(console.log("[App] Switching from TEAM mode to SESSION mode, clearing requests"),t([])):ae&&!Ae&&!Je&&Ke&&(console.log("[App] Switching from SESSION mode to TEAM mode, clearing requests"),t([])),we.current={hasTeam:!!ae,hasSession:!!Ae}},[j,L]),d.useEffect(()=>(fetch("/api/preferences").then(ae=>ae.json()).then(ae=>{ae.collapseToolResults!==void 0&&E(!!ae.collapseToolResults),ae.expandThinking!==void 0&&_(!!ae.expandThinking),ae.expandDiff!==void 0&&N(!!ae.expandDiff);const Ae=ae.filterIrrelevant!==void 0?!!ae.filterIrrelevant:!0;g(!Ae)}).catch(()=>{}),fetch("/api/user-profile").then(ae=>ae.json()).then(ae=>v(ae)).catch(()=>{}),fetch("/api/project-name").then(ae=>ae.json()).then(ae=>{console.log("[App] projectName loaded:",ae.projectName),x(ae.projectName||"")}).catch(()=>{}),fetch("/api/cli-mode").then(ae=>ae.json()).then(ae=>{ae.cliMode&&A(!0)}).catch(()=>{}),ce(),window.addEventListener("hashchange",ce),()=>{window.removeEventListener("hashchange",ce)}),[]);const ce=d.useCallback(()=>{const ae=window.location.hash.slice(1)||"/team",[Ae,Fe]=ae.split("?"),Je=new URLSearchParams(Fe||"");console.log("[App handleHashChange] Processing hash:",ae,"path:",Ae),Ae==="/raw"?i("raw"):Ae==="/chat"?i("chat"):Ae==="/monitor"?i("monitor"):Ae==="/team"?i("team"):Ae==="/session-monitor"&&(console.log("[App handleHashChange] Setting viewMode to session-monitor"),i("session-monitor"));const Ke=Je.get("session");Ke?(console.log("[App handleHashChange] Setting selectedSession:",Ke),V(Ke),D(null)):V(null);const nt=Je.get("agent");W(nt);const dt=Je.get("team");dt&&!Ke?D({id:dt,name:dt}):Ke||D(null);const tt=Je.get("scrollTs");tt&&(K(tt),i("chat"));const ht=Je.get("idx");ht&&r(parseInt(ht,10));const st=Je.get("tab");st&&c(st),Je.get("center")==="true"&&B(!0)},[]),me=d.useCallback(ae=>{r(ae),$e({idx:ae})},[]),be=d.useCallback(ae=>{c(ae),$e({tab:ae})},[]),Se=d.useCallback(ae=>{i("chat"),K(ae),$e({scrollTs:ae})},[]),ge=d.useCallback(ae=>{i("raw"),r(ae),$e({idx:ae})},[]),ie=d.useCallback(ae=>{q(ae)},[]),ve=d.useCallback((ae,Ae)=>{Z(Fe=>({...Fe,[ae]:{...Fe[ae],...Ae,loadedAt:Date.now()}}))},[]),$e=d.useCallback(ae=>{const Ae=window.location.hash.slice(1)||"/team",[Fe,Je]=Ae.split("?"),Ke=new URLSearchParams(Je||"");Object.entries(ae).forEach(([dt,tt])=>{tt==null?Ke.delete(dt):Ke.set(dt,String(tt))});const nt=Ke.toString()?`${Fe}?${Ke.toString()}`:Fe;window.location.hash=nt},[]),Te=bz(e||[]),De=m?e||[]:Te,ke=d.useMemo(()=>{const ae=window.location.hash.slice(1),[,Ae]=ae.split("?");return new URLSearchParams(Ae||"").get("member")||null},[o]),je=d.useMemo(()=>{if(!j||!ke)return e||[];const ae=ke.split("@")[0].toLowerCase(),Ae=ae==="team-lead";return(e||[]).filter(Fe=>{var nt,dt,tt,ht,st,He;if(Ae)return!Hd(Fe);const Je=Hd(Fe);if(Je&&Je.split("@")[0].toLowerCase()===ae||((dt=(nt=Fe.body)==null?void 0:nt.metadata)==null?void 0:dt.agent_id)===ke)return!0;const Ke=(tt=Fe.body)!=null&&tt.system&&typeof((ht=Fe.body)==null?void 0:ht.system)=="string"?Fe.body.system.toLowerCase():Array.isArray((st=Fe.body)==null?void 0:st.system)?(He=Fe.body)==null?void 0:He.system.map(lt=>(lt==null?void 0:lt.text)||"").join("").toLowerCase():"";return!!(Ke.includes(ae)&&Ke.includes("teammate"))})},[j,ke,e]),Pe=d.useMemo(()=>!L||!H?e||[]:(e||[]).filter(ae=>tY(ae,H)),[L,H,e]);return e.length>0&&(Te.length===0||De.length===0)&&console.log("[数据调试] requests:",e.length,"relevantRequests:",Te.length,"filteredRequests:",De.length,"showAll:",m),C.jsxs(ya,{theme:{algorithm:HL.darkAlgorithm,token:{colorBgContainer:"#111",colorBgLayout:"#0a0a0a",colorBgElevated:"#1a1a1a",colorBorder:"#2a2a2a"}},children:[O&&C.jsx("div",{className:Ul.loadingOverlay,children:C.jsxs("div",{className:Ul.loadingText,children:["Loading...(",le,")"]})}),C.jsxs(fi,{className:Ul.layout,children:[C.jsx(fi.Header,{className:Ul.header,children:C.jsx(kh,{requestCount:o==="monitor"||o==="team"?De.length:o==="session-monitor"?Pe.length:je.length,requests:o==="monitor"||o==="team"?De:o==="session-monitor"?Pe:je,viewMode:o,cacheExpireAt:te,cacheType:pe,projectName:b,collapseToolResults:S,onCollapseToolResultsChange:E,expandThinking:w,onExpandThinkingChange:_,expandDiff:R,onExpandDiffChange:N,filterIrrelevant:!m,onFilterIrrelevantChange:ae=>g(!ae),cliMode:k,selectedTeam:j})}),C.jsx(fi.Content,{className:Ul.content,children:C.jsx(cY,{viewMode:o,requests:De,allRequests:e,selectedIndex:n,currentTab:l,scrollCenter:G,chatScrollToTs:z,userProfile:h,collapseToolResults:S,expandThinking:w,expandDiff:R,leftPanelWidth:u,selectedTeam:j,selectedSession:L,currentAgent:H,projectName:b,currentMember:ke,filteredMemberRequests:je,filteredAgentRequests:Pe,onSelectRequest:me,onScrollDone:()=>B(!1),onTabChange:be,onViewInChat:Se,onViewRequest:ge,onResize:f,memberRequests:U,onMemberRequestsChange:ie,teamData:X,onTeamDataChange:ve})})]})]})}function cY(e){var L;console.log("[MainContent] props.requests.length:",(L=e.requests)==null?void 0:L.length);const{viewMode:t,requests:n,allRequests:r,selectedIndex:o,currentTab:i,scrollCenter:l,chatScrollToTs:c,userProfile:u,collapseToolResults:f,expandThinking:m,expandDiff:g,leftPanelWidth:h,selectedTeam:v,selectedSession:b,currentAgent:x,projectName:S,currentMember:E,filteredMemberRequests:w,filteredAgentRequests:_,onSelectRequest:R,onScrollDone:N,onTabChange:O,onViewInChat:I,onViewRequest:P,onResize:M,memberRequests:k,onMemberRequestsChange:A,teamData:j,onTeamDataChange:D}=e;if(t==="raw"){const V=b?_:w;return console.log("[MainContent] raw view:",{selectedSession:b,currentAgent:x,currentMember:E,memberRequestKeys:Object.keys(k),filteredCount:V.length,allRequestsCount:r.length}),C.jsx(KV,{requests:V,selectedIndex:o,currentTab:i,scrollCenter:l,onSelectRequest:R,onScrollDone:N,onTabChange:O,onViewInChat:I,expandDiff:g,leftPanelWidth:h,onResize:M,onBackToTeam:()=>{if(b)window.location.hash=`/session-monitor?session=${encodeURIComponent(b)}`;else{const H=(v==null?void 0:v.id)||(v==null?void 0:v.name);window.location.hash=H?`/monitor?team=${encodeURIComponent(H)}`:"/monitor"}}})}if(t==="chat"){const V=b?_:w;return console.log("[MainContent] chat view:",{selectedSession:b,currentAgent:x,currentMember:E,memberRequestKeys:Object.keys(k),filteredCount:V.length,allRequestsCount:r.length}),C.jsx(kq,{requests:V,userProfile:u,collapseToolResults:f,expandThinking:m,onViewRequest:P,chatScrollToTs:c,onScrollTsDone:()=>{},cliMode:!1,onBackToTeam:()=>{if(b)window.location.hash=`/session-monitor?session=${encodeURIComponent(b)}`;else{const H=(v==null?void 0:v.id)||(v==null?void 0:v.name);window.location.hash=H?`/monitor?team=${encodeURIComponent(H)}`:"/monitor"}}})}return t==="team"||t==="monitor"?C.jsx(FX,{requests:n,projectName:S,selectedTeam:v,viewMode:t,onMemberRequestsChange:A,teamData:j,onTeamDataChange:D}):t==="session-monitor"?C.jsx(JX,{requests:n,projectName:S,selectedSession:b,viewMode:t}):null}const uY=T3.createRoot(document.getElementById("root"));uY.render(C.jsx(lY,{}));
|
package/dist/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>Claude Code Viewer</title>
|
|
7
7
|
<link rel="icon" href="/favicon.ico?v=1">
|
|
8
8
|
<link rel="shortcut icon" href="/favicon.ico?v=1">
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-DA5iEoc6.js"></script>
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-DDdbZDlo.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
package/package.json
CHANGED
package/proxy/interceptor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// LLM Request Interceptor
|
|
2
2
|
// 拦截并记录所有Claude API请求
|
|
3
3
|
import './proxy-env.js';
|
|
4
|
-
import { appendFileSync, mkdirSync, readdirSync, readFileSync, writeFileSync, statSync, renameSync, unlinkSync, existsSync,
|
|
4
|
+
import { appendFileSync, mkdirSync, readdirSync, readFileSync, writeFileSync, statSync, renameSync, unlinkSync, existsSync, watch } from 'node:fs';
|
|
5
5
|
import { homedir } from 'node:os';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import { dirname, join, basename } from 'node:path';
|
|
@@ -72,22 +72,25 @@ function loadTeamConfigs() {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// 监听团队配置目录变化,配置更新时立即刷新缓存
|
|
75
|
-
let
|
|
75
|
+
let teamsDirWatcher = null;
|
|
76
76
|
function setupTeamConfigWatcher() {
|
|
77
|
-
if (
|
|
77
|
+
if (teamsDirWatcher) return; // 已经启动了监听器
|
|
78
78
|
const teamsDir = join(homedir(), '.claude', 'teams');
|
|
79
|
-
if (!existsSync(teamsDir)) return;
|
|
80
79
|
|
|
80
|
+
// 即使目录不存在也创建监听器(后续创建会触发)
|
|
81
81
|
try {
|
|
82
|
-
|
|
83
|
-
//
|
|
84
|
-
if (
|
|
82
|
+
teamsDirWatcher = watch(teamsDir, { recursive: true }, (eventType, filename) => {
|
|
83
|
+
// 监听所有 config.json 文件的变化
|
|
84
|
+
if (filename && filename.endsWith('config.json')) {
|
|
85
|
+
logDebug(`Team config changed: ${filename}, invalidating cache...`);
|
|
85
86
|
teamConfigCache = null;
|
|
86
87
|
teamCacheTime = 0;
|
|
87
88
|
}
|
|
88
89
|
});
|
|
89
|
-
|
|
90
|
-
} catch {
|
|
90
|
+
logInfo('Team config watcher started');
|
|
91
|
+
} catch (err) {
|
|
92
|
+
logError(`Failed to watch teams dir: ${err.message}`);
|
|
93
|
+
}
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
// 启动时设置监听器
|
|
@@ -752,8 +755,17 @@ export function setupInterceptor() {
|
|
|
752
755
|
if (!toolsList.includes('Edit') || !toolsList.includes('Bash')) return false;
|
|
753
756
|
if (!toolsList.includes('Task') && !toolsList.includes('Agent')) return false;
|
|
754
757
|
}
|
|
755
|
-
// 排除 SubAgent
|
|
758
|
+
// 排除 SubAgent
|
|
759
|
+
// 1. 检查内置 specialist/general-agent 模式
|
|
756
760
|
if (/\b(\w+ )?specialist\b|general-purpose agent/i.test(sysText)) return false;
|
|
761
|
+
// 2. 检查自定义 agent(system 数组中包含 "# Agent:" 模式)
|
|
762
|
+
if (Array.isArray(body.system) && body.system.length > 1) {
|
|
763
|
+
// 检查非首个元素是否包含 "# Agent:" 模式(自定义 agent 定义)
|
|
764
|
+
const agentContent = body.system.slice(1).map(s => s?.text || '').join('');
|
|
765
|
+
if (/#\s+Agent:/i.test(agentContent)) return false;
|
|
766
|
+
}
|
|
767
|
+
// 3. 通用 fallback:检测任何 "# Agent:" 模式
|
|
768
|
+
if (/#\s+Agent:/i.test(sysText)) return false;
|
|
757
769
|
return true;
|
|
758
770
|
})();
|
|
759
771
|
|