@cluesmith/codev 3.0.0-rc.4 → 3.0.0-rc.5
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.
|
@@ -122,7 +122,7 @@ void main() {
|
|
|
122
122
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
123
123
|
* http://bellard.org/jslinux/
|
|
124
124
|
* Copyright (c) 2011 Fabrice Bellard
|
|
125
|
-
*/var aR=class{constructor(e,t,r,i={}){this._terminal=e,this._regex=t,this._handler=r,this._options=i}provideLinks(e,t){let r=lR.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(r,i)=>{if(this._options.hover){let{range:o}=t;this._options.hover(r,i,o)}},t))}};function oR(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var lR=class Su{static computeLink(t,r,i,o){let h=new RegExp(r.source,(r.flags||"")+"g"),[g,a]=Su._getWindowedLineStrings(t-1,i),c=g.join(""),f,v=[];for(;f=h.exec(c);){let u=f[0];if(!oR(u))continue;let[m,w]=Su._mapStrIdx(i,a,0,f.index),[C,_]=Su._mapStrIdx(i,m,w,u.length);if(m===-1||w===-1||C===-1||_===-1)continue;let d={start:{x:w+1,y:m+1},end:{x:_,y:C+1}};v.push({range:d,text:u,activate:o})}return v}static _getWindowedLineStrings(t,r){let i,o=t,h=t,g=0,a="",c=[];if(i=r.buffer.active.getLine(t)){let f=i.translateToString(!0);if(i.isWrapped&&f[0]!==" "){for(g=0;(i=r.buffer.active.getLine(--o))&&g<2048&&(a=i.translateToString(!0),g+=a.length,c.push(a),!(!i.isWrapped||a.indexOf(" ")!==-1)););c.reverse()}for(c.push(f),g=0;(i=r.buffer.active.getLine(++h))&&i.isWrapped&&g<2048&&(a=i.translateToString(!0),g+=a.length,c.push(a),a.indexOf(" ")===-1););}return[c,o]}static _mapStrIdx(t,r,i,o){let h=t.buffer.active,g=h.getNullCell(),a=i;for(;o;){let c=h.getLine(r);if(!c)return[-1,-1];for(let f=a;f<c.length;++f){c.getCell(f,g);let v=g.getChars();if(g.getWidth()&&(o-=v.length||1,f===c.length-1&&v==="")){let u=h.getLine(r+1);u&&u.isWrapped&&(u.getCell(0,g),g.getWidth()===2&&(o+=1))}if(o<0)return[r,f]}r++,a=0}return[r,a]}},cR=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function uR(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var hR=class{constructor(e=uR,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||cR;this._linkProvider=this._terminal.registerLinkProvider(new aR(this._terminal,r,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const Ou=new RegExp("(?<![a-zA-Z]:\\/\\/)(?:^|[\\s\"'`(\\[{])([./]?[\\w./-]+\\.[a-zA-Z]{1,10})(?::(\\d+)(?::(\\d+))?|\\((\\d+),(\\d+)\\))?","g");function c2(e){return!(!/\.[a-zA-Z]{1,10}(?::\d+(?::\d+)?|\(\d+,\d+\))?$/.test(e)||/^https?:\/\//i.test(e)||/^[a-z0-9-]+\.(com|org|net|io|dev|app|co)$/i.test(e))}const fR=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC");class dR{constructor(t,r,i,o){this.terminal=t,this.onFileOpen=r,this.terminalId=i,this.decorationManager=o}provideLinks(t,r){const i=this.terminal.buffer.active.getLine(t-1);if(!i){r(void 0);return}const o=i.translateToString(),h=new RegExp(Ou.source,Ou.flags),g=[];let a;for(;(a=h.exec(o))!==null;){const c=a[1];if(!c||!c2(c))continue;const f=a[2]?parseInt(a[2],10):a[4]?parseInt(a[4],10):void 0,v=a[3]?parseInt(a[3],10):a[5]?parseInt(a[5],10):void 0,u=a[0],m=u.indexOf(c),w=a.index+m,C=a.index+u.length,_=w,d=t-1;g.push({range:{start:{x:w+1,y:t},end:{x:C,y:t}},text:u.substring(m),decorations:{pointerCursor:!0,underline:!0},activate:(y,b)=>{(fR?!y.metaKey:!y.ctrlKey)||this.onFileOpen(c,f,v,this.terminalId)},hover:()=>{var y;(y=this.decorationManager)==null||y.highlightAt(d,_)},leave:()=>{var y;(y=this.decorationManager)==null||y.unhighlightAll()}})}r(g.length>0?g:void 0)}}class vR{constructor(t){$t(this,"disposables",[]);$t(this,"entries",[]);$t(this,"lastScannedLine",-1);this.terminal=t,this.disposables.push(t.onWriteParsed(()=>this.scanNewLines()))}highlightAt(t,r){for(const i of this.entries)i.marker.line===t&&i.x===r&&i.element&&i.element.classList.add("file-path-decoration-hover")}unhighlightAll(){var t;for(const r of this.entries)(t=r.element)==null||t.classList.remove("file-path-decoration-hover")}scanNewLines(){const t=this.terminal.buffer.active,r=t.baseY+t.cursorY;for(let i=this.lastScannedLine+1;i<=r;i++)this.decorateLine(i);this.lastScannedLine=r}decorateLine(t){const r=this.terminal.buffer.active,i=r.getLine(t);if(!i)return;const o=i.translateToString(),h=new RegExp(Ou.source,Ou.flags);let g;for(;(g=h.exec(o))!==null;){const a=g[1];if(!a||!c2(a))continue;const c=g[0],f=c.indexOf(a),v=g.index+f,u=c.length-f,m=r.baseY+r.cursorY,w=t-m,C=this.terminal.registerMarker(w);if(!C||C.line===-1)continue;const _={marker:C,x:v},d=this.terminal.registerDecoration({marker:C,x:v,width:u});d&&(d.onRender(y=>{y.classList.add("file-path-decoration"),_.element=y}),this.disposables.push(d)),this.entries.push(_),this.disposables.push(C)}}dispose(){for(const t of this.disposables)t.dispose();this.disposables=[],this.entries=[],this.lastScannedLine=-1}}const pR=1;function aS(e,t){if(!e||e.readyState!==WebSocket.OPEN)return;const r=new TextEncoder().encode(t),i=new Uint8Array(1+r.length);i[0]=pR,i.set(r,1),e.send(i.buffer)}function gR({wsRef:e,modifierRef:t}){const[r,i]=z.useState(null);z.useEffect(()=>(t.current.clearCallback=()=>i(null),()=>{t.current.clearCallback=null}),[t]);const o=z.useCallback(c=>{c.preventDefault(),aS(e.current,"\x1B")},[e]),h=z.useCallback(c=>{c.preventDefault(),aS(e.current," ")},[e]),g=z.useCallback(c=>{c.preventDefault();const f=r==="ctrl"?null:"ctrl";i(f),t.current.ctrl=f==="ctrl",t.current.cmd=!1},[r,t]),a=z.useCallback(c=>{c.preventDefault();const f=r==="cmd"?null:"cmd";i(f),t.current.cmd=f==="cmd",t.current.ctrl=!1},[r,t]);return G.jsxs("div",{className:"virtual-keyboard",role:"toolbar","aria-label":"Virtual modifier keys",children:[G.jsx("button",{className:"virtual-key",onPointerDown:o,tabIndex:-1,children:"Esc"}),G.jsx("button",{className:"virtual-key",onPointerDown:h,tabIndex:-1,children:"Tab"}),G.jsx("button",{className:`virtual-key virtual-key-modifier${r==="ctrl"?" virtual-key-active":""}`,onPointerDown:g,tabIndex:-1,"aria-pressed":r==="ctrl",children:"Ctrl"}),G.jsx("button",{className:`virtual-key virtual-key-modifier${r==="cmd"?" virtual-key-active":""}`,onPointerDown:a,tabIndex:-1,"aria-pressed":r==="cmd",children:"Cmd"})]})}class _R{constructor(t){$t(this,"term");$t(this,"fitAddon");$t(this,"getContainer");$t(this,"debug");$t(this,"_phase","initial-load");$t(this,"_viewportY",0);$t(this,"_baseY",0);$t(this,"_wasAtBottom",!0);$t(this,"_fitSuppressed",!1);$t(this,"_isProgrammaticScroll",!1);$t(this,"scrollDisposable");this.term=t.term,this.fitAddon=t.fitAddon,this.getContainer=t.getContainer,this.debug=t.debug??!1,this.scrollDisposable=this.term.onScroll(()=>this.handleScroll())}get phase(){return this._phase}get state(){return{phase:this._phase,viewportY:this._viewportY,baseY:this._baseY,wasAtBottom:this._wasAtBottom,fitSuppressed:this._fitSuppressed,isProgrammaticScroll:this._isProgrammaticScroll}}beginReplay(){if(this._phase!=="initial-load"){console.warn("[ScrollController] beginReplay called in phase:",this._phase);return}this._phase="buffer-replay",this._fitSuppressed=!0,this.log("phase","initial-load → buffer-replay")}endReplay(){if(this._phase!=="buffer-replay"){console.warn("[ScrollController] endReplay called in phase:",this._phase);return}this._fitSuppressed=!1,this._phase="interactive",this._wasAtBottom=!0,this.log("phase","buffer-replay → interactive"),this.programmaticScroll(()=>this.term.scrollToBottom()),this.safeFit()}enterInteractive(){if(this._phase!=="initial-load"){console.warn("[ScrollController] enterInteractive called in phase:",this._phase);return}this._phase="interactive",this.log("phase","initial-load → interactive")}reset(){this._phase="initial-load",this._viewportY=0,this._baseY=0,this._wasAtBottom=!0,this._fitSuppressed=!1,this._isProgrammaticScroll=!1,this.log("reset","back to initial-load")}suppressFit(){this._fitSuppressed=!0,this.log("fit","suppressed")}unsuppressFit(){this._fitSuppressed=!1,this.log("fit","unsuppressed")}safeFit(){var o,h;if(this._fitSuppressed){this.log("safeFit","skipped (fit suppressed)");return}if(!this.isContainerVisible()){this.log("safeFit","skipped (container not visible)");return}if(this._phase==="initial-load"){this.fitAddon.fit(),this.log("safeFit","fit (initial-load, no scroll preservation)");return}if(!(this._baseY>0||(((h=(o=this.term.buffer)==null?void 0:o.active)==null?void 0:h.baseY)??0)>0)){this.fitAddon.fit(),this.log("safeFit","fit (no scrollback)");return}const r=this._wasAtBottom,i=this._viewportY;this.fitAddon.fit(),r?(this.programmaticScroll(()=>this.term.scrollToBottom()),this.log("safeFit","fit + scrollToBottom (was at bottom)")):i>0?(this.programmaticScroll(()=>this.term.scrollToLine(i)),this.log("safeFit",`fit + scrollToLine(${i})`)):(console.warn("[ScrollController] restoreY=0 with scrollback — defaulting to bottom"),this.programmaticScroll(()=>this.term.scrollToBottom()))}scrollToBottom(){this.programmaticScroll(()=>this.term.scrollToBottom()),this._wasAtBottom=!0,this.log("scrollToBottom","explicit")}isContainerVisible(){const t=this.getContainer();if(!t)return!1;const r=t.getBoundingClientRect();return r.width>0&&r.height>0}dispose(){this.scrollDisposable.dispose(),this.log("dispose","cleaned up")}handleScroll(){var i,o,h,g,a,c,f,v;if(this._isProgrammaticScroll){const u=((o=(i=this.term.buffer)==null?void 0:i.active)==null?void 0:o.baseY)??0,m=((g=(h=this.term.buffer)==null?void 0:h.active)==null?void 0:g.viewportY)??0;this._baseY=u,this._viewportY=m,this._wasAtBottom=!u||m>=u,this.log("onScroll",`programmatic update: viewportY=${m} baseY=${u}`);return}if(this._phase!=="interactive"){this.log("onScroll",`ignored (phase: ${this._phase})`);return}if(!this.isContainerVisible()){this.log("onScroll","ignored (container not visible)");return}const t=((c=(a=this.term.buffer)==null?void 0:a.active)==null?void 0:c.baseY)??0,r=((v=(f=this.term.buffer)==null?void 0:f.active)==null?void 0:v.viewportY)??0;r===0&&t>0&&this._viewportY>0&&console.warn("[ScrollController] unexpected scroll-to-top in interactive phase:",`was viewportY=${this._viewportY}, now viewportY=0, baseY=${t}`),this._baseY=t,this._viewportY=r,this._wasAtBottom=!t||r>=t-2,this.log("onScroll",`viewportY=${r} baseY=${t} wasAtBottom=${this._wasAtBottom}`)}programmaticScroll(t){this._isProgrammaticScroll=!0;try{t()}finally{this._isProgrammaticScroll=!1}}log(t,r){this.debug&&console.debug(`[ScrollController] ${t}: ${r}`)}}class mR{constructor(){$t(this,"pending","")}write(t){t=this.pending+t,this.pending="";const r=t.lastIndexOf("\x1B");if(r===-1)return t;const i=t.substring(r);return yR(i)?t:(this.pending=i,t.substring(0,r))}flush(){const t=this.pending;return this.pending="",t}get hasPending(){return this.pending.length>0}}function yR(e){if(e.length<2)return!1;const t=e.charCodeAt(1);if(t===91){for(let r=2;r<e.length;r++){const i=e.charCodeAt(r);if(i>=64&&i<=126)return!0;if(!(i>=32&&i<=63))return!0}return!1}if(t===93){for(let r=2;r<e.length;r++)if(e.charCodeAt(r)===7||e.charCodeAt(r)===27&&r+1<e.length&&e.charCodeAt(r+1)===92)return!0;return!1}if(t===80||t===95||t===94||t===88){for(let r=2;r<e.length;r++)if(e.charCodeAt(r)===27&&r+1<e.length&&e.charCodeAt(r+1)===92)return!0;return!1}return t>=32&&t<=126,!0}function bR({fitRef:e,wsRef:t,xtermRef:r,connStatus:i,toolbarExtra:o,onReconnect:h}){const g=c=>{c.preventDefault(),h()},a=c=>{var f;c.preventDefault(),(f=r.current)==null||f.scrollToBottom()};return G.jsxs("div",{className:"terminal-controls",children:[G.jsx("button",{className:"terminal-control-btn",onPointerDown:g,tabIndex:-1,"aria-label":"Refresh terminal",children:G.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[G.jsx("path",{d:"M13.5 2.5v4h-4"}),G.jsx("path",{d:"M2.5 8a5.5 5.5 0 0 1 9.35-3.5L13.5 6.5"}),G.jsx("path",{d:"M2.5 13.5v-4h4"}),G.jsx("path",{d:"M13.5 8a5.5 5.5 0 0 1-9.35 3.5L2.5 9.5"})]})}),G.jsx("button",{className:"terminal-control-btn",onPointerDown:a,tabIndex:-1,"aria-label":"Scroll to bottom",children:G.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[G.jsx("path",{d:"M8 3v8"}),G.jsx("path",{d:"M4 8l4 4 4-4"}),G.jsx("line",{x1:"4",y1:"13",x2:"12",y2:"13"})]})}),G.jsx("span",{className:`terminal-control-btn terminal-status-icon terminal-status-${i}`,role:"status",title:i==="connected"?"Connected":i==="reconnecting"?"Reconnecting…":"Disconnected","aria-label":i==="connected"?"Connected":i==="reconnecting"?"Reconnecting":"Disconnected",children:G.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:G.jsx("circle",{cx:"8",cy:"8",r:"4",fill:"currentColor"})})}),o&&G.jsxs(G.Fragment,{children:[G.jsx("span",{className:"toolbar-divider"}),o]})]})}const u2=0,h2=1,f2=["image/png","image/jpeg","image/gif","image/webp","image/bmp"];async function SR(e){var r;if(!((r=navigator.clipboard)!=null&&r.read))return!1;let t=!1;try{const i=await navigator.clipboard.read();for(const o of i){const h=o.types.find(g=>f2.includes(g));if(h){t=!0;const g=await o.getType(h);e.write(`\r
|
|
125
|
+
*/var aR=class{constructor(e,t,r,i={}){this._terminal=e,this._regex=t,this._handler=r,this._options=i}provideLinks(e,t){let r=lR.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(r))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(r,i)=>{if(this._options.hover){let{range:o}=t;this._options.hover(r,i,o)}},t))}};function oR(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var lR=class Su{static computeLink(t,r,i,o){let h=new RegExp(r.source,(r.flags||"")+"g"),[g,a]=Su._getWindowedLineStrings(t-1,i),c=g.join(""),f,v=[];for(;f=h.exec(c);){let u=f[0];if(!oR(u))continue;let[m,w]=Su._mapStrIdx(i,a,0,f.index),[C,_]=Su._mapStrIdx(i,m,w,u.length);if(m===-1||w===-1||C===-1||_===-1)continue;let d={start:{x:w+1,y:m+1},end:{x:_,y:C+1}};v.push({range:d,text:u,activate:o})}return v}static _getWindowedLineStrings(t,r){let i,o=t,h=t,g=0,a="",c=[];if(i=r.buffer.active.getLine(t)){let f=i.translateToString(!0);if(i.isWrapped&&f[0]!==" "){for(g=0;(i=r.buffer.active.getLine(--o))&&g<2048&&(a=i.translateToString(!0),g+=a.length,c.push(a),!(!i.isWrapped||a.indexOf(" ")!==-1)););c.reverse()}for(c.push(f),g=0;(i=r.buffer.active.getLine(++h))&&i.isWrapped&&g<2048&&(a=i.translateToString(!0),g+=a.length,c.push(a),a.indexOf(" ")===-1););}return[c,o]}static _mapStrIdx(t,r,i,o){let h=t.buffer.active,g=h.getNullCell(),a=i;for(;o;){let c=h.getLine(r);if(!c)return[-1,-1];for(let f=a;f<c.length;++f){c.getCell(f,g);let v=g.getChars();if(g.getWidth()&&(o-=v.length||1,f===c.length-1&&v==="")){let u=h.getLine(r+1);u&&u.isWrapped&&(u.getCell(0,g),g.getWidth()===2&&(o+=1))}if(o<0)return[r,f]}r++,a=0}return[r,a]}},cR=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function uR(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var hR=class{constructor(e=uR,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||cR;this._linkProvider=this._terminal.registerLinkProvider(new aR(this._terminal,r,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const Ou=new RegExp("(?<![a-zA-Z]:\\/\\/)(?:^|[\\s\"'`(\\[{])([./]?[\\w./-]+\\.[a-zA-Z]{1,10})(?::(\\d+)(?::(\\d+))?|\\((\\d+),(\\d+)\\))?","g");function c2(e){return!(!/\.[a-zA-Z]{1,10}(?::\d+(?::\d+)?|\(\d+,\d+\))?$/.test(e)||/^https?:\/\//i.test(e)||/^[a-z0-9-]+\.(com|org|net|io|dev|app|co)$/i.test(e))}const fR=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC");class dR{constructor(t,r,i,o){this.terminal=t,this.onFileOpen=r,this.terminalId=i,this.decorationManager=o}provideLinks(t,r){const i=this.terminal.buffer.active.getLine(t-1);if(!i){r(void 0);return}const o=i.translateToString(),h=new RegExp(Ou.source,Ou.flags),g=[];let a;for(;(a=h.exec(o))!==null;){const c=a[1];if(!c||!c2(c))continue;const f=a[2]?parseInt(a[2],10):a[4]?parseInt(a[4],10):void 0,v=a[3]?parseInt(a[3],10):a[5]?parseInt(a[5],10):void 0,u=a[0],m=u.indexOf(c),w=a.index+m,C=a.index+u.length,_=w,d=t-1;g.push({range:{start:{x:w+1,y:t},end:{x:C,y:t}},text:u.substring(m),decorations:{pointerCursor:!0,underline:!0},activate:(y,b)=>{(fR?!y.metaKey:!y.ctrlKey)||this.onFileOpen(c,f,v,this.terminalId)},hover:()=>{var y;(y=this.decorationManager)==null||y.highlightAt(d,_)},leave:()=>{var y;(y=this.decorationManager)==null||y.unhighlightAll()}})}r(g.length>0?g:void 0)}}class vR{constructor(t){$t(this,"disposables",[]);$t(this,"entries",[]);$t(this,"lastScannedLine",-1);this.terminal=t,this.disposables.push(t.onWriteParsed(()=>this.scanNewLines()))}highlightAt(t,r){for(const i of this.entries)i.marker.line===t&&i.x===r&&i.element&&i.element.classList.add("file-path-decoration-hover")}unhighlightAll(){var t;for(const r of this.entries)(t=r.element)==null||t.classList.remove("file-path-decoration-hover")}scanNewLines(){const t=this.terminal.buffer.active,r=t.baseY+t.cursorY;for(let i=this.lastScannedLine+1;i<=r;i++)this.decorateLine(i);this.lastScannedLine=r}decorateLine(t){const r=this.terminal.buffer.active,i=r.getLine(t);if(!i)return;const o=i.translateToString(),h=new RegExp(Ou.source,Ou.flags);let g;for(;(g=h.exec(o))!==null;){const a=g[1];if(!a||!c2(a))continue;const c=g[0],f=c.indexOf(a),v=g.index+f,u=c.length-f,m=r.baseY+r.cursorY,w=t-m,C=this.terminal.registerMarker(w);if(!C||C.line===-1)continue;const _={marker:C,x:v},d=this.terminal.registerDecoration({marker:C,x:v,width:u});d&&(d.onRender(y=>{y.classList.add("file-path-decoration"),_.element=y}),this.disposables.push(d)),this.entries.push(_),this.disposables.push(C)}}dispose(){for(const t of this.disposables)t.dispose();this.disposables=[],this.entries=[],this.lastScannedLine=-1}}const pR=1;function aS(e,t){if(!e||e.readyState!==WebSocket.OPEN)return;const r=new TextEncoder().encode(t),i=new Uint8Array(1+r.length);i[0]=pR,i.set(r,1),e.send(i.buffer)}function gR({wsRef:e,modifierRef:t}){const[r,i]=z.useState(null);z.useEffect(()=>(t.current.clearCallback=()=>i(null),()=>{t.current.clearCallback=null}),[t]);const o=z.useCallback(c=>{c.preventDefault(),aS(e.current,"\x1B")},[e]),h=z.useCallback(c=>{c.preventDefault(),aS(e.current," ")},[e]),g=z.useCallback(c=>{c.preventDefault();const f=r==="ctrl"?null:"ctrl";i(f),t.current.ctrl=f==="ctrl",t.current.cmd=!1},[r,t]),a=z.useCallback(c=>{c.preventDefault();const f=r==="cmd"?null:"cmd";i(f),t.current.cmd=f==="cmd",t.current.ctrl=!1},[r,t]);return G.jsxs("div",{className:"virtual-keyboard",role:"toolbar","aria-label":"Virtual modifier keys",children:[G.jsx("button",{className:"virtual-key",onPointerDown:o,tabIndex:-1,children:"Esc"}),G.jsx("button",{className:"virtual-key",onPointerDown:h,tabIndex:-1,children:"Tab"}),G.jsx("button",{className:`virtual-key virtual-key-modifier${r==="ctrl"?" virtual-key-active":""}`,onPointerDown:g,tabIndex:-1,"aria-pressed":r==="ctrl",children:"Ctrl"}),G.jsx("button",{className:`virtual-key virtual-key-modifier${r==="cmd"?" virtual-key-active":""}`,onPointerDown:a,tabIndex:-1,"aria-pressed":r==="cmd",children:"Cmd"})]})}class _R{constructor(t){$t(this,"term");$t(this,"fitAddon");$t(this,"getContainer");$t(this,"debug");$t(this,"_phase","initial-load");$t(this,"_viewportY",0);$t(this,"_baseY",0);$t(this,"_wasAtBottom",!0);$t(this,"_fitSuppressed",!1);$t(this,"_isProgrammaticScroll",!1);$t(this,"scrollDisposable");this.term=t.term,this.fitAddon=t.fitAddon,this.getContainer=t.getContainer,this.debug=t.debug??!1,this.scrollDisposable=this.term.onScroll(()=>this.handleScroll())}get phase(){return this._phase}get state(){return{phase:this._phase,viewportY:this._viewportY,baseY:this._baseY,wasAtBottom:this._wasAtBottom,fitSuppressed:this._fitSuppressed,isProgrammaticScroll:this._isProgrammaticScroll}}beginReplay(){if(this._phase!=="initial-load"){console.warn("[ScrollController] beginReplay called in phase:",this._phase);return}this._phase="buffer-replay",this._fitSuppressed=!0,this.log("phase","initial-load → buffer-replay")}endReplay(){if(this._phase!=="buffer-replay"){console.warn("[ScrollController] endReplay called in phase:",this._phase);return}this._fitSuppressed=!1,this._phase="interactive",this._wasAtBottom=!0,this.log("phase","buffer-replay → interactive"),this.programmaticScroll(()=>this.term.scrollToBottom()),this.safeFit()}enterInteractive(){if(this._phase!=="initial-load"){console.warn("[ScrollController] enterInteractive called in phase:",this._phase);return}this._phase="interactive",this.log("phase","initial-load → interactive")}reset(){this._phase="initial-load",this._viewportY=0,this._baseY=0,this._wasAtBottom=!0,this._fitSuppressed=!1,this._isProgrammaticScroll=!1,this.log("reset","back to initial-load")}suppressFit(){this._fitSuppressed=!0,this.log("fit","suppressed")}unsuppressFit(){this._fitSuppressed=!1,this.log("fit","unsuppressed")}safeFit(){var o,h;if(this._fitSuppressed){this.log("safeFit","skipped (fit suppressed)");return}if(!this.isContainerVisible()){this.log("safeFit","skipped (container not visible)");return}if(this._phase==="initial-load"){this.fitAddon.fit(),this.log("safeFit","fit (initial-load, no scroll preservation)");return}if(!(this._baseY>0||(((h=(o=this.term.buffer)==null?void 0:o.active)==null?void 0:h.baseY)??0)>0)){this.fitAddon.fit(),this.log("safeFit","fit (no scrollback)");return}const r=this._wasAtBottom,i=this._viewportY;this.fitAddon.fit(),r?(this.programmaticScroll(()=>this.term.scrollToBottom()),this.log("safeFit","fit + scrollToBottom (was at bottom)")):i>0?(this.programmaticScroll(()=>this.term.scrollToLine(i)),this.log("safeFit",`fit + scrollToLine(${i})`)):(console.warn("[ScrollController] restoreY=0 with scrollback — defaulting to bottom"),this.programmaticScroll(()=>this.term.scrollToBottom()))}scrollToBottom(){this.programmaticScroll(()=>this.term.scrollToBottom()),this._wasAtBottom=!0,this.log("scrollToBottom","explicit")}isContainerVisible(){const t=this.getContainer();if(!t)return!1;const r=t.getBoundingClientRect();return r.width>0&&r.height>0}dispose(){this.scrollDisposable.dispose(),this.log("dispose","cleaned up")}handleScroll(){var i,o,h,g,a,c,f,v;if(this._isProgrammaticScroll){const u=((o=(i=this.term.buffer)==null?void 0:i.active)==null?void 0:o.baseY)??0,m=((g=(h=this.term.buffer)==null?void 0:h.active)==null?void 0:g.viewportY)??0;this._baseY=u,this._viewportY=m,this._wasAtBottom=!u||m>=u,this.log("onScroll",`programmatic update: viewportY=${m} baseY=${u}`);return}if(this._phase!=="interactive"){this.log("onScroll",`ignored (phase: ${this._phase})`);return}if(!this.isContainerVisible()){this.log("onScroll","ignored (container not visible)");return}const t=((c=(a=this.term.buffer)==null?void 0:a.active)==null?void 0:c.baseY)??0,r=((v=(f=this.term.buffer)==null?void 0:f.active)==null?void 0:v.viewportY)??0;if(r===0&&t>0&&this._viewportY>50){if(console.warn("[ScrollController] correcting scroll-to-top reset:",`was viewportY=${this._viewportY}, now viewportY=0, baseY=${t}`),this._wasAtBottom)this.programmaticScroll(()=>this.term.scrollToBottom()),this._viewportY=t,this._wasAtBottom=!0;else{const m=Math.min(this._viewportY,t);this.programmaticScroll(()=>this.term.scrollToLine(m)),this._viewportY=m,this._wasAtBottom=m>=t-2}this._baseY=t;return}this._baseY=t,this._viewportY=r,this._wasAtBottom=!t||r>=t-2,this.log("onScroll",`viewportY=${r} baseY=${t} wasAtBottom=${this._wasAtBottom}`)}programmaticScroll(t){this._isProgrammaticScroll=!0;try{t()}finally{this._isProgrammaticScroll=!1}}log(t,r){this.debug&&console.debug(`[ScrollController] ${t}: ${r}`)}}class mR{constructor(){$t(this,"pending","")}write(t){t=this.pending+t,this.pending="";const r=t.lastIndexOf("\x1B");if(r===-1)return t;const i=t.substring(r);return yR(i)?t:(this.pending=i,t.substring(0,r))}flush(){const t=this.pending;return this.pending="",t}get hasPending(){return this.pending.length>0}}function yR(e){if(e.length<2)return!1;const t=e.charCodeAt(1);if(t===91){for(let r=2;r<e.length;r++){const i=e.charCodeAt(r);if(i>=64&&i<=126)return!0;if(!(i>=32&&i<=63))return!0}return!1}if(t===93){for(let r=2;r<e.length;r++)if(e.charCodeAt(r)===7||e.charCodeAt(r)===27&&r+1<e.length&&e.charCodeAt(r+1)===92)return!0;return!1}if(t===80||t===95||t===94||t===88){for(let r=2;r<e.length;r++)if(e.charCodeAt(r)===27&&r+1<e.length&&e.charCodeAt(r+1)===92)return!0;return!1}return t>=32&&t<=126,!0}function bR({fitRef:e,wsRef:t,xtermRef:r,connStatus:i,toolbarExtra:o,onReconnect:h}){const g=c=>{c.preventDefault(),h()},a=c=>{var f;c.preventDefault(),(f=r.current)==null||f.scrollToBottom()};return G.jsxs("div",{className:"terminal-controls",children:[G.jsx("button",{className:"terminal-control-btn",onPointerDown:g,tabIndex:-1,"aria-label":"Refresh terminal",children:G.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[G.jsx("path",{d:"M13.5 2.5v4h-4"}),G.jsx("path",{d:"M2.5 8a5.5 5.5 0 0 1 9.35-3.5L13.5 6.5"}),G.jsx("path",{d:"M2.5 13.5v-4h4"}),G.jsx("path",{d:"M13.5 8a5.5 5.5 0 0 1-9.35 3.5L2.5 9.5"})]})}),G.jsx("button",{className:"terminal-control-btn",onPointerDown:a,tabIndex:-1,"aria-label":"Scroll to bottom",children:G.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[G.jsx("path",{d:"M8 3v8"}),G.jsx("path",{d:"M4 8l4 4 4-4"}),G.jsx("line",{x1:"4",y1:"13",x2:"12",y2:"13"})]})}),G.jsx("span",{className:`terminal-control-btn terminal-status-icon terminal-status-${i}`,role:"status",title:i==="connected"?"Connected":i==="reconnecting"?"Reconnecting…":"Disconnected","aria-label":i==="connected"?"Connected":i==="reconnecting"?"Reconnecting":"Disconnected",children:G.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:G.jsx("circle",{cx:"8",cy:"8",r:"4",fill:"currentColor"})})}),o&&G.jsxs(G.Fragment,{children:[G.jsx("span",{className:"toolbar-divider"}),o]})]})}const u2=0,h2=1,f2=["image/png","image/jpeg","image/gif","image/webp","image/bmp"];async function SR(e){var r;if(!((r=navigator.clipboard)!=null&&r.read))return!1;let t=!1;try{const i=await navigator.clipboard.read();for(const o of i){const h=o.types.find(g=>f2.includes(g));if(h){t=!0;const g=await o.getType(h);e.write(`\r
|
|
126
126
|
\x1B[90m[Uploading image...]\x1B[0m`);const{path:a}=await e2(g);return e.write("\r\x1B[2K"),e.paste(a),!0}}}catch{if(t)return e.write(`\r\x1B[2K\x1B[31m[Image upload failed]\x1B[0m\r
|
|
127
127
|
`),!0}return!1}async function wR(e){var t;if(!await SR(e))try{const r=await((t=navigator.clipboard)==null?void 0:t.readText());r&&e.paste(r)}catch{}}function CR(e,t){var i;const r=(i=e.clipboardData)==null?void 0:i.items;if(r){for(const o of Array.from(r))if(f2.includes(o.type)){const h=o.getAsFile();if(!h)continue;e.preventDefault(),t.write(`\r
|
|
128
128
|
\x1B[90m[Uploading image...]\x1B[0m`),e2(h).then(({path:g})=>{t.write("\r\x1B[2K"),t.paste(g)}).catch(()=>{t.write(`\r\x1B[2K\x1B[31m[Image upload failed]\x1B[0m\r
|
|
@@ -191,4 +191,4 @@ void main() {
|
|
|
191
191
|
* This source code is licensed under the MIT license found in the
|
|
192
192
|
* LICENSE file in the root directory of this source tree.
|
|
193
193
|
*/var D5;function i9(){if(D5)return pg;D5=1;var e=Wa();function t(c,f){return c===f&&(c!==0||1/c===1/f)||c!==c&&f!==f}var r=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,o=e.useRef,h=e.useEffect,g=e.useMemo,a=e.useDebugValue;return pg.useSyncExternalStoreWithSelector=function(c,f,v,u,m){var w=o(null);if(w.current===null){var C={hasValue:!1,value:null};w.current=C}else C=w.current;w=g(function(){function d(L){if(!y){if(y=!0,b=L,L=u(L),m!==void 0&&C.hasValue){var x=C.value;if(m(x,L))return S=x}return S=L}if(x=S,r(b,L))return x;var O=u(L);return m!==void 0&&m(x,O)?(b=L,x):(b=L,S=O)}var y=!1,b,S,E=v===void 0?null:v;return[function(){return d(f())},E===null?void 0:function(){return d(E())}]},[f,v,u,m]);var _=i(c,w[0],w[1]);return h(function(){C.hasValue=!0,C.value=_},[_]),a(_),_},pg}var R5;function n9(){return R5||(R5=1,vg.exports=i9()),vg.exports}n9();function s9(e){e()}function a9(){let e=null,t=null;return{clear(){e=null,t=null},notify(){s9(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let i=e;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0;const o=t={callback:r,next:null,prev:t};return o.prev?o.prev.next=o:e=o,function(){!i||e===null||(i=!1,o.next?o.next.prev=o.prev:t=o.prev,o.prev?o.prev.next=o.next:e=o.next)}}}}var k5={notify(){},get:()=>[]};function o9(e,t){let r,i=k5,o=0,h=!1;function g(_){v();const d=i.subscribe(_);let y=!1;return()=>{y||(y=!0,d(),u())}}function a(){i.notify()}function c(){C.onStateChange&&C.onStateChange()}function f(){return h}function v(){o++,r||(r=e.subscribe(c),i=a9())}function u(){o--,r&&o===0&&(r(),r=void 0,i.clear(),i=k5)}function m(){h||(h=!0,v())}function w(){h&&(h=!1,u())}const C={addNestedSub:g,notifyNestedSubs:a,handleChangeWrapper:c,isSubscribed:f,trySubscribe:m,tryUnsubscribe:w,getListeners:()=>i};return C}var l9=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",c9=l9(),u9=()=>typeof navigator<"u"&&navigator.product==="ReactNative",h9=u9(),f9=()=>c9||h9?z.useLayoutEffect:z.useEffect,d9=f9();function P5(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function v9(e,t){if(P5(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(t,r[o])||!P5(e[r[o]],t[r[o]]))return!1;return!0}var gg=Symbol.for("react-redux-context"),_g=typeof globalThis<"u"?globalThis:{};function p9(){if(!z.createContext)return{};const e=_g[gg]??(_g[gg]=new Map);let t=e.get(z.createContext);return t||(t=z.createContext(null),e.set(z.createContext,t)),t}var g9=p9();function _9(e){const{children:t,context:r,serverState:i,store:o}=e,h=z.useMemo(()=>{const c=o9(o);return{store:o,subscription:c,getServerState:i?()=>i:void 0}},[o,i]),g=z.useMemo(()=>o.getState(),[o]);d9(()=>{const{subscription:c}=h;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),g!==o.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[h,g]);const a=r||g9;return z.createElement(a.Provider,{value:h},t)}var m9=_9,y9=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function b9(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function Wm(e,t){var r=new Set([...Object.keys(e),...Object.keys(t)]);for(var i of r)if(y9.has(i)){if(e[i]==null&&t[i]==null)continue;if(!v9(e[i],t[i]))return!1}else if(!b9(e[i],t[i]))return!1;return!0}function Hs(e,t){var r,i;return(r=(i=e.graphicalItems.cartesianItems.find(o=>o.id===t))===null||i===void 0?void 0:i.xAxisId)!==null&&r!==void 0?r:kL}function $s(e,t){var r,i;return(r=(i=e.graphicalItems.cartesianItems.find(o=>o.id===t))===null||i===void 0?void 0:i.yAxisId)!==null&&r!==void 0?r:kL}var S9="Invariant failed";function w9(e,t){throw new Error(S9)}function c_(){return c_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},c_.apply(null,arguments)}function mh(e){return z.createElement(D$,c_({shapeType:"rectangle",activeClassName:"recharts-active-bar"},e))}var C9=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(i,o)=>{if(Oe(t))return t;var h=Oe(i)||Wt(i);return h?t(i,o):(h||w9(),r)}},x9=(e,t,r)=>r,E9=(e,t)=>t,ql=ce([wm,E9],(e,t)=>e.filter(r=>r.type==="bar").find(r=>r.id===t)),A9=ce([ql],e=>e==null?void 0:e.maxBarSize),M9=(e,t,r,i)=>i,L9=ce([ot,wm,Hs,$s,x9],(e,t,r,i,o)=>t.filter(h=>e==="horizontal"?h.xAxisId===r:h.yAxisId===i).filter(h=>h.isPanorama===o).filter(h=>h.hide===!1).filter(h=>h.type==="bar")),O9=(e,t,r)=>{var i=ot(e),o=Hs(e,t),h=$s(e,t);if(!(o==null||h==null))return i==="horizontal"?i_(e,"yAxis",h,r):i_(e,"xAxis",o,r)},T9=(e,t)=>{var r=ot(e),i=Hs(e,t),o=$s(e,t);if(!(i==null||o==null))return r==="horizontal"?Mx(e,"xAxis",i):Mx(e,"yAxis",o)},D9=ce([L9,LI,T9],aU),R9=(e,t,r)=>{var i,o,h=ql(e,t);if(h==null)return 0;var g=Hs(e,t),a=$s(e,t);if(g==null||a==null)return 0;var c=ot(e),f=KA(e),{maxBarSize:v}=h,u=Wt(v)?f:v,m,w;return c==="horizontal"?(m=Fa(e,"xAxis",g,r),w=Ua(e,"xAxis",g,r)):(m=Fa(e,"yAxis",a,r),w=Ua(e,"yAxis",a,r)),(i=(o=Wu(m,w,!0))!==null&&o!==void 0?o:u)!==null&&i!==void 0?i:0},$L=(e,t,r)=>{var i=ot(e),o=Hs(e,t),h=$s(e,t);if(!(o==null||h==null)){var g,a;return i==="horizontal"?(g=Fa(e,"xAxis",o,r),a=Ua(e,"xAxis",o,r)):(g=Fa(e,"yAxis",h,r),a=Ua(e,"yAxis",h,r)),Wu(g,a)}},k9=ce([D9,KA,MI,YA,R9,$L,A9],hU),P9=(e,t,r)=>{var i=Hs(e,t);if(i!=null)return Fa(e,"xAxis",i,r)},B9=(e,t,r)=>{var i=$s(e,t);if(i!=null)return Fa(e,"yAxis",i,r)},j9=(e,t,r)=>{var i=Hs(e,t);if(i!=null)return Ua(e,"xAxis",i,r)},I9=(e,t,r)=>{var i=$s(e,t);if(i!=null)return Ua(e,"yAxis",i,r)},N9=ce([k9,ql],dU),z9=ce([O9,ql],fU),H9=ce([Gt,j_,P9,B9,j9,I9,N9,ot,yI,$L,z9,ql,M9],(e,t,r,i,o,h,g,a,c,f,v,u,m)=>{var{chartData:w,dataStartIndex:C,dataEndIndex:_}=c;if(!(u==null||g==null||t==null||a!=="horizontal"&&a!=="vertical"||r==null||i==null||o==null||h==null||f==null)){var{data:d}=u,y;if(d!=null&&d.length>0?y=d:y=w==null?void 0:w.slice(C,_+1),y!=null)return vF({layout:a,barSettings:u,pos:g,parentViewBox:t,bandSize:f,xAxis:r,yAxis:i,xAxisTicks:o,yAxisTicks:h,stackedData:v,displayedData:y,offset:e,cells:m,dataStartIndex:C})}}),$9=["index"];function u_(){return u_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},u_.apply(null,arguments)}function U9(e,t){if(e==null)return{};var r,i,o=F9(e,t);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(e);for(i=0;i<h.length;i++)r=h[i],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function F9(e,t){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;r[i]=e[i]}return r}var UL=z.createContext(void 0),q9=e=>{var t=z.useContext(UL);if(t!=null)return t.stackId;if(e!=null)return mP(e)},W9=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),G9=e=>{var t=z.useContext(UL);if(t!=null){var{stackId:r}=t;return"url(#".concat(W9(r,e),")")}},FL=e=>{var{index:t}=e,r=U9(e,$9),i=G9(t);return z.createElement(nn,u_({className:"recharts-bar-stack-layer",clipPath:i},r))},K9=["onMouseEnter","onMouseLeave","onClick"],Y9=["value","background","tooltipPosition"],V9=["id"],X9=["onMouseEnter","onClick","onMouseLeave"];function hn(){return hn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},hn.apply(null,arguments)}function B5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,i)}return r}function ur(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?B5(Object(r),!0).forEach(function(i){Z9(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):B5(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Z9(e,t,r){return(t=Q9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Q9(e){var t=J9(e,"string");return typeof t=="symbol"?t:t+""}function J9(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yh(e,t){if(e==null)return{};var r,i,o=eF(e,t);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(e);for(i=0;i<h.length;i++)r=h[i],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function eF(e,t){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;r[i]=e[i]}return r}var tF=e=>{var{dataKey:t,name:r,fill:i,legendType:o,hide:h}=e;return[{inactive:h,dataKey:t,type:o,color:i,value:TE(r,t),payload:e}]},rF=z.memo(e=>{var{dataKey:t,stroke:r,strokeWidth:i,fill:o,name:h,hide:g,unit:a,tooltipType:c,id:f}=e,v={dataDefinedOnItem:void 0,getPosition:Ga,settings:{stroke:r,strokeWidth:i,fill:o,dataKey:t,nameKey:void 0,name:TE(h,t),hide:g,type:c,color:o,unit:a,graphicalItemId:f}};return z.createElement(R$,{tooltipEntrySettings:v})});function iF(e){var t=ke(qa),{data:r,dataKey:i,background:o,allOtherBarProps:h}=e,{onMouseEnter:g,onMouseLeave:a,onClick:c}=h,f=yh(h,K9),v=OL(g,i,h.id),u=TL(a),m=DL(c,i,h.id);if(!o||r==null)return null;var w=y_(o);return z.createElement(ts,{zIndex:vU(o,wr.barBackground)},r.map((C,_)=>{var{value:d,background:y,tooltipPosition:b}=C,S=yh(C,Y9);if(!y)return null;var E=v(C,_),L=u(C,_),x=m(C,_),O=ur(ur(ur(ur(ur({option:o,isActive:String(_)===t},S),{},{fill:"#eee"},y),w),A_(f,C,_)),{},{onMouseEnter:E,onMouseLeave:L,onClick:x,dataKey:i,index:_,className:"recharts-bar-background-rectangle"});return z.createElement(mh,hn({key:"background-bar-".concat(_)},O))}))}function nF(e){var{showLabels:t,children:r,rects:i}=e,o=i==null?void 0:i.map(h=>{var g={x:h.x,y:h.y,width:h.width,lowerWidth:h.width,upperWidth:h.width,height:h.height};return ur(ur({},g),{},{value:h.value,payload:h.payload,parentViewBox:h.parentViewBox,viewBox:g,fill:h.fill})});return z.createElement(r$,{value:t?o:void 0},r)}function sF(e){var{shape:t,activeBar:r,baseProps:i,entry:o,index:h,dataKey:g}=e,a=ke(qa),c=ke(sL),f=r&&String(h)===a&&(c==null||g===c),v=f?r:t;return f?z.createElement(ts,{zIndex:wr.activeBar},z.createElement(FL,{index:h},z.createElement(mh,hn({},i,{name:String(i.name)},o,{isActive:f,option:v,index:h,dataKey:g})))):z.createElement(mh,hn({},i,{name:String(i.name)},o,{isActive:f,option:v,index:h,dataKey:g}))}function aF(e){var{shape:t,baseProps:r,entry:i,index:o,dataKey:h}=e;return z.createElement(mh,hn({},r,{name:String(r.name)},i,{isActive:!1,option:t,index:o,dataKey:h}))}function oF(e){var t,{data:r,props:i}=e,o=(t=Xn(i))!==null&&t!==void 0?t:{},{id:h}=o,g=yh(o,V9),{shape:a,dataKey:c,activeBar:f}=i,{onMouseEnter:v,onClick:u,onMouseLeave:m}=i,w=yh(i,X9),C=OL(v,c,h),_=TL(m),d=DL(u,c,h);return r?z.createElement(z.Fragment,null,r.map((y,b)=>z.createElement(FL,hn({index:b,key:"rectangle-".concat(y==null?void 0:y.x,"-").concat(y==null?void 0:y.y,"-").concat(y==null?void 0:y.value,"-").concat(b),className:"recharts-bar-rectangle"},A_(w,y,b),{onMouseEnter:C(y,b),onMouseLeave:_(y,b),onClick:d(y,b)}),f?z.createElement(sF,{shape:a,activeBar:f,baseProps:g,entry:y,index:b,dataKey:c}):z.createElement(aF,{shape:a,baseProps:g,entry:y,index:b,dataKey:c})))):null}function lF(e){var{props:t,previousRectanglesRef:r}=e,{data:i,layout:o,isAnimationActive:h,animationBegin:g,animationDuration:a,animationEasing:c,onAnimationEnd:f,onAnimationStart:v}=t,u=r.current,m=U_(t,"recharts-bar-"),[w,C]=z.useState(!1),_=!w,d=z.useCallback(()=>{typeof f=="function"&&f(),C(!1)},[f]),y=z.useCallback(()=>{typeof v=="function"&&v(),C(!0)},[v]);return z.createElement(nF,{showLabels:_,rects:i},z.createElement($_,{animationId:m,begin:g,duration:a,isActive:h,easing:c,onAnimationEnd:d,onAnimationStart:y,key:m},b=>{var S=b===1?i:i==null?void 0:i.map((E,L)=>{var x=u&&u[L];if(x)return ur(ur({},E),{},{x:ir(x.x,E.x,b),y:ir(x.y,E.y,b),width:ir(x.width,E.width,b),height:ir(x.height,E.height,b)});if(o==="horizontal"){var O=ir(0,E.height,b),M=ir(E.stackedBarStart,E.y,b);return ur(ur({},E),{},{y:M,height:O})}var D=ir(0,E.width,b),k=ir(E.stackedBarStart,E.x,b);return ur(ur({},E),{},{width:D,x:k})});return b>0&&(r.current=S??null),S==null?null:z.createElement(nn,null,z.createElement(oF,{props:t,data:S}))}),z.createElement(s$,{label:t.label}),t.children)}function cF(e){var t=z.useRef(null);return z.createElement(lF,{previousRectanglesRef:t,props:e})}var qL=0,uF=(e,t)=>{var r=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:r,errorVal:sr(e,t)}};class hF extends z.PureComponent{render(){var{hide:t,data:r,dataKey:i,className:o,xAxisId:h,yAxisId:g,needClip:a,background:c,id:f}=this.props;if(t||r==null)return null;var v=dt("recharts-bar",o),u=f;return z.createElement(nn,{className:v,id:f},a&&z.createElement("defs",null,z.createElement(r9,{clipPathId:u,xAxisId:h,yAxisId:g})),z.createElement(nn,{className:"recharts-bar-rectangles",clipPath:a?"url(#clipPath-".concat(u,")"):void 0},z.createElement(iF,{data:r,dataKey:i,background:c,allOtherBarProps:this.props}),z.createElement(cF,this.props)))}}var fF={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:qL,xAxisId:0,yAxisId:0,zIndex:wr.bar};function dF(e){var{xAxisId:t,yAxisId:r,hide:i,legendType:o,minPointSize:h,activeBar:g,animationBegin:a,animationDuration:c,animationEasing:f,isAnimationActive:v}=e,{needClip:u}=HL(t,r),m=Ka(),w=Ir(),C=f$(e.children,$m),_=ke(b=>H9(b,e.id,w,C));if(m!=="vertical"&&m!=="horizontal")return null;var d,y=_==null?void 0:_[0];return y==null||y.height==null||y.width==null?d=0:d=m==="vertical"?y.height/2:y.width/2,z.createElement(t9,{xAxisId:t,yAxisId:r,data:_,dataPointFormatter:uF,errorBarOffset:d},z.createElement(hF,hn({},e,{layout:m,needClip:u,data:_,xAxisId:t,yAxisId:r,hide:i,legendType:o,minPointSize:h,activeBar:g,animationBegin:a,animationDuration:c,animationEasing:f,isAnimationActive:v})))}function vF(e){var{layout:t,barSettings:{dataKey:r,minPointSize:i},pos:o,bandSize:h,xAxis:g,yAxis:a,xAxisTicks:c,yAxisTicks:f,stackedData:v,displayedData:u,offset:m,cells:w,parentViewBox:C,dataStartIndex:_}=e,d=t==="horizontal"?a:g,y=v?d.scale.domain():null,b=yP({numericAxis:d}),S=d.scale.map(b);return u.map((E,L)=>{var x,O,M,D,k,B;if(v){var R=v[L+_];if(R==null)return null;x=dP(R,y)}else x=sr(E,r),Array.isArray(x)||(x=[b,x]);var P=C9(i,qL)(x[1],L);if(t==="horizontal"){var H,V=a.scale.map(x[0]),F=a.scale.map(x[1]);if(V==null||F==null)return null;O=Mw({axis:g,ticks:c,bandSize:h,offset:o.offset,entry:E,index:L}),M=(H=F??V)!==null&&H!==void 0?H:void 0,D=o.size;var K=V-F;if(k=Ti(K)?0:K,B={x:O,y:m.top,width:D,height:m.height},Math.abs(P)>0&&Math.abs(k)<Math.abs(P)){var Y=Rr(k||P)*(Math.abs(P)-Math.abs(k));M-=Y,k+=Y}}else{var j=g.scale.map(x[0]),$=g.scale.map(x[1]);if(j==null||$==null)return null;if(O=j,M=Mw({axis:a,ticks:f,bandSize:h,offset:o.offset,entry:E,index:L}),D=$-j,k=o.size,B={x:m.left,y:M,width:m.width,height:k},Math.abs(P)>0&&Math.abs(D)<Math.abs(P)){var N=Rr(D||P)*(Math.abs(P)-Math.abs(D));D+=N}}if(O==null||M==null||D==null||k==null)return null;var U=ur(ur({},E),{},{stackedBarStart:S,x:O,y:M,width:D,height:k,value:v?x:x[1],payload:E,background:B,tooltipPosition:{x:O+D/2,y:M+k/2},parentViewBox:C},w&&w[L]&&w[L].props);return U}).filter(Boolean)}function pF(e){var t=ii(e,fF),r=q9(t.stackId),i=Ir();return z.createElement(N$,{id:t.id,type:"bar"},o=>z.createElement(z.Fragment,null,z.createElement(k$,{legendPayload:tF(t)}),z.createElement(rF,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:o}),z.createElement(W$,{type:"bar",id:o,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:r,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:i}),z.createElement(ts,{zIndex:t.zIndex},z.createElement(dF,hn({},t,{id:o})))))}var WL=z.memo(pF,Wm);WL.displayName="Bar";var gF=["domain","range"],_F=["domain","range"];function j5(e,t){if(e==null)return{};var r,i,o=mF(e,t);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(e);for(i=0;i<h.length;i++)r=h[i],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function mF(e,t){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;r[i]=e[i]}return r}function I5(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function GL(e,t){if(e===t)return!0;var{domain:r,range:i}=e,o=j5(e,gF),{domain:h,range:g}=t,a=j5(t,_F);return!I5(r,h)||!I5(i,g)?!1:Wm(o,a)}var yF=["type"],bF=["dangerouslySetInnerHTML","ticks","scale"],SF=["id","scale"];function h_(){return h_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},h_.apply(null,arguments)}function N5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,i)}return r}function z5(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?N5(Object(r),!0).forEach(function(i){wF(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N5(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function wF(e,t,r){return(t=CF(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function CF(e){var t=xF(e,"string");return typeof t=="symbol"?t:t+""}function xF(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function f_(e,t){if(e==null)return{};var r,i,o=EF(e,t);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(e);for(i=0;i<h.length;i++)r=h[i],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function EF(e,t){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;r[i]=e[i]}return r}function AF(e){var t=At(),r=z.useRef(null),i=BE(),{type:o}=e,h=f_(e,yF),g=ef(i,"xAxis",o),a=z.useMemo(()=>{if(g!=null)return z5(z5({},h),{},{type:g})},[h,g]);return z.useLayoutEffect(()=>{a!=null&&(r.current===null?t(X$(a)):r.current!==a&&t(Z$({prev:r.current,next:a})),r.current=a)},[a,t]),z.useLayoutEffect(()=>()=>{r.current&&(t(Q$(r.current)),r.current=null)},[t]),null}var MF=e=>{var{xAxisId:t,className:r}=e,i=ke(j_),o=Ir(),h="xAxis",g=ke(y=>NM(y,h,t,o)),a=ke(y=>PM(y,t)),c=ke(y=>ON(y,t)),f=ke(y=>iM(y,t));if(a==null||c==null||f==null)return null;var{dangerouslySetInnerHTML:v,ticks:u,scale:m}=e,w=f_(e,bF),{id:C,scale:_}=f,d=f_(f,SF);return z.createElement(qm,h_({},w,d,{x:c.x,y:c.y,width:a.width,height:a.height,className:dt("recharts-".concat(h," ").concat(h),r),viewBox:i,ticks:g,axisType:h}))},LF={allowDataOverflow:Ut.allowDataOverflow,allowDecimals:Ut.allowDecimals,allowDuplicatedCategory:Ut.allowDuplicatedCategory,angle:Ut.angle,axisLine:Ts.axisLine,height:Ut.height,hide:!1,includeHidden:Ut.includeHidden,interval:Ut.interval,label:!1,minTickGap:Ut.minTickGap,mirror:Ut.mirror,orientation:Ut.orientation,padding:Ut.padding,reversed:Ut.reversed,scale:Ut.scale,tick:Ut.tick,tickCount:Ut.tickCount,tickLine:Ts.tickLine,tickSize:Ts.tickSize,type:Ut.type,xAxisId:0},OF=e=>{var t=ii(e,LF);return z.createElement(z.Fragment,null,z.createElement(AF,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),z.createElement(MF,t))},KL=z.memo(OF,GL);KL.displayName="XAxis";var TF=["type"],DF=["dangerouslySetInnerHTML","ticks","scale"],RF=["id","scale"];function d_(){return d_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},d_.apply(null,arguments)}function H5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,i)}return r}function $5(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?H5(Object(r),!0).forEach(function(i){kF(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):H5(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function kF(e,t,r){return(t=PF(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function PF(e){var t=BF(e,"string");return typeof t=="symbol"?t:t+""}function BF(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function v_(e,t){if(e==null)return{};var r,i,o=jF(e,t);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(e);for(i=0;i<h.length;i++)r=h[i],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function jF(e,t){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;r[i]=e[i]}return r}function IF(e){var t=At(),r=z.useRef(null),i=BE(),{type:o}=e,h=v_(e,TF),g=ef(i,"yAxis",o),a=z.useMemo(()=>{if(g!=null)return $5($5({},h),{},{type:g})},[g,h]);return z.useLayoutEffect(()=>{a!=null&&(r.current===null?t(J$(a)):r.current!==a&&t(eU({prev:r.current,next:a})),r.current=a)},[a,t]),z.useLayoutEffect(()=>()=>{r.current&&(t(tU(r.current)),r.current=null)},[t]),null}function NF(e){var{yAxisId:t,className:r,width:i,label:o}=e,h=z.useRef(null),g=z.useRef(null),a=ke(j_),c=Ir(),f=At(),v="yAxis",u=ke(x=>BM(x,t)),m=ke(x=>DN(x,t)),w=ke(x=>NM(x,v,t,c)),C=ke(x=>nM(x,t));if(z.useLayoutEffect(()=>{if(!(i!=="auto"||!u||Fm(o)||z.isValidElement(o)||C==null)){var x=h.current;if(x){var O=x.getCalculatedWidth();Math.round(u.width)!==Math.round(O)&&f(rU({id:t,width:O}))}}},[w,u,f,o,t,i,C]),u==null||m==null||C==null)return null;var{dangerouslySetInnerHTML:_,ticks:d,scale:y}=e,b=v_(e,DF),{id:S,scale:E}=C,L=v_(C,RF);return z.createElement(qm,d_({},b,L,{ref:h,labelRef:g,x:m.x,y:m.y,tickTextProps:i==="auto"?{width:void 0}:{width:i},width:u.width,height:u.height,className:dt("recharts-".concat(v," ").concat(v),r),viewBox:a,ticks:w,axisType:v}))}var zF={allowDataOverflow:Ft.allowDataOverflow,allowDecimals:Ft.allowDecimals,allowDuplicatedCategory:Ft.allowDuplicatedCategory,angle:Ft.angle,axisLine:Ts.axisLine,hide:!1,includeHidden:Ft.includeHidden,interval:Ft.interval,label:!1,minTickGap:Ft.minTickGap,mirror:Ft.mirror,orientation:Ft.orientation,padding:Ft.padding,reversed:Ft.reversed,scale:Ft.scale,tick:Ft.tick,tickCount:Ft.tickCount,tickLine:Ts.tickLine,tickSize:Ts.tickSize,type:Ft.type,width:Ft.width,yAxisId:0},HF=e=>{var t=ii(e,zF);return z.createElement(z.Fragment,null,z.createElement(IF,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),z.createElement(NF,t))},YL=z.memo(HF,GL);YL.displayName="YAxis";var $F=(e,t)=>t,Gm=ce([$F,ot,tM,Vt,tL,yn,W7,Gt],Q7),Km=e=>{var t=e.currentTarget.getBoundingClientRect(),r=t.width/e.currentTarget.offsetWidth,i=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/r),chartY:Math.round((e.clientY-t.top)/i)}},VL=ei("mouseClick"),XL=Tl();XL.startListening({actionCreator:VL,effect:(e,t)=>{var r=e.payload,i=Gm(t.getState(),Km(r));(i==null?void 0:i.activeIndex)!=null&&t.dispatch(WN({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}});var p_=ei("mouseMove"),ZL=Tl(),bu=null;ZL.startListening({actionCreator:p_,effect:(e,t)=>{var r=e.payload;bu!==null&&cancelAnimationFrame(bu);var i=Km(r);bu=requestAnimationFrame(()=>{var o=t.getState(),h=Dm(o,o.tooltip.settings.shared);if(h==="axis"){var g=Gm(o,i);(g==null?void 0:g.activeIndex)!=null?t.dispatch(GM({activeIndex:g.activeIndex,activeDataKey:void 0,activeCoordinate:g.activeCoordinate})):t.dispatch(WM())}bu=null})}});function UF(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<<CHILDREN>>":t}var U5={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},QL=Cr({name:"rootProps",initialState:U5,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:U5.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),FF=QL.reducer,{updateOptions:qF}=QL.actions,WF=null,GF={updatePolarOptions:(e,t)=>t.payload},JL=Cr({name:"polarOptions",initialState:WF,reducers:GF}),{updatePolarOptions:lW}=JL.actions,KF=JL.reducer,eO=ei("keyDown"),tO=ei("focus"),Ym=Tl();Ym.startListening({actionCreator:eO,effect:(e,t)=>{var r=t.getState(),i=r.rootProps.accessibilityLayer!==!1;if(i){var{keyboardInteraction:o}=r.tooltip,h=e.payload;if(!(h!=="ArrowRight"&&h!=="ArrowLeft"&&h!=="Enter")){var g=Rm(o,ro(r),Hl(r),Ul(r)),a=g==null?-1:Number(g);if(!(!Number.isFinite(a)||a<0)){var c=yn(r);if(h==="Enter"){var f=vh(r,"axis","hover",String(o.index));t.dispatch(s_({active:!o.active,activeIndex:o.index,activeCoordinate:f}));return}var v=BN(r),u=v==="left-to-right"?1:-1,m=h==="ArrowRight"?1:-1,w=a+m*u;if(!(c==null||w>=c.length||w<0)){var C=vh(r,"axis","hover",String(w));t.dispatch(s_({active:!0,activeIndex:w.toString(),activeCoordinate:C}))}}}}}});Ym.startListening({actionCreator:tO,effect:(e,t)=>{var r=t.getState(),i=r.rootProps.accessibilityLayer!==!1;if(i){var{keyboardInteraction:o}=r.tooltip;if(!o.active&&o.index==null){var h="0",g=vh(r,"axis","hover",String(h));t.dispatch(s_({active:!0,activeIndex:h,activeCoordinate:g}))}}}});var Zr=ei("externalEvent"),rO=Tl(),mg=new Map;rO.startListening({actionCreator:Zr,effect:(e,t)=>{var{handler:r,reactEvent:i}=e.payload;if(r!=null){i.persist();var o=i.type,h=mg.get(o);h!==void 0&&cancelAnimationFrame(h);var g=requestAnimationFrame(()=>{try{var a=t.getState(),c={activeCoordinate:T7(a),activeDataKey:sL(a),activeIndex:qa(a),activeLabel:nL(a),activeTooltipIndex:qa(a),isTooltipActive:D7(a)};r(c,i)}finally{mg.delete(o)}});mg.set(o,g)}}});var YF=ce([eo],e=>e.tooltipItemPayloads),VF=ce([YF,(e,t)=>t,(e,t,r)=>r],(e,t,r)=>{if(t!=null){var i=e.find(h=>h.settings.graphicalItemId===r);if(i!=null){var{getPosition:o}=i;if(o!=null)return o(t)}}}),iO=ei("touchMove"),nO=Tl();nO.startListening({actionCreator:iO,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){var i=t.getState(),o=Dm(i,i.tooltip.settings.shared);if(o==="axis"){var h=r.touches[0];if(h==null)return;var g=Gm(i,Km({clientX:h.clientX,clientY:h.clientY,currentTarget:r.currentTarget}));(g==null?void 0:g.activeIndex)!=null&&t.dispatch(GM({activeIndex:g.activeIndex,activeDataKey:void 0,activeCoordinate:g.activeCoordinate}))}else if(o==="item"){var a,c=r.touches[0];if(document.elementFromPoint==null||c==null)return;var f=document.elementFromPoint(c.clientX,c.clientY);if(!f||!f.getAttribute)return;var v=f.getAttribute(AP),u=(a=f.getAttribute(MP))!==null&&a!==void 0?a:void 0,m=to(i).find(_=>_.id===u);if(v==null||m==null||u==null)return;var{dataKey:w}=m,C=VF(i,v,u);t.dispatch(qM({activeDataKey:w,activeIndex:v,activeCoordinate:C,activeGraphicalItemId:u}))}}}});var XF=tE({brush:gU,cartesianAxis:iU,chartData:Tz,errorBars:VU,graphicalItems:F$,layout:lP,legend:w6,options:Ez,polarAxis:o$,polarOptions:KF,referenceElements:bU,rootProps:FF,tooltip:GN,zIndex:fz}),ZF=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return k4({reducer:XF,preloadedState:t,middleware:i=>{var o;return i({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((o="es6")!==null&&o!==void 0?o:"")}).concat([XL.middleware,ZL.middleware,Ym.middleware,rO.middleware,nO.middleware])},enhancers:i=>{var o=i;return typeof i=="function"&&(o=i()),o.concat(gE({type:"raf"}))},devTools:{serialize:{replacer:UF},name:"recharts-".concat(r)}})};function QF(e){var{preloadedState:t,children:r,reduxStoreName:i}=e,o=Ir(),h=z.useRef(null);if(o)return r;h.current==null&&(h.current=ZF(t,i));var g=O_;return z.createElement(m9,{context:g,store:h.current},r)}function JF(e){var{layout:t,margin:r}=e,i=At(),o=Ir();return z.useEffect(()=>{o||(i(sP(t)),i(nP(r)))},[i,o,t,r]),null}var eq=z.memo(JF,Wm);function tq(e){var t=At();return z.useEffect(()=>{t(qF(e))},[t,e]),null}function F5(e){var{zIndex:t,isPanorama:r}=e,i=z.useRef(null),o=At();return z.useLayoutEffect(()=>(i.current&&o(uz({zIndex:t,element:i.current,isPanorama:r})),()=>{o(hz({zIndex:t,isPanorama:r}))}),[o,t,r]),z.createElement("g",{tabIndex:-1,ref:i})}function q5(e){var{children:t,isPanorama:r}=e,i=ke(ez);if(!i||i.length===0)return t;var o=i.filter(g=>g<0),h=i.filter(g=>g>0);return z.createElement(z.Fragment,null,o.map(g=>z.createElement(F5,{key:g,zIndex:g,isPanorama:r})),t,h.map(g=>z.createElement(F5,{key:g,zIndex:g,isPanorama:r})))}var rq=["children"];function iq(e,t){if(e==null)return{};var r,i,o=nq(e,t);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(e);for(i=0;i<h.length;i++)r=h[i],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function nq(e,t){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;r[i]=e[i]}return r}function bh(){return bh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},bh.apply(null,arguments)}var sq={width:"100%",height:"100%",display:"block"},aq=z.forwardRef((e,t)=>{var r=n6(),i=s6(),o=qE();if(!Zn(r)||!Zn(i))return null;var{children:h,otherAttributes:g,title:a,desc:c}=e,f,v;return g!=null&&(typeof g.tabIndex=="number"?f=g.tabIndex:f=o?0:void 0,typeof g.role=="string"?v=g.role:v=o?"application":void 0),z.createElement(y2,bh({},g,{title:a,desc:c,role:v,tabIndex:f,width:r,height:i,style:sq,ref:t}),h)}),oq=e=>{var{children:t}=e,r=ke(Hh);if(!r)return null;var{width:i,height:o,y:h,x:g}=r;return z.createElement(y2,{width:i,height:o,x:g,y:h},t)},W5=z.forwardRef((e,t)=>{var{children:r}=e,i=iq(e,rq),o=Ir();return o?z.createElement(oq,null,z.createElement(q5,{isPanorama:!0},r)):z.createElement(aq,bh({ref:t},i),z.createElement(q5,{isPanorama:!1},r))});function lq(){var e=At(),[t,r]=z.useState(null),i=ke(EP);return z.useEffect(()=>{if(t!=null){var o=t.getBoundingClientRect(),h=o.width/t.offsetWidth;Xe(h)&&h!==i&&e(oP(h))}},[t,e,i]),r}function G5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,i)}return r}function cq(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?G5(Object(r),!0).forEach(function(i){uq(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G5(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function uq(e,t,r){return(t=hq(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hq(e){var t=fq(e,"string");return typeof t=="symbol"?t:t+""}function fq(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vn(){return Vn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Vn.apply(null,arguments)}var dq=()=>(zz(),null);function Sh(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var vq=z.forwardRef((e,t)=>{var r,i,o=z.useRef(null),[h,g]=z.useState({containerWidth:Sh((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:Sh((i=e.style)===null||i===void 0?void 0:i.height)}),a=z.useCallback((f,v)=>{g(u=>{var m=Math.round(f),w=Math.round(v);return u.containerWidth===m&&u.containerHeight===w?u:{containerWidth:m,containerHeight:w}})},[]),c=z.useCallback(f=>{if(typeof t=="function"&&t(f),f!=null&&typeof ResizeObserver<"u"){var{width:v,height:u}=f.getBoundingClientRect();a(v,u);var m=C=>{var _=C[0];if(_!=null){var{width:d,height:y}=_.contentRect;a(d,y)}},w=new ResizeObserver(m);w.observe(f),o.current=w}},[t,a]);return z.useEffect(()=>()=>{var f=o.current;f!=null&&f.disconnect()},[a]),z.createElement(z.Fragment,null,z.createElement(Rl,{width:h.containerWidth,height:h.containerHeight}),z.createElement("div",Vn({ref:c},e)))}),pq=z.forwardRef((e,t)=>{var{width:r,height:i}=e,[o,h]=z.useState({containerWidth:Sh(r),containerHeight:Sh(i)}),g=z.useCallback((c,f)=>{h(v=>{var u=Math.round(c),m=Math.round(f);return v.containerWidth===u&&v.containerHeight===m?v:{containerWidth:u,containerHeight:m}})},[]),a=z.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:f,height:v}=c.getBoundingClientRect();g(f,v)}},[t,g]);return z.createElement(z.Fragment,null,z.createElement(Rl,{width:o.containerWidth,height:o.containerHeight}),z.createElement("div",Vn({ref:a},e)))}),gq=z.forwardRef((e,t)=>{var{width:r,height:i}=e;return z.createElement(z.Fragment,null,z.createElement(Rl,{width:r,height:i}),z.createElement("div",Vn({ref:t},e)))}),_q=z.forwardRef((e,t)=>{var{width:r,height:i}=e;return typeof r=="string"||typeof i=="string"?z.createElement(pq,Vn({},e,{ref:t})):typeof r=="number"&&typeof i=="number"?z.createElement(gq,Vn({},e,{width:r,height:i,ref:t})):z.createElement(z.Fragment,null,z.createElement(Rl,{width:r,height:i}),z.createElement("div",Vn({ref:t},e)))});function mq(e){return e?vq:_q}var yq=z.forwardRef((e,t)=>{var{children:r,className:i,height:o,onClick:h,onContextMenu:g,onDoubleClick:a,onMouseDown:c,onMouseEnter:f,onMouseLeave:v,onMouseMove:u,onMouseUp:m,onTouchEnd:w,onTouchMove:C,onTouchStart:_,style:d,width:y,responsive:b,dispatchTouchEvents:S=!0}=e,E=z.useRef(null),L=At(),[x,O]=z.useState(null),[M,D]=z.useState(null),k=lq(),B=I_(),R=(B==null?void 0:B.width)>0?B.width:y,P=(B==null?void 0:B.height)>0?B.height:o,H=z.useCallback(Z=>{k(Z),typeof t=="function"&&t(Z),O(Z),D(Z),Z!=null&&(E.current=Z)},[k,t,O,D]),V=z.useCallback(Z=>{L(VL(Z)),L(Zr({handler:h,reactEvent:Z}))},[L,h]),F=z.useCallback(Z=>{L(p_(Z)),L(Zr({handler:f,reactEvent:Z}))},[L,f]),K=z.useCallback(Z=>{L(WM()),L(Zr({handler:v,reactEvent:Z}))},[L,v]),Y=z.useCallback(Z=>{L(p_(Z)),L(Zr({handler:u,reactEvent:Z}))},[L,u]),j=z.useCallback(()=>{L(tO())},[L]),$=z.useCallback(Z=>{L(eO(Z.key))},[L]),N=z.useCallback(Z=>{L(Zr({handler:g,reactEvent:Z}))},[L,g]),U=z.useCallback(Z=>{L(Zr({handler:a,reactEvent:Z}))},[L,a]),ee=z.useCallback(Z=>{L(Zr({handler:c,reactEvent:Z}))},[L,c]),te=z.useCallback(Z=>{L(Zr({handler:m,reactEvent:Z}))},[L,m]),de=z.useCallback(Z=>{L(Zr({handler:_,reactEvent:Z}))},[L,_]),pe=z.useCallback(Z=>{S&&L(iO(Z)),L(Zr({handler:C,reactEvent:Z}))},[L,S,C]),X=z.useCallback(Z=>{L(Zr({handler:w,reactEvent:Z}))},[L,w]),W=mq(b);return z.createElement(fL.Provider,{value:x},z.createElement(h3.Provider,{value:M},z.createElement(W,{width:R??(d==null?void 0:d.width),height:P??(d==null?void 0:d.height),className:dt("recharts-wrapper",i),style:cq({position:"relative",cursor:"default",width:R,height:P},d),onClick:V,onContextMenu:N,onDoubleClick:U,onFocus:j,onKeyDown:$,onMouseDown:ee,onMouseEnter:F,onMouseLeave:K,onMouseMove:Y,onMouseUp:te,onTouchEnd:X,onTouchMove:pe,onTouchStart:de,ref:H},z.createElement(dq,null),r)))}),bq=["width","height","responsive","children","className","style","compact","title","desc"];function Sq(e,t){if(e==null)return{};var r,i,o=wq(e,t);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(e);for(i=0;i<h.length;i++)r=h[i],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function wq(e,t){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;r[i]=e[i]}return r}var Cq=z.forwardRef((e,t)=>{var{width:r,height:i,responsive:o,children:h,className:g,style:a,compact:c,title:f,desc:v}=e,u=Sq(e,bq),m=Xn(u);return c?z.createElement(z.Fragment,null,z.createElement(Rl,{width:r,height:i}),z.createElement(W5,{otherAttributes:m,title:f,desc:v},h)):z.createElement(yq,{className:g,style:a,width:r,height:i,responsive:o??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},z.createElement(W5,{otherAttributes:m,title:f,desc:v,ref:t},z.createElement(wU,null,h)))});function g_(){return g_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},g_.apply(null,arguments)}var xq={top:5,right:5,bottom:5,left:5},Eq={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:xq,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},Aq=z.forwardRef(function(t,r){var i,o=ii(t.categoricalChartProps,Eq),{chartName:h,defaultTooltipEventType:g,validateTooltipEventTypes:a,tooltipPayloadSearcher:c,categoricalChartProps:f}=t,v={chartName:h,defaultTooltipEventType:g,validateTooltipEventTypes:a,tooltipPayloadSearcher:c,eventEmitter:void 0};return z.createElement(QF,{preloadedState:{options:v},reduxStoreName:(i=f.id)!==null&&i!==void 0?i:h},z.createElement(pU,{chartData:f.data}),z.createElement(eq,{layout:o.layout,margin:o.margin}),z.createElement(tq,{baseValue:o.baseValue,accessibilityLayer:o.accessibilityLayer,barCategoryGap:o.barCategoryGap,maxBarSize:o.maxBarSize,stackOffset:o.stackOffset,barGap:o.barGap,barSize:o.barSize,syncId:o.syncId,syncMethod:o.syncMethod,className:o.className,reverseStackOrder:o.reverseStackOrder}),z.createElement(Cq,g_({},o,{ref:r})))}),Mq=["axis","item"],Lq=z.forwardRef((e,t)=>z.createElement(Aq,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Mq,tooltipPayloadSearcher:Cz,categoricalChartProps:e,ref:t}));const K5=["#6366f1","#8b5cf6","#a78bfa","#c4b5fd","#ddd6fe","#818cf8","#4f46e5","#7c3aed","#5b21b6","#3730a3"];function wh(e,t=1,r=""){return e===null?"—":`${Number(e.toFixed(t))}${r}`}function Y5(e){return e===null?"—":`$${e.toFixed(2)}`}function V5(e){return e===null?"—":`${e.toFixed(1)}%`}function sO({title:e,error:t,defaultOpen:r=!0,children:i}){const[o,h]=z.useState(r);return G.jsxs("section",{className:"analytics-section",children:[G.jsxs("h3",{className:"analytics-section-title",onClick:()=>h(!o),style:{cursor:"pointer",userSelect:"none"},children:[G.jsx("span",{className:"analytics-collapse-icon",children:o?"▾":"▸"}),e]}),t&&G.jsx("div",{className:"analytics-error",children:t}),o&&i]})}function __({children:e}){return G.jsx("div",{className:"analytics-metric-grid",children:e})}function Ji({label:e,value:t}){return G.jsxs("div",{className:"analytics-metric",children:[G.jsx("span",{className:"analytics-metric-value",children:t}),G.jsx("span",{className:"analytics-metric-label",children:e})]})}function Lu({data:e,dataKey:t,nameKey:r,color:i,formatter:o}){if(e.length===0)return null;const h=Math.max(120,e.length*28+30);return G.jsx(t6,{width:"100%",height:h,children:G.jsxs(Lq,{data:e,layout:"vertical",margin:{top:4,right:40,bottom:4,left:0},children:[G.jsx(KL,{type:"number",hide:!0}),G.jsx(YL,{type:"category",dataKey:r,width:80,tick:{fontSize:10,fill:"var(--text-secondary)"}}),G.jsx(Kz,{formatter:o?(g=>typeof g=="number"?o(g):""):void 0,contentStyle:{background:"var(--bg-primary)",border:"1px solid var(--border-color)",fontSize:11,borderRadius:4},labelStyle:{color:"var(--text-primary)"},itemStyle:{color:"var(--text-secondary)"}}),G.jsx(WL,{dataKey:t,radius:[0,3,3,0],children:e.map((g,a)=>G.jsx($m,{fill:i??K5[a%K5.length]},a))})]})})}function X5(e){return e===null?"—":e<1?`${Math.round(e*60)}m`:`${Number(e.toFixed(1))}h`}function Oq({activity:e,errors:t}){const r=Object.entries(e.projectsByProtocol).map(([i,o])=>({name:i.toUpperCase(),count:o.count,avgWallClock:o.avgWallClockHours,avgAgentTime:o.avgAgentTimeHours})).sort((i,o)=>o.count-i.count);return G.jsxs(sO,{title:"Activity",error:t==null?void 0:t.github,children:[r.length>0&&G.jsxs("div",{className:"analytics-sub-section",children:[G.jsx("h4",{className:"analytics-sub-title",children:"Projects by Protocol"}),G.jsx(__,{children:r.map(i=>G.jsx(Ji,{label:i.name,value:`${i.count} (wall ${X5(i.avgWallClock)}${i.avgAgentTime!=null?`, agent ${X5(i.avgAgentTime)}`:""})`},i.name))}),G.jsx(Lu,{data:r,dataKey:"count",nameKey:"name"})]}),G.jsxs(__,{children:[G.jsx(Ji,{label:"PRs Merged",value:String(e.prsMerged)}),G.jsx(Ji,{label:"Issues Closed",value:String(e.issuesClosed)}),G.jsx(Ji,{label:"Median Time to Merge",value:wh(e.medianTimeToMergeHours,1,"h")}),G.jsx(Ji,{label:"Median Time to Close Bugs",value:wh(e.medianTimeToCloseBugsHours,1,"h")})]})]})}function Tq({consultation:e,errors:t}){const r=e.byModel.map(h=>({name:h.model,count:h.count,cost:h.totalCost??0,latency:h.avgLatency,success:h.successRate})),i=Object.entries(e.byReviewType).map(([h,g])=>({name:h,value:g})),o=Object.entries(e.byProtocol).map(([h,g])=>({name:h,value:g}));return G.jsxs(sO,{title:"Consultation",error:t==null?void 0:t.consultation,children:[G.jsxs(__,{children:[G.jsx(Ji,{label:"Total Consultations",value:String(e.totalCount)}),G.jsx(Ji,{label:"Total Cost",value:Y5(e.totalCostUsd)}),G.jsx(Ji,{label:"Avg Latency",value:wh(e.avgLatencySeconds,1,"s")}),G.jsx(Ji,{label:"Success Rate",value:V5(e.successRate)})]}),r.length>0&&G.jsxs("div",{className:"analytics-sub-section",children:[G.jsx("h4",{className:"analytics-sub-title",children:"Cost by Model"}),G.jsx(Lu,{data:r,dataKey:"cost",nameKey:"name",formatter:h=>`$${h.toFixed(2)}`})]}),r.length>0&&G.jsxs("div",{className:"analytics-sub-section",children:[G.jsx("h4",{className:"analytics-sub-title",children:"Per Model"}),G.jsxs("table",{className:"analytics-table",children:[G.jsx("thead",{children:G.jsxs("tr",{children:[G.jsx("th",{children:"Model"}),G.jsx("th",{children:"Count"}),G.jsx("th",{children:"Cost"}),G.jsx("th",{children:"Latency"}),G.jsx("th",{children:"Success"})]})}),G.jsx("tbody",{children:e.byModel.map(h=>G.jsxs("tr",{children:[G.jsx("td",{children:h.model}),G.jsx("td",{children:h.count}),G.jsx("td",{children:Y5(h.totalCost)}),G.jsx("td",{children:wh(h.avgLatency,1,"s")}),G.jsx("td",{children:V5(h.successRate)})]},h.model))})]})]}),(i.length>0||o.length>0)&&G.jsxs("div",{className:"analytics-charts-row",children:[i.length>0&&G.jsxs("div",{className:"analytics-sub-section analytics-chart-half",children:[G.jsx("h4",{className:"analytics-sub-title",children:"By Review Type"}),G.jsx(Lu,{data:i,dataKey:"value",nameKey:"name"})]}),o.length>0&&G.jsxs("div",{className:"analytics-sub-section analytics-chart-half",children:[G.jsx("h4",{className:"analytics-sub-title",children:"By Protocol"}),G.jsx(Lu,{data:o,dataKey:"value",nameKey:"name"})]})]})]})}function Dq({isActive:e}){const{data:t,error:r,loading:i,range:o,setRange:h,refresh:g}=t3(e),a=["24h","7d","30d","all"];return G.jsx("div",{className:"analytics-view",children:G.jsxs("div",{className:"analytics-content",children:[G.jsxs("div",{className:"analytics-header",children:[G.jsx("h2",{className:"analytics-title",children:"Analytics"}),G.jsxs("div",{className:"analytics-actions",children:[G.jsx("div",{className:"analytics-range-selector",children:a.map(c=>G.jsx("button",{className:`analytics-range-btn ${o===c?"active":""}`,onClick:()=>h(c),children:c==="all"?"All":c},c))}),G.jsx("button",{className:"work-btn work-btn-secondary",onClick:g,disabled:i,children:i?"Loading...":"Refresh"})]})]}),r&&!t&&G.jsx("div",{className:"analytics-error",children:r}),i&&!t&&G.jsx("div",{className:"analytics-loading",children:"Loading analytics..."}),t&&G.jsxs(G.Fragment,{children:[G.jsx(Oq,{activity:t.activity,errors:t.errors}),G.jsx(Tq,{consultation:t.consultation,errors:t.errors})]})]})})}function Rq(e){const[t,r]=z.useState(null),[i,o]=z.useState(null),[h,g]=z.useState(!1),a=z.useCallback(async()=>{g(!0),o(null);try{const f=await jD();r(f)}catch(f){o(f instanceof Error?f.message:"Failed to fetch team data")}finally{g(!1)}},[]);z.useEffect(()=>{e&&a()},[e,a]);const c=z.useCallback(()=>{a()},[a]);return{data:t,error:i,loading:h,refresh:c}}function kq({member:e}){const t=e.github_data,r=(t==null?void 0:t.assignedIssues.length)??0,i=(t==null?void 0:t.openPRs.length)??0,o=(t==null?void 0:t.recentActivity.mergedPRs.length)??0,h=(t==null?void 0:t.recentActivity.closedIssues.length)??0;return G.jsxs("div",{className:"team-member-card",children:[G.jsxs("div",{className:"team-member-header",children:[G.jsx("span",{className:"team-member-name",children:e.name}),G.jsx("span",{className:"team-member-role",children:e.role})]}),G.jsxs("a",{className:"team-member-github",href:`https://github.com/${e.github}`,target:"_blank",rel:"noopener noreferrer",children:["@",e.github]}),G.jsxs("div",{className:"team-member-stats",children:[G.jsxs("span",{title:"Assigned issues",children:[r," issues"]}),G.jsxs("span",{title:"Open PRs",children:[i," PRs"]})]}),(o>0||h>0)&&G.jsxs("div",{className:"team-member-activity",children:[o>0&&G.jsxs("span",{children:[o," merged"]}),h>0&&G.jsxs("span",{children:[h," closed"]}),G.jsx("span",{className:"team-activity-label",children:"last 7d"})]})]})}function Pq({message:e}){return G.jsxs("div",{className:"team-message",children:[G.jsxs("div",{className:"team-message-header",children:[G.jsx("span",{className:"team-message-author",children:e.author}),G.jsx("span",{className:"team-message-time",children:e.timestamp})]}),G.jsx("div",{className:"team-message-body",children:e.body})]})}function Bq({isActive:e}){const{data:t,error:r,loading:i,refresh:o}=Rq(e);if(i&&!t)return G.jsx("div",{className:"team-view",children:G.jsx("div",{className:"team-loading",children:"Loading team data..."})});if(r&&!t)return G.jsx("div",{className:"team-view",children:G.jsx("div",{className:"team-error",children:r})});if(!t||!t.enabled)return null;const h=t.members??[],a=[...t.messages??[]].reverse();return G.jsx("div",{className:"team-view",children:G.jsxs("div",{className:"team-content",children:[G.jsxs("div",{className:"team-header",children:[G.jsx("h2",{className:"team-title",children:"Team"}),G.jsx("button",{className:"team-refresh-btn",onClick:o,disabled:i,children:i?"Refreshing...":"Refresh"})]}),t.githubError&&G.jsx("div",{className:"team-error",children:t.githubError}),G.jsxs("div",{className:"team-section",children:[G.jsxs("h3",{className:"team-section-title",children:["Members (",h.length,")"]}),G.jsx("div",{className:"team-member-grid",children:h.map(c=>G.jsx(kq,{member:c},c.github))})]}),G.jsxs("div",{className:"team-section",children:[G.jsx("h3",{className:"team-section-title",children:"Messages"}),a.length===0?G.jsx("div",{className:"team-no-messages",children:"No messages yet"}):G.jsx("div",{className:"team-messages",children:a.map((c,f)=>G.jsx(Pq,{message:c},f))})]})]})})}function jq(e,t){const r=e==null?void 0:e.trim(),i=t==null?void 0:t.trim();return r&&i&&r.toLowerCase()!==i.toLowerCase()?`${i} on ${r} overview`:i?`${i} overview`:"overview"}function Iq(){const{state:e,refresh:t}=KD(),{tabs:r,activeTab:i,activeTabId:o,selectTab:h}=VD(e),g=s2(`(max-width: ${Q5}px)`),[a,c]=z.useState(null),[f,v]=z.useState(new Set),u=z.useRef(new Map),m=z.useCallback(async(M,D,k,B)=>{try{const R=await Ch(M,D,B);D&&D>0&&u.current.set(R.id,D),t()}catch(R){console.error("Failed to open file:",R)}},[t]),w=jq(e==null?void 0:e.hostname,e==null?void 0:e.workspaceName);z.useEffect(()=>{document.title=w},[w]);const[C]=z.useState(()=>new URLSearchParams(window.location.search).get("fullscreen")==="1");z.useEffect(()=>{if(!i)return;(i.type==="architect"||i.type==="builder"||i.type==="shell")&&v(D=>{if(D.has(i.id))return D;const k=new Set(D);return k.add(i.id),k})},[i==null?void 0:i.id,i==null?void 0:i.type]);const _=M=>{const D=Ov(M);return D?G.jsx(Pv,{wsPath:D,onFileOpen:m,persistent:M.persistent}):G.jsx("div",{className:"no-terminal",children:"No terminal session"})},d=M=>{if(!M.annotationId||!e)return G.jsx("div",{className:"no-terminal",children:"No file viewer"});if(!e.annotations.find(B=>B.id===M.annotationId))return G.jsx("div",{className:"no-terminal",children:"Annotation not found"});const k=u.current.get(M.annotationId);return k!==void 0&&u.current.delete(M.annotationId),G.jsx(JR,{tabId:M.annotationId,initialLine:k??M.initialLine})},y=M=>{const D=r.filter(k=>M.includes(k.type)&&f.has(k.id));return G.jsxs(G.Fragment,{children:[D.map(k=>{const B=Ov(k);return G.jsx("div",{className:"terminal-tab-pane",style:{display:o===k.id?void 0:"none"},children:B?G.jsx(Pv,{wsPath:B,onFileOpen:m,persistent:k.persistent}):G.jsx("div",{className:"no-terminal",children:"No terminal session"})},k.id)}),G.jsx("div",{style:{display:(i==null?void 0:i.type)==="work"?void 0:"none",height:"100%"},children:G.jsx(ZR,{state:e,onRefresh:t,onSelectTab:h})}),G.jsx("div",{style:{display:(i==null?void 0:i.type)==="analytics"?void 0:"none",height:"100%"},children:G.jsx(Dq,{isActive:(i==null?void 0:i.type)==="analytics"})}),(e==null?void 0:e.teamEnabled)&&G.jsx("div",{style:{display:(i==null?void 0:i.type)==="team"?void 0:"none",height:"100%"},children:G.jsx(Bq,{isActive:(i==null?void 0:i.type)==="team"})}),(i==null?void 0:i.type)==="file"&&d(i)]})};if(C)return i&&(i.type==="architect"||i.type==="builder"||i.type==="shell")?G.jsx("div",{className:"fullscreen-terminal",children:_(i)}):G.jsx("div",{className:"fullscreen-terminal"});if(g)return G.jsx("div",{className:"mobile-wrapper",children:G.jsx(QR,{tabs:r,activeTabId:o,onSelectTab:h,onRefresh:t,children:y(["architect","builder","shell"])})});const b=r.find(M=>M.type==="architect"),S=()=>{c(a==="right"?null:"left")},E=()=>{c(a==="left"?null:"right")},L=G.jsxs(G.Fragment,{children:[a!=="left"&&G.jsx("button",{className:"terminal-control-btn",onPointerDown:M=>M.preventDefault(),onClick:S,title:a==="right"?"Restore split layout":"Collapse architect panel","aria-label":a==="right"?"Restore split layout":"Collapse architect panel",children:G.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[G.jsx("line",{x1:"3",y1:"2",x2:"3",y2:"14"}),G.jsx("path",{d:"M12 5l-4 3 4 3"})]})}),a!=="right"&&G.jsx("button",{className:"terminal-control-btn",onPointerDown:M=>M.preventDefault(),onClick:E,title:"Collapse work panel","aria-label":"Collapse work panel",children:G.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[G.jsx("line",{x1:"13",y1:"2",x2:"13",y2:"14"}),G.jsx("path",{d:"M4 5l4 3-4 3"})]})})]}),x=b?Ov(b):null,O=x?G.jsx(Pv,{wsPath:x,onFileOpen:m,persistent:b.persistent,toolbarExtra:L}):G.jsx("div",{className:"no-architect",children:"No architect terminal"});return G.jsxs("div",{className:"app",children:[G.jsxs("header",{className:"app-header",children:[G.jsx("h1",{className:"app-title",children:w}),G.jsx("div",{className:"header-controls",children:(e==null?void 0:e.version)&&G.jsxs("span",{className:"header-version",children:["v",e.version]})})]}),G.jsx("div",{className:"app-body",children:G.jsx(XD,{left:O,right:G.jsxs("div",{className:"right-panel",children:[G.jsx(a2,{tabs:r.filter(M=>M.type!=="architect"),activeTabId:o,onSelectTab:h,onRefresh:t}),G.jsx("div",{className:"tab-content",role:"tabpanel",children:y(["builder","shell"])})]}),collapsedPane:a,onExpandLeft:()=>c(null),onExpandRight:()=>c(null)})})]})}RD.createRoot(document.getElementById("root")).render(G.jsx(z.StrictMode,{children:G.jsx(Iq,{})}));
|
|
194
|
-
//# sourceMappingURL=index-
|
|
194
|
+
//# sourceMappingURL=index-1OFuumc_.js.map
|