agmon 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/fallback-build-manifest.json +3 -3
- package/.next/prerender-manifest.json +8 -8
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +16 -15
- package/.next/server/app/_not-found.segments/_full.segment.rsc +16 -15
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +8 -7
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/media/route.js.nft.json +1 -1
- package/.next/server/app/api/reports/tokens/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/transcript/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/transcript/route.js.nft.json +1 -1
- package/.next/server/app/api/traces/stream/route.js +1 -1
- package/.next/server/app/api/traces/stream/route.js.nft.json +1 -1
- package/.next/server/app/api/version/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/file-content/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
- package/.next/server/app/chat/page.js.nft.json +1 -1
- package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
- package/.next/server/app/chat.html +1 -1
- package/.next/server/app/chat.rsc +4 -4
- package/.next/server/app/chat.segments/_full.segment.rsc +4 -4
- package/.next/server/app/chat.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/chat.segments/chat/__PAGE__.segment.rsc +6 -5
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +5 -5
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +7 -6
- package/.next/server/app/index.segments/_full.segment.rsc +5 -5
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/reports/page.js.nft.json +1 -1
- package/.next/server/app/reports/page_client-reference-manifest.js +1 -1
- package/.next/server/app/reports.html +1 -1
- package/.next/server/app/reports.rsc +2 -2
- package/.next/server/app/reports.segments/_full.segment.rsc +2 -2
- package/.next/server/app/reports.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/reports.segments/reports/__PAGE__.segment.rsc +4 -3
- package/.next/server/app/store/page.js.nft.json +1 -1
- package/.next/server/app/store/page_client-reference-manifest.js +1 -1
- package/.next/server/app/store.html +1 -1
- package/.next/server/app/store.rsc +2 -2
- package/.next/server/app/store.segments/_full.segment.rsc +2 -2
- package/.next/server/app/store.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/store.segments/store/__PAGE__.segment.rsc +4 -3
- package/.next/server/chunks/[root-of-the-server]__0dw97_pahi8uf._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0dw97_pahi8uf._.js.map +1 -0
- package/.next/server/chunks/_0ao-_t4jkb46h._.js +2 -2
- package/.next/server/chunks/_0ao-_t4jkb46h._.js.map +1 -1
- package/.next/server/chunks/_1-8ipqazoyrrk._.js +1 -1
- package/.next/server/chunks/_1-8ipqazoyrrk._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1jwplflwix8wi._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1jwplflwix8wi._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1kt7h7bz59mdn._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1kt7h7bz59mdn._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1otsvjy81s8my._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1otsvjy81s8my._.js.map +1 -1
- package/.next/server/chunks/ssr/{_0--937zhi743v._.js → _0zel-n0h--cnl._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0jla9ugf1y6rb._.js → node_modules_01avo0bde3tpo._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0sjdrli5douui._.js → node_modules_01l0208e5kqic._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0lqovp8j8ld76._.js → node_modules_033x29yqle_sj._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_05i69rc9pwcdx._.js → node_modules_03wbg__aslvui._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1ltys5mwtcv-n._.js → node_modules_08-bqkrz7sh0l._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_09v49jhajmvl4._.js → node_modules_089w9jm7s2qa3._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0z1e37smavebg._.js → node_modules_0cy47-s63xjzh._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0dw0vozejrnml._.js → node_modules_0czh0jcnsm5e6._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0e3njj436xau-._.js → node_modules_0fv321j1nslkb._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0d2ios01ot1in._.js → node_modules_0g-wb7h-hsdwc._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1l46or7mgko0z._.js → node_modules_0oz_zzlh8exwx._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0b8zi3pbl-y9n._.js → node_modules_0so2agzqd9p8l._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1wew4nn7i1uup._.js → node_modules_0w2w61b8bh769._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_07bjxeq9dfgn1._.js → node_modules_0wd6szix_zku7._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1aqaelh-8fme6._.js → node_modules_0wp7omf0xblv8._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0xh8tnq1niblb._.js → node_modules_10c51o2qv6mbi._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1d4sreyq0ubqg._.js → node_modules_19vqq7rvf-_ar._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1e_nc2eyg4djz._.js → node_modules_1hu83gui7_nj2._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1zbmc81s-4zsm._.js → node_modules_1j8hpoiygrs5e._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1pquu5wprusnc._.js → node_modules_1n4kig4mj6n4s._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1st9dwe66yx93._.js → node_modules_1s8oxeqa5_i3k._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_01p9ctt-n2dxp._.js → node_modules_1xz1dstlo5ri-._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0kqo9zl9cgwbo._.js → node_modules_katex_dist_katex_mjs_067omoj5szuys._.js} +1 -1
- package/.next/server/chunks/ssr/src_app_page_1vqfk0-j72fp6.js +1 -1
- package/.next/server/chunks/ssr/src_app_page_1vqfk0-j72fp6.js.map +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/preview-props.json +3 -3
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/0jo6fy2c_gmqn.js +1 -0
- package/.next/static/chunks/2q9cwykv6ox1t.css +1 -0
- package/.next/static/chunks/{3og0e9qcff393.js → 2zf44j8sjo0w0.js} +4 -4
- package/.next/trace +1 -1
- package/.next/trace-build +1 -1
- package/package.json +1 -1
- package/src/app/api/traces/stream/route.js +41 -5
- package/src/app/layout.js +2 -1
- package/src/app/page.js +17 -1
- package/src/components/chat/SessionChatView.js +1 -1
- package/src/components/factory/office-canvas.js +32 -1
- package/src/components/layout/BottomPanel.jsx +6 -6
- package/src/components/layout/LeftSidebar.jsx +62 -4
- package/src/components/layout/StatusBar.jsx +1 -1
- package/src/components/layout/TitleBar.jsx +71 -1
- package/src/components/layout/VSCodeWorkbench.jsx +21 -0
- package/src/lib/mockTraces.js +13 -11
- package/src/lib/parsers/codexParser.js +373 -0
- package/src/lib/parsers/transcriptParser.js +35 -3
- package/src/lib/useFactoryTraces.js +70 -5
- package/src/lib/watchers/antigravityWatcher.js +15 -1
- package/src/lib/watchers/claudeWatcher.js +64 -53
- package/src/lib/watchers/codexWatcher.js +482 -0
- package/src/lib/watchers/watcherManager.js +46 -30
- package/.next/server/chunks/src_lib_watchers_antigravityWatcher_0w1-atg39y__p.js +0 -3
- package/.next/server/chunks/src_lib_watchers_antigravityWatcher_0w1-atg39y__p.js.map +0 -1
- package/.next/static/chunks/17jorrh_pfel_.js +0 -1
- package/.next/static/chunks/25l0z48vlvdu4.css +0 -1
- /package/.next/server/chunks/ssr/{_0--937zhi743v._.js.map → _0zel-n0h--cnl._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0jla9ugf1y6rb._.js.map → node_modules_01avo0bde3tpo._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0sjdrli5douui._.js.map → node_modules_01l0208e5kqic._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0lqovp8j8ld76._.js.map → node_modules_033x29yqle_sj._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_05i69rc9pwcdx._.js.map → node_modules_03wbg__aslvui._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1ltys5mwtcv-n._.js.map → node_modules_08-bqkrz7sh0l._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_09v49jhajmvl4._.js.map → node_modules_089w9jm7s2qa3._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0z1e37smavebg._.js.map → node_modules_0cy47-s63xjzh._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0dw0vozejrnml._.js.map → node_modules_0czh0jcnsm5e6._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0e3njj436xau-._.js.map → node_modules_0fv321j1nslkb._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0d2ios01ot1in._.js.map → node_modules_0g-wb7h-hsdwc._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0xh8tnq1niblb._.js.map → node_modules_0oz_zzlh8exwx._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_0b8zi3pbl-y9n._.js.map → node_modules_0so2agzqd9p8l._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1wew4nn7i1uup._.js.map → node_modules_0w2w61b8bh769._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_07bjxeq9dfgn1._.js.map → node_modules_0wd6szix_zku7._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1aqaelh-8fme6._.js.map → node_modules_0wp7omf0xblv8._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1d4sreyq0ubqg._.js.map → node_modules_10c51o2qv6mbi._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1l46or7mgko0z._.js.map → node_modules_19vqq7rvf-_ar._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1e_nc2eyg4djz._.js.map → node_modules_1hu83gui7_nj2._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1zbmc81s-4zsm._.js.map → node_modules_1j8hpoiygrs5e._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1pquu5wprusnc._.js.map → node_modules_1n4kig4mj6n4s._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_1st9dwe66yx93._.js.map → node_modules_1s8oxeqa5_i3k._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_01p9ctt-n2dxp._.js.map → node_modules_1xz1dstlo5ri-._.js.map} +0 -0
- /package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0kqo9zl9cgwbo._.js.map → node_modules_katex_dist_katex_mjs_067omoj5szuys._.js.map} +0 -0
- /package/.next/static/{1y6Da0YgnPr2_6ncpWrbV → dGN2VKPk5TJgezxS3JvRc}/_buildManifest.js +0 -0
- /package/.next/static/{1y6Da0YgnPr2_6ncpWrbV → dGN2VKPk5TJgezxS3JvRc}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{1y6Da0YgnPr2_6ncpWrbV → dGN2VKPk5TJgezxS3JvRc}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[85690,a=>{"use strict";let b,c,d,e;var f,g,h=a.i(87924),i=a.i(72131),j=a.i(28423),k=a.i(63359),l=a.i(33838);function m(a){let b=(0,i.useId)();return`${a??b}`}let n=i.useEffect;function o(a){let b=(0,i.useRef)(a);return n(()=>{b.current=a},[a]),(0,i.useCallback)((...a)=>b.current?.(...a),[b])}function p(...a){return o(b=>{a.forEach(a=>{if(a)switch(typeof a){case"function":a(b);break;case"object":a.current=b}})})}function q(a,b="Assertion error"){if(!a)throw Error(b)}(0,i.createContext)(null);class r{#a={};addListener(a,b){let c=this.#a[a];return void 0===c?this.#a[a]=[b]:c.includes(b)||c.push(b),()=>{this.removeListener(a,b)}}emit(a,b){let c=this.#a[a];if(void 0!==c)if(1===c.length)c[0].call(null,b);else{let a=!1,d=null,e=Array.from(c);for(let c=0;c<e.length;c++){let f=e[c];try{f.call(null,b)}catch(b){null===d&&(a=!0,d=b)}}if(a)throw d}}removeAllListeners(){this.#a={}}removeListener(a,b){let c=this.#a[a];if(void 0!==c){let a=c.indexOf(b);a>=0&&c.splice(a,1)}}}let s={cursorFlags:0,state:"inactive"},t=new r;function u(a){return t.addListener("change",a)}function v(a){let b=s;s=a,"active"===b.state&&"active"!==a.state&&b.didPointerMove&&b.hitRegions.forEach(({separator:a})=>{a&&a.element.ownerDocument.activeElement===a.element&&a.element.blur()}),t.emit("change",{prev:b,next:a})}let w=a=>a,x=()=>{};function y(){return void 0===c&&(c=!1),c}let z=new WeakMap;function A(a){if(!a.defaultView||!a.adoptedStyleSheets)return;let{prevStyle:b,styleSheet:c}=z.get(a)??{};void 0===c&&(c=new a.defaultView.CSSStyleSheet,a.adoptedStyleSheets&&(Object.isExtensible(a.adoptedStyleSheets)?a.adoptedStyleSheets.push(c):a.adoptedStyleSheets=[...a.adoptedStyleSheets,c]));let d=s;switch(d.state){case"active":case"hover":{let a=function({cursorFlags:a,axes:b,state:c}){let d=0,e=0;switch(c){case"active":case"hover":b.forEach(a=>{if(!a.mutableState.disableCursor)switch(a.orientation){case"horizontal":d++;break;case"vertical":e++}})}if(0!==d||0!==e){if("active"===c&&a&&y()){let b=(4&a)!=0,c=(8&a)!=0;if((1&a)!=0)return b?"se-resize":c?"ne-resize":"e-resize";if((2&a)!=0)return b?"sw-resize":c?"nw-resize":"w-resize";if(b)return"s-resize";if(c)return"n-resize"}return y()?d>0&&e>0?"move":d>0?"ew-resize":"ns-resize":d>0&&e>0?"grab":d>0?"col-resize":"row-resize"}}({cursorFlags:d.cursorFlags,axes:d.hitRegions.map(a=>a.axis),state:d.state}),e=`*, *:hover {cursor: ${a} !important; }`;if(b===e)return;b=e,a?0===c.cssRules.length?c.insertRule(e):c.replaceSync(e):1===c.cssRules.length&&c.deleteRule(0);break}case"inactive":b=void 0,1===c.cssRules.length&&c.deleteRule(0)}z.set(a,{prevStyle:b,styleSheet:c})}function B({axis:a}){let{layoutStrategy:b,orientation:c,items:d}=a;return b?b.calculateAvailableSize():d.reduce((a,b)=>a+="horizontal"===c?b.element.offsetWidth:b.element.offsetHeight,0)}function C(a,b){let c=a.compareDocumentPosition(b);return c&Node.DOCUMENT_POSITION_DISCONNECTED?0:c&Node.DOCUMENT_POSITION_FOLLOWING?-1:c&Node.DOCUMENT_POSITION_PRECEDING?1:0}function D(a,b){return Array.from(b).sort((b,c)=>{var d,e,f,g;let h,i,j="horizontal"===a?(d=b,e=c,0!=(h=d.element.offsetLeft-e.element.offsetLeft)?h:d.element.offsetWidth-e.element.offsetWidth):(f=b,g=c,0!=(i=f.element.offsetTop-g.element.offsetTop)?i:f.element.offsetHeight-g.element.offsetHeight);return 0!==j?j:C(b.element,c.element)})}function E(a){return null!==a&&"object"==typeof a&&"nodeType"in a&&a.nodeType===Node.ELEMENT_NODE}function F(a,b){return{x:a.x>=b.left&&a.x<=b.right?0:Math.min(Math.abs(a.x-b.left),Math.abs(a.x-b.right)),y:a.y>=b.top&&a.y<=b.bottom?0:Math.min(Math.abs(a.y-b.top),Math.abs(a.y-b.bottom))}}function G({expandHitTargets:a=!0,axis:c,includeDisabled:d=!1}){if(c.layoutStrategy)return c.layoutStrategy.calculateHitRegions({expandHitTargets:a,axis:c,includeDisabled:d});let{element:e,orientation:f,items:g,separators:h}=c,i=D(f,Array.from(e.children).filter(E).filter(a=>!a.hasAttribute("data-resize-preview")).map(a=>({element:a}))).map(({element:a})=>a),j=[],k=!1,l=!1,m=-1,n,o=-1,p=0,r,s=[];{let a=-1;for(let b of i)b.hasAttribute("data-panel")&&(a++,b.hasAttribute("data-disabled")||(p++,-1===m&&(m=a),o=a))}if(d||p>1){let e=-1;for(let p of i)if(p.hasAttribute("data-panel")){e++;let h=g.find(a=>a.element===p);if(h){if(r){let g,i=r.element.getBoundingClientRect(),t=p.getBoundingClientRect();if(l){let a="horizontal"===f?new DOMRect(i.right,i.top,0,i.height):new DOMRect(i.left,i.bottom,i.width,0),b="horizontal"===f?new DOMRect(t.left,t.top,0,t.height):new DOMRect(t.left,t.top,t.width,0);switch(s.length){case 0:g=[a,b];break;case 1:{let c=s[0],d=function({orientation:a,rects:b,targetRect:c}){let d={x:c.x+c.width/2,y:c.y+c.height/2},e,f=Number.MAX_VALUE;for(let c of b){let{x:b,y:g}=F(d,c),h="horizontal"===a?b:g;h<f&&(f=h,e=c)}return q(e,"No rect found"),e}({orientation:f,rects:[i,t],targetRect:c.element.getBoundingClientRect()});g=[c,d===i?b:a];break}default:g=s}}else g=s.length?s:["horizontal"===f?new DOMRect(i.right,t.top,t.left-i.right,t.height):new DOMRect(t.left,i.bottom,t.width,t.top-i.bottom)];for(let f of g){let g=function({expandHitTargets:a,axis:c,rect:d}){let e=a?(void 0===b&&(b="function"==typeof matchMedia&&!!matchMedia("(pointer:coarse)").matches),b)?c.resizeTargetMinimumSize.coarse:c.resizeTargetMinimumSize.fine:0;if(d.width<e){let a=e-d.width;d=new DOMRect(d.x-a/2,d.y,d.width+a,d.height)}if(d.height<e){let a=e-d.height;d=new DOMRect(d.x,d.y-a/2,d.width,d.height+a)}return d}({expandHitTargets:a,axis:c,rect:"width"in f?f:f.element.getBoundingClientRect()}),i=e<=m||e>o;!d&&(k||i)||(n??=B({axis:c}),j.push({axis:c,axisSize:n,items:[r,h],separator:"width"in f?void 0:f,rect:g})),k=!1}}l=!1,r=h,s=[]}}else if(p.hasAttribute("data-separator")){null!==p.ariaDisabled&&(k=!0);let a=h.find(a=>a.element===p);a?s.push(a):(r=void 0,s=[])}else l=!0}return j}function H({axisSize:a,itemElement:b,styleProp:c}){let d,[e,f]=function(a){switch(typeof a){case"number":return[a,"px"];case"string":{let b=parseFloat(a);return a.endsWith("%")?[b,"%"]:a.endsWith("px")?[b,"px"]:a.endsWith("rem")?[b,"rem"]:a.endsWith("em")?[b,"em"]:a.endsWith("vh")?[b,"vh"]:a.endsWith("vw")?[b,"vw"]:[b,"%"]}}}(c);switch(f){case"%":d=e/100*a;break;case"px":d=e;break;case"rem":d=e*parseFloat(getComputedStyle(b.ownerDocument.documentElement).fontSize);break;case"em":d=e*parseFloat(getComputedStyle(b).fontSize);break;case"vh":d=e/100*window.innerHeight;break;case"vw":d=e/100*window.innerWidth}return d}function I(a){return parseFloat(a.toFixed(3))}function J(a){let{items:b}=a,c=B({axis:a});return 0===c?b.map(a=>({groupResizeBehavior:a.constraintProps.groupResizeBehavior,collapsedSize:0,collapsible:!0===a.constraintProps.collapsible,defaultSize:void 0,disabled:a.constraintProps.disabled,minSize:0,maxSize:100,itemId:a.id})):b.map(a=>{let b,d,{element:e,constraintProps:f}=a,g=0;void 0!==f.collapsedSize&&(g=I(H({axisSize:c,itemElement:e,styleProp:f.collapsedSize})/c*100)),void 0!==f.collapsedThreshold&&(b=I(H({axisSize:c,itemElement:e,styleProp:f.collapsedThreshold})/c*100)),void 0!==f.defaultSize&&(d=I(H({axisSize:c,itemElement:e,styleProp:f.defaultSize})/c*100));let h=0;void 0!==f.minSize&&(h=I(H({axisSize:c,itemElement:e,styleProp:f.minSize})/c*100));let i=100;return void 0!==f.maxSize&&(i=I(H({axisSize:c,itemElement:e,styleProp:f.maxSize})/c*100)),{groupResizeBehavior:f.groupResizeBehavior,collapsedSize:g,collapsedThreshold:b,collapsible:!0===f.collapsible,defaultSize:d,disabled:f.disabled,minSize:h,maxSize:i,itemId:a.id}})}let K=new Map,L=new r;function M(a,b){for(let[b]of K)if(b.id===a)return b}function N(a,b){for(let[b,c]of K)if(b.id===a)return c;if(b)throw Error(`Could not find data for Group with id ${a}`)}function O(a,b){return L.addListener("axisChange",c=>{c.axis.id===a&&b(c)})}function P(a,b,c){let d=K.get(a);(K=new Map(K)).set(a,b),L.emit("axisChange",{axis:a,isUserInteraction:c?.isUserInteraction===!0,prev:d,next:b})}function Q(a,b,c=0){return Math.abs(I(a)-I(b))<=c}function R(a,b){return Q(a,b)?0:a>b?1:-1}function S({overrideDisabledItems:a,itemConstraints:b,prevSize:c,size:d}){let{collapsedSize:e=0,collapsedThreshold:f,collapsible:g,disabled:h,maxSize:i=100,minSize:j=0}=b;if(h&&!a)return c;if(0>R(d,j))if(g){let a=f??(j-e)/2,b=0>=R(c,e),g=R(d,b?e+a:j-a);d=0>=R(d,e)||g<0||void 0!==f&&b&&0===g?e:j}else d=j;return I(d=Math.min(i,d))}function T({delta:a,initialLayout:b,itemConstraints:c,pivotIndices:d,prevLayout:e,trigger:f}){if(Q(a,0))return b;let g="imperative-api"===f,h=c.map(({itemId:a})=>b[a]),i=c.map(({itemId:a})=>e[a]),j=[...h],[k,l]=d;q(null!=k,"Invalid first pivot index"),q(null!=l,"Invalid second pivot index");let m=0;if("keyboard"===f){{let b=a<0?l:k,d=c[b];q(d,`Panel constraints not found for index ${b}`);let{collapsedSize:e=0,collapsible:f,minSize:g=0}=d;if(f){let c=h[b];if(q(null!=c,`Previous layout not found for panel index ${b}`),Q(c,e)){let b=g-c;R(b,Math.abs(a))>0&&(a=a<0?0-b:b)}}}{let b=a<0?k:l,d=c[b];q(d,`No panel constraints found for index ${b}`);let{collapsedSize:e=0,collapsible:f,minSize:g=0}=d;if(f){let c=h[b];if(q(null!=c,`Previous layout not found for panel index ${b}`),Q(c,g)){let b=c-e;R(b,Math.abs(a))>0&&(a=a<0?0-b:b)}}}}else{let b=a<0?l:k,d=c[b];q(d,`Panel constraints not found for index ${b}`);let e=h[b],{collapsedSize:f,collapsedThreshold:g,collapsible:i,minSize:j}=d;if(i&&0>R(e,j)){let b=j-f;if(0>R(e+Math.abs(a),j)){let c=R(Math.abs(a),g??b/2),d=void 0===g&&a<0;a=c>0||0===c&&d?a<0?-b:b:0}}}{let b=a<0?1:-1,d=a<0?l:k,e=0;for(;;){let a=h[d];if(q(null!=a,`Previous layout not found for panel index ${d}`),e+=S({overrideDisabledItems:g,itemConstraints:c[d],prevSize:a,size:100})-a,(d+=b)<0||d>=c.length)break}let f=Math.min(Math.abs(a),Math.abs(e));a=a<0?0-f:f}{let b=a<0?k:l;for(;b>=0&&b<c.length;){let d=Math.abs(a)-Math.abs(m),e=h[b];q(null!=e,`Previous layout not found for panel index ${b}`);let f=e-d,i=S({overrideDisabledItems:g,itemConstraints:c[b],prevSize:e,size:f});if(!Q(e,i)&&(m+=e-i,j[b]=i,m.toFixed(3).localeCompare(Math.abs(a).toFixed(3),void 0,{numeric:!0})>=0))break;a<0?b--:b++}}if(function(a,b){if(a.length!==b.length)return!1;for(let c=0;c<a.length;c++)if(a[c]!=b[c])return!1;return!0}(i,j))return e;{let b=a<0?l:k,d=h[b];q(null!=d,`Previous layout not found for panel index ${b}`);let e=d+m,f=S({overrideDisabledItems:g,itemConstraints:c[b],prevSize:d,size:e});if(j[b]=f,!Q(f,e)){let b=e-f,d=a<0?l:k;for(;d>=0&&d<c.length;){let e=j[d];q(null!=e,`Previous layout not found for panel index ${d}`);let f=e+b,h=S({overrideDisabledItems:g,itemConstraints:c[d],prevSize:e,size:f});if(Q(e,h)||(b-=h-e,j[d]=h),Q(b,0))break;a>0?d--:d++}}}return Q(Object.values(j).reduce((a,b)=>b+a,0),100,.1)?j.reduce((a,b,d)=>(a[c[d].itemId]=b,a),{}):e}function U(a,b){if(Object.keys(a).length!==Object.keys(b).length)return!1;for(let c in a)if(void 0===b[c]||0!==R(a[c],b[c]))return!1;return!0}function V({commit:a,document:b,event:c,hitRegions:d,initialLayoutMap:e,mountedAxes:f,pointerDownAtPoint:g,prevCursorFlags:h}){let i=0,j=s,k="active"===j.state?j.previews:[],l=new Map("active"===j.state?j.previewLayoutMap:void 0);d.forEach(b=>{let{axis:d,axisSize:h}=b,{orientation:j,items:m}=d;if(a&&"separator"!==d.resizePreviewMode)return;let{disableCursor:n}=d.mutableState,o=0;o=g?"horizontal"===j?(c.clientX-g.x)/h*100:(c.clientY-g.y)/h*100:"horizontal"===j?c.clientX<0?-100:100:c.clientY<0?-100:100;let p=e.get(d),q=f.get(d);if(!p||!q)return;let{defaultLayoutDeferred:r,derivedItemConstraints:s,axisSize:t,layout:u,separatorToItems:v}=q;if(s&&u&&v){let c="separator"===d.resizePreviewMode?l.get(d)??u:u,e=T({delta:o,initialLayout:p,itemConstraints:s,pivotIndices:b.items.map(a=>m.indexOf(a)),prevLayout:c,trigger:"mouse-or-touch"});if("separator"===d.resizePreviewMode&&!a&&!U(e,c)){l.set(d,e);let a=0,b=m.map(b=>h/100*(a+=e[b.id]-p[b.id]));k=k.map(a=>{if(a.axis!==d)return a;let c=b[a.itemIndex];return c===a.offset?a:{...a,offset:c}})}if(U(e,c)&&0!==o&&!n)switch(j){case"horizontal":i|=o<0?1:2;break;case"vertical":i|=o<0?4:8}("separator"!==d.resizePreviewMode||a)&&!U(e,u)&&P(b.axis,{defaultLayoutDeferred:r,derivedItemConstraints:s,axisSize:t,layout:e,requestedAxisSize:t,requestedLayout:e,separatorToItems:v})}});let m=0;0===c.movementX?m|=3&h:m|=3&i,0===c.movementY?m|=12&h:m|=12&i;let n="active"===j.state&&(c.clientX!==j.pointerDownAtPoint.x||c.clientY!==j.pointerDownAtPoint.y);(function(a,b=[],c,d=!1){let e=s,f={...s};f.cursorFlags=a,"active"===f.state&&(f.didPointerMove||=d,f.previews=b,c&&(f.previewLayoutMap=c)),s=f,t.emit("change",{prev:e,next:f})})(m,k,l,n),A(b)}function W(a,b){let c=s,d=K,e=!1;return"active"===c.state&&(V({commit:!0,document:a,event:b,hitRegions:c.hitRegions,initialLayoutMap:c.initialLayoutMap,mountedAxes:d,pointerDownAtPoint:c.pointerDownAtPoint,prevCursorFlags:c.cursorFlags}),v({cursorFlags:0,state:"inactive"}),c.hitRegions.length>0&&(A(a),e=!0,c.hitRegions.forEach(a=>{if(!d.has(a.axis))return;let b=N(a.axis.id,!0);P(a.axis,b,{isUserInteraction:!0})}))),e}function X(a){a.defaultPrevented||W(a.currentTarget,a)}let Y=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Z(a){let b=a.length;for(;b--;){let c=a[b];if(q(c,"Missing node"),function(a){let b,c=getComputedStyle(a);return!!("fixed"===c.position||"auto"!==c.zIndex&&("static"!==c.position||"flex"===(b=getComputedStyle(aa(a)??a).display)||"inline-flex"===b)||1>+c.opacity||"transform"in c&&"none"!==c.transform||"webkitTransform"in c&&"none"!==c.webkitTransform||"mixBlendMode"in c&&"normal"!==c.mixBlendMode||"filter"in c&&"none"!==c.filter||"webkitFilter"in c&&"none"!==c.webkitFilter||"isolation"in c&&"isolate"===c.isolation||Y.test(c.willChange)||"touch"===c.webkitOverflowScrolling)}(c))return c}return null}function $(a){return a&&Number(getComputedStyle(a).zIndex)||0}function _(a){let b=[];for(;a;)b.push(a),a=aa(a);return b}function aa(a){let{parentNode:b}=a;return null!==b&&"object"==typeof b&&"nodeType"in b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}function ab(a,b){let c=[];return b.forEach((b,d)=>{if(d.disabled)return;let e=G({axis:d}),f=function(a,b,c){let d,e={x:1/0,y:1/0};for(let f of b){let b=F(c,f.rect);switch(a){case"horizontal":(b.x<e.x||b.x===e.x&&b.y<=e.y)&&(d=f,e=b);break;case"vertical":(b.y<e.y||b.y===e.y&&b.x<=e.x)&&(d=f,e=b)}}return d?{distance:e,hitRegion:d}:void 0}(d.orientation,e,{x:a.clientX,y:a.clientY});f&&f.distance.x<=0&&f.distance.y<=0&&function({axisElement:a,hitRegion:b,pointerEventTarget:c}){if(E(c)){let b=c.closest("dialog");if(b&&!b.contains(a)&&function(a){try{return a.matches(":modal")}catch{return!1}}(b))return!1}if(!E(c)||c.contains(a)||a.contains(c))return!0;if(function(a,b){let c;if(a===b)throw Error("Cannot compare node with itself");let d={a:_(a),b:_(b)};for(;d.a.at(-1)===d.b.at(-1);)c=d.a.pop(),d.b.pop();q(c,"Stacking order can only be calculated for elements with a common ancestor");let e={a:$(Z(d.a)),b:$(Z(d.b))};if(e.a===e.b){let a=c.childNodes,b={a:d.a.at(-1),b:d.b.at(-1)},e=a.length;for(;e--;){let c=a[e];if(c===b.a)return 1;if(c===b.b)return -1}}return Math.sign(e.a-e.b)}(c,a)>0){let e=c;for(;e;){var d;if(e.contains(a))break;if(d=e.getBoundingClientRect(),d.x<b.x+b.width&&d.x+d.width>b.x&&d.y<b.y+b.height&&d.y+d.height>b.y)return!1;e=e.parentElement}}return!0}({axisElement:d.element,hitRegion:f.hitRegion.rect,pointerEventTarget:a.target})&&c.push(f.hitRegion)}),c}function ac({layout:a,itemConstraints:b}){let c=b.map(({itemId:b})=>a[b]),d=[...c],e=d.reduce((a,b)=>a+b,0);if(Object.keys(a).length!==b.length)throw Error(`Invalid ${b.length} panel layout: ${Object.values(a).map(a=>`${a}%`).join(", ")}`);if(!Q(e,100)&&d.length>0)for(let a=0;a<b.length;a++){let b=d[a];q(null!=b,`No layout data found for index ${a}`);let c=100/e*b;d[a]=c}let f=0;for(let a=0;a<b.length;a++){let e=c[a];q(null!=e,`No layout data found for index ${a}`);let g=d[a];q(null!=g,`No layout data found for index ${a}`);let h=S({overrideDisabledItems:!0,itemConstraints:b[a],prevSize:e,size:g});g!=h&&(f+=g-h,d[a]=h)}if(!Q(f,0))for(let a=0;a<b.length;a++){let c=d[a];q(null!=c,`No layout data found for index ${a}`);let e=c+f,g=S({overrideDisabledItems:!0,itemConstraints:b[a],prevSize:c,size:e});if(c!==g&&(f-=g-c,d[a]=g,Q(f,0)))break}return d.reduce((a,c,d)=>(a[b[d].itemId]=c,a),{})}function ad({axisId:a,itemId:b}){let c=()=>{for(let[b,{defaultLayoutDeferred:c,derivedItemConstraints:d,layout:e,axisSize:f,separatorToItems:g}]of K)if(b.id===a)return{defaultLayoutDeferred:c,derivedItemConstraints:d,axis:b,axisSize:f,layout:e,separatorToItems:g};throw Error(`Group ${a} not found`)},d=()=>{let a=c().derivedItemConstraints.find(a=>a.itemId===b);if(void 0!==a)return a;throw Error(`Panel constraints not found for Panel ${b}`)},e=()=>{let a=c().axis.items.find(a=>a.id===b);if(void 0!==a)return a;throw Error(`Layout not found for Panel ${b}`)},f=()=>{let a=c().layout[b];if(void 0!==a)return a;throw Error(`Layout not found for Panel ${b}`)},g=a=>{if(a===f())return;let{defaultLayoutDeferred:d,derivedItemConstraints:e,axis:g,axisSize:h,layout:i,separatorToItems:j}=c(),k=ac({layout:(({nextSize:a,items:c,prevLayout:d,derivedItemConstraints:e})=>{let g=f(),h=c.findIndex(a=>a.id===b),i=0===h,j=h===c.length-1;if(j&&a<g&&(i||c.slice(0,h).every((a,b)=>{let c=e[b];return c?.collapsible&&Q(c.collapsedSize,d[c.itemId])}))){let a=c.slice(0,h).reduce((a,b)=>a+d[b.id],0);return{...d,[b]:I(100-a)}}return T({delta:j?g-a:a-g,initialLayout:d,itemConstraints:e,pivotIndices:j?[h-1,h]:[h,h+1],prevLayout:d,trigger:"imperative-api"})})({nextSize:a,items:g.items,prevLayout:i,derivedItemConstraints:e}),itemConstraints:e});U(i,k)||P(g,{defaultLayoutDeferred:d,derivedItemConstraints:e,axisSize:h,layout:k,requestedAxisSize:h,requestedLayout:k,separatorToItems:j})};return{collapse:()=>{let{collapsible:a,collapsedSize:b}=d(),{mutableValues:c}=e(),h=f();a&&h!==b&&(c.expandToSize=h,g(b))},expand:()=>{let{collapsible:a,collapsedSize:b,minSize:c}=d(),{mutableValues:h}=e(),i=f();if(a&&i===b){let a=h.expandToSize??c;0===a&&(a=1),g(a)}},getSize:()=>{let{axis:a}=c(),d=f(),{element:g}=e();return{asPercentage:d,inPixels:a.layoutStrategy?a.layoutStrategy.getItemSizeInPixels(b):"horizontal"===a.orientation?g.offsetWidth:g.offsetHeight}},isCollapsed:()=>{let{collapsible:a,collapsedSize:b}=d(),c=f();return a&&Q(b,c)},resize:a=>{let{axis:b}=c(),{element:d}=e(),f=B({axis:b});g(I(H({axisSize:f,itemElement:d,styleProp:a})/f*100))}}}function ae(a){a.defaultPrevented||ab(a,K).forEach(b=>{if(b.separator&&!b.separator.disableDoubleClick){let c=b.items.find(a=>void 0!==a.constraintProps.defaultSize);if(c){let d=c.constraintProps.defaultSize,e=ad({axisId:b.axis.id,itemId:c.id});e&&void 0!==d&&(e.resize(d),a.preventDefault())}}})}function af(a){for(let[b]of K)if(b.separators.some(b=>b.element===a))return b;throw Error("Could not find parent Group for separator element")}function ag({axisId:a}){let b=()=>{for(let[b,c]of K)if(b.id===a)return{axis:b,...c};throw Error(`Could not find Group with id "${a}"`)};return{getLayout(){let{defaultLayoutDeferred:a,layout:c}=b();return a?{}:c},setLayout(a){let{defaultLayoutDeferred:c,derivedItemConstraints:d,axis:e,axisSize:f,layout:g,separatorToItems:h}=b(),i=ac({layout:a,itemConstraints:d});return c?g:(U(g,i)||P(e,{defaultLayoutDeferred:c,derivedItemConstraints:d,axisSize:f,layout:i,requestedAxisSize:f,requestedLayout:i,separatorToItems:h}),i)}}}function ah(a,b){let c=af(a),d=N(c.id,!0),e=c.separators.find(b=>b.element===a);q(e,"Matching separator not found");let f=d.separatorToItems.get(e);q(f,"Matching panels not found");let g=f.map(a=>c.items.indexOf(a)),h=ag({axisId:c.id}).getLayout(),i=ac({layout:T({delta:b,initialLayout:h,itemConstraints:d.derivedItemConstraints,pivotIndices:g,prevLayout:h,trigger:"keyboard"}),itemConstraints:d.derivedItemConstraints});U(h,i)||P(c,{defaultLayoutDeferred:d.defaultLayoutDeferred,derivedItemConstraints:d.derivedItemConstraints,axisSize:d.axisSize,layout:i,requestedAxisSize:d.axisSize,requestedLayout:i,separatorToItems:d.separatorToItems},{isUserInteraction:!0})}function ai(a){if(a.defaultPrevented)return;let b=a.currentTarget,c=af(b);if(!(c.disabled||c.separators.find(a=>a.element===b)?.disabled))switch(a.key){case"ArrowDown":a.preventDefault(),"vertical"===c.orientation&&ah(b,5);break;case"ArrowLeft":a.preventDefault(),"horizontal"===c.orientation&&ah(b,-5);break;case"ArrowRight":a.preventDefault(),"horizontal"===c.orientation&&ah(b,5);break;case"ArrowUp":a.preventDefault(),"vertical"===c.orientation&&ah(b,-5);break;case"End":a.preventDefault(),ah(b,100);break;case"Enter":{a.preventDefault();let{derivedItemConstraints:d,layout:e,separatorToItems:f}=N(c.id,!0),g=c.separators.find(a=>a.element===b);q(g,"Matching separator not found");let h=f.get(g);q(h,"Matching panels not found");let i=h[0],j=d.find(a=>a.itemId===i.id);if(q(j,"Panel metadata not found"),j.collapsible){let a=e[i.id];ah(b,(j.collapsedSize===a?c.mutableState.expandedItemSizes[i.id]??j.minSize:j.collapsedSize)-a)}break}case"F6":{a.preventDefault();let b=c.separators.map(a=>a.element),d=Array.from(b).findIndex(b=>b===a.currentTarget);q(null!==d,"Index not found");let e=a.shiftKey?d>0?d-1:b.length-1:d+1<b.length?d+1:0;b[e].focus({preventScroll:!0});break}case"Home":a.preventDefault(),ah(b,-100)}}function aj(a){let b=s;if("active"!==b.state)return!1;let c=K;return b.previewLayoutMap.forEach((a,b)=>{let d=c.get(b);"separator"===b.resizePreviewMode&&d&&!U(a,d.layout)&&P(b,{...d,layout:a,requestedAxisSize:d.axisSize,requestedLayout:a})}),v({cursorFlags:0,state:"inactive"}),b.hitRegions.forEach(a=>{if(!c.has(a.axis))return;let b=N(a.axis.id,!0);P(a.axis,b,{isUserInteraction:!0})}),A(a),!0}function ak(a){let b=s;if("active"!==b.state)return;let c=b.hitRegions.flatMap(({separator:a})=>a?[a.element]:[]);!c.some(b=>b===a.target)||c.some(b=>b.hasPointerCapture?.(a.pointerId))||aj(a.currentTarget)}function al(a){aj(a.currentTarget)}function am(a){if(a.defaultPrevented||"mouse"===a.pointerType&&a.button>0)return;let b=K,c=ab(a,b);if(0===c.length)return;let d=new Map,e=!1;c.forEach(a=>{a.separator&&(e||(e=!0,a.separator.element.focus({focusVisible:!1,preventScroll:!0})));let c=b.get(a.axis);c&&d.set(a.axis,c.layout)});let f=Array.from(d.keys()).flatMap(a=>"separator"===a.resizePreviewMode?function(a,b){let{element:c,orientation:d,items:e}=a,f=c.getBoundingClientRect(),g="horizontal"===d;return G({expandHitTargets:!1,axis:a,includeDisabled:!0}).map(({items:d,rect:h,separator:i},j)=>{let k=e.indexOf(d[0]),l=g?h.left+h.width/2:h.top+h.height/2;return{active:b.some(b=>b.axis===a&&b.items[0]===d[0]&&(i||b.separator?b.separator===i:Q(l,g?b.rect.left+b.rect.width/2:b.rect.top+b.rect.height/2))),axis:a,key:i?`separator-${i.id}`:`panel-${d[0].id}-${j}`,offset:0,itemIndex:k,rect:new DOMRect((g&&!i?l:h.left)-f.left-c.clientLeft+c.scrollLeft,(!g&&!i?l:h.top)-f.top-c.clientTop+c.scrollTop,g&&!i?0:h.width,!g&&!i?0:h.height),separator:i}})}(a,c):[]);v({cursorFlags:0,didPointerMove:!1,hitRegions:c,initialLayoutMap:d,pointerDownAtPoint:{x:a.clientX,y:a.clientY},previewLayoutMap:new Map(d),previews:f,state:"active"}),a.preventDefault()}function an(a){let b=K,c=s;"active"===c.state&&V({commit:!1,document:a.currentTarget,event:a,hitRegions:c.hitRegions,initialLayoutMap:c.initialLayoutMap,mountedAxes:b,prevCursorFlags:c.cursorFlags})}function ao(a){if(a.defaultPrevented)return;let b=s,c=K;if("active"===b.state){if(0===a.buttons)return void aj(a.currentTarget);for(let c of b.hitRegions)if(c.separator){let{element:b}=c.separator;b.isConnected&&!b.hasPointerCapture?.(a.pointerId)&&b.setPointerCapture?.(a.pointerId)}V({commit:!1,document:a.currentTarget,event:a,hitRegions:b.hitRegions,initialLayoutMap:b.initialLayoutMap,mountedAxes:c,pointerDownAtPoint:b.pointerDownAtPoint,prevCursorFlags:b.cursorFlags})}else{let d=ab(a,c);0===d.length?"inactive"!==b.state&&v({cursorFlags:0,state:"inactive"}):v({cursorFlags:0,hitRegions:d,state:"hover"}),A(a.currentTarget)}}function ap(a){a.relatedTarget instanceof HTMLIFrameElement&&"hover"===s.state&&v({cursorFlags:0,state:"inactive"})}function aq(a){a.defaultPrevented||("mouse"!==a.pointerType||!(a.button>0))&&W(a.currentTarget,a)&&a.preventDefault()}function ar(a){a.target===a.currentTarget&&aj(a.currentTarget.document)}function as({axis:a,itemConstraints:b}){let c=a.items.map(({id:a})=>a).join(","),d=a.mutableState.defaultLayout;return a.mutableState.layouts[c]??(d&&function(a,b){let c=a.map(a=>a.id),d=Object.keys(b);if(c.length!==d.length)return!1;for(let a of c)if(!d.includes(a))return!1;return!0}(a.items,d)?d:function(a){let b=0,c=0,d={};for(let e of a)if(void 0!==e.defaultSize){b++;let a=I(e.defaultSize);c+=a,d[e.itemId]=a}else d[e.itemId]=void 0;let e=a.length-b;if(0!==e){let b=I((100-c)/e);for(let c of a)void 0===c.defaultSize&&(d[c.itemId]=b)}return d}(b))}function at({itemIds:a,layout:b}){return ac({layout:b,itemConstraints:a.map(a=>({collapsedSize:0,collapsible:!1,defaultSize:void 0,disabled:void 0,itemId:a,maxSize:100,minSize:0}))})}function au(a,b){if(Object.keys(a).length!==Object.keys(b).length)return!1;for(let c in a)if(a[c]!==b[c])return!1;return!0}let av=new Map;function aw(a){let b=(0,i.useRef)({...a});return n(()=>{for(let c in a)b.current[c]=a[c]},[a]),b.current}let ax=(0,i.createContext)(null);function ay({attributes:a,axisId:b,axisOrientation:c,children:d,className:e,disableCursor:f,disabled:g,disableDoubleClick:j,elementRef:k,id:l,isSharedHitRegion:m,preview:o,registerSeparator:q,requiredStyle:r,style:t,styleDefaults:w,tabIndex:x=0,updateSeparatorProps:y}){let z,A,B=aw({disabled:g,disableDoubleClick:j,children:d,className:e,preview:o,style:t}),[C,D]=(0,i.useState)({}),[E,F]=(0,i.useState)("inactive"),[G,H]=(0,i.useState)(!1),I=(0,i.useRef)(null),J=(0,i.useRef)(null),K=p(I,k);return n(()=>{let a=I.current;if(null!==a){let c={disabled:B.disabled,disableDoubleClick:B.disableDoubleClick,element:a,id:l,get children(){return B.children},get className(){return B.className},get preview(){return B.preview},get style(){return B.style}};J.current=c;let d=q(c),e=u(a=>{F("inactive"!==a.next.state&&a.next.hitRegions.some(a=>a.separator===c||(m?.(a)??!1))?a.next.state:"inactive")}),f=O(b,a=>{let{derivedItemConstraints:b,layout:d,separatorToItems:e}=a.next,f=e.get(c);if(f){let c=f[0],e=b.findIndex(a=>a.itemId===c.id),{layoutStrategy:g}=a.axis;D({...function({layout:a,itemConstraints:b,itemId:c,itemIndex:d}){let e,f,g=a[c],h=b.find(a=>a.itemId===c);if(h){let i=h.maxSize,j=h.collapsible?h.collapsedSize:h.minSize,k=[d,d+1];f=ac({layout:T({delta:j-g,initialLayout:a,itemConstraints:b,pivotIndices:k,prevLayout:a}),itemConstraints:b})[c],e=ac({layout:T({delta:i-g,initialLayout:a,itemConstraints:b,pivotIndices:k,prevLayout:a}),itemConstraints:b})[c]}return{valueControls:c,valueMax:e,valueMin:f,valueNow:g}}({layout:d,itemConstraints:b,itemId:c.id,itemIndex:e}),...g?.getItemAriaControls&&{valueControls:g.getItemAriaControls(c.id)}})}});return()=>{J.current=null,e(),f(),d()}}},[b,l,m,q,B]),n(()=>{let a=J.current;a&&"active"===s.state&&s.previews.some(b=>b.separator===a)&&v({...s,previews:s.previews.map(b=>b.separator===a?{...b}:b)})},[o]),(0,i.useEffect)(()=>{y(l,{disabled:g,disableDoubleClick:j})},[g,j,l,y]),g&&!f&&(z="not-allowed"),A=g?"disabled":"active"===E?"active":G?"focus":E,(0,h.jsx)("div",{...a,"aria-controls":C.valueControls,"aria-disabled":g||void 0,"aria-orientation":"horizontal"===c?"vertical":"horizontal","aria-valuemax":C.valueMax,"aria-valuemin":C.valueMin,"aria-valuenow":C.valueNow,children:d,className:e,"data-separator":A,"data-testid":l,id:l,onBlur:()=>H(!1),onFocus:()=>H(!0),ref:K,role:"separator",style:{...w,cursor:z,...t,...r,touchAction:"none"},tabIndex:g?void 0:x})}function az({separator:a}){let{element:b}=a,c=(0,i.useRef)(null);return n(()=>{let a=b.cloneNode(!0),d=[b,...b.querySelectorAll("*")],e=[a,...a.querySelectorAll("*")],f=b.ownerDocument.defaultView;return d.forEach((a,b)=>{let c=e[b];if(c instanceof f.HTMLElement||c instanceof f.SVGElement){let b=f.getComputedStyle(a);for(let a=0;a<b.length;a++){let d=b.item(a);c.style.setProperty(d,b.getPropertyValue(d))}}c.removeAttribute("data-testid"),c.removeAttribute("id")}),Object.assign(a.style,{boxSizing:"border-box",height:"100%",margin:"0",position:"static",transform:"none",width:"100%"}),c.current.appendChild(a),()=>a.remove()},[b]),(0,h.jsx)("div",{ref:c,style:{height:"100%",opacity:.65,pointerEvents:"none",width:"100%"}})}function aA(){let a=(0,i.useContext)(ax);return q(a,"Group Context not found; did you render a Panel or Separator outside of a Group?"),a}function aB(a){let{registerOverlay:b}=aA(),c=(0,i.useRef)(a);au(c.current,a)||(c.current=a);let d=c.current;return n(()=>b(d),[b,d]),null}function aC({active:a,orientation:b,style:c,...d}){let e;switch(b){case"horizontal":e={height:"100%",minWidth:"1px"};break;case"vertical":e={minHeight:"1px",width:"100%"}}return(0,h.jsx)("div",{...d,"data-separator-overlay":a?"active":"inactive",style:{...e,...c,flexShrink:0,pointerEvents:"none"}})}function aD({overlay:a,preview:b}){let{axis:c,offset:d,rect:e,separator:f}=b,g="horizontal"===c.orientation,j=f?.preview,k=a;return(0,i.isValidElement)(j)&&j.type===aB&&(k=j.props,j=void 0),null==j&&(k?j=(0,h.jsx)(aC,{...k,active:b.active,orientation:c.orientation}):f&&(j=(0,h.jsx)(az,{separator:f}))),(0,h.jsx)("div",{"aria-hidden":"true","data-resize-preview":!0,inert:!0,style:{height:e.height,left:e.left,pointerEvents:"none",position:"absolute",top:e.top,transform:g?`translateX(${d}px)`:`translateY(${d}px)`,width:e.width},children:j})}function aE({children:a,className:b,defaultLayout:c,disableCursor:d,disabled:e,elementRef:f,groupRef:g,id:j,onLayoutChange:k,onLayoutChanged:l,orientation:r="horizontal",resizePreviewMode:t="panel",resizeTargetMinimumSize:x={coarse:20,fine:10},style:y,...z}){let E,F=(0,i.useRef)({onLayoutChange:{},onLayoutChanged:{}}),H=o(a=>{U(F.current.onLayoutChange,a)||(F.current.onLayoutChange=a,k?.(a))}),L=o((a,b,c)=>{U(F.current.onLayoutChanged,a)||(F.current.onLayoutChanged=a,l?.(a,{isUserInteraction:b,requestedLayout:c}))}),R=m(j),[S,T]=(0,i.useState)(),V=function({groupId:a,resizePreviewMode:b}){let[c,d]=(0,i.useState)([]),e=(0,i.useRef)(c);return n(()=>{let c=c=>{let f=M(a),g="separator"===b&&"active"===c.state?c.previews.filter(a=>a.axis===f&&(a.active||!Q(a.offset,0))):[],h=e.current;h.length===g.length&&g.every((a,b)=>a===h[b])||(e.current=g,d(g))};if("separator"!==b)return void c(s);let f=u(({next:a})=>c(a));return c(s),f},[a,b]),c}({groupId:R,resizePreviewMode:t}),W=(0,i.useRef)(null),[Y,Z]=function(){let[a,b]=(0,i.useState)({});return[a,(0,i.useCallback)(()=>b({}),[])]}(),$=(0,i.useRef)([]),_=(0,i.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),aa=p(W,f);E=(0,i.useRef)({getLayout:()=>({}),setLayout:w}),(0,i.useImperativeHandle)(g,()=>E.current,[]),n(()=>{Object.assign(E.current,ag({axisId:R}))});let ab=o((a,b)=>{let d=N(a);return d?{flexGrow:d.layout[b]??1}:c?.[b]?{flexGrow:c?.[b]}:void 0}),ad=aw({defaultLayout:c,disableCursor:d,resizeTargetMinimumSize:x}),af=(0,i.useMemo)(()=>({get disableCursor(){return!!ad.disableCursor},getPanelStyles:ab,id:R,orientation:r,registerPanel:a=>{let b=_.current;return b.panels=D(r,[...b.panels,a]),Z(),()=>{b.panels=b.panels.filter(b=>b!==a),Z()}},registerOverlay:a=>(T(a),()=>{T(void 0)}),registerSeparator:a=>{let b=_.current;return b.separators=D(r,[...b.separators,a]),Z(),()=>{b.separators=b.separators.filter(b=>b!==a),Z()}},updatePanelProps:(a,{disabled:b})=>{let c=_.current.panels.find(b=>b.id===a);c&&(c.constraintProps.disabled=b);let d=M(R),e=N(R);d&&e&&P(d,{...e,derivedItemConstraints:J(d)})},updateSeparatorProps:(a,{disabled:b,disableDoubleClick:c})=>{let d=_.current.separators.find(b=>b.id===a);d&&(d.disabled=b,d.disableDoubleClick=c)}}),[ab,R,Z,r,ad]),ah=(0,i.useRef)(null);return n(()=>{var a;let b,c,d,f,g,h,i,j,k,l,m,n,o,p=W.current;if(null===p)return;let u=_.current;if(u.panels=D(r,u.panels),u.separators=D(r,u.separators),$.current=Array.from([...u.panels.map(({element:a})=>a),...u.separators.map(({element:a})=>a)]).sort(C),void 0!==ad.defaultLayout&&Object.keys(ad.defaultLayout).length===u.panels.length)for(let a of(o={},u.panels)){let b=ad.defaultLayout[a.id];void 0!==b&&(o[a.id]=b)}let w={disabled:!!e,element:p,id:R,mutableState:{defaultLayout:o,disableCursor:!!ad.disableCursor,expandedItemSizes:_.current.lastExpandedPanelSizes,layouts:_.current.layouts},orientation:r,items:u.panels,resizePreviewMode:t,get resizeTargetMinimumSize(){return ad.resizeTargetMinimumSize},separators:u.separators};ah.current=w;let x=(b=!0,q((a=w).element.ownerDocument.defaultView,"Cannot register an unmounted Group"),c=a.element.ownerDocument.defaultView.ResizeObserver,d=new Set,f=new Set,(g=new c(c=>{for(let d of c){let{borderBoxSize:c,target:e}=d;if(e===a.element){if(b){let b=B({axis:a});if(0===b)return;let c=N(a.id);if(!c)return;let d=J(a),e=c.requestedAxisSize,f=c.requestedLayout;c.defaultLayoutDeferred&&(e=b,f=at({itemIds:a.items.map(({id:a})=>a),layout:as({axis:a,itemConstraints:d})}));let g=ac({layout:function({axis:a,nextAxisSize:b,prevAxisSize:c,prevLayout:d}){if(c<=0||b<=0||c===b)return d;let e=0,f=0,g=!1,h=new Map,i=[];for(let j of a.items){let a=d[j.id]??0;if("preserve-pixel-size"===j.constraintProps.groupResizeBehavior){g=!0;let d=I(a/100*c/b*100);h.set(j.id,d),e+=d}else i.push(j.id),f+=a}if(!g||0===i.length)return d;let j=100-e,k={...d};if(h.forEach((a,b)=>{k[b]=a}),f>0)for(let a of i){let b=d[a]??0;k[a]=I(b/f*j)}else{let a=I(j/i.length);for(let b of i)k[b]=a}return k}({axis:a,nextAxisSize:b,prevAxisSize:e,prevLayout:f}),itemConstraints:d});if(!c.defaultLayoutDeferred&&U(c.layout,g)&&function(a,b){return a.length===b.length&&a.every((a,c)=>au(a,b[c]))}(c.derivedItemConstraints,d)&&c.axisSize===b)continue;P(a,{defaultLayoutDeferred:!1,derivedItemConstraints:d,axisSize:b,layout:g,requestedAxisSize:e,requestedLayout:f,separatorToItems:c.separatorToItems})}}else!function(a,b,c){if(!c[0])return;let d=a.items.find(a=>a.element===b);if(!d||!d.onResize)return;let e=B({axis:a}),f="horizontal"===a.orientation?d.element.offsetWidth:d.element.offsetHeight,g=d.mutableValues.prevSize,h={asPercentage:I(f/e*100),inPixels:f};d.mutableValues.prevSize=h,d.onResize(h,d.id,g)}(a,e,c)}})).observe(a.element),a.items.forEach(a=>{q(!d.has(a.id),`Panel ids must be unique; id "${a.id}" was used more than once`),d.add(a.id),a.onResize&&g.observe(a.element)}),h=B({axis:a}),i=J(a),k=ac({layout:j=as({axis:a,itemConstraints:i}),itemConstraints:i}),m=(l=a.element.ownerDocument).defaultView,av.set(l,(av.get(l)??0)+1),n=new Map,G({axis:a,includeDisabled:!0}).forEach(a=>{a.separator&&n.set(a.separator,a.items)}),P(a,{defaultLayoutDeferred:0===h,derivedItemConstraints:i,axisSize:h,layout:k,requestedAxisSize:h,requestedLayout:at({itemIds:a.items.map(({id:a})=>a),layout:j}),separatorToItems:n}),a.separators.forEach(a=>{q(!f.has(a.id),`Separator ids must be unique; id "${a.id}" was used more than once`),f.add(a.id),a.element.addEventListener("keydown",ai)}),1===av.get(l)&&(l.addEventListener("contextmenu",X,!0),l.addEventListener("dblclick",ae,!0),l.addEventListener("lostpointercapture",ak,!0),l.addEventListener("pointercancel",al,!0),l.addEventListener("pointerdown",am,!0),l.addEventListener("pointerleave",an),l.addEventListener("pointermove",ao),l.addEventListener("pointerout",ap),l.addEventListener("pointerup",aq,!0),m?.addEventListener("blur",ar)),function(){b=!1,av.set(l,Math.max(0,(av.get(l)??0)-1)),(K=new Map(K)).delete(a),function(a){if("inactive"===s.state)return!1;let b=s.hitRegions.filter(b=>b.axis!==a),c="active"===s.state&&s.previews.some(b=>b.axis===a);if(b.length===s.hitRegions.length&&!c)return!1;if(0===b.length)v({cursorFlags:0,state:"inactive"});else if("active"===s.state){let c=new Map(s.initialLayoutMap),d=new Map(s.previewLayoutMap);c.delete(a),d.delete(a),v({...s,cursorFlags:0,hitRegions:b,initialLayoutMap:c,previewLayoutMap:d,previews:s.previews.filter(b=>b.axis!==a)})}else v({...s,hitRegions:b});return!0}(a)&&A(l),a.separators.forEach(a=>{a.element.removeEventListener("keydown",ai)}),av.get(l)||(l.removeEventListener("contextmenu",X,!0),l.removeEventListener("dblclick",ae,!0),l.removeEventListener("lostpointercapture",ak,!0),l.removeEventListener("pointercancel",al,!0),l.removeEventListener("pointerdown",am,!0),l.removeEventListener("pointerleave",an),l.removeEventListener("pointermove",ao),l.removeEventListener("pointerout",ap),l.removeEventListener("pointerup",aq,!0),m?.removeEventListener("blur",ar)),g.disconnect()}),{defaultLayoutDeferred:y,derivedItemConstraints:z,layout:E,requestedLayout:F}=N(w.id,!0);!y&&z.length>0&&(H(E),L(E,!1,F));let M=O(R,a=>{let{defaultLayoutDeferred:b,derivedItemConstraints:c,layout:d,requestedLayout:e}=a.next;if(b||0===c.length)return;!function({derivedItemConstraints:a,axis:b,layout:c,prevLayout:d,requestedLayout:e}){let f=b.items.map(({id:a})=>a).join(",");b.mutableState.layouts[f]=e,d&&a.forEach(a=>{if(a.collapsible){let e=Q(a.collapsedSize,c[a.itemId]),f=Q(a.collapsedSize,d[a.itemId]);e&&!f&&(b.mutableState.expandedItemSizes[a.itemId]=d[a.itemId])}})}({derivedItemConstraints:c,axis:w,layout:d,prevLayout:a.prev?.layout,requestedLayout:e});let f=s,g="active"!==f.state||!f.hitRegions.some(a=>a.axis===w);H(d),g&&L(d,a.isUserInteraction,e)});return()=>{ah.current=null,x(),M()}},[e,R,L,H,r,Y,t,ad]),n(()=>{(function(a){for(let b=1;b<a.length;b++)if(C(a[b-1],a[b])>0)return!1;return!0})($.current)||Z()}),(0,i.useEffect)(()=>{let a=ah.current;a&&(a.mutableState.defaultLayout=c,a.mutableState.disableCursor=!!d)}),(0,h.jsx)(ax.Provider,{value:af,children:(0,h.jsxs)("div",{...z,className:b,"data-group":!0,"data-testid":R,id:R,ref:aa,style:{height:"100%",width:"100%",overflow:"hidden",position:"separator"===t?"relative":void 0,...y,display:"flex",flexDirection:"horizontal"===r?"row":"column",flexWrap:"nowrap",touchAction:"horizontal"===r?"pan-y":"pan-x"},children:[a,V.map(a=>(0,h.jsx)(aD,{overlay:S,preview:a},a.key))]})})}function aF({children:a,className:b,collapsedSize:c="0%",collapsedThreshold:d,collapsible:e=!1,defaultSize:f,disabled:g,elementRef:j,groupResizeBehavior:k="preserve-relative-size",id:l,maxSize:q="100%",minSize:r="0%",onResize:s,panelRef:t,style:u,...v}){let w,y=!!l,z=m(l),A=aw({disabled:g}),B=(0,i.useRef)(null),C=p(B,j),{getPanelStyles:D,id:E,orientation:F,registerPanel:G,updatePanelProps:H}=aA(),I=null!==s,J=o((a,b,c)=>{s?.(a,l,c)});n(()=>{let a=B.current;if(null!==a)return G({element:a,id:z,idIsStable:y,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:I?J:void 0,constraintProps:{groupResizeBehavior:k,collapsedSize:c,collapsedThreshold:d,collapsible:e,defaultSize:f,disabled:A.disabled,maxSize:q,minSize:r}})},[k,c,d,e,f,I,z,y,q,r,J,G,A]),(0,i.useEffect)(()=>{H(z,{disabled:g})},[g,z,H]),function(a,b){let{id:c}=aA(),d=(0,i.useRef)({collapse:x,expand:x,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:x});(0,i.useImperativeHandle)(b,()=>d.current,[]),n(()=>{Object.assign(d.current,ad({axisId:c,itemId:a}))})}(z,t);let K=()=>{let a=D(E,z);if(a)return JSON.stringify(a)},L=(0,i.useSyncExternalStore)(a=>O(E,a),K,K);return w=L?JSON.parse(L):void 0!==f?{flexGrow:void 0,flexShrink:void 0,flexBasis:f}:{flexGrow:1},(0,h.jsx)("div",{...v,"data-disabled":g||void 0,"data-panel":!0,"data-testid":z,id:z,ref:C,style:{...aG,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...w},children:(0,h.jsx)("div",{className:b,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...u,touchAction:"horizontal"===F?"pan-y":"pan-x"},children:a})})}aB.displayName="SeparatorOverlay",aE.displayName="Group",aF.displayName="Panel";let aG={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0},aH={flexBasis:"auto"},aI={flexGrow:0,flexShrink:0};function aJ({children:a,className:b,disabled:c,disableDoubleClick:d,elementRef:e,id:f,preview:g,style:i,...j}){let k=m(f),{disableCursor:l,id:n,orientation:o,registerSeparator:p,updateSeparatorProps:q}=aA();return(0,h.jsx)(ay,{attributes:j,axisId:n,axisOrientation:o,className:b,disableCursor:l,disabled:c,disableDoubleClick:d,elementRef:e,id:k,preview:g,registerSeparator:p,requiredStyle:aI,style:i,styleDefaults:aH,updateSeparatorProps:q,children:a})}aJ.displayName="Separator";var aK=a.i(45050),aL=a.i(82260),aM=a.i(33540),aN=a.i(48819),aO=a.i(2276),aP=a.i(64831);let aQ={name:"volume-x",size:24,node:[["path",{d:"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z",key:"1p7khw"}],["path",{d:"m16.5 14.5 5-5",key:"cul3yw"}],["path",{d:"m16.5 9.5 5 5",key:"1akey5"}]]};aQ.node;let aR=(0,aP.f)(aQ),aS={name:"bell",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]};aS.node;let aT=(0,aP.f)(aS),aU={name:"bell-off",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]};aU.node;let aV=(0,aP.f)(aU),aW={name:"radio",size:24,node:[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]};aW.node;let aX=(0,aP.f)(aW);var aY=a.i(83248),aZ=a.i(55699),a$=a.i(1195),a_=a.i(86708);let a0={name:"panel-left",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],aliases:["sidebar"]};a0.node;let a1=(0,aP.f)(a0),a2={name:"panel-bottom",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]};a2.node;let a3=(0,aP.f)(a2),a4={name:"panel-right",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]};a4.node;let a5=(0,aP.f)(a4);var a6=a.i(86461),a7=a.i(73819);function a8({isLeftSidebarVisible:a,isBottomPanelVisible:b,isRightSidebarVisible:c,onToggleLeftSidebar:d,onToggleBottomPanel:e,onToggleRightSidebar:f,isZenFullscreen:g=!1,onToggleZenFullscreen:i=null}){let j=a=>`inline-flex items-center justify-center p-1 rounded transition-colors ${a?"bg-[#007acc]/20 border border-[#007acc]/50 text-[#4fc1ff]":"border border-transparent text-[#858585] hover:text-[#cccccc] hover:bg-[#2a2d2e]"}`;return(0,h.jsxs)("div",{"data-testid":"layout-toggles-group",className:"inline-flex items-center gap-0.5 bg-[#252526] p-0.5 rounded border border-[#333333]",children:[(0,h.jsx)("button",{type:"button","data-testid":"toggle-left-sidebar",title:"Toggle Primary Sidebar (Cmd+B / Ctrl+B)",onClick:d,className:j(a),children:(0,h.jsx)(a1,{className:"w-3.5 h-3.5"})}),(0,h.jsx)("button",{type:"button","data-testid":"toggle-bottom-panel",title:"Toggle Bottom Panel (Cmd+J / Ctrl+J)",onClick:e,className:j(b),children:(0,h.jsx)(a3,{className:"w-3.5 h-3.5"})}),(0,h.jsx)("button",{type:"button","data-testid":"toggle-right-sidebar",title:"Toggle Secondary Sidebar (Live Chat & Inspector - Cmd+Alt+B)",onClick:f,className:j(c),children:(0,h.jsx)(a5,{className:"w-3.5 h-3.5"})}),i&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:"w-[1px] h-3 bg-[#333333] my-auto mx-0.5"}),(0,h.jsx)("button",{type:"button","data-testid":"toggle-zen-fullscreen",title:g?"Thoát chế độ toàn màn hình Chill Mode (ESC)":"Chế độ Chill toàn màn hình Virtual Office (Shift+F / ESC để thoát)",onClick:i,className:`inline-flex items-center justify-center p-1 rounded transition-colors ${g?"bg-amber-500/20 border border-amber-500/50 text-amber-300 shadow-sm":"border border-transparent text-[#858585] hover:text-[#4fc1ff] hover:bg-[#2a2d2e]"}`,children:g?(0,h.jsx)(a7.f,{className:"w-3.5 h-3.5 text-amber-400"}):(0,h.jsx)(a6.f,{className:"w-3.5 h-3.5"})})]})]})}let a9=[{id:"showcase",label:"All Items Showcase (24)"},{id:"cases",label:"Edge Cases & Items (17)"},{id:"showcase_skins",label:"Skins & Outfits (15)"},{id:"showcase_props",label:"Tech Props & Gadgets (14)"},{id:"showcase_pets",label:"Pets & Companions (12)"},{id:"showcase_auras",label:"Particle Auras & VFX (12)"},{id:"showcase_trophies",label:"Trophies & Badges (12)"},{id:"storm",label:"Storm (30 Agents)"},{id:"busy",label:"Busy (8 Agents)"},{id:"idle",label:"Idle (2 Agents)"},{id:"errors",label:"Error States"}];function ba({stats:a={},mode:b="live",mockPreset:c="cases",onModeChange:d,onPresetChange:e,isRefreshing:f=!1,onRefresh:g,soundEnabled:i=!1,onToggleSound:j,notifEnabled:k=!1,onToggleNotif:l,onOpenCommandPalette:m,onOpenReports:n,onOpenStore:o,onOpenThemeSettings:p,isSupporter:q=!1,layout:r,onToggleLeftSidebar:s,onToggleBottomPanel:t,onToggleRightSidebar:u,isZenFullscreen:v=!1,onToggleZenFullscreen:w=null}){return(0,h.jsxs)("header",{className:"h-[34px] min-h-[34px] bg-[#1e1e1e] border-b border-[#2b2b2b] flex items-center justify-between px-3 text-[#cccccc] text-xs select-none shrink-0 z-40",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-[200px]",children:[(0,h.jsx)("div",{className:"flex h-5 w-5 items-center justify-center rounded bg-gradient-to-br from-emerald-500 to-cyan-600 shadow-sm shadow-emerald-500/20",children:(0,h.jsx)(aL.f,{className:"w-3.5 h-3.5 text-white"})}),(0,h.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,h.jsx)("span",{className:"font-bold text-[#e1e1e1] tracking-wide text-[11px]",children:"AGMON"}),(0,h.jsx)("span",{className:"rounded bg-[#2d2d2d] px-1.5 py-0.2 text-[9px] font-medium text-slate-400 border border-[#3e3e42]",children:"v0.2.0"})]}),(0,h.jsxs)("div",{className:"hidden lg:flex items-center gap-1 bg-[#252526] px-1.5 py-0.5 rounded text-[10px] text-emerald-400 border border-[#333333]",children:[(0,h.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),(0,h.jsx)("span",{children:"Multi-Provider"})]})]}),(0,h.jsxs)("div",{onClick:m,title:"Search sessions or run commands (Cmd+Shift+P / Ctrl+Shift+P)",className:"flex items-center justify-between w-[320px] max-w-[35vw] h-6 bg-[#252526] border border-[#3e3e42] hover:border-[#007acc] rounded px-2 cursor-pointer transition-colors text-slate-400 group",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 overflow-hidden",children:[(0,h.jsx)(aM.f,{className:"w-3 h-3 text-slate-500 group-hover:text-slate-300 shrink-0"}),(0,h.jsx)("span",{className:"text-[11px] truncate",children:"Search agents, logs, commands..."})]}),(0,h.jsx)("kbd",{className:"hidden sm:inline-block text-[9px] font-mono bg-[#1e1e1e] border border-[#3e3e42] rounded px-1 text-slate-400",children:"Cmd+Shift+P"})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-[240px] justify-end",children:[(0,h.jsxs)("div",{onClick:n,title:"Click to view detailed Token & Cost Analytics",className:"hidden xl:flex items-center gap-1.5 bg-[#252526] hover:bg-[#2d2d2e] border border-[#333333] hover:border-[#007acc] px-2 py-0.5 rounded text-[11px] cursor-pointer transition-colors",children:[(0,h.jsx)("span",{className:"text-slate-400",children:"Desks:"}),(0,h.jsx)("span",{className:"font-bold text-slate-200",children:a?.agents??0}),(0,h.jsx)("span",{className:"text-slate-600",children:"|"}),(0,h.jsx)("span",{className:"text-slate-400",children:"Active:"}),(0,h.jsx)("span",{className:"font-bold text-cyan-400",children:a?.busy??0}),(0,h.jsx)("span",{className:"text-slate-600",children:"|"}),(0,h.jsx)("span",{className:"text-slate-400",children:"Tokens:"}),(0,h.jsx)("span",{className:"font-bold text-emerald-400",children:a?.tokensLabel??"0k"})]}),(0,h.jsxs)("button",{onClick:n,title:"Open Token & Cost Analytics",className:"flex items-center gap-1.5 px-2 py-0.5 rounded bg-[#252526] hover:bg-[#2e2e30] border border-[#333333] hover:border-[#007acc] text-slate-300 hover:text-white text-[11px] transition-colors",children:[(0,h.jsx)(aY.f,{className:"w-3 h-3 text-amber-400"}),(0,h.jsx)("span",{className:"hidden md:inline font-medium",children:"Reports"})]}),(0,h.jsxs)("button",{onClick:o,title:"Supporter Store: Skins, Pets, Ambience & Coffee",className:`flex items-center gap-1.5 px-2.5 py-0.5 rounded border text-[11px] transition-all cursor-pointer ${q?"bg-amber-500/20 border-amber-500/50 text-amber-300 hover:bg-amber-500/30 shadow-sm shadow-amber-500/10":"bg-amber-500/10 hover:bg-amber-500/20 border-amber-500/40 hover:border-amber-400 text-amber-300 hover:text-white"}`,children:[(0,h.jsx)(aZ.f,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),(0,h.jsx)("span",{className:"font-semibold text-amber-300",children:q?"VIP Supporter":"Store"})]}),(0,h.jsxs)("button",{onClick:p,title:"Color Themes & Font Customization (Preferences)",className:"flex items-center gap-1.5 px-2 py-0.5 rounded bg-[#252526] hover:bg-[#2e2e30] border border-[#333333] hover:border-[#007acc] text-slate-300 hover:text-white text-[11px] transition-colors cursor-pointer",children:[(0,h.jsx)(a$.f,{className:"w-3 h-3 text-cyan-400"}),(0,h.jsx)("span",{className:"hidden lg:inline font-medium",children:"Themes"})]}),(0,h.jsxs)("div",{className:"flex items-center rounded bg-[#252526] border border-[#333333] p-0.5 text-[11px]",children:[(0,h.jsxs)("button",{onClick:()=>d?.("live"),title:"Connect live log watchers ~/.gemini and ~/.claude",className:`flex items-center gap-1 rounded px-2 py-0.5 font-medium transition-colors ${"live"===b?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30":"text-slate-400 hover:text-slate-200"}`,children:[(0,h.jsx)(aX,{className:`w-2.5 h-2.5 ${"live"===b?"text-emerald-400 animate-pulse":"text-slate-500"}`}),"Live"]}),(0,h.jsx)("button",{onClick:()=>d?.("mock"),title:"Simulated multi-agent mock telemetry",className:`flex items-center gap-1 rounded px-2 py-0.5 font-medium transition-colors ${"mock"===b?"bg-[#333333] text-slate-200":"text-slate-400 hover:text-slate-200"}`,children:"Mock"}),"mock"===b&&(0,h.jsx)("select",{value:c,onChange:a=>e?.(a.target.value),className:"bg-transparent px-1 py-0.5 text-[10px] text-slate-300 outline-none cursor-pointer border-l border-[#333333] ml-1",children:a9.map(a=>(0,h.jsx)("option",{value:a.id,className:"bg-[#1e1e1e] text-slate-200",children:a.label},a.id))})]}),(0,h.jsxs)("button",{type:"button",onClick:()=>{d?.("mock"),e?.("showcase")},title:"Quickly showcase all 24 item archetypes in action",className:`flex items-center gap-1 px-2 py-0.5 rounded text-[11px] font-semibold border transition-all ${"mock"===b&&"showcase"===c?"bg-cyan-500/20 text-cyan-300 border-cyan-500/50 shadow-sm shadow-cyan-500/20":"bg-[#252526] text-slate-300 border-[#333333] hover:text-cyan-300 hover:border-cyan-500/40"}`,children:[(0,h.jsx)(a_.f,{className:"w-3 h-3 text-cyan-400"}),(0,h.jsx)("span",{children:"Items Showcase"})]}),(0,h.jsx)("button",{onClick:g,title:"Force refresh connections & data",className:"flex h-6 w-6 items-center justify-center rounded border border-[#333333] bg-[#252526] text-slate-400 hover:text-slate-200 hover:border-[#444444] transition-colors",children:(0,h.jsx)(aN.f,{className:`w-3 h-3 ${f?"animate-spin text-emerald-400":""}`})}),(0,h.jsx)("button",{onClick:j,title:i?"Sound effects: ON":"Sound effects: OFF",className:`flex h-6 w-6 items-center justify-center rounded border transition-colors ${i?"border-emerald-500/50 bg-emerald-500/20 text-emerald-300":"border-[#333333] bg-[#252526] text-slate-500 hover:text-slate-300"}`,children:i?(0,h.jsx)(aO.f,{className:"w-3 h-3"}):(0,h.jsx)(aR,{className:"w-3 h-3"})}),(0,h.jsx)("button",{onClick:l,title:k?"Desktop notifications: ON":"Desktop notifications: OFF",className:`flex h-6 w-6 items-center justify-center rounded border transition-colors ${k?"border-amber-500/50 bg-amber-500/20 text-amber-300":"border-[#333333] bg-[#252526] text-slate-500 hover:text-slate-300"}`,children:k?(0,h.jsx)(aT,{className:"w-3 h-3"}):(0,h.jsx)(aV,{className:"w-3 h-3"})}),(0,h.jsx)(a8,{isLeftSidebarVisible:r?.isLeftSidebarVisible,isBottomPanelVisible:r?.isBottomPanelVisible,isRightSidebarVisible:r?.isRightSidebarVisible,onToggleLeftSidebar:s,onToggleBottomPanel:t,onToggleRightSidebar:u,isZenFullscreen:v,onToggleZenFullscreen:w})]})]})}let bb={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]};bb.node;let bc=(0,aP.f)(bb);var bd=a.i(38688),be=a.i(57307);let bf={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};bf.node;let bg=(0,aP.f)(bf);var bh=a.i(55771);let bi={name:"files",size:24,node:[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]};bi.node;let bj=(0,aP.f)(bi);function bk({activeView:a="explorer",onViewChange:b,onOpenStore:c,agentCount:d=0,isLeftSidebarVisible:e=!0,activeLeftSidebarTab:f="agents",isRightSidebarVisible:g=!1,activeRightSidebarTab:i="chat",isBottomPanelVisible:k=!1,onToggleBottomPanel:l,onOpenSettings:m}){let n=[{id:"explorer",title:"Explorer: Agents & Sessions (Ctrl+Shift+E)",icon:bc,badge:d>0?d:void 0},{id:"files",title:"Workspace Files: File Tree & Code Editor",icon:bj},{id:"chat",title:"Live Chat / Transcript (Sidebar)",icon:j.f},{id:"office",title:"Virtual 2D Office View (Canvas)",icon:aL.f},{id:"network",title:"Multi-Agent Collaboration DAG Graph",icon:bh.f},{id:"reports",title:"Token & AI Cost Analytics",icon:aY.f},{id:"telemetry",title:"Live Telemetry & Traces",icon:bd.f},{id:"store",title:"Supporter Store: Skins, Pets & Ambience",icon:aZ.f}];return(0,h.jsxs)("aside",{"data-testid":"activity-bar",className:"w-12 h-full bg-[#181818] flex flex-col justify-between items-center border-r border-[#2b2b2b] py-2 shrink-0 z-30 select-none",children:[(0,h.jsxs)("div",{className:"flex flex-col gap-1 w-full items-center",children:[n.map(d=>{let j="chat"===d.id?g&&"chat"===i:"files"===d.id?e&&"files"===f:"explorer"===d.id?e&&"agents"===f:a===d.id,k=d.icon;return(0,h.jsxs)("button",{onClick:()=>{"store"===d.id?c?.():b?.(d.id)},title:d.title,className:`w-full py-2.5 flex justify-center items-center relative transition-colors ${j?"text-white border-l-2 border-[#007acc] bg-[#252526]/50":"store"===d.id?"text-amber-400 hover:text-amber-300 hover:bg-[#252526]/40 border-l-2 border-transparent":"text-[#858585] hover:text-[#cccccc] border-l-2 border-transparent"}`,children:[(0,h.jsx)(k,{className:`w-5 h-5 ${"store"===d.id?"text-amber-400":""}`}),void 0!==d.badge&&(0,h.jsx)("span",{className:"absolute top-1.5 right-1.5 bg-[#007acc] text-white text-[9px] font-bold px-1 rounded-full leading-none min-w-3 text-center",children:d.badge})]},d.id)}),(0,h.jsx)("button",{onClick:l,title:k?"Hide Terminal & Logs (Cmd+J)":"Show Terminal & Logs (Cmd+J)",className:`w-full py-2.5 flex justify-center items-center relative transition-colors ${k?"text-cyan-400 border-l-2 border-cyan-500/50":"text-[#858585] hover:text-[#cccccc] border-l-2 border-transparent"}`,children:(0,h.jsx)(be.f,{className:"w-5 h-5"})})]}),(0,h.jsx)("div",{className:"flex flex-col gap-1 w-full items-center",children:(0,h.jsx)("button",{onClick:m,title:"System Settings & Watchers",className:"w-full py-2.5 flex justify-center items-center text-[#858585] hover:text-[#cccccc] transition-colors border-l-2 border-transparent",children:(0,h.jsx)(bg,{className:"w-5 h-5"})})})]})}var bl=a.i(89027),bm=a.i(41146);let bn={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};bn.node;let bo=(0,aP.f)(bn),bp={name:"folder-open",size:24,node:[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]};bp.node;let bq=(0,aP.f)(bp);var br=a.i(85953),bs=a.i(63145);let bt={name:"blocks",size:24,node:[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]]};bt.node;let bu=(0,aP.f)(bt);var bv=a.i(5004);let bw={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};bw.node;let bx=(0,aP.f)(bw);function by({filename:a="",isFolder:b=!1,isOpen:c=!1,size:d=14,className:e=""}){if(b)return c?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${e}`,children:[(0,h.jsx)("path",{d:"M1.5 3A1.5 1.5 0 0 1 3 1.5h3.293a1.5 1.5 0 0 1 1.06.44l1.207 1.207a.5.5 0 0 0 .354.146H13A1.5 1.5 0 0 1 14.5 4.793V6H3a1.5 1.5 0 0 0-1.42 1.027L.5 11V3a1.5 1.5 0 0 1 1-1.5z",fill:"#c99e55"}),(0,h.jsx)("path",{d:"M2 13.5l1.8-6.2c.16-.54.66-.9 1.22-.9h9.46c.72 0 1.22.68 1.03 1.36l-1.5 5.2a1.5 1.5 0 0 1-1.44 1.04H3.5A1.5 1.5 0 0 1 2 13.5z",fill:"#e8a838"})]}):(0,h.jsx)("svg",{width:d,height:d,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${e}`,children:(0,h.jsx)("path",{d:"M1.5 3A1.5 1.5 0 0 1 3 1.5h3.293a1.5 1.5 0 0 1 1.06.44l1.207 1.207a.5.5 0 0 0 .354.146H13A1.5 1.5 0 0 1 14.5 4.793V12A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V3z",fill:"#dcb67a"})});let f=(a||"").toLowerCase();return f.endsWith(".js")||f.endsWith(".jsx")||f.endsWith(".mjs")||f.endsWith(".cjs")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f7df1e"}),(0,h.jsx)("text",{x:"3",y:"12",fill:"#000000",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"9.5",children:f.endsWith(".jsx")?"JSX":"JS"})]}):f.endsWith(".ts")||f.endsWith(".tsx")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#3178c6"}),(0,h.jsx)("text",{x:"2.5",y:"12",fill:"#ffffff",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"9.5",children:f.endsWith(".tsx")?"TSX":"TS"})]}):f.endsWith(".json")||f.endsWith(".jsonl")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f1c40f",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"3.5",y:"12",fill:"#f1c40f",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"10",children:"{}"})]}):f.endsWith(".md")||f.endsWith(".markdown")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#519aba",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"2",y:"11.5",fill:"#519aba",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8.5",children:"MD"})]}):f.endsWith(".html")||f.endsWith(".htm")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#e44d26",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"1",y:"11.5",fill:"#e44d26",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8",children:"</>"})]}):f.endsWith(".css")||f.endsWith(".scss")||f.endsWith(".sass")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#42a5f5",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"2",y:"11.5",fill:"#42a5f5",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8.5",children:"#"})]}):f.endsWith(".java")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f89820",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"1.5",y:"11.5",fill:"#f89820",fontFamily:"var(--font-family-ui, sans-serif)",fontWeight:"bold",fontSize:"8.5",children:"JAVA"})]}):f.endsWith(".py")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#3776ab",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"2.5",y:"11.5",fill:"#3776ab",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"9",children:"PY"})]}):f.endsWith(".sql")||f.endsWith(".ddl")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#00bcd4",fillOpacity:"0.2"}),(0,h.jsx)("path",{d:"M8 2C4.69 2 2 3.12 2 4.5v7C2 12.88 4.69 14 8 14s6-1.12 6-2.5v-7C14 3.12 11.31 2 8 2zm0 1.5c2.76 0 4.5.83 4.5 1s-1.74 1-4.5 1-4.5-.83-4.5-1 1.74-1 4.5-1zm-4.5 3.32c1.07.47 2.68.68 4.5.68s3.43-.21 4.5-.68v1.73c0 .17-1.74 1-4.5 1s-4.5-.83-4.5-1V6.82zm0 3.5c1.07.47 2.68.68 4.5.68s3.43-.21 4.5-.68v1.73c0 .17-1.74 1-4.5 1s-4.5-.83-4.5-1v-1.73z",fill:"#00bcd4"})]}):f.endsWith(".png")||f.endsWith(".jpg")||f.endsWith(".jpeg")||f.endsWith(".gif")||f.endsWith(".webp")||f.endsWith(".ico")||f.endsWith(".bmp")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#26a69a",fillOpacity:"0.2",stroke:"#26a69a",strokeWidth:"0.8"}),(0,h.jsx)("circle",{cx:"5",cy:"5.5",r:"1.5",fill:"#26a69a"}),(0,h.jsx)("path",{d:"M2.5 13.5l4-5 3.5 4 2-2.5 2 3.5h-11.5z",fill:"#26a69a"})]}):f.endsWith(".svg")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#ff7043",fillOpacity:"0.2",stroke:"#ff7043",strokeWidth:"0.8"}),(0,h.jsx)("text",{x:"1",y:"11.5",fill:"#ff7043",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"7.5",children:"SVG"})]}):"dockerfile"===f||f.startsWith("dockerfile.")||f.endsWith(".dockerfile")||f.includes("docker-compose")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#2496ed",fillOpacity:"0.2"}),(0,h.jsx)("path",{d:"M13.8 6.8c-.3-.2-.8-.2-1.1 0-.1-.6-.5-1.1-1.1-1.3l-.4-.1-.2.4c-.2.5-.2 1 0 1.5-.4.2-.8.5-1.2.9H2.5c-.3 0-.5.2-.5.5v3.5c0 1.7 1.3 3 3 3h5.2c2.5 0 4.6-1.8 4.8-4.3.4-.6.6-1.3.6-2 0-.8-.4-1.4-1-1.8-.2-.1-.5-.2-.8-.3zM4 6.5h1.5v1.5H4V6.5zm2 0h1.5v1.5H6V6.5zm2 0h1.5v1.5H8V6.5zm2 0h1.5v1.5H10V6.5z",fill:"#2496ed"})]}):f.startsWith(".git")||f.includes("git")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f05032",fillOpacity:"0.15"}),(0,h.jsx)("circle",{cx:"5",cy:"5",r:"1.5",fill:"#f05032"}),(0,h.jsx)("circle",{cx:"11",cy:"5",r:"1.5",fill:"#f05032"}),(0,h.jsx)("circle",{cx:"8",cy:"11.5",r:"1.5",fill:"#f05032"}),(0,h.jsx)("path",{d:"M5 6.5v2a3 3 0 0 0 3 3M11 6.5v2a3 3 0 0 1-3 3",stroke:"#f05032",strokeWidth:"1.2",fill:"none"})]}):f.endsWith(".yaml")||f.endsWith(".yml")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#cb171e",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"1",y:"11.5",fill:"#e06c75",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"7.5",children:"YML"})]}):f.endsWith(".toml")||f.endsWith(".ini")||f.endsWith(".conf")||f.endsWith(".cfg")||f.endsWith(".properties")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#61afef",fillOpacity:"0.2"}),(0,h.jsx)("circle",{cx:"8",cy:"8",r:"3",stroke:"#61afef",strokeWidth:"1.2",fill:"none"}),(0,h.jsx)("circle",{cx:"8",cy:"8",r:"1",fill:"#61afef"}),(0,h.jsx)("path",{d:"M8 2.5v2M8 11.5v2M2.5 8h2M11.5 8h2",stroke:"#61afef",strokeWidth:"1.2"})]}):f.endsWith(".sh")||f.endsWith(".bash")||f.endsWith(".zsh")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#89d185",fillOpacity:"0.2"}),(0,h.jsx)("path",{d:"M4 5l3 3-3 3",stroke:"#89d185",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),(0,h.jsx)("line",{x1:"8.5",y1:"11",x2:"12",y2:"11",stroke:"#89d185",strokeWidth:"1.5",strokeLinecap:"round"})]}):f.includes("lock")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#e5c07b",fillOpacity:"0.2"}),(0,h.jsx)("rect",{x:"4.5",y:"7",width:"7",height:"6",rx:"1",fill:"#e5c07b"}),(0,h.jsx)("path",{d:"M6 7V5a2 2 0 1 1 4 0v2",stroke:"#e5c07b",strokeWidth:"1.2",fill:"none"})]}):f.endsWith(".xml")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#e74c3c",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"1",y:"11.5",fill:"#e74c3c",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8",children:"</>"})]}):f.startsWith(".env")||f.includes("config")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#9b59b6",fillOpacity:"0.2"}),(0,h.jsx)("circle",{cx:"8",cy:"8",r:"3.5",stroke:"#bb86fc",strokeWidth:"1.2",fill:"none"}),(0,h.jsx)("circle",{cx:"8",cy:"8",r:"1.5",fill:"#03dac6"})]}):(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${e}`,children:[(0,h.jsx)("path",{d:"M3 2a1 1 0 0 1 1-1h5.5l3.5 3.5V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2z",stroke:"#858585",strokeWidth:"1.2",fill:"#1e1e1e"}),(0,h.jsx)("path",{d:"M9 1v4h4",stroke:"#858585",strokeWidth:"1.2"}),(0,h.jsx)("line",{x1:"5",y1:"8",x2:"11",y2:"8",stroke:"#858585",strokeWidth:"1",strokeLinecap:"round"}),(0,h.jsx)("line",{x1:"5",y1:"11",x2:"9",y2:"11",stroke:"#858585",strokeWidth:"1",strokeLinecap:"round"})]})}function bz({entry:a,depth:b=0,expandedPaths:c,toggleFolder:d,onOpenFile:e,searchQuery:f}){let g=!!c[a.path],[j,k]=(0,i.useState)(null),[l,m]=(0,i.useState)(!1);(0,i.useEffect)(()=>{a.isDirectory&&g&&null===j&&!l&&(m(!0),fetch(`/api/workspace/files?path=${encodeURIComponent(a.path)}`).then(a=>a.json()).then(a=>{k(a.entries||[])}).catch(()=>k([])).finally(()=>m(!1)))},[a.isDirectory,a.path,g,j,l]);let n=(0,i.useMemo)(()=>!f||a.name.toLowerCase().includes(f.toLowerCase()),[a.name,f]);return a.isDirectory?(0,h.jsxs)("div",{className:"flex flex-col",children:[(0,h.jsxs)("div",{onClick:()=>d(a.path),className:"flex items-center gap-1.5 py-1 px-2 text-xs text-slate-300 hover:text-white hover:bg-[#2a2d2e] rounded cursor-pointer transition-colors select-none",style:{paddingLeft:`${14*b+8}px`},title:a.path,children:[g?(0,h.jsx)(bl.f,{className:"w-3.5 h-3.5 text-slate-400 shrink-0"}):(0,h.jsx)(bm.f,{className:"w-3.5 h-3.5 text-slate-400 shrink-0"}),(0,h.jsx)(by,{isFolder:!0,isOpen:g,size:14}),(0,h.jsx)("span",{className:"font-medium text-[11px] truncate",children:a.name}),l&&(0,h.jsx)(aN.f,{className:"w-2.5 h-2.5 animate-spin text-cyan-400 ml-auto"})]}),g&&j&&(0,h.jsx)("div",{className:"flex flex-col",children:0===j.length?(0,h.jsx)("div",{className:"text-[10px] text-slate-500 italic py-0.5",style:{paddingLeft:`${(b+1)*14+18}px`},children:"(Empty folder)"}):j.map(a=>(0,h.jsx)(bz,{entry:a,depth:b+1,expandedPaths:c,toggleFolder:d,onOpenFile:e,searchQuery:f},a.path))})]}):n?(0,h.jsxs)("div",{onClick:()=>e?.(a),className:"flex items-center gap-1.5 py-1 px-2 text-xs text-slate-300 hover:text-white hover:bg-[#2a2d2e] rounded cursor-pointer transition-colors select-none group",style:{paddingLeft:`${14*b+20}px`},title:`${a.name} (${a.size?`${Math.round(a.size/1024)} KB`:""})`,children:[(0,h.jsx)(by,{filename:a.name,size:14}),(0,h.jsx)("span",{className:"text-[11px] text-slate-300 group-hover:text-cyan-300 truncate",children:a.name}),a.size>0&&(0,h.jsx)("span",{className:"text-[9px] text-slate-600 font-mono ml-auto opacity-0 group-hover:opacity-100 transition-opacity",children:a.size>1048576?`${(a.size/1048576).toFixed(1)}M`:`${Math.round(a.size/1024)}k`})]}):null}function bA({onOpenFile:a,initialPath:b=""}){let[c,d]=(0,i.useState)(b),[e,f]=(0,i.useState)(null),[g,j]=(0,i.useState)([]),[k,l]=(0,i.useState)(!1),[m,n]=(0,i.useState)(""),[o,p]=(0,i.useState)({}),q=(0,i.useCallback)(async a=>{l(!0);try{let b=a?`/api/workspace/files?path=${encodeURIComponent(a)}`:"/api/workspace/files",c=await fetch(b),e=await c.json();c.ok&&(j(e.entries||[]),d(e.currentPath||""),f(e.parentPath||null))}catch{}finally{l(!1)}},[]);(0,i.useEffect)(()=>{q(b)},[b,q]);let r=(0,i.useCallback)(a=>{p(b=>({...b,[a]:!b[a]}))},[]),s=(0,i.useMemo)(()=>c?c.split("/").pop()||c:"Workspace",[c]);return(0,h.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#181818] text-slate-200 overflow-hidden text-xs",children:[(0,h.jsxs)("div",{className:"h-[30px] min-h-[30px] px-2.5 bg-[#252526] border-b border-[#2b2b2b] flex items-center justify-between shrink-0 select-none",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[(0,h.jsx)(bq,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),(0,h.jsx)("span",{className:"font-bold text-[11px] uppercase tracking-wider text-slate-300 truncate",title:c,children:s})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[e&&(0,h.jsx)("button",{onClick:()=>{e&&q(e)},className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors cursor-pointer",title:"Navigate up one directory",children:(0,h.jsx)(bx,{className:"w-3.5 h-3.5"})}),(0,h.jsx)("button",{onClick:()=>q(c),className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors cursor-pointer",title:"Refresh file explorer",children:(0,h.jsx)(aN.f,{className:`w-3.5 h-3.5 ${k?"animate-spin text-emerald-400":""}`})})]})]}),(0,h.jsx)("div",{className:"p-2 border-b border-[#2b2b2b] bg-[#1e1e1e]/60",children:(0,h.jsxs)("div",{className:"flex items-center gap-1.5 bg-[#252526] border border-[#3e3e42] focus-within:border-[#007acc] rounded px-2 py-1",children:[(0,h.jsx)(aM.f,{className:"w-3 h-3 text-slate-500 shrink-0"}),(0,h.jsx)("input",{type:"text",value:m,onChange:a=>n(a.target.value),placeholder:"Search files...",className:"bg-transparent text-[11px] text-slate-200 outline-none w-full placeholder:text-slate-500"})]})}),(0,h.jsx)("div",{className:"flex-1 overflow-y-auto p-1 py-1.5 space-y-0.5",children:k&&0===g.length?(0,h.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"Loading files..."}):0===g.length?(0,h.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs italic",children:"No files found"}):g.map(b=>(0,h.jsx)(bz,{entry:b,depth:0,expandedPaths:o,toggleFolder:r,onOpenFile:a,searchQuery:m},b.path))})]})}var bB=a.i(13503);function bC({workstations:a=[],selectedId:b=null,onSelectAgent:c,onOpenAgentTab:d,stats:e={},onRefresh:f,onStartReplay:g,onViewConversation:k,onOpenFile:m,onOpenStore:n,activeSidebarTab:o,onActiveSidebarTabChange:p}){let[q,r]=(0,i.useState)("agents"),s=void 0!==o?o:q,t=p||r,[u,v]=(0,i.useState)(""),[w,x]=(0,i.useState)(""),[y,z]=(0,i.useState)({agents:!0,folders:!0,metrics:!1}),A=a=>{z(b=>({...b,[a]:!b[a]}))},B=(0,i.useMemo)(()=>{if(!w.trim())return a;let b=w.toLowerCase();return a.filter(a=>a.account?.toLowerCase().includes(b)||a.sessionTitle?.toLowerCase().includes(b)||a.lastText?.toLowerCase().includes(b)||a.connectionId?.toLowerCase().includes(b)||a.provider?.toLowerCase().includes(b)||a.model?.toLowerCase().includes(b)||a.activeTool?.toLowerCase().includes(b))},[a,w]),C=(0,i.useMemo)(()=>{let a={extensions:[],desktop:[],geminiApp:[],geminiCli:[],claude:[],other:[]};return B.forEach(b=>{let c=(b.provider||"").toLowerCase(),d=(b.clientType||"").toLowerCase(),e=(b.cli||"").toLowerCase(),f=(b.connectionId||"").toLowerCase(),g=(b.model||"").toLowerCase(),h="extension"===d||"ide"===d||f.includes("extension"),i="desktop"===d||f.includes("desktop"),j="claude"===e||c.includes("claude")||c.includes("anthropic")||g.includes("claude");h?a.extensions.push(b):i?a.desktop.push(b):"app"===d||c.includes("app")||f.includes("app")?a.geminiApp.push(b):j?a.claude.push(b):c.includes("gemini")||"antigravity"===e||"cli"===d?a.geminiCli.push(b):a.other.push(b)}),a},[B]),D=(a,e)=>{let f=b===a.connectionId,i=a.state||"idle",m=a.account||"agent-factory",n=a.sessionTitle||m,o="app"===a.clientType||(a.provider||"").includes("(app)"),p="extension"===a.clientType||(a.provider||"").includes("extension")||(a.connectionId||"").toLowerCase().includes("extension"),q="desktop"===a.clientType||(a.connectionId||"").toLowerCase().includes("desktop"),r=a.lastText?`${"assistant"===a.lastTextRole?"AI: ":"user"===a.lastTextRole?"You: ":""}${a.lastText}`:`${m} \xb7 ${a.model||"AI Agent"}${a.activeTool?` \xb7 ${a.activeTool}`:""}`;return(0,h.jsxs)("div",{onClick:()=>{c?.(a.connectionId),d?.(a)},className:`group flex items-center justify-between px-3 py-2 cursor-pointer text-xs transition-colors border-l-2 ${f?"bg-[#37373d] text-white border-[#007acc]":"hover:bg-[#2a2d2e] text-[#cccccc] border-transparent"}`,children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1 mr-2",children:[(0,h.jsx)("span",{className:`w-2 h-2 rounded-full shrink-0 ${"error"===i?"bg-rose-500":"streaming"===i||"busy"===i||"working"===i?"bg-emerald-400 animate-pulse shadow-sm shadow-emerald-400":"bg-slate-500"}`}),(0,h.jsxs)("div",{className:"flex flex-col min-w-0 flex-1",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between gap-1.5 min-w-0",children:[(0,h.jsx)("span",{className:"font-medium truncate text-[11px] text-slate-200",title:n,children:n}),p?(0,h.jsx)("span",{className:"shrink-0 bg-sky-950/80 text-sky-300 border border-sky-500/40 text-[9px] font-bold px-1 rounded uppercase tracking-wider",children:"EXT"}):q?(0,h.jsx)("span",{className:"shrink-0 bg-orange-950/80 text-orange-300 border border-orange-500/40 text-[9px] font-bold px-1 rounded uppercase tracking-wider",children:"DESK"}):o?(0,h.jsx)("span",{className:"shrink-0 bg-purple-950/80 text-purple-300 border border-purple-500/40 text-[9px] font-bold px-1 rounded uppercase tracking-wider",children:"APP"}):(0,h.jsx)("span",{className:"shrink-0 bg-emerald-950/80 text-emerald-300 border border-emerald-500/40 text-[9px] font-bold px-1 rounded uppercase tracking-wider",children:"CLI"})]}),(0,h.jsx)("p",{className:"truncate text-[10px] leading-4 text-slate-400 mt-0.5",title:r,children:r})]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[g&&(0,h.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),g(a.connectionId)},className:"opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-[#3e3e42] text-cyan-400 hover:text-white transition-all cursor-pointer",title:"Replay Session (Default)",children:(0,h.jsx)(l.f,{className:"w-3 h-3"})}),k&&(0,h.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),k(a.connectionId)},className:"opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-[#3e3e42] text-slate-400 hover:text-cyan-300 transition-all cursor-pointer",title:"View conversation transcript",children:(0,h.jsx)(j.f,{className:"w-3 h-3"})}),(0,h.jsx)("span",{className:"text-[10px] text-slate-500 font-mono group-hover:text-slate-300",children:a.totalLabel||"0k"})]})]},a.connectionId||`agent-${e}`)};return(0,h.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#1e1e1e] text-[#cccccc] select-none overflow-hidden",children:[(0,h.jsxs)("div",{className:"h-[35px] min-h-[35px] bg-[#252526] border-b border-[#2b2b2b] px-2 flex items-center justify-between",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1",children:[(0,h.jsxs)("button",{onClick:()=>t("agents"),className:`flex items-center gap-1.5 px-2 py-1 rounded text-[11px] font-semibold transition-colors cursor-pointer ${"agents"===s?"bg-[#1e1e1e] text-white border border-[#3e3e42]":"text-slate-400 hover:text-slate-200"}`,title:"View active AI Agents & Sessions",children:[(0,h.jsx)(aL.f,{className:"w-3.5 h-3.5 text-cyan-400"}),(0,h.jsxs)("span",{children:["Agents (",a.length,")"]})]}),(0,h.jsxs)("button",{onClick:()=>t("files"),className:`flex items-center gap-1.5 px-2 py-1 rounded text-[11px] font-semibold transition-colors cursor-pointer ${"files"===s?"bg-[#1e1e1e] text-white border border-[#3e3e42]":"text-slate-400 hover:text-slate-200"}`,title:"Browse Workspace & Project Files",children:[(0,h.jsx)(bc,{className:"w-3.5 h-3.5 text-amber-400"}),(0,h.jsx)("span",{children:"Files"})]})]}),(0,h.jsx)("div",{className:"flex items-center gap-1",children:(0,h.jsx)("button",{onClick:f,title:"Refresh",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors cursor-pointer",children:(0,h.jsx)(aN.f,{className:"w-3 h-3"})})})]}),"files"===s?(0,h.jsx)(bA,{onOpenFile:m,initialPath:u}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:"p-2 border-b border-[#2b2b2b] bg-[#1e1e1e]",children:(0,h.jsxs)("div",{className:"flex items-center gap-1.5 bg-[#252526] border border-[#3e3e42] focus-within:border-[#007acc] rounded px-2 py-1",children:[(0,h.jsx)(aM.f,{className:"w-3 h-3 text-slate-500 shrink-0"}),(0,h.jsx)("input",{type:"text",value:w,onChange:a=>x(a.target.value),placeholder:"Filter agents by name, model...",className:"w-full bg-transparent text-[11px] text-slate-200 outline-none placeholder:text-slate-500"})]})}),(0,h.jsxs)("div",{className:"flex-1 overflow-y-auto divide-y divide-[#2b2b2b]",children:[(0,h.jsxs)("div",{children:[(0,h.jsxs)("button",{type:"button",onClick:()=>A("agents"),className:"w-full flex items-center justify-between px-3 py-1.5 bg-[#252526]/60 hover:bg-[#252526] text-[11px] font-semibold text-slate-300 transition-colors",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1.5",children:[y.agents?(0,h.jsx)(bl.f,{className:"w-3 h-3 text-slate-400"}):(0,h.jsx)(bm.f,{className:"w-3 h-3 text-slate-400"}),(0,h.jsxs)("span",{className:"uppercase text-[10px] tracking-wide",children:["Workstations & Sessions (",B.length,")"]})]}),e?.busy>0&&(0,h.jsxs)("span",{className:"bg-emerald-500/20 text-emerald-400 text-[9px] font-bold px-1.5 py-0.2 rounded-full border border-emerald-500/30",children:[e.busy," active"]})]}),y.agents&&(0,h.jsx)("div",{className:"py-1",children:0===B.length?(0,h.jsx)("div",{className:"px-4 py-3 text-center text-xs text-slate-500 italic",children:"No active agents found"}):(0,h.jsxs)(h.Fragment,{children:[C.extensions?.length>0&&(0,h.jsxs)("div",{className:"mb-2",children:[(0,h.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-sky-400/90 flex items-center gap-1",children:[(0,h.jsx)(bu,{className:"w-2.5 h-2.5"}),(0,h.jsxs)("span",{children:["Extensions & IDEs (",C.extensions.length,")"]})]}),C.extensions.map(D)]}),C.desktop?.length>0&&(0,h.jsxs)("div",{className:"mb-2",children:[(0,h.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-orange-400/90 flex items-center gap-1",children:[(0,h.jsx)(bv.f,{className:"w-2.5 h-2.5"}),(0,h.jsxs)("span",{children:["Claude Desktop (",C.desktop.length,")"]})]}),C.desktop.map(D)]}),C.geminiApp.length>0&&(0,h.jsxs)("div",{className:"mb-2",children:[(0,h.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-purple-400/80 flex items-center gap-1",children:[(0,h.jsx)(a_.f,{className:"w-2.5 h-2.5"}),(0,h.jsxs)("span",{children:["Antigravity Desktop App (",C.geminiApp.length,")"]})]}),C.geminiApp.map(D)]}),C.geminiCli.length>0&&(0,h.jsxs)("div",{className:"mb-2",children:[(0,h.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-emerald-400/80 flex items-center gap-1",children:[(0,h.jsx)(br.f,{className:"w-2.5 h-2.5"}),(0,h.jsxs)("span",{children:["Gemini CLI / Antigravity (",C.geminiCli.length,")"]})]}),C.geminiCli.map(D)]}),C.claude.length>0&&(0,h.jsxs)("div",{className:"mb-2",children:[(0,h.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-amber-400/80 flex items-center gap-1",children:[(0,h.jsx)(bd.f,{className:"w-2.5 h-2.5"}),(0,h.jsxs)("span",{children:["Claude Code (",C.claude.length,")"]})]}),C.claude.map(D)]}),C.other.length>0&&(0,h.jsxs)("div",{className:"mb-2",children:[(0,h.jsx)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-slate-400 flex items-center gap-1",children:(0,h.jsxs)("span",{children:["Other Agents (",C.other.length,")"]})}),C.other.map(D)]})]})})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("button",{type:"button",onClick:()=>A("folders"),className:"w-full flex items-center justify-between px-3 py-1.5 bg-[#252526]/60 hover:bg-[#252526] text-[11px] font-semibold text-slate-300 transition-colors",children:(0,h.jsxs)("div",{className:"flex items-center gap-1.5",children:[y.folders?(0,h.jsx)(bl.f,{className:"w-3 h-3 text-slate-400"}):(0,h.jsx)(bm.f,{className:"w-3 h-3 text-slate-400"}),(0,h.jsx)("span",{className:"uppercase text-[10px] tracking-wide",children:"Watched Brain Directories"})]})}),y.folders&&(0,h.jsxs)("div",{className:"px-3 py-2 space-y-1.5 text-[11px]",children:[(0,h.jsxs)("div",{onClick:()=>{v("~/.gemini/antigravity/brain"),t("files")},className:"flex items-center gap-2 text-slate-400 hover:text-purple-300 cursor-pointer p-1 rounded hover:bg-[#252526] transition-colors",title:"Click to browse Antigravity Brain files",children:[(0,h.jsx)(bq,{className:"w-3.5 h-3.5 text-purple-400 shrink-0"}),(0,h.jsx)("span",{className:"truncate font-mono text-[10px]",children:"~/.gemini/antigravity/brain"})]}),(0,h.jsxs)("div",{onClick:()=>{v("~/.gemini/antigravity-cli/brain"),t("files")},className:"flex items-center gap-2 text-slate-400 hover:text-emerald-300 cursor-pointer p-1 rounded hover:bg-[#252526] transition-colors",title:"Click to browse Antigravity CLI Brain files",children:[(0,h.jsx)(bo,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}),(0,h.jsx)("span",{className:"truncate font-mono text-[10px]",children:"~/.gemini/antigravity-cli/brain"})]}),(0,h.jsxs)("div",{onClick:()=>{v("~/.claude/projects"),t("files")},className:"flex items-center gap-2 text-slate-400 hover:text-amber-300 cursor-pointer p-1 rounded hover:bg-[#252526] transition-colors",title:"Click to browse Claude Projects files",children:[(0,h.jsx)(bo,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),(0,h.jsx)("span",{className:"truncate font-mono text-[10px]",children:"~/.claude/projects"})]})]})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("button",{type:"button",onClick:()=>A("metrics"),className:"w-full flex items-center justify-between px-3 py-1.5 bg-[#252526]/60 hover:bg-[#252526] text-[11px] font-semibold text-slate-300 transition-colors",children:(0,h.jsxs)("div",{className:"flex items-center gap-1.5",children:[y.metrics?(0,h.jsx)(bl.f,{className:"w-3 h-3 text-slate-400"}):(0,h.jsx)(bm.f,{className:"w-3 h-3 text-slate-400"}),(0,h.jsx)("span",{className:"uppercase text-[10px] tracking-wide",children:"Factory Overview"})]})}),y.metrics&&(0,h.jsxs)("div",{className:"p-3 space-y-2 text-xs",children:[(0,h.jsxs)("div",{className:"flex justify-between items-center text-slate-400",children:[(0,h.jsx)("span",{children:"Total Workstations:"}),(0,h.jsx)("span",{className:"font-bold text-slate-200",children:e?.agents||0})]}),(0,h.jsxs)("div",{className:"flex justify-between items-center text-slate-400",children:[(0,h.jsx)("span",{children:"Active Agents:"}),(0,h.jsx)("span",{className:"font-bold text-emerald-400",children:e?.busy||0})]}),(0,h.jsxs)("div",{className:"flex justify-between items-center text-slate-400",children:[(0,h.jsx)("span",{children:"Total Tokens:"}),(0,h.jsx)("span",{className:"font-bold text-cyan-400",children:e?.tokensLabel||"0k"})]})]})]}),(0,h.jsx)("div",{className:"p-2 border-t border-[#252526] bg-[#1a1a1b]",children:(0,h.jsxs)("button",{type:"button",onClick:n,className:"w-full flex items-center justify-between p-2 rounded-lg bg-gradient-to-r from-amber-500/15 to-amber-600/10 hover:from-amber-500/25 hover:to-amber-600/20 border border-amber-500/30 text-amber-300 transition-all cursor-pointer text-xs",title:`Open Supporter Store: ${bB.E} Tech Items & 3D Effects`,children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)(bs.f,{className:"w-4 h-4 text-amber-400"}),(0,h.jsxs)("div",{className:"text-left",children:[(0,h.jsx)("div",{className:"font-bold text-white text-[11px] leading-tight",children:"Supporter Store"}),(0,h.jsxs)("div",{className:"text-[10px] text-amber-400/80",children:[bB.E," Tech Items & 3D Effects"]})]})]}),(0,h.jsx)("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-amber-500/20 border border-amber-500/40",children:"Open"})]})})]})]})]})}var bD=a.i(74215),bE=a.i(7963);function bF({tabs:a=[],activeTabId:b="canvas",onSelectTab:c,onCloseTab:d,isZenFullscreen:e=!1,onToggleZenFullscreen:f=null}){let g=(0,i.useRef)(null);return(0,h.jsxs)("div",{"data-testid":"editor-tabs-bar",className:"h-[35px] min-h-[35px] bg-[#252526] border-b border-[#1e1e1e] flex items-center justify-between select-none overflow-hidden",children:[(0,h.jsx)("div",{ref:g,onWheel:a=>{g.current&&(g.current.scrollLeft+=a.deltaY)},className:"flex items-center h-full overflow-x-auto no-scrollbar scroll-smooth flex-1",style:{scrollbarWidth:"none"},children:a.map(a=>{let e=a.id===b;return(0,h.jsxs)("div",{onClick:()=>c?.(a.id),className:`group flex items-center gap-2 h-full px-3 text-xs cursor-pointer border-r border-[#1e1e1e] transition-colors relative shrink-0 ${e?"bg-[#1e1e1e] text-white border-t-2 border-t-[#007acc]":"bg-[#2d2d2d] text-[#969696] hover:bg-[#252526] hover:text-[#cccccc] border-t-2 border-t-transparent"}`,children:["canvas"===a.type?(0,h.jsx)(aL.f,{className:"w-3.5 h-3.5 text-emerald-400"}):"network"===a.type?(0,h.jsx)(bh.f,{className:"w-3.5 h-3.5 text-indigo-400"}):"telemetry"===a.type?(0,h.jsx)(bd.f,{className:"w-3.5 h-3.5 text-cyan-400"}):"reports"===a.type?(0,h.jsx)(aY.f,{className:"w-3.5 h-3.5 text-amber-400"}):"store"===a.type?(0,h.jsx)(bs.f,{className:"w-3.5 h-3.5 text-amber-400"}):"file"===a.type?(0,h.jsx)(by,{filename:a.filePath||a.title,size:14}):(0,h.jsx)(br.f,{className:"w-3.5 h-3.5 text-purple-400"}),(0,h.jsx)("span",{className:"font-medium text-[11px] truncate max-w-[140px]",children:a.title}),!1!==a.closable&&(0,h.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),d?.(a.id)},title:"Close tab",className:"p-0.5 rounded text-slate-500 hover:text-white hover:bg-[#333333] transition-colors opacity-70 group-hover:opacity-100",children:(0,h.jsx)(bD.X,{className:"w-3 h-3"})})]},a.id)})}),(0,h.jsxs)("div",{className:"flex items-center px-2 gap-1 bg-[#252526] border-l border-[#1e1e1e] shrink-0 h-full",children:[f&&"canvas"===b&&(0,h.jsx)("button",{type:"button","data-testid":"editor-zen-fullscreen-btn",onClick:f,title:e?"Thoát toàn màn hình (ESC)":"Chế độ Chill toàn màn hình Virtual Office (Shift+F / ESC để thoát)",className:"p-1 mr-0.5 rounded text-slate-400 hover:text-cyan-300 hover:bg-[#333333] transition-colors cursor-pointer",children:(0,h.jsx)(a6.f,{className:"w-3.5 h-3.5"})}),(0,h.jsx)("button",{onClick:()=>{g.current&&g.current.scrollBy({left:-100,behavior:"smooth"})},title:"Scroll left",className:"p-1 rounded text-slate-500 hover:text-slate-200 transition-colors",children:(0,h.jsx)(bE.f,{className:"w-3 h-3"})}),(0,h.jsx)("button",{onClick:()=>{g.current&&g.current.scrollBy({left:100,behavior:"smooth"})},title:"Scroll right",className:"p-1 rounded text-slate-500 hover:text-slate-200 transition-colors",children:(0,h.jsx)(bm.f,{className:"w-3 h-3"})})]})]})}var bG=a.i(90702);let bH={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};bH.node;let bI=(0,aP.f)(bH);var bJ=a.i(82524),bK=a.i(49140);function bL({traces:a=[],activeTab:b="logs",onTabChange:c,onClose:d,isMaximized:e=!1,onToggleMaximize:f}){let[g,j]=(0,i.useState)(b),[k,l]=(0,i.useState)(""),[m,n]=(0,i.useState)(!0),[o,p]=(0,i.useState)(null),[q,r]=(0,i.useState)(!1),s=(0,i.useRef)(null);(0,i.useEffect)(()=>{r(!0)},[]),(0,i.useEffect)(()=>{j(b)},[b]);let t=(0,i.useMemo)(()=>{let b=[],c=a=>{if(!q)return"--:--:--";if(a){if("string"==typeof a&&a.includes(":"))return a;let b=new Date(a);if(!isNaN(b.getTime()))return b.toLocaleTimeString()}return new Date().toLocaleTimeString()};a.forEach(a=>{let d=a.account||"Agent",e=a.model||"gemini-3.8-flash",f=a.clientType||(a.provider?.includes("app")?"app":"cli"),g=a.provider||"gemini",h=a.connectionId||a.traceId||"agent";Array.isArray(a.logs)&&a.logs.length>0?a.logs.forEach((a,i)=>{let j=(a.type||"").toUpperCase(),k=j.includes("ERR")?"ERROR":j.includes("TOOL")?"TOOL":"STREAM";b.push({id:`${h}-${a.timestamp||i}-${i}`,time:c(a.timestamp),level:k,provider:g,clientType:f,account:d,model:e,message:a.detail||a.summary||"Event recorded",meta:a.summary!==a.detail?a.summary:""})}):(a.activeTool&&b.push({id:`${h}-tool-${a.activeTool}`,time:c(a.timestamp),level:"TOOL",provider:g,clientType:f,account:d,model:e,message:`Executing tool: ${a.activeTool}`,meta:a.activeToolParams||""}),("streaming"===a.state||"busy"===a.state)&&b.push({id:`${h}-stream`,time:c(a.timestamp),level:"STREAM",provider:g,clientType:f,account:d,model:e,message:`Active session processing tokens (${Number.isFinite(a.totalTokens)?`${Math.round(a.totalTokens/1e3)}k`:"unavailable"})`}),"error"===a.state&&b.push({id:`${h}-err`,time:c(a.timestamp),level:"ERROR",provider:g,clientType:f,account:d,model:e,message:`Session encountered error state (${a.error||"failed"})`}))}),0===b.length&&b.push({id:"sys-init",time:q?new Date().toLocaleTimeString():"--:--:--",level:"SYSTEM",provider:"system",clientType:"cli",account:"AGMon Core",message:"Watcher initialized. Monitoring ~/.gemini and ~/.claude directories in real time."});let d=b.length>250?b.slice(-250):b;return o?d.filter(a=>a.time>o):d},[a,o,q]),u=(0,i.useMemo)(()=>{let a=t;if("tools"===g?a=a.filter(a=>"TOOL"===a.level):"problems"===g&&(a=a.filter(a=>"ERROR"===a.level)),k.trim()){let b=k.toLowerCase();a=a.filter(a=>a.message.toLowerCase().includes(b)||a.account.toLowerCase().includes(b)||a.level.toLowerCase().includes(b)||a.model?.toLowerCase().includes(b))}return a},[t,g,k]);(0,i.useEffect)(()=>{m&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[u,m]);let v=[{id:"logs",label:"Agent Output",icon:be.f,count:t.length},{id:"tools",label:"Tool Executions",icon:bd.f,count:t.filter(a=>"TOOL"===a.level).length},{id:"problems",label:"Problems",icon:bG.f,count:t.filter(a=>"ERROR"===a.level).length}];return(0,h.jsxs)("div",{"data-testid":"bottom-panel-container",className:"flex flex-col h-full w-full bg-[#1e1e1e] text-[#cccccc] select-none overflow-hidden",children:[(0,h.jsxs)("div",{className:"h-[32px] min-h-[32px] bg-[#252526] border-b border-[#2b2b2b] px-2 flex items-center justify-between",children:[(0,h.jsx)("div",{className:"flex items-center h-full gap-1",children:v.map(a=>{let b=g===a.id,d=a.icon;return(0,h.jsxs)("button",{type:"button",onClick:()=>{j(a.id),c?.(a.id)},className:`flex items-center gap-1.5 h-full px-2.5 text-xs transition-colors border-b-2 font-medium ${b?"text-white border-[#007acc] bg-[#1e1e1e]":"text-[#858585] hover:text-[#cccccc] border-transparent"}`,children:[(0,h.jsx)(d,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{className:"text-[11px] uppercase tracking-wider",children:a.label}),a.count>0&&(0,h.jsx)("span",{className:"bg-[#333333] text-slate-300 text-[9px] font-mono px-1 rounded-full",children:a.count})]},a.id)})}),(0,h.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1 bg-[#1e1e1e] border border-[#3e3e42] rounded px-1.5 py-0.5 h-5",children:[(0,h.jsx)(aM.f,{className:"w-2.5 h-2.5 text-slate-500"}),(0,h.jsx)("input",{type:"text",value:k,onChange:a=>l(a.target.value),placeholder:"Filter logs...",className:"bg-transparent text-[10px] text-slate-200 outline-none w-20 sm:w-32 placeholder:text-slate-500"})]}),(0,h.jsx)("button",{onClick:()=>n(a=>!a),title:m?"Pause auto-scroll":"Resume auto-scroll",className:`p-1 rounded text-xs transition-colors ${m?"text-cyan-400 bg-cyan-950/40":"text-slate-500 hover:text-slate-300"}`,children:m?(0,h.jsx)(bK.f,{className:"w-3 h-3"}):(0,h.jsx)(bJ.f,{className:"w-3 h-3"})}),(0,h.jsx)("button",{onClick:()=>p(new Date().toLocaleTimeString()),title:"Clear log console",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors",children:(0,h.jsx)(bI,{className:"w-3 h-3"})}),f&&(0,h.jsx)("button",{onClick:f,title:e?"Restore panel size":"Maximize panel",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors",children:e?(0,h.jsx)(a7.f,{className:"w-3 h-3"}):(0,h.jsx)(a6.f,{className:"w-3 h-3"})}),(0,h.jsx)("button",{onClick:d,title:"Close panel (Cmd+J / Ctrl+J)",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors",children:(0,h.jsx)(bD.X,{className:"w-3 h-3"})})]})]}),(0,h.jsx)("div",{ref:s,className:"flex-1 p-2 font-mono text-[11px] leading-relaxed overflow-y-auto bg-[#181818] select-text divide-y divide-[#222222]",children:0===u.length?(0,h.jsx)("div",{className:"text-slate-500 italic py-4 text-center",children:"No logs match the current filters"}):u.map(a=>{let b="TOOL"===a.level,c="ERROR"===a.level,d="app"===a.clientType;return(0,h.jsxs)("div",{className:"py-1 flex items-start gap-2 hover:bg-[#202020] px-1 rounded",children:[(0,h.jsx)("span",{suppressHydrationWarning:!0,className:"text-slate-500 shrink-0 text-[10px]",children:a.time}),(0,h.jsx)("span",{className:`px-1 py-0.2 rounded text-[9px] font-bold shrink-0 ${c?"bg-rose-950/80 text-rose-300 border border-rose-500/40":b?"bg-cyan-950/80 text-cyan-300 border border-cyan-500/40":"bg-slate-800 text-slate-300 border border-slate-700"}`,children:a.level}),(0,h.jsx)("span",{className:`px-1 py-0.2 rounded text-[9px] font-bold shrink-0 ${d?"bg-purple-950/80 text-purple-300 border border-purple-500/40":"bg-emerald-950/80 text-emerald-300 border border-emerald-500/40"}`,children:d?"APP":"CLI"}),(0,h.jsxs)("span",{className:"text-slate-300 font-semibold shrink-0",children:["[",a.account,"]"]}),(0,h.jsx)("span",{className:"text-slate-400 break-all",children:a.message}),a.meta&&(0,h.jsx)("span",{className:"text-slate-500 text-[10px] truncate max-w-xs",children:a.meta})]},a.id)})})]})}var bM=a.i(11715),bN=a.i(80447),bO=a.i(85650),bP=a.i(52562),bQ=a.i(33364),bR=a.i(14498);function bS({selectedAgent:a=null,workstations:b=[],activeTab:c="chat",onTabChange:d,onSelectAgent:e,onClose:f,onStartReplay:g}){let m,n,o,p,q,r,s,t,u,v,[w,x]=(0,i.useState)(!1),[y,z]=(0,i.useState)(c||"chat"),A=d?c:y,B=a=>{d?d(a):z(a)},C=a?.clientType==="app"||(a?.provider||"").toLowerCase().includes("(app)"),D=a?.state==="streaming"||a?.state==="busy"||a?.state==="working"||a?.mode==="streaming";return(0,h.jsxs)("div",{"data-testid":"secondary-sidebar-container",className:"flex flex-col h-full w-full bg-[var(--bg-editor)] text-[var(--text-main)] select-none overflow-hidden",children:[(0,h.jsxs)("div",{className:"h-[36px] min-h-[36px] bg-[var(--bg-card)] border-b border-[var(--border-subtle)] px-2 flex items-center justify-between shrink-0",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1",children:[(0,h.jsxs)("button",{type:"button",onClick:()=>B("chat"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-semibold transition-colors cursor-pointer ${"chat"===A?"bg-[var(--bg-editor)] text-[var(--accent-primary)] border border-[var(--border-card)]":"text-[var(--text-muted)] hover:text-[var(--text-bright)] hover:bg-[var(--bg-hover)]"}`,title:"View Agent Live Chat & Conversation Transcript",children:[(0,h.jsxs)("div",{className:"relative",children:[(0,h.jsx)(j.f,{className:"w-3.5 h-3.5"}),D&&(0,h.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-1.5 h-1.5 rounded-full bg-cyan-400 animate-ping"})]}),(0,h.jsx)("span",{children:"Live Chat"}),D&&(0,h.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 inline-block ml-0.5"})]}),(0,h.jsxs)("button",{type:"button",onClick:()=>B("inspector"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-semibold transition-colors cursor-pointer ${"inspector"===A?"bg-[var(--bg-editor)] text-[var(--accent-primary)] border border-[var(--border-card)]":"text-[var(--text-muted)] hover:text-[var(--text-bright)] hover:bg-[var(--bg-hover)]"}`,title:"View Agent specs, telemetry, and token usage",children:[(0,h.jsx)(bM.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{children:"Inspector"})]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1",children:["chat"===A&&a&&(0,h.jsx)("button",{onClick:()=>(0,aK.f)(a.connectionId||a.traceId),title:"Open in Detached Window (VS Code style)",className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--accent-primary)] hover:bg-[var(--bg-hover)] transition-colors cursor-pointer",children:(0,h.jsx)(k.f,{className:"w-3.5 h-3.5"})}),(0,h.jsx)("button",{onClick:f,title:"Close Secondary Sidebar (Cmd+Alt+B)",className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-bright)] hover:bg-[var(--bg-hover)] transition-colors cursor-pointer",children:(0,h.jsx)(bD.X,{className:"w-3.5 h-3.5"})})]})]}),(0,h.jsx)("div",{className:"flex-1 overflow-hidden flex flex-col",children:"chat"===A?a?(0,h.jsx)(bQ.f,{sessionTrace:a,isSidebar:!0,onClose:f,onStartReplay:g}):(0,h.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col justify-center items-center text-center space-y-4",children:[(0,h.jsx)("div",{className:"w-12 h-12 rounded-full bg-[#252526] border border-[#333333] flex items-center justify-center text-slate-500",children:(0,h.jsx)(j.f,{className:"w-6 h-6"})}),(0,h.jsxs)("div",{className:"space-y-1.5 max-w-[280px]",children:[(0,h.jsx)("h4",{className:"font-bold text-slate-300 text-xs",children:"No Agent Selected"}),(0,h.jsx)("p",{className:"text-[11px] text-slate-400 leading-relaxed",children:"Click any workstation on the virtual office or select an active agent below to inspect live conversation:"})]}),b.length>0&&(0,h.jsxs)("div",{className:"w-full max-w-[280px] space-y-1.5 pt-2 text-left",children:[(0,h.jsxs)("span",{className:"text-[10px] font-bold uppercase tracking-wider text-slate-500 block px-1",children:["Active Agents (",b.length,")"]}),(0,h.jsx)("div",{className:"space-y-1 max-h-[28rem] overflow-y-auto pr-1",children:b.map((a,b)=>{let c="streaming"===a.state||"busy"===a.state||"working"===a.state||"streaming"===a.mode,d=a.account||"agent-factory",f=a.sessionTitle||d,g="app"===a.clientType||(a.provider||"").includes("(app)"),i="extension"===a.clientType||(a.provider||"").includes("extension")||(a.connectionId||"").toLowerCase().includes("extension"),j=a.lastText?`${"assistant"===a.lastTextRole?"AI: ":"user"===a.lastTextRole?"You: ":""}${a.lastText}`:`${d} \xb7 ${a.model||"AI Agent"}${a.activeTool?` \xb7 ${a.activeTool}`:""}`;return(0,h.jsxs)("button",{onClick:()=>e?.(a.connectionId||a.traceId),className:"w-full flex items-center gap-2 p-2 rounded bg-[#252526] hover:bg-[#2d2d2e] border border-[#333333] hover:border-[#007acc] text-left transition-colors cursor-pointer text-slate-300",children:[(0,h.jsx)(aL.f,{className:"w-3.5 h-3.5 text-cyan-400 shrink-0 self-start mt-0.5"}),(0,h.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between gap-1.5 min-w-0",children:[(0,h.jsx)("span",{className:"truncate font-medium text-xs text-slate-200",title:f,children:f}),i?(0,h.jsx)("span",{className:"shrink-0 bg-sky-950/80 text-sky-300 border border-sky-500/40 text-[9px] font-bold px-1 rounded uppercase",children:"EXT"}):g?(0,h.jsx)("span",{className:"shrink-0 bg-purple-950/80 text-purple-300 border border-purple-500/40 text-[9px] font-bold px-1 rounded uppercase",children:"APP"}):(0,h.jsx)("span",{className:"shrink-0 bg-emerald-950/80 text-emerald-300 border border-emerald-500/40 text-[9px] font-bold px-1 rounded uppercase",children:"CLI"})]}),(0,h.jsx)("p",{className:"truncate text-[10px] leading-4 text-slate-400 mt-0.5",title:j,children:j})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[c&&(0,h.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),(0,h.jsx)(bm.f,{className:"w-3.5 h-3.5 text-slate-500"})]})]},a.connectionId||a.traceId||`active-agent-${b}`)})})]})]}):(0,h.jsx)("div",{className:"flex-1 overflow-y-auto p-3 space-y-3 text-xs select-text",children:a?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)("div",{className:"w-6 h-6 rounded bg-[#1e1e1e] flex items-center justify-center border border-[#3e3e42]",children:(0,h.jsx)(br.f,{className:"w-3.5 h-3.5 text-cyan-400"})}),(0,h.jsxs)("div",{children:[(0,h.jsx)("h3",{className:"font-bold text-slate-200 text-xs",children:a.account||`Desk #${(a.deskIndex??0)+1}`}),(0,h.jsxs)("p",{className:"text-[10px] text-slate-400 font-mono",children:["ID: ",a.connectionId?.slice(0,8),"..."]})]})]}),C?(0,h.jsxs)("span",{className:"bg-purple-950/80 text-purple-300 border border-purple-500/40 text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider flex items-center gap-1",children:[(0,h.jsx)(bN.f,{className:"w-2.5 h-2.5"}),(0,h.jsx)("span",{children:"APP"})]}):(0,h.jsxs)("span",{className:"bg-emerald-950/80 text-emerald-300 border border-emerald-500/40 text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider flex items-center gap-1",children:[(0,h.jsx)(be.f,{className:"w-2.5 h-2.5"}),(0,h.jsx)("span",{children:"CLI"})]})]}),(0,h.jsxs)("div",{className:"pt-2 border-t border-[#2b2b2b] grid grid-cols-2 gap-2 text-[11px]",children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"PROVIDER"}),(0,h.jsx)("span",{className:"font-semibold text-slate-300 uppercase",children:a.provider||"Unavailable"})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"MODEL"}),(0,h.jsx)("span",{className:"font-semibold text-emerald-400 truncate block",children:a.model||"Unavailable"})]})]})]}),(0,h.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,h.jsx)("span",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider block",children:"CURRENT ACTIVITY"}),(0,h.jsxs)("div",{className:"flex items-center justify-between text-[11px]",children:[(0,h.jsx)("span",{className:"text-slate-400",children:"Status:"}),(0,h.jsx)("span",{className:`font-semibold capitalize px-1.5 py-0.2 rounded text-[10px] ${"streaming"===a.state?"bg-cyan-500/20 text-cyan-300 border border-cyan-500/30":"busy"===a.state?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30":"error"===a.state?"bg-rose-500/20 text-rose-300 border border-rose-500/30":"bg-slate-800 text-slate-400"}`,children:a.state||"Idle"})]}),a.activeTool&&(0,h.jsxs)("div",{className:"pt-1",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[11px] block",children:"Active Tool:"}),(0,h.jsx)("div",{className:"mt-1 bg-[#181818] p-1.5 rounded border border-[#2b2b2b] font-mono text-[10px] text-cyan-300 truncate",children:a.activeTool})]})]}),(m=(0,bR.F)(),n=a?.skin||m?.equippedSkin,o=a?.aura||m?.equippedAura,p=a?.pet||m?.equippedPet,q=a?.props&&a.props.length>0?a.props:m?.equippedProps||[],r=a?.trophy||m?.equippedTrophy,s=n&&"classic"!==n&&"none"!==n?(0,bB.x)(n):null,t=o&&"none"!==o?(0,bB.x)(o):null,u=p&&"none"!==p?(0,bB.x)(p):null,v=r&&"none"!==r?(0,bB.x)(r):null,(0,h.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsxs)("span",{className:"text-[10px] font-bold text-cyan-400 uppercase tracking-wider flex items-center gap-1.5",children:[(0,h.jsx)(a_.f,{className:"w-3 h-3 text-cyan-400"}),(0,h.jsx)("span",{children:"EQUIPPED COSMETICS"})]}),(s||t||u||v||q.length>0)&&(0,h.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-cyan-950/80 text-cyan-300 border border-cyan-500/40 font-mono font-bold",children:"ACTIVE GEAR"})]}),(0,h.jsxs)("div",{className:"space-y-1.5 text-[11px]",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between py-1 border-b border-[#2d2d30]",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Chassis Skin:"}),(0,h.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:s?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("span",{className:"w-2 h-2 rounded-full inline-block border border-white/20",style:{backgroundColor:s.color}}),(0,h.jsx)("span",{className:"text-emerald-400 font-semibold truncate max-w-[120px]",children:s.name}),(0,h.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-slate-800 text-slate-400 border border-slate-700",children:s.archetype})]}):(0,h.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Classic Chassis"})})]}),(0,h.jsxs)("div",{className:"flex items-center justify-between py-1 border-b border-[#2d2d30]",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Particle Aura:"}),(0,h.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:t?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("span",{className:"text-purple-400 font-semibold truncate max-w-[120px]",children:t.name}),(0,h.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-purple-950/60 text-purple-300 border border-purple-800/40",children:t.archetype})]}):(0,h.jsx)("span",{className:"text-slate-500 text-[10px]",children:"None"})})]}),(0,h.jsxs)("div",{className:"py-1 border-b border-[#2d2d30]",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between mb-0.5",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Tech Desk Props:"}),(0,h.jsxs)("span",{className:"text-[9px] text-slate-500 font-mono",children:["(",q.length,")"]})]}),q.length>0?(0,h.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:q.map((a,b)=>{let c=(0,bB.x)(a);return(0,h.jsxs)("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-cyan-950/60 text-cyan-300 border border-cyan-800/40 font-mono flex items-center gap-1",children:[(0,h.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:c?.color||"#38bdf8"}}),(0,h.jsx)("span",{children:c?.name||a})]},b)})}):(0,h.jsx)("span",{className:"text-slate-500 text-[10px]",children:"Standard Workstation"})]}),(0,h.jsxs)("div",{className:"flex items-center justify-between py-1 border-b border-[#2d2d30]",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Companion Pet:"}),(0,h.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:u?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("span",{className:"text-amber-400 font-semibold truncate max-w-[120px]",children:u.name}),(0,h.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-amber-950/60 text-amber-300 border border-amber-800/40",children:u.archetype})]}):(0,h.jsx)("span",{className:"text-slate-500 text-[10px]",children:"None"})})]}),(0,h.jsxs)("div",{className:"flex items-center justify-between py-1",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Desk Trophy:"}),(0,h.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:v?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("span",{className:"text-yellow-400 font-semibold truncate max-w-[120px]",children:v.name}),(0,h.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-yellow-950/60 text-yellow-300 border border-yellow-800/40",children:v.archetype})]}):(0,h.jsx)("span",{className:"text-slate-500 text-[10px]",children:"None"})})]})]})]})),(0,h.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,h.jsx)("span",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider block",children:"TOKEN USAGE"}),(0,h.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-[11px]",children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"Total Tokens"}),(0,h.jsx)("span",{className:"font-bold text-emerald-400 font-mono",children:Number.isFinite(a.totalTokens)?a.totalTokens.toLocaleString():"—"})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"Requests / Steps"}),(0,h.jsx)("span",{className:"font-bold text-slate-300 font-mono",children:Number.isFinite(a.requestCount)?a.requestCount:"—"})]})]})]}),(0,h.jsxs)("div",{className:"space-y-1.5 pt-1",children:[g&&(0,h.jsxs)("button",{onClick:()=>g(a.connectionId||a.traceId),className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#007acc] hover:bg-[#0062a3] text-white font-medium text-xs transition-colors shadow-sm cursor-pointer",children:[(0,h.jsx)(l.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{children:"Replay Session"})]}),(0,h.jsxs)("button",{onClick:()=>B("chat"),className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#252526] hover:bg-[#2d2d2e] text-slate-200 hover:text-white font-medium text-xs transition-colors border border-[#3e3e42] cursor-pointer",children:[(0,h.jsx)(j.f,{className:"w-3.5 h-3.5 text-cyan-400"}),(0,h.jsx)("span",{children:"View Live Chat (Pin to Sidebar)"})]}),(0,h.jsxs)("button",{onClick:()=>(0,aK.f)(a.connectionId||a.traceId),className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#252526] hover:bg-[#2d2d2e] text-slate-300 hover:text-white text-xs transition-colors border border-[#3e3e42] cursor-pointer",children:[(0,h.jsx)(k.f,{className:"w-3.5 h-3.5 text-cyan-400"}),(0,h.jsx)("span",{children:"Open in Detached Window"})]}),(0,h.jsxs)("button",{onClick:()=>{a?.connectionId&&(navigator.clipboard?.writeText(a.connectionId),x(!0),setTimeout(()=>x(!1),2e3))},className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#252526] hover:bg-[#2d2d2e] text-slate-300 text-xs transition-colors border border-[#3e3e42] cursor-pointer",children:[w?(0,h.jsx)(bP.f,{className:"w-3.5 h-3.5 text-emerald-400"}):(0,h.jsx)(bO.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{children:w?"Connection ID Copied!":"Copy Connection ID"})]})]})]}):(0,h.jsxs)("div",{className:"py-12 text-center text-slate-500 space-y-3",children:[(0,h.jsx)("div",{className:"w-10 h-10 rounded-full bg-[#252526] border border-[#333333] flex items-center justify-center mx-auto text-slate-600",children:(0,h.jsx)(bM.f,{className:"w-5 h-5"})}),(0,h.jsxs)("div",{className:"space-y-1 px-4",children:[(0,h.jsx)("h4",{className:"font-bold text-slate-400 text-xs",children:"No Agent Selected"}),(0,h.jsx)("p",{className:"text-[11px] leading-relaxed",children:"Click any workstation on the virtual office or select from the Explorer list to inspect telemetry and details."})]})]})})})]})}let bT={name:"users",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};bT.node;let bU=(0,aP.f)(bT);function bV({mode:a="live",connected:b=!0,live:c=!0,stats:d={},selectedAgent:e=null,soundEnabled:f=!1,isBottomOpen:g=!0,onToggleBottom:i}){return(0,h.jsxs)("footer",{"data-testid":"status-bar",className:"h-[22px] min-h-[22px] bg-[#181818] border-t border-[#2b2b2b] px-3 flex items-center justify-between text-[11px] text-[#cccccc] select-none shrink-0 z-30 font-sans",children:[(0,h.jsxs)("div",{className:"flex items-center gap-3",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1.5 hover:text-white cursor-pointer transition-colors",children:[(0,h.jsx)("span",{className:`w-2 h-2 rounded-full ${b&&c?"bg-emerald-400 animate-pulse shadow-sm shadow-emerald-400":"bg-amber-400"}`}),(0,h.jsx)("span",{className:"font-medium text-[10px]",children:"live"===a?"WATCHER: LIVE":"MODE: DEMO MOCK"})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 hover:text-white transition-colors",children:[(0,h.jsx)(bU,{className:"w-3 h-3 text-[#007acc]"}),(0,h.jsxs)("span",{children:[d?.agents||0," Desks"]})]}),d?.busy>0&&(0,h.jsxs)("div",{className:"flex items-center gap-1 text-emerald-400",children:[(0,h.jsx)(bd.f,{className:"w-3 h-3 animate-spin"}),(0,h.jsxs)("span",{children:[d.busy," Working"]})]})]}),(0,h.jsx)("div",{className:"hidden md:flex items-center gap-2 text-slate-400 text-[10px]",children:e?(0,h.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(br.f,{className:"w-3 h-3 text-cyan-400"}),(0,h.jsx)("span",{className:"text-slate-200 font-semibold truncate max-w-[200px]",children:e.account||e.connectionId}),(0,h.jsxs)("span",{children:["(",e.model||"gemini-3.8-flash",")"]})]}):(0,h.jsx)("span",{children:"Ready · Real-time monitoring Antigravity CLI, App & Claude"})}),(0,h.jsxs)("div",{className:"flex items-center gap-3",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1 text-slate-400 text-[10px]",children:[f?(0,h.jsx)(aO.f,{className:"w-3 h-3 text-emerald-400"}):(0,h.jsx)(aR,{className:"w-3 h-3 text-slate-500"}),(0,h.jsx)("span",{className:"hidden sm:inline",children:f?"Audio On":"Muted"})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 text-slate-400 font-mono text-[10px]",children:[(0,h.jsx)("span",{children:"Tokens:"}),(0,h.jsx)("span",{className:"text-emerald-400 font-bold",children:d?.tokensLabel||"0k"})]}),(0,h.jsxs)("button",{type:"button",onClick:i,title:g?"Hide Terminal (Cmd+J)":"Show Terminal (Cmd+J)",className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors ${g?"bg-[#007acc]/20 text-[#4fc1ff]":"text-slate-400 hover:text-white hover:bg-[#252526]"}`,children:[(0,h.jsx)(be.f,{className:"w-3 h-3"}),(0,h.jsx)("span",{className:"text-[10px] hidden sm:inline",children:"Terminal"})]})]})]})}var bW=a.i(8658);let bX={name:"type",size:24,node:[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]]};bX.node;let bY=(0,aP.f)(bX);function bZ({isOpen:a=!1,onClose:b,onOpenStore:c,onOpenThemeSettings:d,onOpenFontSettings:e,onToggleLeftSidebar:f,onToggleBottomPanel:g,onToggleRightSidebar:m,onToggleZenFullscreen:n,onOpenChatSidebar:o,onOpenFilesExplorer:p,onToggleSound:q,onToggleNotif:r,onRefresh:s,onSetMode:t,onSelectPreset:u,onOpenReports:v,onStartReplay:w}){let[x,y]=(0,i.useState)(""),z=(0,i.useRef)(null);if((0,i.useEffect)(()=>{a&&(setTimeout(()=>z.current?.focus(),50),y(""))},[a]),(0,i.useEffect)(()=>{let c=c=>{"Escape"===c.key&&a&&b()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a,b]),!a)return null;let A=[{id:"toggle-left",title:"View: Toggle Primary Side Bar",shortcut:"Cmd+B",icon:a1,action:()=>{f(),b()}},{id:"open-files-explorer",title:"File: Open Workspace Files Explorer (Code & Artifacts)",icon:bj,action:()=>{p?.(),b()}},{id:"toggle-bottom",title:"View: Toggle Bottom Panel (Terminal & Logs)",shortcut:"Cmd+J",icon:a3,action:()=>{g(),b()}},{id:"toggle-zen-fullscreen",title:"View: Toggle Virtual Office Chill Mode (Full Screen)",shortcut:"Shift+F",icon:a6.f,action:()=>{n?.(),b()}},{id:"toggle-right",title:"View: Toggle Secondary Side Bar (Live Chat & Inspector)",shortcut:"Cmd+Alt+B",icon:a5,action:()=>{m(),b()}},{id:"open-chat-sidebar",title:"Chat: Pin Live Chat to Sidebar",icon:j.f,action:()=>{o?.(),b()}},{id:"open-chat-new-window",title:"Chat: Move into New Window (Detached)",icon:k.f,action:()=>{(0,aK.f)(),b()}},{id:"preferences-theme",title:"Preferences: Color Theme (VS Code Themes)",icon:a$.f,action:()=>{d?.(),b()}},{id:"preferences-fonts",title:"Preferences: Configure Fonts (UI & Monospace)",icon:bY,action:()=>{e?.(),b()}},{id:"open-reports",title:"Reports: Open Token Usage & Analytics Report",icon:aY.f,action:()=>{v?.(),b()}},{id:"open-store",title:"Store: Open Supporter Store & Character Customization (Buy Me a Coffee)",icon:aZ.f,action:()=>{c?.(),b()}},{id:"start-replay",title:"Time-Machine: Replay Session History",icon:l.f,action:()=>{w?.(),b()}},{id:"refresh-watchers",title:"Watcher: Force Refresh All Watchers & Brain Transcripts",shortcut:"Cmd+R",icon:aN.f,action:()=>{s(),b()}},{id:"live-mode",title:"Mode: Switch to Live Watchers (Realtime ~/.gemini & ~/.claude)",icon:aX,action:()=>{t("live"),b()}},{id:"mock-storm",title:"Preset: Run Storm Demo (30 Agents Stress Test)",icon:bW.f,action:()=>{t("mock"),u("storm"),b()}},{id:"mock-busy",title:"Preset: Run Busy Demo (8 Working Agents)",icon:bW.f,action:()=>{t("mock"),u("busy"),b()}},{id:"toggle-sound",title:"Audio: Toggle 8-bit Sound FX",icon:aO.f,action:()=>{q(),b()}},{id:"toggle-notif",title:"System: Toggle Desktop Notifications",icon:aT,action:()=>{r(),b()}}].filter(a=>a.title.toLowerCase().includes(x.toLowerCase()));return(0,h.jsx)("div",{onClick:b,className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-xs flex items-start justify-center pt-16 px-4",children:(0,h.jsxs)("div",{onClick:a=>a.stopPropagation(),className:"w-full max-w-xl bg-[#252526] border border-[#3e3e42] rounded-lg shadow-2xl overflow-hidden flex flex-col max-h-[420px]",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5 bg-[#1e1e1e] border-b border-[#333333]",children:[(0,h.jsx)(aM.f,{className:"w-4 h-4 text-slate-400 shrink-0"}),(0,h.jsx)("input",{ref:z,type:"text",value:x,onChange:a=>y(a.target.value),placeholder:"Type a command or search actions...",className:"w-full bg-transparent text-xs text-slate-100 outline-none placeholder:text-slate-500"}),(0,h.jsx)("kbd",{className:"text-[10px] bg-[#2a2d2e] border border-[#3e3e42] rounded px-1.5 py-0.5 text-slate-400",children:"Esc"})]}),(0,h.jsx)("div",{className:"flex-1 overflow-y-auto divide-y divide-[#2d2d2d] py-1",children:0===A.length?(0,h.jsx)("div",{className:"p-4 text-center text-xs text-slate-500 italic",children:"No matching commands found"}):A.map(a=>{let b=a.icon;return(0,h.jsxs)("div",{onClick:a.action,className:"flex items-center justify-between px-3 py-2 cursor-pointer hover:bg-[#007acc] hover:text-white text-[#cccccc] text-xs transition-colors group",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,h.jsx)(b,{className:"w-4 h-4 text-slate-400 group-hover:text-white shrink-0"}),(0,h.jsx)("span",{className:"font-medium truncate text-[11px]",children:a.title})]}),a.shortcut&&(0,h.jsx)("kbd",{className:"font-mono text-[9px] bg-[#1e1e1e] group-hover:bg-[#0062a3] border border-[#3e3e42] group-hover:border-transparent px-1.5 py-0.5 rounded text-slate-400 group-hover:text-white shrink-0",children:a.shortcut})]},a.id)})})]})})}var b$=a.i(12265),b_=a.i(72391);let b0={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]};b0.node;let b1=(0,aP.f)(b0);var b2=a.i(44373);let b3={extension:{type:b2.x.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await a.A(7916)}},b4={extension:{type:b2.x.Environment,name:"webworker",priority:0},test:()=>"u">typeof self&&void 0!==self.WorkerGlobalScope,load:async()=>{await a.A(44390)}};a.i(28755),a.i(91540),a.i(68087);var b5=a.i(61607);b2.H.add(b3,b4);var b6=a.i(58422),b7=a.i(67663);async function b8(a={}){return void 0!==e?e:e=await (async()=>{let b=b6.f.get().getNavigator().gpu;if(!b)return!1;try{let c=await b.requestAdapter(a);return await c.requestDevice(),!0}catch(a){return!1}})()}let b9=["webgl","webgpu","canvas"];async function ca(b){let c,e=[];b.preference?Array.isArray(b.preference)?e=b.preference.slice():(e.push(b.preference),b9.forEach(a=>{a!==b.preference&&e.push(a)})):e=b9.slice();let f={};for(let g=0;g<e.length;g++){let h=e[g];if("webgpu"===h&&await b8()){let{WebGPURenderer:d}=await a.A(21326);c=d,f={...b,...b.webgpu};break}if("webgl"===h&&function(a){return void 0!==d?d:d=(()=>{let b={stencil:!0,failIfMajorPerformanceCaveat:a??b7.f.defaultOptions.failIfMajorPerformanceCaveat};try{if(!b6.f.get().getWebGLRenderingContext())return!1;let a=b6.f.get().createCanvas().getContext("webgl",b),c=!!a?.getContextAttributes()?.stencil;if(a){let b=a.getExtension("WEBGL_lose_context");b&&b.loseContext()}return a=null,c}catch(a){return!1}})()}(b.failIfMajorPerformanceCaveat??b7.f.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:d}=await a.A(96549);c=d,f={...b,...b.webgl};break}if("canvas"===h){let{CanvasRenderer:d}=await a.A(10069);c=d,f={...b,...b.canvasOptions};break}}if(delete f.webgpu,delete f.webgl,delete f.canvasOptions,!c)throw Error("No available renderer for the current environment");let g=new c;return await g.init(f),g}var cb=a.i(84764),cc=a.i(99553),cd=a.i(2897);class ce{static init(a){Object.defineProperty(this,"resizeTo",{configurable:!0,set(a){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=a,a&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{let a,b;if(this._resizeTo){if(this._cancelResize(),this._resizeTo===globalThis.window)a=globalThis.innerWidth,b=globalThis.innerHeight;else{let{clientWidth:c,clientHeight:d}=this._resizeTo;a=c,b=d}this.renderer.resize(a,b),this.render()}},this._resizeId=null,this._resizeTo=null,this.resizeTo=a.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}ce.extension=b2.x.Application;var cf=a.i(83019),cg=a.i(83717);class ch{static init(a){a=Object.assign({autoStart:!0,sharedTicker:!1},a),Object.defineProperty(this,"ticker",{configurable:!0,set(a){this._ticker&&this._ticker.remove(this.render,this),this._ticker=a,a&&a.add(this.render,this,cf.f.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=a.sharedTicker?cg.f.shared:new cg.f,a.autoStart&&this.start()}static destroy(){if(this._ticker){let a=this._ticker;this.ticker=null,a.destroy()}}}ch.extension=b2.x.Application,b2.H.add(ce),b2.H.add(ch);let ci=class a{constructor(...a){this.stage=new cb.t,void 0!==a[0]&&(0,cd.K)(cd.e,"Application constructor options are deprecated, please use Application.init() instead.")}async init(b){b={...b},this.stage||(this.stage=new cb.t),this.renderer=await ca(b),a._plugins.forEach(a=>{a.init.call(this,b)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return(0,cd.K)(cd.e,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}get domContainerRoot(){return this.renderer.renderPipes.dom?._domElement}destroy(b=!1,c=!1){let d=a._plugins.slice(0);d.reverse(),d.forEach(a=>{a.destroy.call(this)}),this.stage.destroy(c),this.stage=null,this.renderer.destroy(b),this.renderer=null}};ci._plugins=[],b2.H.handleByList(b2.x.Application,ci._plugins),b2.H.add(cc.L);var cj=a.i(98953),ck=a.i(28136),cl=a.i(31394),cm=a.i(94214),cn=a.i(37155),co=a.i(24869);class cp extends co.f{constructor(a,b){let{text:c,resolution:d,style:e,anchor:f,width:g,height:h,roundPixels:i,...j}=a;super({...j}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=b,this.text=c??"",this.style=e,this.resolution=d??null,this.allowChildren=!1,this._anchor=new cn.f({_onUpdate:()=>{this.onViewUpdate()}}),f&&(this.anchor=f),this.roundPixels=i??!1,void 0!==g&&(this.width=g),void 0!==h&&(this.height=h)}get anchor(){return this._anchor}set anchor(a){"number"==typeof a?this._anchor.set(a):this._anchor.copyFrom(a)}set text(a){a=a.toString(),this._text!==a&&(this._text=a,this.onViewUpdate())}get text(){return this._text}set resolution(a){this._autoResolution=null===a,this._resolution=a,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(a){a||(a={}),this._style?.off("update",this.onViewUpdate,this),a instanceof this._styleClass?this._style=a:this._style=new this._styleClass(a),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(a){this._setWidth(a,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(a){this._setHeight(a,this.bounds.height)}getSize(a){return a||(a={}),a.width=Math.abs(this.scale.x)*this.bounds.width,a.height=Math.abs(this.scale.y)*this.bounds.height,a}setSize(a,b){"object"==typeof a?(b=a.height??a.width,a=a.width):b??(b=a),void 0!==a&&this._setWidth(a,this.bounds.width),void 0!==b&&this._setHeight(b,this.bounds.height)}containsPoint(a){let b=this.bounds.width,c=this.bounds.height,d=-b*this.anchor.x,e=0;return!!(a.x>=d)&&!!(a.x<=d+b)&&(e=-c*this.anchor.y,!!(a.y>=e)&&!!(a.y<=e+c))||!1}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(a=!1){this._style?.off("update",this.onViewUpdate,this),super.destroy(a),this.owner=null,this._bounds=null,this._anchor=null,("boolean"==typeof a?a:a?.style)&&this._style.destroy(a),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}}var cq=a.i(98063),cr=a.i(31023),cs=a.i(9124),ct=a.i(48732);let cu=null,cv=null;function cw(a,b,c){for(let d=0,e=4*c*b;d<b;++d,e+=4)if(0!==a[e+3])return!1;return!0}function cx(a,b,c,d,e){let f=4*b;for(let b=d,g=d*f+4*c;b<=e;++b,g+=f)if(0!==a[g+3])return!1;return!0}class cy{constructor(a=0,b=0,c=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=a,this.resetTtl=c,this.size=0,this.ttl=b}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(a){if(this.has(a)){let b=this.items[a];delete this.items[a],this.size--,null!==b.prev&&(b.prev.next=b.next),null!==b.next&&(b.next.prev=b.prev),this.first===b&&(this.first=b.next),this.last===b&&(this.last=b.prev)}return this}entries(a=this.keys()){let b=Array(a.length);for(let c=0;c<a.length;c++){let d=a[c];b[c]=[d,this.get(d)]}return b}evict(a=!1){if(a||this.size>0){let a=this.first;delete this.items[a.key],0==--this.size?(this.first=null,this.last=null):(this.first=a.next,this.first.prev=null)}return this}expiresAt(a){let b;return this.has(a)&&(b=this.items[a].expiry),b}get(a){let b=this.items[a];if(void 0!==b)return this.ttl>0&&b.expiry<=Date.now()?void this.delete(a):(this.moveToEnd(b),b.value)}has(a){return a in this.items}moveToEnd(a){this.last!==a&&(null!==a.prev&&(a.prev.next=a.next),null!==a.next&&(a.next.prev=a.prev),this.first===a&&(this.first=a.next),a.prev=this.last,a.next=null,null!==this.last&&(this.last.next=a),this.last=a,null===this.first&&(this.first=a))}keys(){let a=Array(this.size),b=this.first,c=0;for(;null!==b;)a[c++]=b.key,b=b.next;return a}setWithEvicted(a,b,c=this.resetTtl){let d=null;if(this.has(a))this.set(a,b,!0,c);else{this.max>0&&this.size===this.max&&(d={...this.first},this.evict(!0));let c=this.items[a]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:a,prev:this.last,next:null,value:b};1==++this.size?this.first=c:this.last.next=c,this.last=c}return d}set(a,b,c=!1,d=this.resetTtl){let e=this.items[a];return c||void 0!==e?(e.value=b,!1===c&&d&&(e.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(e)):(this.max>0&&this.size===this.max&&this.evict(!0),e=this.items[a]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:a,prev:this.last,next:null,value:b},1==++this.size?this.first=e:this.last.next=e,this.last=e),this}values(a=this.keys()){let b=Array(a.length);for(let c=0;c<a.length;c++)b[c]=this.get(a[c]);return b}}function cz(a){return!!a.tagStyles&&Object.keys(a.tagStyles).length>0}function cA(a){return a.includes("<")}let cB=new Set([10,13]),cC=new Set([9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]),cD=new Set([45,8208,8211,8212,173]),cE=/(\r\n|\r|\n)/,cF=/(?:\r\n|\r|\n)/;function cG(a){return"string"==typeof a&&cB.has(a.charCodeAt(0))}function cH(a,b){return"string"==typeof a&&cC.has(a.charCodeAt(0))}function cI(a){return"normal"===a||"pre-line"===a}function cJ(a){return"normal"===a}function cK(a){if("string"!=typeof a)return"";let b=a.length-1;for(;b>=0&&cH(a[b]);)b--;return b<a.length-1?a.slice(0,b+1):a}function cL(a){let b=[],c=[];if("string"!=typeof a)return b;for(let d=0;d<a.length;d++){let e=a[d],f=a[d+1];if(cH(e,f)||cG(e)){c.length>0&&(b.push(c.join("")),c.length=0),"\r"===e&&"\n"===f?(b.push("\r\n"),d++):b.push(e);continue}c.push(e),"string"==typeof e&&cD.has(e.charCodeAt(0))&&f&&!cH(f)&&!cG(f)&&(b.push(c.join("")),c.length=0)}return c.length>0&&b.push(c.join("")),b}function cM(a,b,c,d){let e=c(a),f=[];for(let c=0;c<e.length;c++){let g=e[c],h=g,i=1;for(;e[c+i];){let f=e[c+i];if(d(h,f,a,c,b))break;g+=f,h=f,i++}c+=i-1,f.push(g)}return f}let cN=/\r\n|\r|\n/g,cO={willReadFrequently:!0};function cP(a,b,c,d,e){let f=c[a];return"number"!=typeof f&&(f=e(a,b,d)+b,c[a]=f),f}let cQ={willReadFrequently:!0},cR=class a{static get experimentalLetterSpacingSupported(){let b=a._experimentalLetterSpacingSupported;if(void 0===b){let c=b6.f.get().getCanvasRenderingContext2D().prototype;b=a._experimentalLetterSpacingSupported="letterSpacing"in c||"textLetterSpacing"in c}return b}constructor(a,b,c,d,e,f,g,h,i,j){this.text=a,this.style=b,this.width=c,this.height=d,this.lines=e,this.lineWidths=f,this.lineHeight=g,this.maxLineWidth=h,this.fontProperties=i,j&&(this.runsByLine=j.runsByLine,this.lineAscents=j.lineAscents,this.lineDescents=j.lineDescents,this.lineHeights=j.lineHeights,this.hasDropShadow=j.hasDropShadow)}static measureText(b=" ",c,d=a._canvas,e=c.wordWrap){let f=`${b}-${c.styleKey}-wordWrap-${e}`;if(a._measurementCache.has(f))return a._measurementCache.get(f);if(cz(c)&&cA(b)){let d=function(a,b,c,d,e,f,g,h,i){let j=function(a,b){let c=[],d=b.tagStyles;if(!cz(b)||!cA(a))return c.push({text:a,style:b}),c;let e=[b],f=[],g="",h=0;for(;h<a.length;){let b=a[h];if("<"===b){let k=a.indexOf(">",h);if(-1===k){g+=b,h++;continue}let l=a.indexOf("<",h+1);if(-1!==l&&l<k){g+=b,h++;continue}let m=a.slice(h+1,k);if(m.startsWith("/")){let b=m.slice(1).trim();if(f.length>0&&f[f.length-1]===b){g.length>0&&(c.push({text:g,style:e[e.length-1]}),g=""),e.pop(),f.pop(),h=k+1;continue}g+=a.slice(h,k+1),h=k+1;continue}{let b=m.trim();if(d[b]){var i,j;g.length>0&&(c.push({text:g,style:e[e.length-1]}),g="");let a=(i=e[e.length-1],j=d[b],i.clone().assign(j));e.push(a),f.push(b),h=k+1;continue}g+=a.slice(h,k+1),h=k+1;continue}}g+=b,h++}return g.length>0&&c.push({text:g,style:e[e.length-1]}),c}(a,b);if(cJ(b.whiteSpace))for(let a=0;a<j.length;a++){let b=j[a];j[a]={text:b.text.replace(cN," "),style:b.style}}let k=[],l=[];for(let a of j){let b=a.text.split(cE);for(let c=0;c<b.length;c++){let d=b[c];"\r\n"===d||"\r"===d||"\n"===d?(k.push(l),l=[]):d.length>0&&l.push({text:d,style:a.style})}}(l.length>0||0===k.length)&&k.push(l);let m=c?function(a,b,c,d,e,f){let{letterSpacing:g,whiteSpace:h,wordWrapWidth:i,breakWords:j}=b,k=cI(h),l=i+g,m={},n="",o=(a,b)=>{let e=`${a}|${b.styleKey}`,f=m[e];if(void 0===f){let g=b._fontString;g!==n&&(c.font=g,n=g),f=d(a,b.letterSpacing,c)+b.letterSpacing,m[e]=f}return f},p=[];for(let b of a){let a=function(a){let b=[],c=!1;for(let d of a){let a=cL(d.text),e=!0;for(let f of a){let a=cH(f)||cG(f),g=e&&c&&!a;b.push({token:f,style:d.style,continuesFromPrevious:g}),c=!a,e=!1}}return b}(b),c=p.length,d=b=>{let c=0,d=b;do{let{token:b,style:e}=a[d];c+=o(b,e),d++}while(d<a.length&&a[d].continuesFromPrevious)return c},g=b=>{let c=[],d=b;do c.push({token:a[d].token,style:a[d].style}),d++;while(d<a.length&&a[d].continuesFromPrevious)return c},h=[],i=0,m=!k,n=null,q=()=>{n&&n.text.length>0&&h.push(n),n=null},r=()=>{if(q(),h.length>0){let a=h[h.length-1];a.text=cK(a.text),0===a.text.length&&h.pop()}p.push(h),h=[],i=0,m=!1};for(let b=0;b<a.length;b++){let{token:c,style:s,continuesFromPrevious:t}=a[b],u=o(c,s);if(k){let a=cH(c),b=n?.text[n.text.length-1]??h[h.length-1]?.text.slice(-1)??"",d=!!b&&cH(b);if(a&&d)continue}let v=!t,w=v?d(b):u;if(w>l&&v)if(i>0&&r(),j){let a=g(b);for(let b=0;b<a.length;b++){let c=a[b].token,d=a[b].style;for(let a of cM(c,j,f,e)){let b=o(a,d);b+i>l&&r(),n&&n.style===d?n.text+=a:(q(),n={text:a,style:d}),i+=b}}b+=a.length-1}else{let a=g(b);q(),p.push(a.map(a=>({text:a.token,style:a.style}))),m=!1,b+=a.length-1}else if(w+i>l&&v){if(cH(c)){m=!1;continue}r(),n={text:c,style:s},i=u}else if(t&&!j)n&&n.style===s?n.text+=c:(q(),n={text:c,style:s}),i+=u;else{let a=cH(c);if(0===i&&a&&!m)continue;n&&n.style===s?n.text+=c:(q(),n={text:c,style:s}),i+=u}}if(q(),h.length>0){let a=h[h.length-1];a.text=cK(a.text),0===a.text.length&&h.pop()}(h.length>0||p.length===c)&&p.push(h)}return p}(k,b,d,f,h,i):k,n=[],o=[],p=[],q=[],r=[],s=0,t=g(b._fontString);0===t.fontSize&&(t.fontSize=b.fontSize,t.ascent=b.fontSize);let u="",v=!!b.dropShadow,w=b._stroke?.width||0;for(let a of m){let c=0,f=t.ascent,h=t.descent,i="";for(let b of a){let a=b.style._fontString,j=g(a);a!==u&&(d.font=a,u=a),c+=e(b.text,b.style.letterSpacing,d),f=Math.max(f,j.ascent),h=Math.max(h,j.descent),i+=b.text;let k=b.style._stroke?.width||0;k>w&&(w=k),!v&&b.style.dropShadow&&(v=!0)}0===a.length&&(f=t.ascent,h=t.descent),n.push(c),o.push(f),p.push(h),r.push(i);let j=b.lineHeight||f+h;q.push(j+b.leading),s=Math.max(s,c)}let x=w,y=s+x+(b.dropShadow?b.dropShadow.distance:0),z=0;for(let a=0;a<q.length;a++)z+=q[a];return{width:y,height:(z=Math.max(z,q[0]+x))+(b.dropShadow?b.dropShadow.distance:0),lines:r,lineWidths:n,lineHeight:(b.lineHeight||t.fontSize)+b.leading,maxLineWidth:s,fontProperties:t,runsByLine:m,lineAscents:o,lineDescents:p,lineHeights:q,hasDropShadow:v}}(b,c,e,a._context,a._measureText,a._measureTextAdvance,a.measureFont,a.canBreakChars,a.wordWrapSplit),g=new a(b,c,d.width,d.height,d.lines,d.lineWidths,d.lineHeight,d.maxLineWidth,d.fontProperties,{runsByLine:d.runsByLine,lineAscents:d.lineAscents,lineDescents:d.lineDescents,lineHeights:d.lineHeights,hasDropShadow:d.hasDropShadow});return a._measurementCache.set(f,g),g}let g=c._fontString,h=a.measureFont(g);0===h.fontSize&&(h.fontSize=c.fontSize,h.ascent=c.fontSize,h.descent=0);let i=a._context;i.font=g;let j=(e?a._wordWrap(b,c,d):b).split(cF),k=Array(j.length),l=0;for(let b=0;b<j.length;b++){let d=a._measureText(j[b],c.letterSpacing,i);k[b]=d,l=Math.max(l,d)}let m=c._stroke?.width??0,n=c.lineHeight||h.fontSize,o=a._adjustWidthForStyle(l,c),p=Math.max(n,h.fontSize+m)+(j.length-1)*(n+c.leading),q=a._adjustHeightForStyle(p,c),r=new a(b,c,o,q,j,k,n+c.leading,l,h);return a._measurementCache.set(f,r),r}static _adjustWidthForStyle(a,b){let c=a+(b._stroke?.width||0);return b.dropShadow&&(c+=b.dropShadow.distance),c}static _adjustHeightForStyle(a,b){let c=a;return b.dropShadow&&(c+=b.dropShadow.distance),c}static _measureText(b,c,d){let{metricWidth:e,metrics:f,letterSpacingVal:g}=a._measureTextCore(b,c,d),h=-(f.actualBoundingBoxLeft??0),i=(f.actualBoundingBoxRight??0)-h;return f.width>0&&(i+=g),Math.max(e,i)}static _measureTextAdvance(b,c,d){return a._measureTextCore(b,c,d).metricWidth}static _measureTextCore(b,c,d){let e=!1;a.experimentalLetterSpacingSupported&&(a.experimentalLetterSpacing?(d.letterSpacing=`${c}px`,d.textLetterSpacing=`${c}px`,e=!0):(d.letterSpacing="0px",d.textLetterSpacing="0px"));let f=d.measureText(b),g=f.width,h=0;return g>0&&(g+=h=e?-c:(a.graphemeSegmenter(b).length-1)*c),{metricWidth:g,metrics:f,letterSpacingVal:h}}static _wordWrap(b,c,d=a._canvas){return function(a,b,c,d,e,f,g){let h=c.getContext("2d",cO);h.font=b._fontString;let i=0,j="",k=[],l=Object.create(null),{letterSpacing:m,whiteSpace:n}=b,o=cI(n),p=cJ(n),q=!o,r=b.wordWrapWidth+m,s=cL(a);for(let a=0;a<s.length;a++){let c=s[a];if(cG(c)){if(!p){k.push(cK(j)),q=!o,j="",i=0;continue}c=" "}if(o){let a=cH(c),b=cH(j[j.length-1]);if(a&&b)continue}let n=cP(c,m,l,h,d);if(n>r)if(""!==j&&(k.push(cK(j)),j="",i=0),e(c,b.breakWords))for(let a of cM(c,b.breakWords,g,f)){let b=cP(a,m,l,h,d);b+i>r&&(k.push(cK(j)),q=!1,j="",i=0),j+=a,i+=b}else j.length>0&&(k.push(cK(j)),j="",i=0),k.push(cK(c)),q=!1,j="",i=0;else n+i>r&&(q=!1,k.push(cK(j)),j="",i=0),(j.length>0||!cH(c)||q)&&(j+=c,i+=n)}let t=cK(j);return t.length>0&&k.push(t),k.join("\n")}(b,c,d,a._measureTextAdvance,a.canBreakWords,a.canBreakChars,a.wordWrapSplit)}static isBreakingSpace(a,b){return cH(a,b)}static canBreakWords(a,b){return b}static canBreakChars(a,b,c,d,e){return!0}static wordWrapSplit(b){return a.graphemeSegmenter(b)}static measureFont(b){if(a._fonts[b])return a._fonts[b];let c=a._context;c.font=b;let d=c.measureText(a.METRICS_STRING+a.BASELINE_SYMBOL),e=d.actualBoundingBoxAscent??0,f=d.actualBoundingBoxDescent??0,g={ascent:e,descent:f,fontSize:e+f};return a._fonts[b]=g,g}static clearMetrics(b=""){b?delete a._fonts[b]:a._fonts={}}static get _canvas(){if(!a.__canvas){let b;try{let c=new OffscreenCanvas(0,0),d=c.getContext("2d",cQ);if(d?.measureText)return a.__canvas=c,c;b=b6.f.get().createCanvas()}catch(a){b=b6.f.get().createCanvas()}b.width=b.height=10,a.__canvas=b}return a.__canvas}static get _context(){return a.__context||(a.__context=a._canvas.getContext("2d",cQ)),a.__context}};cR.METRICS_STRING="|ÉqÅ",cR.BASELINE_SYMBOL="M",cR.BASELINE_MULTIPLIER=1.4,cR.HEIGHT_MULTIPLIER=2,cR.graphemeSegmenter=(()=>{if("function"==typeof Intl?.Segmenter){let a=new Intl.Segmenter;return b=>{let c=a.segment(b),d=[],e=0;for(let a of c)d[e++]=a.segment;return d}}return a=>[...a]})(),cR.experimentalLetterSpacing=!1,cR._fonts={},cR._measurementCache=function(a=1e3,b=0,c=!1){if(isNaN(a)||a<0)throw TypeError("Invalid max value");if(isNaN(b)||b<0)throw TypeError("Invalid ttl value");if("boolean"!=typeof c)throw TypeError("Invalid resetTtl value");return new cy(a,b,c)}(1e3);let cS=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function cT(a){let b="number"==typeof a.fontSize?`${a.fontSize}px`:a.fontSize,c=a.fontFamily;Array.isArray(a.fontFamily)||(c=a.fontFamily.split(","));for(let a=c.length-1;a>=0;a--){let b=c[a].trim();/([\"\'])[^\'\"]+\1/.test(b)||cS.includes(b)||(b=`"${b}"`),c[a]=b}return`${a.fontStyle} ${a.fontVariant} ${a.fontWeight} ${b} ${c.join(",")}`}var cU=a.i(67309),cV=a.i(87069),cW=a.i(71805),cX=a.i(51983),cY=a.i(89376);function cZ(a,b,c,d=0,e=0,f=0){if(a.texture===cW.f.WHITE&&!a.fill)return cq.f.shared.setValue(a.color).setAlpha(a.alpha??1).toHexa();if(a.fill){if(a.fill instanceof cY.f){let c=a.fill,d=b.createPattern(c.texture.source.resource,"repeat");return cV.f.applyPatternTransform(d,c.transform,!1),d}else if(a.fill instanceof cj.f){let g,h=a.fill,i="linear"===h.type,j="local"===h.textureSpace,k=1,l=1;j&&c&&(k=c.width+d,l=c.height+d);let m=!1;if(i){let{start:a,end:c}=h;g=b.createLinearGradient(a.x*k+e,a.y*l+f,c.x*k+e,c.y*l+f),m=Math.abs(c.x-a.x)<Math.abs((c.y-a.y)*.1)}else{let{center:a,innerRadius:c,outerCenter:d,outerRadius:i}=h;g=b.createRadialGradient(a.x*k+e,a.y*l+f,c*k,d.x*k+e,d.y*l+f,i*k)}if(m&&j&&c){let a=c.lineHeight/l;for(let b=0;b<c.lines.length;b++){let e=(b*c.lineHeight+d/2)/l;h.colorStops.forEach(b=>{let c=e+b.offset*a;c=Math.max(0,Math.min(1,c)),g.addColorStop(Math.floor(1e5*c)/1e5,cq.f.shared.setValue(b.color).toHex())})}}else h.colorStops.forEach(a=>{g.addColorStop(a.offset,cq.f.shared.setValue(a.color).toHex())});return g}}else{let c=b.createPattern(a.texture.source.resource,"repeat"),d=a.matrix.copyTo(cU.f.shared);return d.scale(a.texture.source.pixelWidth,a.texture.source.pixelHeight),c.setTransform(d),c}return(0,cX.f)("FillStyle not recognised",a),"red"}let c$=new cr.f;function c_(a){let b=0;for(let c=0;c<a.length;c++)32===a.charCodeAt(c)&&b++;return b}let c0=new class{getCanvasAndContext(a){let{text:b,style:c,resolution:d=1}=a,e=c._getFinalPadding(),f=cR.measureText(b||" ",c),g=Math.ceil(Math.ceil(Math.max(1,f.width)+2*e)*d),h=Math.ceil(Math.ceil(Math.max(1,f.height)+2*e)*d),i=cs.f.getOptimalCanvasAndContext(g,h);this._renderTextToCanvas(c,e,d,i,f);let j=c.trim?function(...a){let b=a[0];b.canvas||(b={canvas:a[0],resolution:a[1]});let{canvas:c}=b,d=Math.min(b.resolution??1,1),e=b.width??c.width,f=b.height??c.height,g=b.output;if(cu||((cv=(cu=b6.f.get().createCanvas(256,128)).getContext("2d",{willReadFrequently:!0})).globalCompositeOperation="copy",cv.globalAlpha=1),(cu.width<e||cu.height<f)&&(cu.width=(0,ct.a)(e),cu.height=(0,ct.a)(f)),!cv)throw TypeError("Failed to get canvas 2D context");cv.drawImage(c,0,0,e,f,0,0,e*d,f*d);let h=cv.getImageData(0,0,e,f).data,i=0,j=0,k=e-1,l=f-1;for(;j<f&&cw(h,e,j);)++j;if(j===f)return cr.f.EMPTY;for(;cw(h,e,l);)--l;for(;cx(h,e,i,j,l);)++i;for(;cx(h,e,k,j,l);)--k;return++k,++l,cv.globalCompositeOperation="source-over",cv.strokeRect(i,j,k-i,l-j),cv.globalCompositeOperation="copy",g??(g=new cr.f),g.set(i/d,j/d,(k-i)/d,(l-j)/d),g}({canvas:i.canvas,width:g,height:h,resolution:1,output:c$}):c$.set(0,0,g,h);return{canvasAndContext:i,frame:j}}returnCanvasAndContext(a){cs.f.returnCanvasAndContext(a)}_renderTextToCanvas(a,b,c,d,e){let f,g;if(e.runsByLine&&e.runsByLine.length>0)return void this._renderTaggedTextToCanvas(e,a,b,c,d);let{canvas:h,context:i}=d,j=cT(a),k=e.lines,l=e.lineHeight,m=e.lineWidths,n=e.maxLineWidth,o=e.fontProperties,p=h.height;if(i.resetTransform(),i.scale(c,c),i.textBaseline=a.textBaseline,a._stroke?.width){let b=a._stroke;i.lineWidth=b.width,i.miterLimit=b.miterLimit,i.lineJoin=b.join,i.lineCap=b.cap}i.font=j;let q=a.dropShadow?2:1,r=(a._stroke?.width??0)/2,s=(l-o.fontSize)/2;l-o.fontSize<0&&(s=0);for(let h=0;h<q;++h){let j=a.dropShadow&&0===h,q=j?Math.ceil(Math.max(1,p)+2*b):0,t=q*c;if(j)this._setupDropShadow(i,a,c,t);else{let c=a._gradientBounds,d=a._gradientOffset;if(c){let f={width:c.width,height:c.height,lineHeight:c.height,lines:e.lines};this._setFillAndStrokeStyles(i,a,f,b,r,d?.x??0,d?.y??0)}else d?this._setFillAndStrokeStyles(i,a,e,b,r,d.x,d.y):this._setFillAndStrokeStyles(i,a,e,b,r);i.shadowColor="rgba(0,0,0,0)"}for(let c=0;c<k.length;c++){f=r,g=r+c*l+o.ascent+s,f+=this._getAlignmentOffset(m[c],n,a.align);let e=0;if("justify"===a.align&&a.wordWrap&&c<k.length-1){let a=c_(k[c]);a>0&&(e=(n-m[c])/a)}a._stroke?.width&&this._drawLetterSpacing(k[c],a,d,f+b,g+b-q,!0,e),void 0!==a._fill&&this._drawLetterSpacing(k[c],a,d,f+b,g+b-q,!1,e)}}}_renderTaggedTextToCanvas(a,b,c,d,e){let{canvas:f,context:g}=e,{runsByLine:h,lineWidths:i,maxLineWidth:j,lineAscents:k,lineHeights:l,hasDropShadow:m}=a,n=f.height;g.resetTransform(),g.scale(d,d),g.textBaseline=b.textBaseline;let o=m?2:1,p=b._stroke?.width??0;for(let a of h)for(let b of a){let a=b.style._stroke?.width??0;a>p&&(p=a)}let q=p/2,r=[];for(let a=0;a<h.length;a++){let b=h[a],c=[];for(let a of b){let b=cT(a.style);g.font=b,c.push({width:cR._measureText(a.text,a.style.letterSpacing,g),font:b})}r.push(c)}for(let a=0;a<o;++a){let f=m&&0===a,o=f?Math.ceil(Math.max(1,n)+2*c):0,p=o*d;f||(g.shadowColor="rgba(0,0,0,0)");let s=q;for(let a=0;a<h.length;a++){let m=h[a],n=i[a],t=k[a],u=l[a],v=r[a],w=q;w+=this._getAlignmentOffset(n,j,b.align);let x=0;if("justify"===b.align&&b.wordWrap&&a<h.length-1){let a=0;for(let b of m)a+=c_(b.text);a>0&&(x=(j-n)/a)}let y=s+t,z=w+c;for(let a=0;a<m.length;a++){let b=m[a],{width:h,font:i}=v[a];if(g.font=i,g.textBaseline=b.style.textBaseline,b.style._stroke?.width){let a=b.style._stroke;if(g.lineWidth=a.width,g.miterLimit=a.miterLimit,g.lineJoin=a.join,g.lineCap=a.cap,f)if(b.style.dropShadow)this._setupDropShadow(g,b.style,d,p);else{z+=h+c_(b.text)*x;continue}else{let d=cR.measureFont(i),e=b.style.lineHeight||d.fontSize;g.strokeStyle=cZ(a,g,{width:h,height:e,lineHeight:e,lines:[b.text]},2*c,z-c,s)}this._drawLetterSpacing(b.text,b.style,e,z,y+c-o,!0,x)}z+=h+c_(b.text)*x}z=w+c;for(let a=0;a<m.length;a++){let b=m[a],{width:h,font:i}=v[a];if(g.font=i,g.textBaseline=b.style.textBaseline,void 0!==b.style._fill){if(f)if(b.style.dropShadow)this._setupDropShadow(g,b.style,d,p);else{z+=h+c_(b.text)*x;continue}else{let a=cR.measureFont(i),d=b.style.lineHeight||a.fontSize,e={width:h,height:d,lineHeight:d,lines:[b.text]};g.fillStyle=cZ(b.style._fill,g,e,2*c,z-c,s)}this._drawLetterSpacing(b.text,b.style,e,z,y+c-o,!1,x)}z+=h+c_(b.text)*x}s+=u}}}_setFillAndStrokeStyles(a,b,c,d,e,f=0,g=0){a.fillStyle=b._fill?cZ(b._fill,a,c,2*d,f,g):null,b._stroke?.width&&(a.strokeStyle=cZ(b._stroke,a,c,e+2*d,f,g))}_setupDropShadow(a,b,c,d){a.fillStyle="black",a.strokeStyle="black";let e=b.dropShadow,f=e.color,g=e.alpha;a.shadowColor=cq.f.shared.setValue(f).setAlpha(g).toRgbaString();let h=e.blur*c,i=e.distance*c;a.shadowBlur=h,a.shadowOffsetX=Math.cos(e.angle)*i,a.shadowOffsetY=Math.sin(e.angle)*i+d}_getAlignmentOffset(a,b,c){return"right"===c?b-a:"center"===c?(b-a)/2:0}_drawLetterSpacing(a,b,c,d,e,f=!1,g=0){let{context:h}=c,i=b.letterSpacing,j=!1;if(cR.experimentalLetterSpacingSupported&&(cR.experimentalLetterSpacing?(h.letterSpacing=`${i}px`,h.textLetterSpacing=`${i}px`,j=!0):(h.letterSpacing="0px",h.textLetterSpacing="0px")),(0===i||j)&&0===g)return void(f?h.strokeText(a,d,e):h.fillText(a,d,e));if(0!==g&&(0===i||j)){let b=a.split(" "),c=d,i=h.measureText(" ").width;for(let a=0;a<b.length;a++)f?h.strokeText(b[a],c,e):h.fillText(b[a],c,e),c+=h.measureText(b[a]).width+i+g;return}let k=d,l=cR.graphemeSegmenter(a),m=h.measureText(a).width,n=0;for(let a=0;a<l.length;++a){let b=l[a];f?h.strokeText(b,k,e):h.fillText(b,k,e);let c="";for(let b=a+1;b<l.length;++b)c+=l[b];k+=m-(n=h.measureText(c).width)+i," "===b&&(k+=g),m=n}}};var c1=b5,c2=a.i(90423),c3=a.i(96781),c4=a.i(52820);let c5=class a extends c1.f{constructor(b={}){super(),this.uid=(0,c2.f)("textStyle"),this._tick=0,this._cachedFontString=null,function(a){if("boolean"==typeof a.dropShadow&&a.dropShadow){let b=c5.defaultDropShadow;a.dropShadow={alpha:a.dropShadowAlpha??b.alpha,angle:a.dropShadowAngle??b.angle,blur:a.dropShadowBlur??b.blur,color:a.dropShadowColor??b.color,distance:a.dropShadowDistance??b.distance}}if(void 0!==a.strokeThickness){(0,cd.K)(cd.e,"strokeThickness is now a part of stroke");let b=a.stroke,c={};if(cq.f.isColorLike(b))c.color=b;else if(b instanceof cj.f||b instanceof cY.f)c.fill=b;else if(Object.hasOwnProperty.call(b,"color")||Object.hasOwnProperty.call(b,"fill"))c=b;else throw Error("Invalid stroke value.");a.stroke={...c,width:a.strokeThickness}}if(Array.isArray(a.fillGradientStops)){if((0,cd.K)(cd.e,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(a.fill)||0===a.fill.length)throw Error("Invalid fill value. Expected an array of colors for gradient fill.");a.fill.length!==a.fillGradientStops.length&&(0,cX.f)("The number of fill colors must match the number of fill gradient stops.");let b=new cj.f({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),c=a.fillGradientStops.slice(),d=a.fill.map(a=>cq.f.shared.setValue(a).toNumber());c.forEach((a,c)=>{b.addColorStop(a,d[c])}),a.fill={fill:b}}}(b);let c=b instanceof a,d=b;c&&(b=d._toObject());let e={...a.defaultTextStyle,...b};for(let a in e)this[a]=e[a];this._tagStyles=b.tagStyles??void 0,this.update(),this._tick=0}get align(){return this._align}set align(a){this._align!==a&&(this._align=a,this.update())}get breakWords(){return this._breakWords}set breakWords(a){this._breakWords!==a&&(this._breakWords=a,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(b){this._dropShadow!==b&&(null!==b&&"object"==typeof b?this._dropShadow=this._createProxy({...a.defaultDropShadow,...b}):this._dropShadow=b?this._createProxy({...a.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(a){this._fontFamily!==a&&(this._fontFamily=a,this.update())}get fontSize(){return this._fontSize}set fontSize(a){this._fontSize!==a&&("string"==typeof a?this._fontSize=parseInt(a,10):this._fontSize=a,this.update())}get fontStyle(){return this._fontStyle}set fontStyle(a){this._fontStyle!==a&&(this._fontStyle=a.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(a){this._fontVariant!==a&&(this._fontVariant=a,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(a){this._fontWeight!==a&&(this._fontWeight=a,this.update())}get leading(){return this._leading}set leading(a){this._leading!==a&&(this._leading=a,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(a){this._letterSpacing!==a&&(this._letterSpacing=a,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(a){this._lineHeight!==a&&(this._lineHeight=a,this.update())}get padding(){return this._padding}set padding(a){this._padding!==a&&(this._padding=a,this.update())}get filters(){return this._filters}set filters(a){this._filters!==a&&(this._filters=Object.freeze(a),this.update())}get trim(){return this._trim}set trim(a){this._trim!==a&&(this._trim=a,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(a){this._textBaseline!==a&&(this._textBaseline=a,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(a){this._whiteSpace!==a&&(this._whiteSpace=a,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(a){this._wordWrap!==a&&(this._wordWrap=a,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(a){this._wordWrapWidth!==a&&(this._wordWrapWidth=a,this.update())}get fill(){return this._originalFill}set fill(a){a!==this._originalFill&&(this._originalFill=a,this._isFillStyle(a)&&(this._originalFill=this._createProxy({...c3.f.defaultFillStyle,...a},()=>{this._fill=(0,c4._)({...this._originalFill},c3.f.defaultFillStyle)})),this._fill=(0,c4._)(0===a?"black":a,c3.f.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(a){a!==this._originalStroke&&(this._originalStroke=a,this._isFillStyle(a)&&(this._originalStroke=this._createProxy({...c3.f.defaultStrokeStyle,...a},()=>{this._stroke=(0,c4.U)({...this._originalStroke},c3.f.defaultStrokeStyle)})),this._stroke=(0,c4.U)(a,c3.f.defaultStrokeStyle),this.update())}get tagStyles(){return this._tagStyles}set tagStyles(a){this._tagStyles!==a&&(this._tagStyles=a??void 0,this.update())}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){let b=a.defaultTextStyle;for(let a in b)this[a]=b[a]}assign(a){for(let b in a)this[b]=a[b];return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return null===this._cachedFontString&&(this._cachedFontString=cT(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new a(this._toObject())}_getFinalPadding(){let a=0;if(this._filters)for(let b=0;b<this._filters.length;b++)a+=this._filters[b].padding;return Math.max(this._padding,a)}destroy(a=!1){if(this.removeAllListeners(),"boolean"==typeof a?a:a?.texture){let b="boolean"==typeof a?a:a?.textureSource;this._fill?.texture&&this._fill.texture.destroy(b),this._originalFill?.texture&&this._originalFill.texture.destroy(b),this._stroke?.texture&&this._stroke.texture.destroy(b),this._originalStroke?.texture&&this._originalStroke.texture.destroy(b)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(a,b){return new Proxy(a,{set:(a,c,d)=>a[c]===d||(a[c]=d,b?.(c,d),this.update(),!0)})}_isFillStyle(a){return(a??null)!==null&&!(cq.f.isColorLike(a)||a instanceof cj.f||a instanceof cY.f)}};c5.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},c5.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let c6=!1;var c7=a.i(46629),c8=a.i(98803),c9=a.i(28343);class da extends c9.f{}class db{constructor(a){this._renderer=a,a.runners.resolutionChange.add(this),a.runners.contextChange.add(this),this._managedTexts=new c7.f({renderer:a,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(let a in this._managedTexts.items){let b=this._managedTexts.items[a];b?._autoResolution&&b.onViewUpdate()}}contextChange(){for(let a in this._managedTexts.items)this._managedTexts.items[a]?.unload()}validateRenderable(a){let b=this._getGpuText(a),c=a.styleKey;return b.currentKey!==c||a._didTextUpdate}addRenderable(a,b){let c=this._getGpuText(a);if(a._didTextUpdate||c.currentKey!==a.styleKey){let b=a._autoResolution?this._renderer.resolution:a.resolution;(c.currentKey!==a.styleKey||a._resolution!==b)&&this._updateGpuText(a),a._didTextUpdate=!1,function(a,b){let{texture:c,bounds:d}=a,e=b._style._getFinalPadding();(0,c8.f)(d,b._anchor,c);let f=b._anchor._x*e*2,g=b._anchor._y*e*2;d.minX-=e-f,d.minY-=e-g,d.maxX-=e-f,d.maxY-=e-g}(c,a)}this._renderer.renderPipes.batch.addToBatch(c,b)}updateRenderable(a){let b=this._getGpuText(a);b._batcher.updateElement(b)}_updateGpuText(a){let b=this._getGpuText(a);b.texture&&this._renderer.canvasText.decreaseReferenceCount(b.currentKey),a._resolution=a._autoResolution?this._renderer.resolution:a.resolution,b.texture=this._renderer.canvasText.getManagedTexture(a),b.currentKey=a.styleKey}_getGpuText(a){return a._gpuData[this._renderer.uid]||this.initGpuText(a)}initGpuText(a){let b=new da;return b.currentKey="--",b.renderable=a,b.transform=a.groupTransform,b.bounds={minX:0,maxX:1,minY:0,maxY:0},b.roundPixels=this._renderer._roundPixels|a._roundPixels,a._gpuData[this._renderer.uid]=b,this._managedTexts.add(a),b}onTextUnload(a){let b=a._gpuData[this._renderer.uid];if(!b)return;let{canvasText:c}=this._renderer;c.getReferenceCount(b.currentKey)>0?c.decreaseReferenceCount(b.currentKey):b.texture&&c.returnTexture(b.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}db.extension={type:[b2.x.WebGLPipes,b2.x.WebGPUPipes,b2.x.CanvasPipes],name:"text"};var dc=a.i(36206),dd=a.i(38252);class de{constructor(a,b){this._activeTextures={},this._renderer=a,this._retainCanvasContext=b}getTexture(a,b,c,d){"string"==typeof a&&((0,cd.K)("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),a={text:a,style:c,resolution:b}),a.style instanceof c5||(a.style=new c5(a.style)),"string"!=typeof a.text&&(a.text=a.text.toString());let{text:e,style:f,textureStyle:g,autoGenerateMipmaps:h}=a,i=a.resolution??this._renderer.resolution,{frame:j,canvasAndContext:k}=c0.getCanvasAndContext({text:e,style:f,resolution:i}),l=(0,dd.f)(k.canvas,j.width,j.height,i,h,g?.scaleMode);if(f.trim&&(j.pad(f.padding),l.frame.copyFrom(j),l.frame.scale(1/i),l.updateUvs()),f.filters){let a=this._applyFilters(l,f.filters);return this.returnTexture(l),c0.returnCanvasAndContext(k),a}return this._renderer.texture.initSource(l._source),this._retainCanvasContext||c0.returnCanvasAndContext(k),l}returnTexture(a){let b=a.source,c=b.resource;if(this._retainCanvasContext&&c?.getContext){let a=c.getContext("2d");a&&c0.returnCanvasAndContext({canvas:c,context:a})}b.resource=null,b.uploadMethodId="unknown",b.alphaMode="no-premultiply-alpha",dc.f.returnTexture(a)}renderTextToCanvas(){(0,cd.K)("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(a){a._resolution=a._autoResolution?this._renderer.resolution:a.resolution;let b=a.styleKey;if(this._activeTextures[b])return this._increaseReferenceCount(b),this._activeTextures[b].texture;let c=this.getTexture({text:a.text,style:a.style,resolution:a._resolution,textureStyle:a.textureStyle,autoGenerateMipmaps:a.autoGenerateMipmaps});return this._activeTextures[b]={texture:c,usageCount:1},c}decreaseReferenceCount(a){let b=this._activeTextures[a];b&&(b.usageCount--,0===b.usageCount&&(this.returnTexture(b.texture),this._activeTextures[a]=null))}getReferenceCount(a){return this._activeTextures[a]?.usageCount??0}_increaseReferenceCount(a){this._activeTextures[a].usageCount++}_applyFilters(a,b){let c=this._renderer.renderTarget.renderTarget,d=this._renderer.filter.generateFilteredTexture({texture:a,filters:b});return this._renderer.renderTarget.bind({target:c,clear:!1}),d}destroy(){for(let a in this._renderer=null,this._activeTextures)this._activeTextures[a]&&this.returnTexture(this._activeTextures[a].texture);this._activeTextures=null}}class df extends de{constructor(a){super(a,!0)}}df.extension={type:[b2.x.CanvasSystem],name:"canvasText"};class dg extends de{constructor(a){super(a,!1)}}dg.extension={type:[b2.x.WebGLSystem,b2.x.WebGPUSystem],name:"canvasText"},b2.H.add(df),b2.H.add(dg),b2.H.add(db);class dh extends cp{constructor(...a){let b,c=(("string"==typeof(b=a[0]??{})||a[1])&&((0,cd.K)(cd.e,'use new Text({ text: "hi!", style }) instead'),b={text:b,style:a[1]}),b);super(c,c5),this.renderPipeId="text",c.textureStyle&&(this.textureStyle=c.textureStyle instanceof cm.f?c.textureStyle:new cm.f(c.textureStyle),function(a){if(c6)return;let b=new cm.f({scaleMode:a.scaleMode});a._resourceId!==b._resourceId&&(c6=!0,(0,cX.f)("Text textureStyle: only scaleMode is applied to a text texture, the other fields are ignored"))}(this.textureStyle)),this.autoGenerateMipmaps=c.autoGenerateMipmaps??cl.f.defaultOptions.autoGenerateMipmaps}updateBounds(){let a=this._bounds,b=this._anchor,c=0,d=0;if(this._style.trim){let{frame:a,canvasAndContext:b}=c0.getCanvasAndContext({text:this.text,style:this._style,resolution:1});c0.returnCanvasAndContext(b),c=a.width,d=a.height}else{let a=cR.measureText(this._text,this._style);c=a.width,d=a.height}a.minX=-b._x*c,a.maxX=a.minX+c,a.minY=-b._y*d,a.maxY=a.minY+d}}let di={pending:0xf59e0b,streaming:2282478,done:3462041,error:0xef4444};function dj(a){return a?a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(1)}k`:String(a):"0"}function dk(a=[]){let b=new Map;for(let c of a){if(!c?.connectionId)continue;let a=b.get(c.connectionId);if(!a){let d=String(c.connectionId||"").toLowerCase(),e=c.clientType||("app"===c.source||d.includes("app")?"app":"extension"===c.source||d.includes("extension")||"ide"===c.source||d.includes("ide")?"extension":"cli");a={connectionId:c.connectionId,account:c.account||c.connectionId,model:c.model,provider:c.provider,cli:c.cli||"agent",clientType:e,source:c.source||e,clientIcon:c.clientIcon,traces:[],tokens:{input:0,output:0,cached:0},totalTokens:null,activeCount:0,errorCount:0,tools:[],errorReason:null,fallbackFrom:null,queued:0,elapsedMs:0,cost:null,pendingCount:0,isLooping:!1,logs:[],skin:c.skin||null,aura:c.aura||null,pet:c.pet||null,props:c.props||[],trophy:c.trophy||null,theme:c.theme||null,sessionTitle:c.sessionTitle||c.account||"agent-factory",lastText:null,lastTextRole:null},b.set(c.connectionId,a)}for(let b of(a.traces.push(c),c.skin&&!a.skin&&(a.skin=c.skin),c.aura&&!a.aura&&(a.aura=c.aura),c.pet&&!a.pet&&(a.pet=c.pet),!c.props?.length||a.props&&a.props.length||(a.props=c.props),c.trophy&&!a.trophy&&(a.trophy=c.trophy),c.theme&&!a.theme&&(a.theme=c.theme),c.isLooping&&(a.isLooping=!0),Array.isArray(c.logs)&&c.logs.length>0&&(a.logs=c.logs),c.currentCommand&&!a.currentCommand&&(a.currentCommand=c.currentCommand),c.sessionTitle&&(a.sessionTitle=c.sessionTitle),c.lastText&&(a.lastText=c.lastText,a.lastTextRole=c.lastTextRole),c.toolCalls||[])){let c=b.tool||b.type;c&&!a.tools.includes(c)&&a.tools.push(c)}a.tokens.input+=c.tokens?.input??0,a.tokens.output+=c.tokens?.output??0,a.tokens.cached+=c.tokens?.cached??0,Number.isFinite(c.totalTokens)&&(a.totalTokens=(a.totalTokens??0)+c.totalTokens),a.queued+=Math.max(1,c.concurrent||1),a.elapsedMs=Math.max(a.elapsedMs,c.elapsedMs??0),Number.isFinite(c.cost)&&(a.cost=(a.cost??0)+c.cost),c.fallback?.from&&!a.fallbackFrom&&(a.fallbackFrom=c.fallback.from),"error"===c.state?(a.errorCount+=1,a.errorReason=a.errorReason||c.error||"error"):("streaming"===c.state||"pending"===c.state)&&(a.activeCount+=1,"pending"===c.state&&(a.pendingCount+=1))}let c=b.size,d=c>35?8:c>18?7:6,e=c>35?175:200,f=c>35?145:170,g=Math.max(1500,60+d*e+120),h=g+360,i=[...b.values()].map((a,b)=>{let c=Math.floor(b/d),g=!!a.isLooping,h=a.errorCount>0?"error":a.activeCount>0?"streaming":"done",i=g?"looping":"error"===h?"error":"streaming"===h?a.pendingCount===a.activeCount?"pending":"streaming":a.elapsedMs>=32e3?"sleeping":"happy",j=a.totalTokens,k=j&&a.tokens.cached>0?Math.round(a.tokens.cached/j*100):null,l=a.account||"agent-factory",m=a.sessionTitle||l;return{...a,deskIndex:b,traceId:a.traces?.[0]?.traceId||a.connectionId,sessionTitle:m,occupied:!0,state:h,mode:i,isLooping:g,logs:a.logs,cachedPct:k,cost:Number.isFinite(a.cost)?Math.round(100*a.cost)/100:null,color:g?0xf43f5e:di[h],totalTokens:j,totalLabel:null===j?"—":dj(j),count:a.traces.length,x:60+b%d*e,y:820-c*f,depth:1,busy:a.activeCount}}),j=[...new Set(i.map(a=>a.provider).filter(Boolean))],k=j.map((a,b)=>{let c=i.filter(b=>b.provider===a),d=c.reduce((a,b)=>a+b.busy,0),e=c.reduce((a,b)=>a+(b.totalTokens??0),0),f=c.some(a=>"error"===a.state);return{provider:a,x:h,y:480-(j.length-1)*104/2+104*b,busy:d,load:Math.min(1,d/4),overloaded:d>=4,totalTokens:e,totalLabel:dj(e),color:f?di.error:d>0?di.streaming:di.done}}),l=new Set(j),m=new Map;for(let a of i){if(!a.fallbackFrom||!l.has(a.fallbackFrom)||a.fallbackFrom===a.provider)continue;let b=`${a.fallbackFrom}>${a.provider}`,c=m.get(b)||{from:a.fallbackFrom,to:a.provider,count:0};c.count+=1,m.set(b,c)}return{workstations:i,pods:k,fallbacks:[...m.values()],rack:{x:g,y:480,active:i.reduce((a,b)=>a+b.busy,0)},stats:{agents:i.length,busy:i.filter(a=>a.busy>0).length,tokens:i.reduce((a,b)=>a+(b.totalTokens??0),0),tokensLabel:dj(i.reduce((a,b)=>a+(b.totalTokens??0),0))}}}var dl=a.i(96519);function dm(a,b=61695){if(!a)return b;if("number"==typeof a)return a;let c=parseInt(String(a).replace("#","").trim(),16);return Number.isNaN(c)?b:c}function dn(a,b){let c=String(a||"");return c.length>b?`${c.slice(0,b-1)}…`:c}let dp=()=>(0,dl.l)("mono"),dq=()=>(0,dl.l)("ui");function dr(...a){return new cj.f({type:"linear",start:{x:0,y:0},end:{x:0,y:1},colorStops:a.map((b,c)=>({offset:c/(a.length-1),color:b})),textureSpace:"local"})}let ds=(a,b,c=1)=>({width:a,color:b,alpha:c,cap:"round",join:"round"});function dt({color:a,depth:b=1,scale:c=1,seed:d=0,trimColor:e,mode:f="streaming",clientType:g="cli",skin:h="classic",aura:i="none"}){let j=new cb.t,k="app"===g?9133302:1096065,l="string"==typeof h?(0,bB.x)(h):null,m=!!(l||h&&"classic"!==h&&"none"!==h),n=l?.archetype||("cat"===h?"cyber_cat":"ninja"===h?"stealth_ninja":"hacker"===h?"matrix_hacker":h||"cyber_classic"),o=l?.variant||"tactical_visor",p=l?.color?dm(l.color,e??k):e??k;l?.secondaryColor&&dm(l.secondaryColor,1120295);let q=l?.accentColor?dm(l.accentColor,0xffffff):0xffffff,r=m?1975344:0xf3f5f9,s=m?1119778:0xc9d0dc,t=new ck.f;"mecha_pilot"===n?(t.poly([-22,-30,22,-30,18,-6,-18,-6]).fill({color:1579035}).stroke({width:1.5,color:p}),t.poly([-27,-29,-20,-33,-17,-25,-25,-20]).fill({color:2565930}).stroke({width:1,color:p}),t.poly([27,-29,20,-33,17,-25,25,-20]).fill({color:2565930}).stroke({width:1,color:p}),t.poly([-12,-26,-7,-26,-3,-20,-8,-20]).fill({color:0xeab308}),t.poly([2,-26,7,-26,11,-20,6,-20]).fill({color:0xeab308}),t.rect(-13,-30,2,24).fill({color:p}),t.rect(11,-30,2,24).fill({color:p}),t.circle(0,-14,5.5).fill({color:592139}).stroke({width:1.4,color:p}),t.circle(0,-14,3).fill({color:p}),t.rect(-4,-15,8,2).fill({color:0xffffff})):"stealth_ninja"===n?(t.poly([-16,-30,16,-30,13,-6,-13,-6]).fill({color:593174}).stroke({width:1.4,color:p}),t.poly([-16,-30,5,-14,2,-14,-16,-28]).fill({color:p}),t.poly([-16,-28,-11,-30,14,-9,9,-7]).fill({color:p,alpha:.9}),t.roundRect(-14,-12,28,6,2).fill({color:1973067}).stroke({width:1.2,color:p}),t.poly([3,-7,6,1,4,6,1,1,3,-7]).fill({color:p})):"matrix_hacker"===n?(t.roundRect(-21,-30,42,25,7).fill({color:1184279}).stroke({width:1.5,color:p}),t.roundRect(-18,-32,36,10,4).fill({color:2039592}).stroke({width:1.2,color:p}),t.rect(-7,-23,2,16).fill({color:0xffffff}),t.rect(-7.5,-7,3,4).fill({color:p}),t.rect(5,-23,2,16).fill({color:0xffffff}),t.rect(4.5,-7,3,4).fill({color:p}),t.poly([-15,-14,15,-14,13,-6,-13,-6]).fill({color:592141}).stroke({width:1,color:2565930})):"celestial_astro"===n?(t.poly([-18,-30,18,-30,16,-6,-16,-6]).fill({color:0xf1f5f9}).stroke({width:1.4,color:p}),t.roundRect(-14,-33,28,5,2).fill({color:3359061}).stroke({width:1.2,color:p}),t.roundRect(-24,-31,8,4.5,1).fill({color:0xf59e0b}).stroke({width:.8,color:7877903}),t.roundRect(16,-31,8,4.5,1).fill({color:0xf59e0b}).stroke({width:.8,color:7877903}),t.circle(-7,-17,3.5).fill({color:988970}).stroke({width:1.2,color:p}),t.circle(-7,-17,1.5).fill({color:2278750}),t.circle(7,-17,3.5).fill({color:988970}).stroke({width:1.2,color:p}),t.circle(7,-17,1.5).fill({color:3718648})):(t.poly([-18,-30,18,-30,15,-6,-15,-6]).fill(dr(0xffffff,r,s)).stroke({width:1.2,color:p}),t.poly([-17,-30,-7,-14,-13,-14]).fill({color:856343}),t.poly([17,-30,7,-14,13,-14]).fill({color:856343}),t.poly([-5,-30,0,-18,5,-30]).stroke({width:1.2,color:q,alpha:.85}),t.roundRect(-4.5,-19,9,12,1.5).fill({color:593174}).stroke({width:1,color:p}),t.rect(-3,-17.5,6,4.5).fill({color:p}),t.rect(-3,-11,6,1.5).fill({color:0xffffff}),t.rect(-15,-10,30,4).fill({color:132631}),t.roundRect(-3.5,-11,7,6,1).fill({color:1976635}).stroke({width:1,color:p}));let u=new ck.f;u.roundRect(-10,-36,20,8,4).fill({color:p});let v=new ck.f;v.roundRect(-6,-34,12,3,1.5).fill({color:a});let w=new ck.f,x=new ck.f;for(let[a,b,c]of[[w,-26,-1],[x,18,1]])a.roundRect(b,-28,8,24,4).fill({color:r}),a.roundRect(b,-28,8,8,4).fill({color:0xffffff,alpha:.6}),a.circle(b+4+1.5*c,-2,4.5).stroke({width:2.4,color:r}),a.pivot.set(b+4,-26),a.position.set(b+4,-26);let y=new ck.f;y.circle(-27,-56,8).fill({color:p}),y.circle(27,-56,8).fill({color:p}),y.circle(-27,-56,8).stroke({width:1.5,color:0xffffff,alpha:.5}),y.circle(27,-56,8).stroke({width:1.5,color:0xffffff,alpha:.5}),y.circle(-29,-58,3).fill({color:0xffffff,alpha:.7}),y.circle(25,-58,3).fill({color:0xffffff,alpha:.7}),y.ellipse(0,-56,26,24).fill(dr(m?2963272:0xffffff,r,s)),m&&y.ellipse(0,-56,27,25).stroke({width:2.2,color:p,alpha:.95}),y.ellipse(4,-50,24,21).stroke({width:3,color:7043728,alpha:.25}),y.ellipse(-8,-68,12,5.5).fill({color:0xffffff,alpha:.8}),y.circle(-14,-64,2).fill({color:0xffffff,alpha:.9}),y.ellipse(0,-53,22,17).fill({color:s}),y.ellipse(0,-53,20,15.5).fill({color:988188}),y.ellipse(-5,-58,11,5).fill({color:0xffffff,alpha:.06}),"tactical_visor"===o?(y.roundRect(-24,-66,48,7,2.5).fill({color:988970}),y.roundRect(-24,-66,48,7,2.5).stroke({width:1.6,color:p}),y.poly([-26,-66,-34,-76,-26,-72]).fill({color:p}),y.poly([26,-66,34,-76,26,-72]).fill({color:p}),y.circle(0,-62.5,2.5).fill({color:q})):"laser_scout"===o?(y.circle(8,-57,7).stroke({width:1.6,color:p}),y.circle(8,-57,2.5).fill({color:0xff0000})):"riot_shield"===o?(y.roundRect(-25,-68,50,9,3).fill({color:1975344}),y.roundRect(-25,-68,50,9,3).stroke({width:1.8,color:p}),y.circle(-16,-64,2.5).fill({color:q}),y.circle(16,-64,2.5).fill({color:q})):"cyber_horns"===o?(y.poly([-20,-70,-30,-88,-14,-76]).fill({color:p}),y.poly([20,-70,30,-88,14,-76]).fill({color:p})):"crown_radiator"===o?(y.poly([-16,-72,-14,-86,-8,-74]).fill({color:p}),y.poly([-4,-74,0,-92,4,-74]).fill({color:p}),y.poly([8,-74,14,-86,16,-72]).fill({color:p}),y.circle(0,-70,3).fill({color:q})):"gas_respirator"===o?(y.circle(-14,-44,6).fill({color:1975344}).stroke({width:1.5,color:p}),y.circle(14,-44,6).fill({color:1975344}).stroke({width:1.5,color:p}),y.circle(-14,-44,3).fill({color:p}),y.circle(14,-44,3).fill({color:p})):"prism_goggles"===o?(y.poly([-16,-62,-8,-66,-2,-62,-2,-52,-8,-48,-16,-52]).fill({color:805486}).stroke({width:1.6,color:p}),y.poly([2,-62,8,-66,16,-62,16,-52,8,-48,2,-52]).fill({color:805486}).stroke({width:1.6,color:p}),y.circle(-9,-57,2.5).fill({color:q}),y.circle(9,-57,2.5).fill({color:q})):"samurai_crest"===o?(y.poly([-22,-72,0,-88,22,-72,0,-80]).fill({color:p}),y.circle(0,-78,3).fill({color:q})):"overdrive_vents"===o?(y.poly([-18,-72,-28,-90,-14,-76]).fill({color:p}),y.poly([18,-72,28,-90,14,-76]).fill({color:p})):"holo_shroud"===o?(y.ellipse(0,-66,28,12).stroke({width:1.8,color:p,alpha:.8}),y.circle(0,-78,4).fill({color:q})):"v_fin"===o?(y.poly([-24,-88,-18,-92,0,-76,18,-92,24,-88,0,-72]).fill({color:p}),y.poly([-4,-72,0,-78,4,-72,0,-68]).fill({color:0xef4444})):"blast_shield"===o?(y.roundRect(-24,-68,48,14,3).fill({color:988970}).stroke({width:2,color:p}),y.circle(-18,-80,3.5).fill({color:0xfde047}),y.circle(18,-80,3.5).fill({color:0xfde047})):"eva_horn"===o?(y.poly([-3,-74,0,-98,3,-74]).fill({color:p}),y.roundRect(-28,-48,5,18,2).fill({color:p}),y.roundRect(23,-48,5,18,2).fill({color:p})):"cage_grille"===o?(y.roundRect(-16,-52,32,14,2).fill({color:1579035}).stroke({width:1.6,color:p}),y.roundRect(-22,-86,4,16,1).fill({color:2565930}).stroke({width:1,color:p}),y.roundRect(18,-86,4,16,1).fill({color:2565930}).stroke({width:1,color:p})):"missile_pod"===o?(y.roundRect(-30,-42,8,12,2).fill({color:1841431}).stroke({width:1.5,color:p}),y.roundRect(22,-42,8,12,2).fill({color:1841431}).stroke({width:1.5,color:p}),y.circle(-26,-38,1.5).fill({color:0xef4444}),y.circle(26,-38,1.5).fill({color:0xef4444})):"quad_array"===o?(y.poly([-22,-72,-26,-90,-20,-72]).fill({color:p}),y.poly([-12,-76,-14,-94,-10,-76]).fill({color:p}),y.poly([10,-76,14,-94,12,-76]).fill({color:p}),y.poly([20,-72,26,-90,22,-72]).fill({color:p}),y.circle(-26,-90,2).fill({color:q}),y.circle(26,-90,2).fill({color:q})):"halo_shield"===o?(y.poly([-32,-42,-26,-46,-20,-42,-20,-34,-26,-30,-32,-34]).fill({color:413243}).stroke({width:1.5,color:p}),y.poly([20,-42,26,-46,32,-42,32,-34,26,-30,20,-34]).fill({color:413243}).stroke({width:1.5,color:p})):"ram_horns"===o?(y.poly([-18,-72,-34,-86,-18,-92,-14,-72]).fill({color:p}),y.poly([18,-72,34,-86,18,-92,14,-72]).fill({color:p})):"radar_dish"===o?(y.ellipse(-24,-84,7,12).fill({color:1579035}).stroke({width:1.5,color:p}),y.circle(-24,-84,2).fill({color:q})):"hyper_wings"===o?(y.poly([-26,-46,-44,-64,-34,-40]).fill({color:p}),y.poly([26,-46,44,-64,34,-40]).fill({color:p})):"flowing_headband"===o?(y.roundRect(-24,-66,48,8,2).fill({color:1973067}).stroke({width:1.5,color:p}),y.circle(0,-62,3).fill({color:3718648}),y.poly([24,-62,38,-56,46,-46,36,-48,24,-56]).fill({color:p})):"tactical_cowl"===o?(y.roundRect(-24,-68,48,24,6).fill({color:988970,alpha:.8}).stroke({width:1.4,color:p}),y.circle(6,-57,4.5).stroke({width:1.8,color:2278750}),y.circle(6,-57,1.5).fill({color:2278750})):"oni_mask"===o?(y.poly([-16,-72,-24,-88,-12,-76]).fill({color:0xef4444}),y.poly([16,-72,24,-88,12,-76]).fill({color:0xef4444}),y.poly([-16,-46,-10,-40,0,-42,10,-40,16,-46,12,-36,-12,-36]).fill({color:0xffffff})):"kitsune_ears"===o?(y.poly([-22,-72,-14,-88,-6,-76]).fill({color:1975344}),y.poly([-20,-73,-14,-85,-8,-76]).fill({color:p}),y.poly([6,-76,14,-88,22,-72]).fill({color:1975344}),y.poly([8,-76,14,-85,20,-73]).fill({color:p})):"conical_kasa"===o?(y.poly([-36,-72,0,-92,36,-72]).fill({color:1579035}).stroke({width:1.6,color:p}),y.roundRect(-36,-72,72,2.5,1).fill({color:q})):"twin_katanas"===o?(y.poly([-24,-32,28,-88,25,-88,-27,-32]).fill({color:p}),y.poly([24,-32,-28,-88,-25,-88,27,-32]).fill({color:p})):"tengu_beak"===o?y.poly([-12,-48,0,-34,12,-48,0,-44]).fill({color:988970}).stroke({width:1.5,color:p}):"veil_shroud"===o?y.roundRect(-22,-62,44,26,6).fill({color:988970,alpha:.85}).stroke({width:1.2,color:p}):"scythe_crest"===o?y.poly([-14,-66,0,-88,14,-66,0,-82]).fill({color:p}):"void_mask"===o?(y.roundRect(-18,-62,36,20,4).fill({color:0}).stroke({width:1.8,color:p}),y.circle(0,-52,3).fill({color:p})):"hoodie_cowl"===o?y.roundRect(-28,-74,56,46,14).fill({color:335627,alpha:.9}).stroke({width:1.8,color:p}):"vr_goggles"===o?(y.roundRect(-22,-64,44,15,3).fill({color:537412}).stroke({width:1.8,color:p}),y.circle(-16,-78,2.5).fill({color:q}),y.poly([-16,-64,-16,-78,-14,-78,-14,-64]).fill({color:p})):"daemon_horns"===o?(y.poly([-16,-70,-22,-86,-10,-74]).fill({color:p}),y.poly([16,-70,22,-86,10,-74]).fill({color:p})):"glitch_halo"===o?(y.rect(-28,-76,56,42).stroke({width:1.5,color:p,alpha:.8}),y.rect(-18,-82,12,6).fill({color:p,alpha:.7})):"floating_hud"===o?y.roundRect(24,-78,30,16,2).fill({color:592139}).stroke({width:1,color:p}):"respirator_eq"===o?(y.roundRect(-18,-46,36,10,3).fill({color:988970}).stroke({width:1.2,color:p}),y.rect(-12,-43,4,5).fill({color:2278750}),y.rect(-4,-45,4,7).fill({color:0xeab308}),y.rect(4,-45,4,7).fill({color:0xef4444}),y.rect(12,-43,4,5).fill({color:2278750})):"heatsink_fins"===o?(y.rect(-18,-84,4,14).fill({color:0xea580c}),y.rect(-10,-88,4,18).fill({color:0xea580c}),y.rect(-2,-90,4,20).fill({color:0xea580c}),y.rect(6,-88,4,18).fill({color:0xea580c}),y.rect(14,-84,4,14).fill({color:0xea580c})):"cable_dreads"===o?(y.poly([-22,-62,-32,-48,-28,-12,-26,-12,-30,-48,-20,-62]).fill({color:p}),y.poly([22,-62,32,-48,28,-12,26,-12,30,-48,20,-62]).fill({color:p})):"cyber_skull"===o?(y.circle(-7,-55,4).fill({color:0}).stroke({width:1.5,color:p}),y.circle(7,-55,4).fill({color:0}).stroke({width:1.5,color:p}),y.poly([-8,-40,8,-40,8,-38,-8,-38]).fill({color:p})):"wireframe_cube"===o?(y.rect(-24,-76,48,42).stroke({width:1.6,color:p}),y.rect(-16,-68,32,26).stroke({width:1.2,color:q,alpha:.8})):"bubble_dome"===o?(y.circle(0,-56,28).stroke({width:2.5,color:p,alpha:.9}),y.circle(0,-84,3.5).fill({color:0xfef08a})):"lunar_pack"===o?(y.rect(-20,-86,2,18).fill({color:p}),y.circle(-19,-86,2).fill({color:0xffffff}),y.ellipse(0,-54,24,18).stroke({width:2,color:0xe2e8f0})):"sunburst_halo"===o?(y.ellipse(0,-64,30,8).stroke({width:2,color:p,alpha:.85}),y.circle(0,-76,3).fill({color:0xfef08a}),y.circle(-22,-70,2).fill({color:0xfef08a}),y.circle(22,-70,2).fill({color:0xfef08a})):"saturn_ring"===o?(y.ellipse(0,-56,36,10).stroke({width:2.2,color:p}),y.circle(28,-62,3).fill({color:q})):"star_crown"===o?(y.poly([-16,-74,-12,-86,-8,-76]).fill({color:p}),y.poly([-6,-76,0,-92,6,-76]).fill({color:p}),y.poly([8,-76,12,-86,16,-74]).fill({color:p}),y.circle(0,-74,2.5).fill({color:0xffffff})):"eclipse_corona"===o?(y.ellipse(0,-56,32,18).stroke({width:3,color:p,alpha:.6}),y.circle(0,-56,22).fill({color:0}).stroke({width:1.5,color:p})):"pulsar_spires"===o?(y.poly([-1.5,-78,1.5,-78,1.5,-98,-1.5,-98]).fill({color:p}),y.circle(0,-98,3).fill({color:0xffffff}),y.poly([-1.5,-34,1.5,-34,1.5,-18,-1.5,-18]).fill({color:p}),y.circle(0,-18,3).fill({color:0xffffff})):"aurora_ribbons"===o?y.ellipse(0,-78,24,6).stroke({width:2.5,color:p,alpha:.75}):"angel_wings"===o?(y.poly([-26,-46,-48,-78,-32,-38]).fill({color:p,alpha:.85}),y.poly([26,-46,48,-78,32,-38]).fill({color:p,alpha:.85}),y.ellipse(0,-80,16,5).stroke({width:1.6,color:q})):"singularity_core"===o?(y.ellipse(0,-56,30,26).stroke({width:2,color:0xffffff,alpha:.9}),y.circle(-22,-70,2.5).fill({color:q}),y.circle(22,-42,2.5).fill({color:q})):"stealth_ninja"===n||"ninja"===n?(y.roundRect(-24,-66,48,8,3).fill({color:1973067}).stroke({width:1.5,color:p}),y.circle(0,-62,3).fill({color:3718648})):"mecha_pilot"===n?(y.poly([-22,-72,-18,-90,-12,-70]).fill({color:p}),y.poly([12,-70,18,-90,22,-72]).fill({color:p})):"celestial_astro"===n?y.ellipse(0,-64,30,8).stroke({width:2,color:p,alpha:.85}):"matrix_hacker"===n||"hacker"===n?y.roundRect(-27,-78,54,48,16).fill({color:1120295}).stroke({width:1.6,color:p}):"cyber_cat"===n||"cat"===h?(y.poly([-22,-72,-14,-86,-6,-76]).fill({color:r}),y.poly([-20,-73,-14,-83,-8,-76]).fill({color:0xf472b6,alpha:.8}),y.poly([6,-76,14,-86,22,-72]).fill({color:r}),y.poly([8,-76,14,-83,20,-73]).fill({color:0xf472b6,alpha:.8})):y.poly([-8,-68,0,-78,8,-68]).fill({color:p});let z=null,A="string"==typeof i?(0,bB.x)(i):null,B=A?.archetype||"plasma_ring";i&&"none"!==i&&(z=new ck.f,j.addChildAt(z,0));let C=new ck.f,D=new ck.f;j.addChild(t,u,v,w,x,y,C,D),j.scale.set(c*b);let E=f,F=m?p:a,G=(a,b,c,d,e,f)=>{if("happy"===f)C.moveTo(a-4.6,b+2).arc(a,b+2,4.6,Math.PI,0).stroke(ds(2.6,F,e));else if("sleep"===f)C.moveTo(a-4.6,b).arc(a,b,4.6,0,Math.PI).stroke(ds(2.2,F,.7));else if("x"===f)C.moveTo(a-4,b-4).lineTo(a+4,b+4).stroke(ds(2.6,F,e)),C.moveTo(a+4,b-4).lineTo(a-4,b+4).stroke(ds(2.6,F,e));else if("looping"===f)C.circle(a,b,4.2).stroke(ds(1.8,F,e)),C.circle(a,b,2).stroke(ds(1.4,F,e)),C.circle(a,b,.6).fill({color:F,alpha:e});else{C.ellipse(a,b,c,d).fill({color:F,alpha:.9*e});for(let e=b-d+1;e<b+d;e+=2.4)C.rect(a-c-1,e,2*c+2,1).fill({color:988188,alpha:.55})}};return{root:j,statusDot:v,setMode(a){E=a},animate(a,b=0){let c=j.baseX??j.x,e=E,f=.012*a+c,g=Math.sin(.004*a+.05*c)*(.8+1.4*b),i=0,k=0;"happy"===e&&(g=-(3.2*Math.abs(Math.sin(.005*a+c)))),"sleeping"===e&&(g=1.1*Math.sin(.0016*a+c)+2.2,k=.12+.02*Math.sin(.0016*a+c)),"error"===e&&(i=1.8*Math.sin(.09*a)),"looping"===e&&(i=2.2*Math.sin(.08*a),g=1.6*Math.sin(.015*a),k=.16*Math.sin(.02*a)),j.x=c+i,j.y=(j.baseY||0)+g,j.rotation=k,w.rotation=0,x.rotation=0,"streaming"===e?(w.rotation=.14*Math.sin(f)*(.3+b),x.rotation=-(.14*Math.sin(f+1.3))*(.3+b)):"pending"===e?(w.rotation=2.5+.35*Math.sin(.012*a),x.rotation=-(.06*Math.sin(f+1.3))):"happy"===e?(w.rotation=2.2+.2*Math.sin(.01*a),x.rotation=-2.2-.2*Math.sin(.01*a+1)):"error"===e?(w.rotation=2.7+.1*Math.sin(.08*a),x.rotation=-2.7-.1*Math.sin(.08*a)):"looping"===e?(w.rotation=2.4+.4*Math.sin(.02*a),x.rotation=-2.4-.4*Math.sin(.02*a+1)):"sleeping"===e&&(w.rotation=.05,x.rotation=-.05);let l=Math.sin(.0013*a+2.1*d)>.985,m=.85+.15*Math.sin(.01*a+d);C.clear();let n="happy"===e?"happy":"sleeping"===e?"sleep":"error"===e?"x":"looping"===e?"looping":"scan";if(G(-8,-57,4.8,l?.8:4.4,m,n),G(8,-57,4.8,l?.8:4.4,m,n),"happy"===e?C.moveTo(-6,-48).arc(0,-48,6,0,Math.PI).stroke(ds(2.2,F,.9)):"sleeping"===e?C.circle(0,-45,1.8).stroke(ds(1.6,F,.6)):"error"===e?C.moveTo(-7,-45).lineTo(-3.5,-48).lineTo(0,-45).lineTo(3.5,-48).lineTo(7,-45).stroke(ds(2,F,m)):"looping"===e?C.circle(0,-46,3.2).stroke(ds(2,F,m)):C.ellipse(0,-46,5+3*b,2.4+1.2*b).fill({color:F,alpha:.75*m}),"cat"===h&&(C.moveTo(-12,-47).lineTo(-22,-49).stroke(ds(1.2,0xffffff,.7)),C.moveTo(-12,-44).lineTo(-21,-43).stroke(ds(1.2,0xffffff,.7)),C.moveTo(12,-47).lineTo(22,-49).stroke(ds(1.2,0xffffff,.7)),C.moveTo(12,-44).lineTo(21,-43).stroke(ds(1.2,0xffffff,.7)),C.poly([-2,-48,0,-46,2,-48]).fill({color:0xf472b6})),D.clear(),"sleeping"===e)for(let b=0;b<3;b+=1){let c=(4e-4*a+b/3+.13*d)%1,e=20+16*c,f=-78-30*c,g=3+4*c;D.moveTo(e,f).lineTo(e+g,f).lineTo(e,f+g).lineTo(e+g,f+g).stroke(ds(1.6,0xa5b4cc,1-c))}else if("error"===e||"looping"===e)for(let b=0;b<5;b+=1){let c=(8e-4*a+b/5+.12*d)%1,e=7*Math.sin(8*c+1.3*b)+(b-2)*3.5,f=-76-38*c,g=2.5+7*c;D.circle(e,f,g).fill({color:4937059,alpha:.65*(1-c)})}if(z){z.clear();let b=A?.color?dm(A.color,61695):61695,c=1+.12*Math.sin(.006*a),f="happy"===e?.95:"error"===e?.35+.35*Math.sin(.08*a):"sleeping"===e?.25:.65;if("matrix_rain"===B)for(let c=-3;c<=3;c++){let e=9*c,g=-70+(.002*a+.33*c+.2*d)%1*50;z.moveTo(e,g-8).lineTo(e,g).stroke({width:1.5,color:b,alpha:.8*f}),z.circle(e,g,1.2).fill({color:0xffffff,alpha:f})}else if("quantum_mist"===B){for(let d=0;d<4;d++){let e=.003*a+d*Math.PI/2,g=30*c+4*Math.sin(e),h=14*c+3*Math.cos(e);z.ellipse(0,-42,g,h).stroke({width:1.2,color:b,alpha:.5*f})}z.circle(28*Math.sin(.007*a),-42+11*Math.cos(.007*a),2.2).fill({color:0xffffff,alpha:f})}else if("glitch_halo"===B){let d=2*Math.sin(.09*a);z.roundRect(-30*c+d,-54*c,60*c,24*c,6).stroke({width:2,color:b,alpha:f}),z.circle(2*d,-42,3).stroke({width:1,color:0xffffff,alpha:.7*f})}else z.ellipse(0,-42,34*c,13*c).stroke({width:2,color:b,alpha:f}),z.ellipse(0,-42,26*c,9*c).stroke({width:1.2,color:0xffffff,alpha:.8*f}),"happy"===e&&z.circle(32*Math.sin(.01*a),-42+12*Math.cos(.01*a),2.5).fill({color:0xffffff})}v.alpha=.6+.4*Math.sin(.007*a+d)*(.3+b)},setState(a){v.tint=a}}}function du(a,{color:b=2282478,size:c=10}={}){return new dh({text:a,style:{fontFamily:dq(),fontSize:c,fill:b,fontWeight:"700"}})}let dv={cap:"round",join:"round"},dw={bash:{label:"Bash",color:3462041,draw(a,b){a.moveTo(-8,-6).lineTo(-2,0).lineTo(-8,6).stroke({width:2.4,color:b,...dv}),a.moveTo(1,7).lineTo(8,7).stroke({width:2.4,color:b,...dv})}},read:{label:"Read",color:6333946,draw(a,b){a.moveTo(-6,-9).lineTo(3,-9).lineTo(7,-5).lineTo(7,9).lineTo(-6,9).closePath().stroke({width:2,color:b,...dv}),a.moveTo(-3,-1).lineTo(4,-1).stroke({width:1.8,color:b,...dv}),a.moveTo(-3,3).lineTo(4,3).stroke({width:1.8,color:b,...dv}),a.moveTo(-3,6.5).lineTo(1,6.5).stroke({width:1.8,color:b,...dv})}},edit:{label:"Edit",color:0xfbbf24,draw(a,b){a.moveTo(-7,8).lineTo(-6,3).lineTo(4,-7).lineTo(8,-3).lineTo(-2,7).closePath().stroke({width:2,color:b,...dv}),a.moveTo(1,-4).lineTo(5,0).stroke({width:1.8,color:b,...dv}),a.moveTo(-8,9.5).lineTo(-1,9.5).stroke({width:1.8,color:b,...dv})}},search:{label:"Search",color:0xf472b6,draw(a,b){a.circle(-2,-2,6).stroke({width:2.2,color:b,...dv}),a.moveTo(2.5,2.5).lineTo(8,8).stroke({width:2.6,color:b,...dv})}},web:{label:"Web",color:2282478,draw(a,b){a.circle(0,0,8.5).stroke({width:2,color:b,...dv}),a.ellipse(0,0,3.6,8.5).stroke({width:1.6,color:b,...dv}),a.moveTo(-8.5,0).lineTo(8.5,0).stroke({width:1.6,color:b,...dv})}},mcp:{label:"MCP",color:0xa78bfa,draw(a,b){a.moveTo(-4,-9).lineTo(-4,-3).stroke({width:2.4,color:b,...dv}),a.moveTo(4,-9).lineTo(4,-3).stroke({width:2.4,color:b,...dv}),a.roundRect(-8,-3,16,9,3).stroke({width:2,color:b,...dv}),a.moveTo(0,6).lineTo(0,10).stroke({width:2.4,color:b,...dv})}},agent:{label:"Subagent",color:0xfb923c,draw(a,b){a.moveTo(0,-4).lineTo(-6,6).stroke({width:1.8,color:b,...dv}),a.moveTo(0,-4).lineTo(6,6).stroke({width:1.8,color:b,...dv}),a.circle(0,-5,3.6).fill({color:b}),a.circle(-6.5,7,3).fill({color:b}),a.circle(6.5,7,3).fill({color:b})}},todo:{label:"Todo",color:9741240,draw(a,b){a.moveTo(-8,-5).lineTo(-6,-3).lineTo(-3,-7).stroke({width:1.8,color:b,...dv}),a.moveTo(1,-5).lineTo(8,-5).stroke({width:1.8,color:b,...dv}),a.moveTo(-8,5).lineTo(-6,7).lineTo(-3,3).stroke({width:1.8,color:b,...dv}),a.moveTo(1,5).lineTo(8,5).stroke({width:1.8,color:b,...dv})}},gitnexus:{label:"GitNexus",color:0xc084fc,draw(a,b){a.moveTo(0,0).lineTo(-6,-6).stroke({width:1.5,color:b,...dv}),a.moveTo(0,0).lineTo(6,-5).stroke({width:1.5,color:b,...dv}),a.moveTo(0,0).lineTo(0,7).stroke({width:1.5,color:b,...dv}),a.circle(0,0,3.2).fill({color:b}),a.circle(-6,-6,2.2).fill({color:b}),a.circle(6,-5,2.2).fill({color:b}),a.circle(0,7,2.2).fill({color:b})}},browser:{label:"Browser",color:440020,draw(a,b){a.roundRect(-8,-7,16,14,2.5).stroke({width:1.8,color:b,...dv}),a.moveTo(-8,-2).lineTo(8,-2).stroke({width:1.4,color:b,...dv}),a.circle(-5,-4.5,1).fill({color:b}),a.circle(-2,-4.5,1).fill({color:b})}},git:{label:"Git",color:0xf97316,draw(a,b){a.moveTo(-4,-7).lineTo(-4,7).stroke({width:2,color:b,...dv}),a.moveTo(-4,2).arc(0,2,4,Math.PI,0).lineTo(4,-3).stroke({width:1.8,color:b,...dv}),a.circle(-4,-6,2.4).fill({color:b}),a.circle(-4,6,2.4).fill({color:b}),a.circle(4,-3,2.4).fill({color:b})}},docker:{label:"Docker",color:3718648,draw(a,b){a.roundRect(-7,1,6,5,1).fill({color:b,alpha:.8}).stroke({width:1.2,color:b,...dv}),a.roundRect(1,1,6,5,1).fill({color:b,alpha:.8}).stroke({width:1.2,color:b,...dv}),a.roundRect(-3,-6,6,5,1).fill({color:b,alpha:.8}).stroke({width:1.2,color:b,...dv})}}},dx={pending:{label:"Queued",color:0xf59e0b,draw(a,b){for(let c of[-7,0,7])a.circle(c,1,2.6).fill({color:b})}},done:{label:"Done",color:3462041,draw(a,b){a.moveTo(-7,0).lineTo(-2,6).lineTo(8,-7).stroke({width:3,color:b,...dv})}},rate_limited:{label:"Rate limit",color:0xef4444,draw(a,b){a.moveTo(-6,-9).lineTo(6,-9).lineTo(-6,9).lineTo(6,9).closePath().stroke({width:2,color:b,...dv}),a.moveTo(-3,6.5).lineTo(3,6.5).stroke({width:2.2,color:b,...dv})}},upstream_timeout:{label:"Timeout",color:0xef4444,draw(a,b){a.circle(0,0,8.5).stroke({width:2,color:b,...dv}),a.moveTo(0,-5).lineTo(0,0).lineTo(4.5,3).stroke({width:2,color:b,...dv})}},quota_exhausted:{label:"Quota",color:0xef4444,draw(a,b){a.roundRect(-8,-5,14,10,2).stroke({width:2,color:b,...dv}),a.rect(6,-2,3,4).fill({color:b}),a.rect(-6,-3,2.6,6).fill({color:b})}},auth_refresh_failed:{label:"Auth",color:0xef4444,draw(a,b){a.circle(-4,0,4.2).stroke({width:2,color:b,...dv}),a.moveTo(0,0).lineTo(8,0).stroke({width:2,color:b,...dv}),a.moveTo(5,0).lineTo(5,4).stroke({width:2,color:b,...dv}),a.moveTo(-9,-8).lineTo(9,8).stroke({width:2.2,color:0xfbbf24,...dv})}},fallback:{label:"Fallback",color:0xfbbf24,draw(a,b){a.moveTo(-8,-4).lineTo(7,-4).stroke({width:2.2,color:b,...dv}),a.moveTo(3,-8).lineTo(8,-4).lineTo(3,0).stroke({width:2.2,color:b,...dv}),a.moveTo(8,5).lineTo(-7,5).stroke({width:2.2,color:b,...dv}),a.moveTo(-3,1).lineTo(-8,5).lineTo(-3,9).stroke({width:2.2,color:b,...dv})}},looping:{label:"Looping",color:0xf43f5e,draw(a,b){a.arc(0,0,6.5,-(.2*Math.PI),1.3*Math.PI).stroke({width:2.2,color:b,...dv}),a.moveTo(4,-6.5).lineTo(7,-3.5).lineTo(1,-3.5).closePath().fill({color:b})}}},dy=Object.keys(dw),dz=["pending","done","rate_limited","upstream_timeout","quota_exhausted","auth_refresh_failed","fallback","looping"];function dA(a,{size:b=1,showLabel:c=!0,label:d}={}){let e=dw[a]||dx[a]||dw.bash,f=new cb.t,g=new ck.f;g.circle(0,0,21).fill({color:e.color,alpha:.18});let h=new ck.f;h.circle(0,0,15).fill({color:988188}),h.circle(0,0,15).stroke({width:2,color:e.color,alpha:.95});let i=new ck.f;if(e.draw(i,e.color),i.scale.set(.95),f.addChild(g,h,i),c){let a=new dh({text:d??e.label,style:{fontFamily:(0,dl.l)("ui"),fontSize:9,fill:e.color,fontWeight:"800"}});a.anchor.set(.5,0),a.y=18,f.addChild(a)}return f.scale.set(b),{root:f,halo:g,tool:a}}let dB={x:-60,y:40,w:2150,h:980},dC=a=>Math.max(0,Math.min(1,a)),dD={streaming:.8,pending:.3,happy:.2,sleeping:0,error:1};async function dE(a,b,c={}){let d,e,f,g,h=c.selectedId??null,i=c.onSelect,j=!1,k={x:0,y:0},l={x:0,y:0},m=!1,n=new ci;await n.init({canvas:a,preference:"webgl",resizeTo:a.parentElement,background:724758,antialias:!0,resolution:Math.min(globalThis.devicePixelRatio||1,2),autoDensity:!0});let o=n.renderer?.context?.extensions?.loseContext;if(o&&"function"==typeof o.loseContext){let a=o.loseContext.bind(o);o.loseContext=()=>{try{let b=n.renderer?.gl;if(b&&"function"==typeof b.isContextLost&&b.isContextLost())return;a()}catch(a){}}}let p=new cb.t,q=new cb.t,r=new cb.t,s=new cb.t,t=new cb.t,u=new cb.t,v=new cb.t,w=(d=new cb.t,e=new ck.f,f=new ck.f,d.addChild(f,e),g=[],{container:d,setRoutes(a){for(let b of(g.length=0,a)){let a=Math.max(1,Math.min(6,Math.round(6*b.weight)));for(let c=0;c<a;c+=1)g.push({from:b.from,to:b.to,t:(c/a+.1*Math.random())%1,speed:35e-5+6e-4*Math.random()+4e-4*b.weight,color:b.color,size:1.6+2.2*b.weight,shape:b.shape||"circle",arc:b.arc??26})}for(;g.length>700;)g.pop()},animate(a){for(let b of(e.clear(),f.clear(),g)){b.t+=b.speed*a,b.t>1&&(b.t-=1,b.speed=35e-5+6e-4*Math.random());let c=function(a,b,c,d){let e=Math.sin(c*Math.PI)*d;return{x:a.x+(b.x-a.x)*c,y:a.y+(b.y-a.y)*c-e}}(b.from,b.to,b.t,b.arc),d=Math.min(1,6*b.t)*Math.min(1,(1-b.t)*6),g=b.size;if("diamond"===b.shape)e.poly([c.x,c.y-1.5*g,c.x+1.2*g,c.y,c.x,c.y+1.5*g,c.x-1.2*g,c.y]).fill({color:b.color,alpha:d});else if("square"===b.shape){let a=.7*g;e.rect(c.x-a,c.y-a,2*a,2*a).fill({color:b.color,alpha:.9*d})}else e.circle(c.x,c.y,g).fill({color:b.color,alpha:d});f.circle(c.x,c.y,3*g).fill({color:b.color,alpha:.14*d})}}});p.addChild(q,r,w.container,s,t,u,v),n.stage.addChild(p);let x=b,y=new ck.f;function z(a=2150,b=980){dB.w=a,dB.h=b,y.clear();let c=(0,bR.F)(),d=x?.[0]?.theme||c?.equippedOfficeTheme||"theme_default",e=(bB.y.officeThemes||[]).find(a=>a.id===d)||bB.y.officeThemes?.[0],f=e?.palette||{floorGradient:[725016,1449772],gridColor:1712944,gridAlpha:.7,borderColor:2503236,panelRackColor:0xfde047,panelPodColor:2282478},[g,h]=f.floorGradient||[725016,1449772],i=f.gridColor??1712944,j=f.gridAlpha??.7,k=f.borderColor??2503236,l=f.panelRackColor??0xfde047,m=f.panelPodColor??2282478;y.roundRect(dB.x,dB.y,dB.w,dB.h,28).fill(new cj.f({type:"linear",start:{x:0,y:0},end:{x:0,y:1},colorStops:[{offset:0,color:g},{offset:1,color:h}],textureSpace:"local"}));for(let a=dB.x+100;a<dB.x+dB.w;a+=100)y.moveTo(a,dB.y+14).lineTo(a,dB.y+dB.h-14).stroke({width:1,color:i,alpha:j});for(let a=dB.y+100;a<dB.y+dB.h;a+=100)y.moveTo(dB.x+14,a).lineTo(dB.x+dB.w-14,a).stroke({width:1,color:i,alpha:j});y.roundRect(dB.x,dB.y,dB.w,dB.h,28).stroke({width:2,color:k,alpha:.9}),y.roundRect(1370,dB.y+120,260,dB.h-240,22).fill({color:l,alpha:.045}),y.roundRect(1750,dB.y+40,220,dB.h-150,22).fill({color:m,alpha:.045})}z(2150,980),y.eventMode="static",y.on("pointertap",()=>{m||O(null)}),q.addChild(y);let A=new cb.t,B=dt({color:0xfde047,trimColor:0xf59e0b,seed:3,scale:.95,mode:"sleeping"});B.root.baseX=0,B.root.baseY=-156,B.root.x=0,B.root.y=-156,A.addChild(B.root);let C=new ck.f;C.roundRect(-70,-170,140,230,10).fill({color:1712685}),C.roundRect(-62,-162,124,60,6).fill({color:2240576}),C.roundRect(-58,40,116,96,6).fill({color:2240576}),A.addChild(C);let D=new ck.f;D.roundRect(-80,-180,160,250,14).fill({color:0xfde047,alpha:.12}),A.addChildAt(D,0);let E=new ck.f;A.addChild(E);let F=new dh({text:"CORE HUB",style:{fontFamily:(0,dl.l)("ui"),fontSize:14,fill:3718648,fontWeight:"800",letterSpacing:2}});F.anchor.set(.5,0),F.y=-92,A.addChild(F);let G=du("0",{color:0xfde047,size:13});G.anchor.set(.5,0),G.y=4,A.addChild(G),s.addChild(A);let H=[],I=[],J=[],K=[],L=!1,M="";function N(){for(let a of I)a.desk.setSelected(a.ws.connectionId===h)}function O(a){h=a,N(),i?.(a)}function P(a,b=!1){x=a;let c=function(a){if(!Array.isArray(a)||0===a.length)return"0:empty";let b=a.length+":";for(let c=0;c<a.length;c++){let d=a[c];d&&(b+=`${d.connectionId||d.id||c}_${d.state||""}_${d.mode||""}_${+!!d.isLooping}_${d.skin||""}_${d.aura||""}_${d.pet||""}_${d.trophy||""}_${Array.isArray(d.props)?d.props.join(","):d.props||""}_${d.cost||0}_${d.elapsedMs||0}_${d.tokens?.input||0}_${d.tokens?.output||0}_${d.tools?.length||0}_${d.error||""}|`)}return b}(a);if(!b&&c===M&&H.length>0)return;M=c;let d=[],e=[],f=[],g=[],i=(a,b)=>(a.addChild(b),d.push(b),b),j=dk(a),k=new Map(j.pods.map(a=>[a.provider,a])),l=[],n=[...j.workstations].sort((a,b)=>a.y-b.y||a.x-b.x),o=(0,bR.F)();for(let[a,b]of n.entries()){let c=!!b.isLooping,d="app"===b.clientType||String(b.provider||"").toLowerCase().includes("app"),f=b.clientType||(d?"app":"cli"),g=function({color:a,label:b="",meta:c="",provider:d="",clientType:e="cli",elapsedMs:f=0,cost:g=0,cachedPct:h=0,queued:i=1,depth:j=1,isLooping:k=!1,pet:l="none",props:m=[],trophy:n="none"}){let o=new cb.t,p="app"===e||String(d||"").toLowerCase().includes("app"),q=new ck.f;q.ellipse(83,102,93,11).fill({color:0,alpha:.18}),q.ellipse(81,100,.56*150,8).fill({color:0,alpha:.28}),q.roundRect(0,34,150,62,7).fill(dr(2831427,1580326)),q.poly([150,40,159,32,159,88,150,94]).fill({color:1053723}),q.poly([-5,28,8,20,148,20,159,28]).fill({color:6122365}),q.roundRect(-5,26,164,14,6).fill(dr(6648714,3818836)),q.roundRect(-5,26,164,2.5,2).fill({color:0xffffff,alpha:.3}),q.roundRect(0,40,150,2,1).fill({color:0,alpha:.35}),o.addChild(q);let r=Math.min(1,f/4e4),s=f<12e3?3462041:f<26e3?0xfbbf24:0xef4444,t=new ck.f;t.roundRect(10,87,130,4,2).fill({color:988188}),t.roundRect(10,87,Math.max(4,130*r),4,2).fill({color:s}),o.addChild(t);let u=new ck.f;u.roundRect(13,-30,76,62,12).fill({color:a,alpha:.12}),o.addChild(u);let v=new ck.f;v.roundRect(25,-16,58,38,5).fill({color:0,alpha:.35}),v.roundRect(23,-18,58,38,5).fill(dr(2765116,724499)),v.roundRect(27,-14,50,30,3).fill({color:a,alpha:.6});for(let a=0;a<4;a+=1)v.roundRect(31,-9+6*a,18+11*a%22,2.4,1).fill({color:0xffffff,alpha:.5});v.poly([27,-14,53,-14,41,16,27,16]).fill({color:0xffffff,alpha:.07}),v.roundRect(46,20,8,6,2).fill({color:2962753}),o.addChild(v);let w=new ck.f;w.roundRect(29,-13,26,11,2.5).fill({color:p?3868516:413243,alpha:.9}),w.roundRect(29,-13,26,11,2.5).stroke({width:.8,color:p?0xa855f7:366185,alpha:.95}),o.addChild(w);let x=new dh({text:p?"APP":"CLI",style:{fontFamily:dp(),fontSize:7,fill:p?0xd8b4fe:7268279,fontWeight:"900"}});x.anchor.set(.5,.5),x.x=42,x.y=-7.5,o.addChild(x);let y=new ck.f;y.roundRect(89,29,34,8,3).fill({color:724499}),y.roundRect(89,27,34,8,3).fill(dr(3884372,2304565)),o.addChild(y);let z=new ck.f,A=Math.min(5,Math.max(1,i));for(let a=0;a<A;a+=1)z.roundRect(-2+a%2,22-3.4*a,22,5,1.5).fill({color:a%2?0xe6edf6:0xcfd8e6}).stroke({width:.6,color:988188,alpha:.5});if(o.addChild(z),i>1){let a=new dh({text:`\xd7${i}`,style:{fontFamily:dq(),fontSize:10,fill:0xfbbf24,fontWeight:"800"}});a.anchor.set(.5,1),a.x=9,a.y=22-3.4*A-1,o.addChild(a)}let B=new dh({text:dn(b,18),style:{fontFamily:dq(),fontSize:11.5,fill:p?0xf5d0fe:0xe6edf6,fontWeight:"700"}});B.anchor.set(.5,0),B.x=75,B.y=42;let C=d?d.toUpperCase():"",D=C?`${C} \xb7 ${dn(c,18)}`:dn(c,28),E=new dh({text:dn(D,28),style:{fontFamily:dp(),fontSize:8.5,fill:p?0xd8b4fe:9675189}});E.anchor.set(.5,0),E.x=75,E.y=57;let F=Number.isFinite(f)?f:null,G=Number.isFinite(g)?`$${g.toFixed(2)}`:"—",H=Number.isFinite(h)?`${h}% cached`:"— cached",I=null===F?"—":F>=1e3?`${(F/1e3).toFixed(1)}s`:`${F}ms`,J=new dh({text:`${I} \xb7 ${G} \xb7 ${H}`,style:{fontFamily:dp(),fontSize:8.5,fill:s}});J.anchor.set(.5,0),J.x=75,J.y=71,o.addChild(B,E,J);let K=Array.isArray(m)?m:[m],L=K.map(a=>"string"==typeof a?(0,bB.x)(a):a).filter(Boolean),M=K.includes("coffee_machine")||L.some(a=>"espresso_station"===a.archetype||a.id?.includes("prop_3")||a.id?.includes("espresso")),N=K.includes("bonsai")||L.some(a=>"terrarium_bonsai"===a.archetype||a.id?.includes("prop_4")||a.id?.includes("bonsai")),O=L.some(a=>"supercomputer"===a.archetype||a.id?.includes("prop_0")||a.id?.includes("server")),P=L.some(a=>"hologram_emitter"===a.archetype||a.id?.includes("prop_2")||a.id?.includes("holo")),Q=L.some(a=>"dual_monitor"===a.archetype||a.id?.includes("prop_1")||a.id?.includes("monitor")),R=L.some(a=>"arcade_cabinet"===a.archetype||a.id?.includes("arcade")),S=L.some(a=>"lab_oscilloscope"===a.archetype||a.id?.includes("oscilloscope")),T=null;if(M){let a=new cb.t;a.x=118,a.y=12;let b=new ck.f;b.roundRect(0,0,16,20,3).fill(dr(4674921,1976635)),b.roundRect(2,2,12,5,1.5).fill({color:988970}),b.roundRect(3,3,3,3,1).fill({color:3718648}),b.roundRect(2,9,12,9,1).fill({color:988970}),b.roundRect(4,11,7,7,2).fill({color:0xf8fafc}),b.roundRect(5,12,5,2,1).fill({color:7877903}),a.addChild(b),T=new ck.f,a.addChild(T),o.addChild(a)}if(N){let a=new cb.t;a.x=4,a.y=14;let b=new ck.f;b.roundRect(0,10,14,7,2).fill({color:8138002}),b.ellipse(7,6,7,5).fill({color:1409085}),b.circle(4,4,3.8).fill({color:2278750}),b.circle(10,4,3.8).fill({color:1483594}),a.addChild(b),o.addChild(a)}let U=null;if(O){let a=new cb.t;a.x=128,a.y=8;let b=new ck.f;b.roundRect(0,0,14,28,2).fill(dr(1976635,988970)),b.roundRect(0,0,14,28,2).stroke({width:1,color:3359061}),a.addChild(b),U=new ck.f,a.addChild(U),o.addChild(a)}let V=null;if(P){let a=new cb.t;a.x=6,a.y=10;let b=new ck.f;b.ellipse(8,22,9,3.5).fill({color:1976635}),b.ellipse(8,22,9,3.5).stroke({width:1,color:440020}),b.poly([8,22,1,6,15,6]).fill({color:440020,alpha:.2}),a.addChild(b),(V=new ck.f).x=8,V.y=4,V.roundRect(-4,-4,8,8,1).stroke({width:1.2,color:3718648,alpha:.9}),V.roundRect(-4,-4,8,8,1).fill({color:440020,alpha:.4}),a.addChild(V),o.addChild(a)}if(Q){let a=new cb.t;a.x=4,a.y=10;let b=new ck.f;b.roundRect(0,0,14,24,2).fill(dr(1976635,988970)),b.roundRect(0,0,14,24,2).stroke({width:1,color:3718648,alpha:.7}),b.roundRect(2,2,10,20,1).fill({color:132631});for(let a=0;a<4;a++)b.roundRect(3,4+4.5*a,5+a%2*3,1.2,.5).fill({color:a%2?2278750:61695,alpha:.8});a.addChild(b),o.addChild(a)}if(R){let a=new cb.t;a.x=126,a.y=6;let b=new ck.f;b.roundRect(0,0,16,30,2).fill(dr(4988309,1973067)),b.roundRect(0,0,16,30,2).stroke({width:1,color:0xa855f7}),b.roundRect(2,2,12,6,1).fill({color:0xf43f5e}),b.roundRect(2,10,12,11,1).fill({color:395284}),b.circle(5,24,1.5).fill({color:0xf59e0b}),a.addChild(b),o.addChild(a)}let W=null;if(S){let a=new cb.t;a.x=6,a.y=12;let b=new ck.f;b.roundRect(0,0,18,18,2).fill({color:1976635}),b.roundRect(0,0,18,18,2).stroke({width:1,color:1096065}),b.circle(9,9,6.5).fill({color:142370}),a.addChild(b),W=new ck.f,a.addChild(W),o.addChild(a)}if(n&&"none"!==n){let a="string"==typeof n?(0,bB.x)(n):null,b=a?.color?dm(a.color,0xf59e0b):0xf59e0b,c=a?.archetype||"quantum_crystal",d=new cb.t;d.x=136,d.y=16;let e=new ck.f;e.roundRect(-6,8,12,4,1).fill({color:988970}),e.roundRect(-6,8,12,4,1).stroke({width:.8,color:b,alpha:.6}),"golden_key"===c?(e.circle(0,-2,4).stroke({width:1.5,color:b}),e.moveTo(0,2).lineTo(0,8).stroke({width:1.5,color:b}),e.moveTo(0,5).lineTo(2.5,5).stroke({width:1.2,color:b})):"silicon_wafer"===c?(e.circle(0,0,5.5).fill({color:1976635}),e.circle(0,0,5.5).stroke({width:1.2,color:b}),e.moveTo(-4,0).lineTo(4,0).stroke({width:.8,color:3718648,alpha:.8}),e.moveTo(0,-4).lineTo(0,4).stroke({width:.8,color:0xec4899,alpha:.8})):"diamond_bug"===c?(e.ellipse(0,0,4.5,5.5).fill({color:b}),e.circle(0,-3.5,2.5).fill({color:0xffffff}),e.moveTo(-4,-1).lineTo(-6,-3).stroke({width:1,color:b}),e.moveTo(4,-1).lineTo(6,-3).stroke({width:1,color:b})):(e.poly([0,-6,5,2,-5,2]).fill({color:b}),e.poly([0,-6,5,2,0,6,-5,2]).stroke({width:1,color:0xffffff,alpha:.8}),e.circle(0,0,1.5).fill({color:0xffffff})),d.addChild(e),o.addChild(d)}let X=null,Y="string"==typeof l?(0,bB.x)(l):null,Z=Y?.archetype||("cat"===l?"cyber_cat":"shiba"===l?"dozing_shiba":l),$=Y?.color?dm(Y.color,0xf472b6):"dozing_shiba"===Z?0xd97706:0xf472b6;if(l&&"none"!==l){(X=new cb.t).x=24,X.y=80;let a=new ck.f;"cyber_cat"===Z||"cat"===l?(a.ellipse(0,0,11,7).fill({color:$}),a.circle(-7,-2,5.5).fill({color:$}),a.poly([-11,-7,-8,-11,-5,-7]).fill({color:0xf43f5e}),a.poly([-7,-7,-4,-11,-1,-7]).fill({color:0xf43f5e}),a.moveTo(-9,-1).arc(-7,-1,2,0,Math.PI).stroke(ds(1,8917815)),a.ellipse(7,2,5,2.5).fill({color:$})):"dozing_shiba"===Z||"shiba"===l?(a.ellipse(0,0,13,8).fill({color:$}),a.ellipse(2,2,9,4).fill({color:0xfef3c7}),a.circle(-8,-2,6).fill({color:$}),a.poly([-12,-7,-9,-12,-6,-7]).fill({color:0xb45309}),a.poly([-7,-7,-4,-12,-1,-7]).fill({color:0xb45309}),a.moveTo(-10,-1).arc(-8,-1,2,0,Math.PI).stroke(ds(1,7877903)),a.circle(9,-2,4).fill({color:$})):"hover_drone"===Z?(a.ellipse(0,6,12,3.5).stroke({width:1.5,color:$,alpha:.8}),a.circle(0,0,7).fill({color:1976635}),a.circle(0,0,7).stroke({width:1.2,color:$}),a.circle(0,0,3).fill({color:3718648}),a.circle(-1,-1,1).fill({color:0xffffff})):(a.ellipse(0,0,8,10).fill({color:1976635}),a.ellipse(0,0,8,10).stroke({width:1.2,color:$}),a.circle(-3,-4,2.5).fill({color:$}),a.circle(3,-4,2.5).fill({color:$}),a.poly([-1,0,1,0,0,2]).fill({color:0xf59e0b})),X.addChild(a),o.addChild(X)}let _=new ck.f;_.roundRect(-12,-76,174,180,14).stroke({width:2.5,color:0xfde047,alpha:.9}),_.roundRect(-12,-76,174,180,14).fill({color:0xfde047,alpha:.05}),_.visible=!1,o.addChildAt(_,0);let aa=new ck.f;return aa.roundRect(-10,18,170,88,10).stroke({width:3,color:0xf43f5e,alpha:.95}),aa.roundRect(-10,18,170,88,10).fill({color:0xf43f5e,alpha:.08}),aa.visible=!!k,o.addChildAt(aa,0),o.eventMode="static",o.cursor="pointer",o.hitArea=new cr.f(-12,-76,174,180),o.scale.set(j),{root:o,screen:v,glow:u,setSelected(a){_.visible=!!a},setHazard(a){aa.visible=!!a},animate(a,b=0,c="streaming"){if(v.alpha=.7+.12*Math.sin(.008*a+o.x)*(.4+b),u.alpha=.3+.5*b+.08*Math.sin(.004*a+o.x),aa.visible&&(aa.alpha=.45+.45*Math.sin(.008*a)),T&&b>0){T.clear();for(let b=0;b<3;b++){let c=(.001*a+b/3)%1,d=7+3*Math.sin(5*c+b),e=8-12*c;T.circle(d,e,1+1.8*c).fill({color:0xffffff,alpha:.45*(1-c)})}}else T&&T.clear();if(U){U.clear();for(let b=0;b<4;b++){let c=Math.sin(.008*a+1.6*b)>0,d=[2278750,61695,0xf59e0b,0xec4899][b];U.circle(4,4+6*b,1.3).fill({color:c?d:1976635})}}if(V&&(V.rotation=.002*a),W){W.clear(),W.moveTo(3,9);for(let b=3;b<=15;b+=1.5){let c=9+3*Math.sin(.01*a+.8*b);W.lineTo(b,c)}W.stroke({width:1.2,color:3462041,alpha:.9})}X&&("hover_drone"===Z?(X.y=72+4*Math.sin(.005*a),X.scale.y=1):"happy"===c?(X.y=80-7*Math.abs(Math.sin(.008*a)),X.scale.y=1+.15*Math.abs(Math.sin(.008*a))):"sleeping"===c?(X.y=80,X.scale.y=1+.04*Math.sin(.0016*a)):"error"===c?(X.x=24+1.5*Math.sin(.08*a),X.y=80):"looping"===c?X.rotation=.15*Math.sin(.04*a):(X.y=80,X.scale.y=1+.06*Math.sin(.003*a)))}}}({color:b.color,label:b.account,meta:`${b.model||""} \xb7 ${b.totalLabel}`,provider:b.provider,clientType:f,elapsedMs:b.elapsedMs,cost:b.cost,cachedPct:b.cachedPct,queued:b.queued,depth:b.depth,isLooping:c,pet:b.pet||o.equippedPet||"none",props:b.props&&b.props.length>0?b.props:o.equippedProps||[],trophy:b.trophy||o.equippedTrophy||"none"});g.root.x=b.x,g.root.y=b.y,g.root.on("pointertap",a=>{m||(a.stopPropagation(),O(b.connectionId===h?null:b.connectionId))});let j=dt({color:b.color,depth:b.depth,seed:a,mode:b.mode,clientType:f,skin:b.skin||o.equippedSkin||"classic",aura:b.aura||o.equippedAura||"none"});j.root.x=b.x+108,j.root.baseX=b.x+108,j.root.baseY=b.y+34,j.root.y=j.root.baseY,i(s,j.root),i(s,g.root);let n=[];if(b.busy>0||b.tools.length>0)for(let a of b.tools){let c=dA(a,{size:1.05});c.root.x=b.x+28,c.root.y=b.y-50,c.root.visible=!1,i(u,c.root),n.push(c)}let p=null,q=b.isLooping?"looping":"pending"===b.mode?"pending":"happy"===b.mode?"done":"error"===b.mode?dx[b.errorReason]?b.errorReason:"rate_limited":null;if(q&&((p=dA(q,{size:1.05})).root.x=b.x+150+14,p.root.y=b.y-34,i(u,p.root)),b.fallbackFrom){let a=dA("fallback",{size:.85,label:`from ${b.fallbackFrom}`});a.root.x=b.x+150+14,a.root.y=b.y+40,i(u,a.root)}let r=null;if("happy"===b.mode&&b.cost>0){r=new cb.t;let a=new ck.f;a.circle(0,0,6).fill({color:0xfacc15}),a.circle(0,0,6).stroke({width:1.2,color:0xa16207});let c=new dh({text:`+$${b.cost.toFixed(2)}`,style:{fontFamily:(0,dl.l)("ui"),fontSize:11,fill:0xfacc15,fontWeight:"800"}});c.x=10,c.anchor.set(0,.5),r.addChild(a,c),r.x=b.x+16,r.visible=!1,i(u,r)}e.push({desk:g,character:j,ws:b,toolBadges:n,statusBadge:p,coin:r});let t=k.get(b.provider);if(b.busy>0){let a=a=>Math.max(.15,dC(a)),c=a(b.tokens.input/16e3),d=a(b.tokens.output/3200),e=b.tokens.cached>0?a(b.tokens.cached/6500):0,f={x:b.x+75,y:b.y-10},g={x:1500,y:390};l.push({from:f,to:g,color:b.color,weight:c}),t&&(l.push({from:{x:1500,y:440},to:{x:t.x-46,y:t.y},color:t.color,weight:c}),l.push({from:{x:t.x-46,y:t.y+14},to:{x:1520,y:470},color:8843180,weight:d,shape:"diamond",arc:-22})),l.push({from:{x:1480,y:490},to:{x:b.x+100,y:b.y+6},color:8843180,weight:d,shape:"diamond",arc:-22}),e&&l.push({from:{x:b.x+90,y:b.y-20},to:{x:1470,y:360},color:0xcbd5e1,weight:e,shape:"square",arc:44})}}for(let a of j.pods){let b=dt({color:a.color,trimColor:a.color,scale:.55,seed:a.provider.length,mode:a.overloaded?"pending":a.busy>0?"streaming":"sleeping"});b.root.x=a.x+2,b.root.baseX=a.x+2,b.root.baseY=a.y+10,b.root.y=a.y+10,i(s,b.root);let c=new ck.f;c.ellipse(0,34,52,10).fill({color:0,alpha:.35}),c.roundRect(-46,-30,92,62,12).fill({color:1844529}),c.roundRect(-46,-30,92,6,5).fill({color:0xffffff,alpha:.06});let d=a.overloaded?di.error:a.load>.5?0xfbbf24:3462041;for(let b=0;b<3;b+=1){let e=dC(3*a.load-b);c.roundRect(-38,-18+14*b,76,9,3).fill({color:988188}),e>0&&c.roundRect(-38,-18+14*b,76*e,9,3).fill({color:d,alpha:.9})}c.x=a.x,c.y=a.y,i(s,c);let e=new ck.f;e.x=a.x+34,e.y=a.y-35,i(s,e);let g=new dh({text:a.provider.toUpperCase(),style:{fontFamily:(0,dl.l)("ui"),fontSize:12,fill:0xdce6f2,fontWeight:"800",letterSpacing:1}});g.anchor.set(.5,0),g.x=a.x,g.y=a.y+38,i(s,g);let h=du(`${a.busy} in flight${a.overloaded?" · FULL":""}`,{color:a.overloaded?di.error:a.color,size:10});h.anchor.set(.5,0),h.x=a.x,h.y=a.y+53,i(s,h),f.push({pod:a,operator:b,siren:e})}j.fallbacks.forEach((a,b)=>{let c=k.get(a.from),d=k.get(a.to);if(!c||!d)return;let e=1778-b%4*14,f=new ck.f;f.moveTo(c.x-46,c.y).lineTo(e,c.y).stroke({width:2,color:0xfbbf24,alpha:.5}),f.moveTo(d.x-46,d.y).lineTo(e,d.y).stroke({width:2,color:0xfbbf24,alpha:.5}),function(a,b,c,d){let e=Math.sign(d-c)||1;for(let f=c;e>0?f<d-8:f>d+8;f+=14*e)a.moveTo(b,f).lineTo(b,f+8*e).stroke({width:2,color:0xfbbf24,alpha:.8})}(f,e,c.y,d.y);let h=Math.sign(d.y-c.y)||1;f.poly([e-6,d.y-10*h,e+6,d.y-10*h,e,d.y]).fill({color:0xfbbf24}),i(r,f);let j=new dh({text:`FALLBACK \xd7${a.count}`,style:{fontFamily:(0,dl.l)("ui"),fontSize:9,fill:0xfbbf24,fontWeight:"800",letterSpacing:1}});j.anchor.set(1,.5),j.x=e-9,j.y=(c.y+d.y)/2,i(r,j);let l=dt({color:0xfbbf24,trimColor:0xf59e0b,scale:.5,seed:b+5,mode:"streaming"}),m=new ck.f;m.roundRect(-30,-22,14,12,2).fill({color:0xd6a15c}),m.moveTo(-30,-16).lineTo(-16,-16).stroke({width:1.2,color:8145437});let n=new ck.f;l.root.addChild(m,n),i(t,l.root),g.push({drone:l,flame:n,laneX:e,y1:c.y,y2:d.y,offset:900*b})}),A.x=1500,A.y=480,G.text=String(j.rack.active),L=j.rack.active>0,B.setMode(L?"streaming":"sleeping"),w.setRoutes(l);let p=H;for(let a of(H=d,I=e,J=f,K=g,N(),p))try{a.destroy({children:!0})}catch(a){}}function Q(){if(n.screen.width<=0||n.screen.height<=0)return;let a=Math.max(.25,Math.min(n.screen.width/2190,n.screen.height/1020,1));p.scale.set(a),z(Math.max(2150,n.screen.width/a-30),Math.max(980,n.screen.height/a-30)),p.x=(n.screen.width-dB.w*p.scale.x)/2-dB.x*p.scale.x,p.y=(n.screen.height-dB.h*p.scale.y)/2-dB.y*p.scale.y,c.onZoomChange?.(Math.round(100*a))}n.renderer.on("resize",Q);let R=a=>{0===a.button&&(j=!0,m=!1,k={x:a.clientX,y:a.clientY},l={x:p.x,y:p.y})},S=a=>{if(!j)return;let b=a.clientX-k.x,c=a.clientY-k.y;Math.hypot(b,c)>4&&(m=!0),p.x=l.x+b,p.y=l.y+c},T=()=>{j=!1},U=b=>{b.preventDefault();let d=a.getBoundingClientRect(),e=b.clientX-d.left,f=b.clientY-d.top,g=b.deltaY<0?1.08:.92,h=p.scale.x,i=Math.max(.25,Math.min(1.15,h*g));if(.001>Math.abs(i-h))return;let j=(e-p.x)/h,k=(f-p.y)/h;p.scale.set(i),p.x=e-j*i,p.y=f-k*i,c.onZoomChange?.(Math.round(100*i))},V=()=>{Q()},W=null,X=a=>{a.preventDefault(),console.warn("[OfficeScene] WebGL context lost - browser reclaimed GPU memory")},Y=()=>{console.info("[OfficeScene] WebGL context restored by browser"),W&&clearTimeout(W),W=setTimeout(()=>{try{P(x,!0)}catch(a){console.warn("[OfficeScene] Soft rebuild after context restore:",a)}},200)};a.addEventListener("pointerdown",R),window.addEventListener("pointermove",S),window.addEventListener("pointerup",T),a.addEventListener("wheel",U,{passive:!1}),a.addEventListener("dblclick",V),a.addEventListener("webglcontextlost",X,!1),a.addEventListener("webglcontextrestored",Y,!1);let Z=()=>{z(dB.w,dB.h),P(x,!0)};window.addEventListener(bR.o,Z),window.addEventListener(dl.D,Z);let $=0;n.ticker.add(a=>{let b=a.deltaMS;for(let a of($+=b,w.animate(b),I)){let{ws:b}=a,c="streaming"===b.mode?Math.min(1,b.busy/2):dD[b.mode]??0;a.desk.animate($,c,b.mode),a.character.animate($,c);let d=a.toolBadges.length;if(d>0){let c=Math.floor(($+3*b.x)/2200)%d,e=($+3*b.x)%2200/2200;a.toolBadges.forEach((a,d)=>{let f=d===c;if(a.root.visible=f,!f)return;let g=Math.min(Math.min(1,6*e),Math.min(1,(1-e)*6));a.root.scale.set(1.05*(.35+.65*g)),a.root.alpha=g,a.root.y=b.y-50+2.5*Math.sin(.005*$+d),a.halo.scale.set(1+.12*Math.sin(.01*$))})}if(a.statusBadge){let c="error"===b.mode;a.statusBadge.root.y=b.y-34+Math.sin($*(c?.02:.004)+b.x)*(c?3:2),a.statusBadge.halo.scale.set(1+Math.sin($*(c?.016:.008))*(c?.3:.12))}if(a.coin){let c=($+5*b.x)%3400/3400;a.coin.visible=c<.8,a.coin.y=b.y-24-30*c,a.coin.alpha=Math.sin(Math.min(1,c/.8)*Math.PI)}}for(let{pod:a,operator:b,siren:c}of J)if(b.animate($,a.overloaded?1:Math.min(1,a.load)),c.clear(),a.overloaded){let a=Math.sin(.014*$)>0;c.circle(0,0,5).fill({color:0xef4444,alpha:a?1:.35}),c.circle(0,0,13).fill({color:0xef4444,alpha:a?.28:.05})}else c.circle(0,0,3).fill({color:a.busy>0?3462041:4674921,alpha:.9});for(let a of K){let b=($+a.offset)%4500/4500,c=b*b*(3-2*b);a.drone.root.baseX=a.laneX,a.drone.root.baseY=a.y1+(a.y2-a.y1)*c+6,a.drone.animate($,1),a.flame.clear(),a.flame.ellipse(0,16,7+1.5*Math.sin(.04*$),10+3*Math.sin(.05*$)).fill({color:0xfbbf24,alpha:.55}),a.flame.ellipse(0,14,4,6).fill({color:0xfff1b8,alpha:.85}),a.drone.root.alpha=Math.min(1,8*b)*Math.min(1,(1-b)*8)}B.animate($,+!!L),E.clear();for(let a=0;a<5;a+=1)for(let b=0;b<6;b+=1)Math.sin(.006*$+1.7*a+.9*b)>(L?-.2:.6)&&E.circle(-40+16*b,56+14*a,2.4).fill({color:a%3==0?3462041:2282478,alpha:.9});D.alpha=L?.5+.3*Math.sin(.005*$):.15});let _=(a,b)=>{let c=new dh({text:a,style:{fontFamily:(0,dl.l)("ui"),fontSize:11,fill:8227488,fontWeight:"800",letterSpacing:2}});c.x=b,c.y=dB.y+dB.h-52,v.addChild(c)};_("TOOL CALLS",35),dy.forEach((a,b)=>{let c=dA(a,{size:.72});c.root.x=160+65*b,c.root.y=dB.y+dB.h-40,v.addChild(c.root)}),_("STATUS",965),dz.forEach((a,b)=>{let c=dA(a,{size:.72});c.root.x=1050+68*b,c.root.y=dB.y+dB.h-40,v.addChild(c.root)});let aa=new dh({text:"● input ◆ output ■ cached",style:{fontFamily:(0,dl.l)("ui"),fontSize:11,fill:8227488,fontWeight:"700"}});return aa.x=1560,aa.y=dB.y+dB.h-50,v.addChild(aa),P(b),Q(),{app:n,rebuild:P,fit:Q,zoomIn(){let a=Math.min(1.15,1.15*p.scale.x),b=n.screen.width/2,d=n.screen.height/2,e=(b-p.x)/p.scale.x,f=(d-p.y)/p.scale.y;p.scale.set(a),p.x=b-e*a,p.y=d-f*a,c.onZoomChange?.(Math.round(100*a))},zoomOut(){let a=Math.max(.25,.85*p.scale.x),b=n.screen.width/2,d=n.screen.height/2,e=(b-p.x)/p.scale.x,f=(d-p.y)/p.scale.y;p.scale.set(a),p.x=b-e*a,p.y=d-f*a,c.onZoomChange?.(Math.round(100*a))},reset100(){p.scale.set(1),p.x=(n.screen.width-2150)/2-dB.x,p.y=(n.screen.height-980)/2-dB.y,c.onZoomChange?.(100)},setSelected(a){h=a,N()},setOnSelect(a){i=a},destroy:()=>{W&&clearTimeout(W);try{a.removeEventListener("pointerdown",R),window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",T),a.removeEventListener("wheel",U),a.removeEventListener("dblclick",V),a.removeEventListener("webglcontextlost",X),a.removeEventListener("webglcontextrestored",Y),window.removeEventListener(bR.o,Z),window.removeEventListener(dl.D,Z),n.renderer?.off?.("resize",Q)}catch{}try{n.ticker?.stop?.()}catch{}try{let a=n.renderer?.gl;(!a||"function"==typeof a.isContextLost&&a.isContextLost())&&n.renderer?.context?.extensions&&(n.renderer.context.extensions.loseContext=null),n.destroy(!1,{children:!0})}catch(a){console.warn("[OfficeScene] Cleanly handled app.destroy:",a)}}}}function dF({traces:a=[],onStats:b,onSelect:c,selectedId:d=null,isZenFullscreen:e=!1,onToggleZenFullscreen:f=null,soundEnabled:g=!1,onToggleSound:j=null}){let k=(0,i.useRef)(null),l=(0,i.useRef)(null),[m,n]=(0,i.useState)(100),[o,p]=(0,i.useState)(!1),q=(0,i.useRef)({onSelect:c,selectedId:d,traces:a});(0,i.useEffect)(()=>{q.current={onSelect:c,selectedId:d,traces:a}});let[r,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let a=!1,b=null,c=k.current;if(!c)return;let d=document.createElement("canvas");return d.style.position="absolute",d.style.inset="0",d.style.width="100%",d.style.height="100%",d.style.display="block",d.style.opacity="0",d.style.transition="opacity 0.2s ease-in-out",c.appendChild(d),(async()=>{try{let c=await dE(d,q.current.traces,{selectedId:q.current.selectedId,onSelect:a=>q.current.onSelect?.(a),onZoomChange:a=>n(a)});if(a){try{c?.destroy?.()}catch{}try{d.remove()}catch{}return}l.current=b=c,d.style.opacity="1",q.current.traces&&q.current.traces.length>0&&b.rebuild?.(q.current.traces)}catch(b){a||(console.error("[OfficeCanvas] mount failed:",b),s(b?.message||"Failed to start the scene"))}})(),()=>{a=!0;try{b?.destroy?.()}catch(a){console.warn("[OfficeCanvas] Cleanup warning:",a)}l.current=null;try{d.remove()}catch{}}},[]),(0,i.useEffect)(()=>{l.current&&l.current.rebuild?.(a)},[a]),(0,i.useEffect)(()=>{let a=()=>{l.current&&l.current.rebuild?.(q.current.traces,!0)};return window.addEventListener(bR.o,a),()=>window.removeEventListener(bR.o,a)},[]),(0,i.useEffect)(()=>{l.current&&l.current.setSelected?.(d)},[d]),(0,i.useEffect)(()=>{if(!b)return;let a=setInterval(()=>{b?.({mounted:!!l.current})},2e3);return()=>clearInterval(a)},[b]),(0,i.useEffect)(()=>{let a=setTimeout(()=>{l.current?.fit?.()},60);return()=>clearTimeout(a)},[e]),(0,i.useEffect)(()=>{if(e){p(!0);let a=setTimeout(()=>p(!1),3500);return()=>clearTimeout(a)}p(!1)},[e]),(0,i.useEffect)(()=>{if(!e)return;let a=a=>{"Escape"===a.key&&(a.preventDefault(),f?.(!1))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,f]),(0,h.jsxs)("div",{className:`relative h-full w-full overflow-hidden bg-[#080d14] ${e?"!fixed !inset-0 !z-[99] !w-screen !h-screen !rounded-none !border-none":"rounded-xl border border-slate-800 shadow-2xl"}`,children:[(0,h.jsx)("div",{ref:k,className:"absolute inset-0"}),r&&(0,h.jsx)("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center text-sm text-rose-400",children:r}),o&&(0,h.jsx)("div",{className:"absolute top-5 left-1/2 -translate-x-1/2 z-30 pointer-events-none transition-all duration-300 animate-in fade-in slide-in-from-top-2",children:(0,h.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 rounded-xl bg-slate-950/90 border border-cyan-500/40 text-cyan-200 text-xs shadow-2xl backdrop-blur-md",children:[(0,h.jsx)(a_.f,{className:"w-4 h-4 text-cyan-400 shrink-0"}),(0,h.jsxs)("span",{children:["Chế độ Chill toàn màn hình · Nhấn ",(0,h.jsx)("kbd",{className:"px-1.5 py-0.5 rounded bg-slate-800 text-amber-300 font-mono text-[10px]",children:"ESC"})," hoặc click nút góc trên để thoát"]})]})}),e&&(0,h.jsxs)("div",{className:"absolute top-4 right-4 z-30 flex items-center gap-2 animate-in fade-in duration-200",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-full bg-slate-950/70 border border-slate-800/80 backdrop-blur-md shadow-xl text-xs text-slate-300 select-none",children:[(0,h.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,h.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),(0,h.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]}),(0,h.jsx)("span",{className:"font-medium text-[11px]",children:"Virtual Office · Chill Mode"}),(0,h.jsxs)("span",{className:"text-[10px] text-slate-400 font-mono",children:["(",a.length," Bots)"]})]}),(0,h.jsxs)("button",{type:"button","data-testid":"exit-zen-fullscreen-btn",onClick:()=>f?.(!1),title:"Thoát chế độ toàn màn hình Chill Mode (ESC)",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-slate-900/80 hover:bg-slate-800 border border-slate-700/60 hover:border-amber-500/50 text-slate-300 hover:text-white backdrop-blur-md shadow-xl transition-all cursor-pointer text-xs font-medium group",children:[(0,h.jsx)(a7.f,{className:"w-3.5 h-3.5 text-amber-400 group-hover:scale-110 transition-transform"}),(0,h.jsx)("span",{className:"text-[11px]",children:"Thoát ESC"})]})]}),(0,h.jsxs)("div",{className:"absolute bottom-3 left-3 z-10 flex items-center gap-1 rounded-lg border border-slate-800/80 bg-slate-950/80 p-1 backdrop-blur-md shadow-xl text-slate-400",children:[(0,h.jsx)("button",{onClick:()=>l.current?.zoomOut?.(),title:"Zoom out",className:"p-1.5 rounded-md hover:bg-slate-800 hover:text-slate-200 transition-colors cursor-pointer",children:(0,h.jsx)(b_.f,{className:"w-3.5 h-3.5"})}),(0,h.jsxs)("button",{onClick:()=>l.current?.reset100?.(),title:"Reset to 100% (1:1 natural scale)",className:"px-2 py-1 rounded-md text-[11px] font-mono hover:bg-slate-800 hover:text-slate-200 transition-colors font-semibold text-slate-300 cursor-pointer",children:[m,"%"]}),(0,h.jsx)("button",{onClick:()=>l.current?.zoomIn?.(),title:"Zoom in",className:"p-1.5 rounded-md hover:bg-slate-800 hover:text-slate-200 transition-colors cursor-pointer",children:(0,h.jsx)(b$.f,{className:"w-3.5 h-3.5"})}),(0,h.jsx)("div",{className:"w-[1px] h-3.5 bg-slate-800 my-auto"}),(0,h.jsx)("button",{onClick:()=>l.current?.fit?.(),title:"Fit to view",className:"p-1.5 rounded-md hover:bg-slate-800 hover:text-slate-200 transition-colors cursor-pointer",children:(0,h.jsx)(a6.f,{className:"w-3.5 h-3.5"})}),f&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:"w-[1px] h-3.5 bg-slate-800 my-auto"}),(0,h.jsx)("button",{type:"button","data-testid":"canvas-camera-zen-fullscreen-btn",onClick:()=>f(!e),title:e?"Thoát toàn màn hình (ESC)":"Chế độ Chill toàn màn hình Virtual Office (ESC để thoát)",className:`p-1.5 rounded-md transition-colors cursor-pointer ${e?"bg-amber-500/20 text-amber-300 hover:bg-amber-500/30":"hover:bg-slate-800 hover:text-cyan-300 text-slate-400"}`,children:e?(0,h.jsx)(a7.f,{className:"w-3.5 h-3.5 text-amber-400"}):(0,h.jsx)(b1,{className:"w-3.5 h-3.5"})})]}),j&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:"w-[1px] h-3.5 bg-slate-800 my-auto"}),(0,h.jsx)("button",{type:"button",onClick:j,title:g?"Âm thanh: BẬT":"Âm thanh: TẮT",className:`p-1.5 rounded-md transition-colors cursor-pointer ${g?"text-emerald-400 hover:bg-slate-800":"text-slate-500 hover:text-slate-300 hover:bg-slate-800"}`,children:g?(0,h.jsx)(aO.f,{className:"w-3.5 h-3.5"}):(0,h.jsx)(aR,{className:"w-3.5 h-3.5"})})]})]})]})}var dG=a.i(68370);function dH({traces:a=[],selectedTraceId:b=null,onSelectTrace:c,activeTurns:d=[],className:e=""}){let f=(0,i.useRef)(null),[g,j]=(0,i.useState)(1),[k,l]=(0,i.useState)({x:100,y:50}),m=(0,i.useRef)(g);m.current=g;let n=(0,i.useRef)(k);n.current=k;let[o,p]=(0,i.useState)(!1),[q,r]=(0,i.useState)({x:0,y:0}),[s,t]=(0,i.useState)(b||a[0]?.traceId||a[0]?.connectionId),u=(0,i.useMemo)(()=>{let b=new Set,c=[];for(let d of a){let a=d.traceId||d.connectionId;!a||b.has(a)||(b.add(a),c.push({id:a,label:`${d.account||d.connectionId} (${d.model||"Gemini"})`}))}return c},[a]);(0,i.useEffect)(()=>{b?t(b):!s&&a.length>0&&t(a[0].traceId||a[0].connectionId)},[b,a,s]);let{nodes:v,edges:w,bounds:x}=(0,i.useMemo)(()=>(function(a=[],b=null,c=[]){if(!Array.isArray(a)||0===a.length)return{nodes:[],edges:[],bounds:{minX:0,maxX:800,minY:0,maxY:600}};let d=a.find(a=>a.traceId===b||a.traces?.[0]?.traceId===b||a.connectionId===b)||a[0],e=[];Array.isArray(c)&&c.forEach((a,b)=>{Array.isArray(a.toolCalls)&&a.toolCalls.forEach(a=>{let c=(a.name||"").toLowerCase();if(c.includes("invoke_subagent")||c.includes("define_subagent")){let c=a.args?.Subagents||a.args?.subagents||a.args;(Array.isArray(c)?c:[c]).forEach((c,f)=>{c&&(c.Role||c.role||c.TypeName||c.name)&&e.push({id:`sub-${b}-${f}-${c.TypeName||c.name||"worker"}`,parentId:d.traceId||d.connectionId,role:c.Role||c.role||"Subagent Worker",typeName:c.TypeName||c.name||"specialist",model:c.Model||c.model||null,prompt:c.Prompt||c.prompt||c.system_prompt||"",workspace:c.Workspace||c.workspace||"inherit",status:"running"===a.status?"streaming":"idle",tokens:null,durationMs:null,isSubagent:!0})})}})});let f=a.filter(a=>!a.parentTraceId);a.filter(a=>a.parentTraceId);let g=[],h=[],i=new Set,j=new Set,k=a=>{!a||!a.id||i.has(a.id)||(i.add(a.id),g.push(a))};(e.length>0?[d]:f.length>0?f:a).forEach(a=>{k({id:a.traceId||a.connectionId,level:0,label:a.account||a.connectionId||"Orchestrator Agent",role:"Lead Orchestrator",model:a.model||null,status:a.state||a.mode||"idle",isLooping:!!a.isLooping,tokens:a.tokens||null,toolsCount:a.tools?.length??a.logs?.length??null,clientType:a.clientType||"cli",color:a.color?`#${a.color.toString(16).padStart(6,"0")}`:"#38bdf8",isRoot:!0,traceRef:a})}),e.length>0&&e.forEach(a=>{var b;k({id:a.id,level:1,parentId:a.parentId,label:a.role,role:a.role,typeName:a.typeName,model:a.model,status:a.status,prompt:a.prompt,tokens:a.tokens,toolsCount:null,clientType:"subagent",color:"#818cf8",isRoot:!1}),!(b={id:`edge-${a.parentId}-${a.id}`,fromId:a.parentId,toId:a.id,active:"streaming"===a.status,label:a.typeName}).id||j.has(b.id)||(j.add(b.id),h.push(b))});let l={};g.forEach(a=>{l[a.level]||(l[a.level]=[]),l[a.level].push(a)});let m=[],n={},o=1;Object.values(l).forEach(a=>{a.length>o&&(o=a.length)});let p=Math.max((320*o-60)/2+100,500);Object.keys(l).forEach(a=>{let b=parseInt(a,10),c=l[b],d=p-(320*c.length-60)/2;c.forEach((a,c)=>{let e=Math.round(d+320*c),f=Math.round(80+280*b),g={...a,x:e,y:f,width:260,height:140};m.push(g),n[a.id]=g})});let q=[];h.forEach(a=>{let b=n[a.fromId],c=n[a.toId];if(b&&c){let d=b.x+b.width/2,e=b.y+b.height,f=c.x+c.width/2,g=c.y,h=Math.max((g-e)/2,40),i=e+h,j=g-h,k=`M ${d} ${e} C ${d} ${i}, ${f} ${j}, ${f} ${g}`;q.push({...a,fromPos:{x:d,y:e},toPos:{x:f,y:g},pathData:k})}});let r=1/0,s=-1/0,t=1/0,u=-1/0;return m.forEach(a=>{a.x<r&&(r=a.x),a.x+a.width>s&&(s=a.x+a.width),a.y<t&&(t=a.y),a.y+a.height>u&&(u=a.y+a.height)}),isFinite(r)||(r=0,s=1e3,t=0,u=700),{nodes:m,edges:q,bounds:{minX:Math.max(0,r-100),maxX:s+100,minY:Math.max(0,t-80),maxY:u+100}}})(a,s,d),[a,s,d]),y=(0,i.useRef)(x);y.current=x;let z=(0,i.useRef)(v.length);z.current=v.length;let A=(0,i.useCallback)(()=>{if(!f.current||0===z.current)return;let{clientWidth:a,clientHeight:b}=f.current,c=y.current,d=c.maxX-c.minX,e=c.maxY-c.minY;if(d<=0||e<=0)return;let g=Math.min(Math.max(Math.min((a-120)/d,(b-120)/e),.3),1.2),h=(c.minX+c.maxX)/2,i=(c.minY+c.maxY)/2,k=a/2-h*g,m=b/2-i*g;j(g),l({x:Math.round(k),y:Math.round(m)})},[]),B=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(s&&s!==B.current&&v.length>0){B.current=s;let a=setTimeout(()=>{A()},100);return()=>clearTimeout(a)}},[s,v.length,A]),(0,i.useEffect)(()=>{let a=()=>p(!1);return window.addEventListener("mouseup",a),()=>window.removeEventListener("mouseup",a)},[]),(0,i.useEffect)(()=>{let a=f.current;if(!a)return;let b=b=>{b.preventDefault();let c=m.current,d=n.current,e=b.deltaY<0?1.08*c:c/1.08;e=Math.min(Math.max(e,.2),3);let f=a.getBoundingClientRect(),g=b.clientX-f.left,h=b.clientY-f.top,i=g-(g-d.x)*(e/c),k=h-(h-d.y)*(e/c);j(e),l({x:Math.round(i),y:Math.round(k)})};return a.addEventListener("wheel",b,{passive:!1}),()=>a.removeEventListener("wheel",b)},[]);let C=v.filter(a=>"streaming"===a.status).length;return(0,h.jsxs)("div",{className:`relative w-full h-full bg-slate-950 overflow-hidden select-none flex flex-col ${e}`,onMouseMove:a=>{o&&l({x:Math.round(a.clientX-q.x),y:Math.round(a.clientY-q.y)})},onMouseUp:()=>{p(!1)},children:[(0,h.jsxs)("div",{className:"absolute top-4 left-4 right-4 z-20 flex items-center justify-between pointer-events-none",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 pointer-events-auto bg-slate-900/90 border border-slate-800 rounded-xl px-3 py-1.5 shadow-xl backdrop-blur-md text-xs",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)("div",{className:"p-1 rounded-lg bg-indigo-500/10 text-indigo-400 border border-indigo-500/20",children:(0,h.jsx)(bh.f,{className:"w-4 h-4"})}),(0,h.jsxs)("div",{children:[(0,h.jsx)("span",{className:"font-semibold text-slate-200 block text-xs",children:"Multi-Agent DAG"}),(0,h.jsxs)("span",{className:"text-[10px] text-slate-400 font-mono",children:[v.length," agents • ",w.length," links ",C>0&&`• ${C} running`]})]})]}),(0,h.jsx)("div",{className:"h-4 w-[1px] bg-slate-800 mx-1"}),(0,h.jsx)("select",{value:s||"",onChange:a=>t(a.target.value),className:"bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1 text-xs text-slate-300 font-mono focus:outline-none focus:border-indigo-500/50 cursor-pointer",children:u.map(a=>(0,h.jsx)("option",{value:a.id,children:a.label},a.id))})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 pointer-events-auto bg-slate-900/90 border border-slate-800 rounded-xl p-1 shadow-xl backdrop-blur-md",children:[(0,h.jsx)("button",{onClick:()=>{let a=m.current,b=n.current,c=Math.min(1.2*a,3);if(f.current){let{clientWidth:d,clientHeight:e}=f.current,g=d/2,h=e/2;l({x:Math.round(g-(g-b.x)*(c/a)),y:Math.round(h-(h-b.y)*(c/a))})}j(c)},className:"p-1.5 rounded-lg text-slate-400 hover:text-slate-200 hover:bg-slate-800 transition-colors",title:"Zoom In (+)",children:(0,h.jsx)(b$.f,{className:"w-4 h-4"})}),(0,h.jsxs)("span",{className:"text-[11px] font-mono text-slate-400 px-2 min-w-12 text-center",children:[Math.round(100*g),"%"]}),(0,h.jsx)("button",{onClick:()=>{let a=m.current,b=n.current,c=Math.max(a/1.2,.2);if(f.current){let{clientWidth:d,clientHeight:e}=f.current,g=d/2,h=e/2;l({x:Math.round(g-(g-b.x)*(c/a)),y:Math.round(h-(h-b.y)*(c/a))})}j(c)},className:"p-1.5 rounded-lg text-slate-400 hover:text-slate-200 hover:bg-slate-800 transition-colors",title:"Zoom Out (-)",children:(0,h.jsx)(b_.f,{className:"w-4 h-4"})}),(0,h.jsx)("div",{className:"h-4 w-[1px] bg-slate-800 mx-0.5"}),(0,h.jsxs)("button",{onClick:A,className:"flex items-center gap-1 px-2.5 py-1 rounded-lg text-xs font-medium text-slate-300 hover:text-white hover:bg-slate-800 transition-colors",title:"Fit to Screen",children:[(0,h.jsx)(a6.f,{className:"w-3.5 h-3.5 text-indigo-400"}),(0,h.jsx)("span",{children:"Fit"})]})]})]}),(0,h.jsxs)("div",{ref:f,onMouseDown:a=>{a.target.closest("button")||a.target.closest(".agent-node-card")||a.target.closest("select")||(p(!0),r({x:a.clientX-n.current.x,y:a.clientY-n.current.y}))},onDoubleClick:a=>{a.target.closest("button")||a.target.closest(".agent-node-card")||a.target.closest("select")||A()},className:"flex-1 w-full h-full relative cursor-grab active:cursor-grabbing overflow-hidden",children:[(0,h.jsxs)("svg",{className:"absolute inset-0 w-full h-full pointer-events-none opacity-20",xmlns:"http://www.w3.org/2000/svg",children:[(0,h.jsx)("defs",{children:(0,h.jsx)("pattern",{id:"dag-grid",width:"28",height:"28",patternUnits:"userSpaceOnUse",children:(0,h.jsx)("circle",{cx:"2",cy:"2",r:"1.2",fill:"#64748b"})})}),(0,h.jsx)("rect",{width:"100%",height:"100%",fill:"url(#dag-grid)"})]}),(0,h.jsxs)("div",{style:{transform:`translate(${k.x}px, ${k.y}px) scale(${g})`,transformOrigin:"0 0",transition:o?"none":"transform 0.1s ease-out"},className:"absolute top-0 left-0",children:[(0,h.jsxs)("svg",{className:"overflow-visible pointer-events-none absolute top-0 left-0",style:{width:1,height:1},children:[(0,h.jsxs)("defs",{children:[(0,h.jsxs)("linearGradient",{id:"edge-pulse-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,h.jsx)("stop",{offset:"0%",stopColor:"#38bdf8"}),(0,h.jsx)("stop",{offset:"50%",stopColor:"#818cf8"}),(0,h.jsx)("stop",{offset:"100%",stopColor:"#c084fc"})]}),(0,h.jsx)("marker",{id:"dag-arrow",viewBox:"0 0 10 10",refX:"6",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:(0,h.jsx)("path",{d:"M 0 1 L 8 5 L 0 9 z",fill:"#6366f1"})})]}),w.map(a=>{let b=a.active;return(0,h.jsxs)("g",{children:[(0,h.jsx)("path",{d:a.pathData,fill:"none",stroke:"#1e293b",strokeWidth:"4",strokeLinecap:"round"}),(0,h.jsx)("path",{d:a.pathData,fill:"none",stroke:b?"url(#edge-pulse-gradient)":"#475569",strokeWidth:b?"2.5":"1.8",strokeDasharray:b?"8 6":"none",strokeLinecap:"round",className:b?"animate-pulse":""}),(0,h.jsx)("circle",{cx:a.toPos.x,cy:a.toPos.y,r:b?"4.5":"3",fill:b?"#38bdf8":"#64748b",className:b?"animate-ping":""}),a.label&&(0,h.jsxs)("g",{transform:`translate(${(a.fromPos.x+a.toPos.x)/2}, ${(a.fromPos.y+a.toPos.y)/2})`,children:[(0,h.jsx)("rect",{x:"-38",y:"-10",width:"76",height:"20",rx:"6",fill:"#090d16",stroke:"#334155",strokeWidth:"1"}),(0,h.jsx)("text",{x:"0",y:"4",textAnchor:"middle",fill:"#94a3b8",fontSize:"9",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"600",children:a.label})]})]},a.id)})]}),(0,h.jsx)("div",{className:"relative",children:v.map(a=>{let b="streaming"===a.status,d="done"===a.status,e=a.isLooping?{text:"Loop Alert",color:"text-rose-400 bg-rose-500/10 border-rose-500/30",dot:"bg-rose-500 animate-ping"}:b?{text:"Running",color:"text-cyan-300 bg-cyan-500/10 border-cyan-500/30",dot:"bg-cyan-400 animate-ping"}:d?{text:"Completed",color:"text-emerald-300 bg-emerald-500/10 border-emerald-500/30",dot:"bg-emerald-400"}:{text:"Idle",color:"text-slate-400 bg-slate-800/60 border-slate-700/60",dot:"bg-slate-500"};return(0,h.jsxs)("div",{style:{position:"absolute",left:`${a.x}px`,top:`${a.y}px`,width:`${a.width}px`,height:`${a.height}px`},onClick:()=>{a.traceRef&&c?.(a.traceRef)},className:`agent-node-card rounded-2xl border transition-all duration-200 cursor-pointer shadow-xl backdrop-blur-md p-3.5 flex flex-col justify-between select-text group hover:scale-[1.02] ${a.isRoot?"bg-slate-900/95 border-cyan-500/40 hover:border-cyan-400 hover:shadow-cyan-500/10":"bg-slate-900/85 border-slate-800 hover:border-indigo-500/50 hover:shadow-indigo-500/10"}`,children:[(0,h.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,h.jsx)("div",{className:"w-8 h-8 rounded-xl border flex items-center justify-center shrink-0 shadow-inner",style:{borderColor:a.color,backgroundColor:`${a.color}20`},children:(0,h.jsx)(aL.f,{className:"w-4 h-4",style:{color:a.color}})}),(0,h.jsxs)("div",{className:"min-w-0",children:[(0,h.jsx)("div",{className:"font-semibold text-slate-100 text-xs truncate",children:a.label}),(0,h.jsx)("div",{className:"text-[10px] text-slate-400 truncate flex items-center gap-1",children:(0,h.jsx)("span",{children:a.role})})]})]}),(0,h.jsxs)("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[9px] font-mono border font-semibold ${e.color}`,children:[(0,h.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${e.dot}`}),(0,h.jsx)("span",{children:e.text})]})]}),(0,h.jsx)("div",{className:"my-1.5",children:a.prompt?(0,h.jsx)("p",{className:"text-[11px] text-slate-300 font-mono line-clamp-2 leading-relaxed bg-black/40 p-1.5 rounded-lg border border-slate-800/80",children:a.prompt}):(0,h.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] text-slate-400",children:[(0,h.jsx)(be.f,{className:"w-3 h-3 text-cyan-400 shrink-0"}),(0,h.jsx)("span",{className:"truncate font-mono",children:a.model})]})}),(0,h.jsxs)("div",{className:"flex items-center justify-between pt-1.5 border-t border-slate-800/80 text-[10px] text-slate-400 font-mono",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1",children:[(0,h.jsx)(br.f,{className:"w-3 h-3 text-indigo-400"}),(0,h.jsx)("span",{className:"truncate max-w-24",children:a.model})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[a.toolsCount>0&&(0,h.jsxs)("span",{children:[a.toolsCount," tools"]}),(0,h.jsx)("button",{onClick:b=>{b.stopPropagation(),a.traceRef&&c?.(a.traceRef)},className:"opacity-0 group-hover:opacity-100 p-1 rounded bg-slate-800 hover:bg-slate-700 text-slate-200 transition-opacity",title:"View chat session for this agent",children:(0,h.jsx)(dG.f,{className:"w-3 h-3"})})]})]})]},a.id)})})]})]})]})}var dI=a.i(12871);function dJ(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function dK(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function dL(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{};b%2?dK(Object(c),!0).forEach(function(b){var d;d=c[b],b in a?Object.defineProperty(a,b,{value:d,enumerable:!0,configurable:!0,writable:!0}):a[b]=d}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):dK(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}return a}function dM(a){return function b(){for(var c=this,d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return e.length>=a.length?a.apply(this,e):function(){for(var a=arguments.length,d=Array(a),f=0;f<a;f++)d[f]=arguments[f];return b.apply(c,[].concat(e,d))}}}function dN(a){return({}).toString.call(a).includes("Object")}function dO(a){return"function"==typeof a}var dP=dM(function(a,b){throw Error(a[b]||a.default)})({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),dQ=function(a,b){return dN(b)||dP("changeType"),Object.keys(b).some(function(b){return!Object.prototype.hasOwnProperty.call(a,b)})&&dP("changeField"),b},dR=function(a){dO(a)||dP("selectorType")},dS=function(a){dO(a)||dN(a)||dP("handlerType"),dN(a)&&Object.values(a).some(function(a){return!dO(a)})&&dP("handlersType")},dT=function(a){a||dP("initialIsRequired"),dN(a)||dP("initialType"),Object.keys(a).length||dP("initialContent")};function dU(a,b){return dO(b)?b(a.current):b}function dV(a,b){return a.current=dL(dL({},a.current),b),b}function dW(a,b,c){return dO(b)?b(a.current):Object.keys(c).forEach(function(c){var d;return null==(d=b[c])?void 0:d.call(b,a.current[c])}),c}var dX={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},dY=(f=function(a,b){throw Error(a[b]||a.default)},function a(){for(var b=this,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return d.length>=f.length?f.apply(this,d):function(){for(var c=arguments.length,e=Array(c),f=0;f<c;f++)e[f]=arguments[f];return a.apply(b,[].concat(d,e))}})(dX),dZ=function(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];return function(a){return b.reduceRight(function(a,b){return b(a)},a)}},d$={type:"cancelation",msg:"operation is manually canceled"};function d_(a){var b=!1,c=new Promise(function(c,d){a.then(function(a){return b?d(d$):c(a)}),a.catch(d)});return c.cancel=function(){return b=!0},c}var d0=function(a){if(Array.isArray(a))return a}(g=function(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dT(a),dS(b);var c={current:a},d=dM(dW)(c,b),e=dM(dV)(c),f=dM(dQ)(a),g=dM(dU)(c);return[function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(a){return a};return dR(a),a(c.current)},function(a){(function(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];return function(a){return b.reduceRight(function(a,b){return b(a)},a)}})(d,e,f,g)(a)}]}({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}))||function(a){var b=null==a?null:"u">typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=b){var c,d,e,f,g=[],h=!0,i=!1;try{e=(b=b.call(a)).next,!1;for(;!(h=(c=e.call(b)).done)&&(g.push(c.value),2!==g.length);h=!0);}catch(a){i=!0,d=a}finally{try{if(!h&&null!=b.return&&(f=b.return(),Object(f)!==f))return}finally{if(i)throw d}}return g}}(g)||function(a){if(a){if("string"==typeof a)return dJ(a,2);var b=({}).toString.call(a).slice(8,-1);return"Object"===b&&a.constructor&&(b=a.constructor.name),"Map"===b||"Set"===b?Array.from(a):"Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b)?dJ(a,2):void 0}}(g)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),d1=d0[0],d2=d0[1];function d3(a){return document.body.appendChild(a)}function d4(a){var b,c,d=d1(function(a){return{config:a.config,reject:a.reject}}),e=(b="".concat(d.config.paths.vs,"/loader.js"),c=document.createElement("script"),b&&(c.src=b),c);return e.onload=function(){return a()},e.onerror=d.reject,e}function d5(){var a=d1(function(a){return{config:a.config,resolve:a.resolve,reject:a.reject}}),b=window.require;b.config(a.config),b(["vs/editor/editor.main"],function(b){var c=b.m||b;d6(c),a.resolve(c)},function(b){a.reject(b)})}function d6(a){d1().monaco||d2({monaco:a})}var d7=new Promise(function(a,b){return d2({resolve:a,reject:b})}),d8=function(){var a=d1(function(a){return{monaco:a.monaco,isInitialized:a.isInitialized,resolve:a.resolve}});if(!a.isInitialized){if(d2({isInitialized:!0}),a.monaco)return a.resolve(a.monaco),d_(d7);if(window.monaco&&window.monaco.editor)return d6(window.monaco),a.resolve(window.monaco),d_(d7);dZ(d3,d4)(d5)}return d_(d7)},d9={display:"flex",position:"relative",textAlign:"initial"},ea={width:"100%"},eb={display:"none"},ec={display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"},ed=function({children:a}){return i.default.createElement("div",{style:ec},a)},ee=(0,i.memo)(function({width:a,height:b,isEditorReady:c,loading:d,_ref:e,className:f,wrapperProps:g}){return i.default.createElement("section",{style:{...d9,width:a,height:b},...g},!c&&i.default.createElement(ed,null,d),i.default.createElement("div",{ref:e,style:{...ea,...!c&&eb},className:f}))}),ef=function(a){(0,i.useEffect)(a,[])},eg=function(a,b,c=!0){let d=(0,i.useRef)(!0);(0,i.useEffect)(d.current||!c?()=>{d.current=!1}:a,b)};function eh(){}function ei(a,b,c,d){var e,f,g,h,i,j;return e=a,f=d,e.editor.getModel(ej(e,f))||(g=a,h=b,i=c,j=d,g.editor.createModel(h,i,j?ej(g,j):void 0))}function ej(a,b){return a.Uri.parse(b)}(0,i.memo)(function({original:a,modified:b,language:c,originalLanguage:d,modifiedLanguage:e,originalModelPath:f,modifiedModelPath:g,keepCurrentOriginalModel:h=!1,keepCurrentModifiedModel:j=!1,theme:k="light",loading:l="Loading...",options:m={},height:n="100%",width:o="100%",className:p,wrapperProps:q={},beforeMount:r=eh,onMount:s=eh}){let[t,u]=(0,i.useState)(!1),[v,w]=(0,i.useState)(!0),x=(0,i.useRef)(null),y=(0,i.useRef)(null),z=(0,i.useRef)(null),A=(0,i.useRef)(s),B=(0,i.useRef)(r),C=(0,i.useRef)(!1);ef(()=>{let a=d8();return a.then(a=>(y.current=a)&&w(!1)).catch(a=>a?.type!=="cancelation"&&console.error("Monaco initialization: error:",a)),()=>{let b;return x.current?(b=x.current?.getModel(),void(h||b?.original?.dispose(),j||b?.modified?.dispose(),x.current?.dispose())):a.cancel()}}),eg(()=>{if(x.current&&y.current){let b=x.current.getOriginalEditor(),e=ei(y.current,a||"",d||c||"text",f||"");e!==b.getModel()&&b.setModel(e)}},[f],t),eg(()=>{if(x.current&&y.current){let a=x.current.getModifiedEditor(),d=ei(y.current,b||"",e||c||"text",g||"");d!==a.getModel()&&a.setModel(d)}},[g],t),eg(()=>{let a=x.current.getModifiedEditor();a.getOption(y.current.editor.EditorOption.readOnly)?a.setValue(b||""):b!==a.getValue()&&(a.executeEdits("",[{range:a.getModel().getFullModelRange(),text:b||"",forceMoveMarkers:!0}]),a.pushUndoStop())},[b],t),eg(()=>{x.current?.getModel()?.original.setValue(a||"")},[a],t),eg(()=>{let{original:a,modified:b}=x.current.getModel();y.current.editor.setModelLanguage(a,d||c||"text"),y.current.editor.setModelLanguage(b,e||c||"text")},[c,d,e],t),eg(()=>{y.current?.editor.setTheme(k)},[k],t),eg(()=>{x.current?.updateOptions(m)},[m],t);let D=(0,i.useCallback)(()=>{if(!y.current)return;B.current(y.current);let h=ei(y.current,a||"",d||c||"text",f||""),i=ei(y.current,b||"",e||c||"text",g||"");x.current?.setModel({original:h,modified:i})},[c,b,e,a,d,f,g]),E=(0,i.useCallback)(()=>{!C.current&&z.current&&(x.current=y.current.editor.createDiffEditor(z.current,{automaticLayout:!0,...m}),D(),y.current?.editor.setTheme(k),u(!0),C.current=!0)},[m,k,D]);return(0,i.useEffect)(()=>{t&&A.current(x.current,y.current)},[t]),(0,i.useEffect)(()=>{v||t||E()},[v,t,E]),i.default.createElement(ee,{width:o,height:n,isEditorReady:t,loading:l,_ref:z,className:p,wrapperProps:q})});var ek=function(a){let b=(0,i.useRef)();return(0,i.useEffect)(()=>{b.current=a},[a]),b.current},el=new Map,em=(0,i.memo)(function({defaultValue:a,defaultLanguage:b,defaultPath:c,value:d,language:e,path:f,theme:g="light",line:h,loading:j="Loading...",options:k={},overrideServices:l={},saveViewState:m=!0,keepCurrentModel:n=!1,width:o="100%",height:p="100%",className:q,wrapperProps:r={},beforeMount:s=eh,onMount:t=eh,onChange:u,onValidate:v=eh}){let[w,x]=(0,i.useState)(!1),[y,z]=(0,i.useState)(!0),A=(0,i.useRef)(null),B=(0,i.useRef)(null),C=(0,i.useRef)(null),D=(0,i.useRef)(t),E=(0,i.useRef)(s),F=(0,i.useRef)(),G=(0,i.useRef)(d),H=ek(f),I=(0,i.useRef)(!1),J=(0,i.useRef)(!1);ef(()=>{let a=d8();return a.then(a=>(A.current=a)&&z(!1)).catch(a=>a?.type!=="cancelation"&&console.error("Monaco initialization: error:",a)),()=>B.current?void(F.current?.dispose(),n?m&&el.set(f,B.current.saveViewState()):B.current.getModel()?.dispose(),B.current.dispose()):a.cancel()}),eg(()=>{let g=ei(A.current,a||d||"",b||e||"",f||c||"");g!==B.current?.getModel()&&(m&&el.set(H,B.current?.saveViewState()),B.current?.setModel(g),m&&B.current?.restoreViewState(el.get(f)))},[f],w),eg(()=>{B.current?.updateOptions(k)},[k],w),eg(()=>{B.current&&void 0!==d&&(B.current.getOption(A.current.editor.EditorOption.readOnly)?B.current.setValue(d):d!==B.current.getValue()&&(J.current=!0,B.current.executeEdits("",[{range:B.current.getModel().getFullModelRange(),text:d,forceMoveMarkers:!0}]),B.current.pushUndoStop(),J.current=!1))},[d],w),eg(()=>{let a=B.current?.getModel();a&&e&&A.current?.editor.setModelLanguage(a,e)},[e],w),eg(()=>{void 0!==h&&B.current?.revealLine(h)},[h],w),eg(()=>{A.current?.editor.setTheme(g)},[g],w);let K=(0,i.useCallback)(()=>{if(!(!C.current||!A.current)&&!I.current){E.current(A.current);let i=f||c,j=ei(A.current,d||a||"",b||e||"",i||"");B.current=A.current?.editor.create(C.current,{model:j,automaticLayout:!0,...k},l),m&&B.current.restoreViewState(el.get(i)),A.current.editor.setTheme(g),void 0!==h&&B.current.revealLine(h),x(!0),I.current=!0}},[a,b,c,d,e,f,k,l,m,g,h]);return(0,i.useEffect)(()=>{w&&D.current(B.current,A.current)},[w]),(0,i.useEffect)(()=>{y||w||K()},[y,w,K]),G.current=d,(0,i.useEffect)(()=>{w&&u&&(F.current?.dispose(),F.current=B.current?.onDidChangeModelContent(a=>{J.current||u(B.current.getValue(),a)}))},[w,u]),(0,i.useEffect)(()=>{if(w){let a=A.current.editor.onDidChangeMarkers(a=>{let b=B.current.getModel()?.uri;if(b&&a.find(a=>a.path===b.path)){let a=A.current.editor.getModelMarkers({resource:b});v?.(a)}});return()=>{a?.dispose()}}return()=>{}},[w,v]),i.default.createElement(ee,{width:o,height:p,isEditorReady:w,loading:j,_ref:C,className:q,wrapperProps:r})});let en={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};en.node;let eo=(0,aP.f)(en),ep={name:"text-wrap",size:24,node:[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],aliases:["wrap-text"]};ep.node;let eq=(0,aP.f)(ep);var er=a.i(55681);let es={name:"eye-off",size:24,node:[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};es.node;let et=(0,aP.f)(es);var eu=a.i(97546),ev=a.i(71215),ew=a.i(28749),ex=a.i(40260);function ey({filePath:a,fileMeta:b,isSvg:c=!1,onToggleSvgSource:d,onClose:e}){let[f,g]=(0,i.useState)(1),[j,k]=(0,i.useState)({x:0,y:0}),[l,m]=(0,i.useState)(!1),[n,o]=(0,i.useState)({x:0,y:0}),[p,q]=(0,i.useState)(!0),[r,s]=(0,i.useState)({width:0,height:0}),[t,u]=(0,i.useState)(!1),[v,w]=(0,i.useState)(!1),[x,y]=(0,i.useState)(!1),z=(0,i.useRef)(null),A=(0,i.useRef)(null),B=(0,i.useMemo)(()=>b?.mediaUrl?b.mediaUrl:a?`/api/media?path=${encodeURIComponent(a)}`:"",[b,a]),C=(0,i.useMemo)(()=>b?.name?b.name:a?a.split("/").pop()||a:"image",[b,a]),D=(0,i.useMemo)(()=>{if(b?.ext)return b.ext.replace(".","").toUpperCase();let a=C.split(".");return a.length>1?a.pop().toUpperCase():"IMG"},[b,C]),E=(0,i.useMemo)(()=>{if(!b?.size)return null;let a=b.size;return a>=1048576?`${(a/1048576).toFixed(2)} MB`:`${Math.round(a/1024)} KB`},[b]),F=()=>{m(!1)};return(0,h.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#181818] text-slate-200 overflow-hidden select-none",children:[(0,h.jsxs)("header",{className:"h-[36px] min-h-[36px] bg-[#252526] border-b border-[#2b2b2b] px-3 flex items-center justify-between shrink-0 text-xs z-10",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-0 overflow-hidden",children:[(0,h.jsx)(by,{filename:C,size:15}),(0,h.jsx)("span",{className:"font-semibold text-white truncate max-w-[200px]",title:C,children:C}),(0,h.jsx)("span",{className:"text-slate-500 font-mono text-[10px] hidden md:inline truncate max-w-[320px]",title:a,children:a})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,h.jsxs)("div",{className:"hidden sm:flex items-center gap-2 text-[10px] font-mono text-slate-400 border-r border-[#3e3e42] pr-2.5",children:[(0,h.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-[#1e1e1e] border border-[#3e3e42] text-teal-300 font-bold uppercase",children:D}),r.width>0&&(0,h.jsxs)("span",{children:[r.width," × ",r.height," px"]}),E&&(0,h.jsx)("span",{children:E})]}),(0,h.jsxs)("button",{onClick:()=>{a&&(navigator.clipboard.writeText(a),y(!0),setTimeout(()=>y(!1),2e3))},className:`flex items-center gap-1 px-2 py-1 rounded text-xs transition-colors cursor-pointer border ${x?"bg-emerald-500/20 border-emerald-500/40 text-emerald-300 font-semibold":"bg-[#2d2d2d] hover:bg-[#383838] border-[#3e3e42] text-slate-300 hover:text-white"}`,title:"Copy absolute file path",children:[x?(0,h.jsx)(bP.f,{className:"w-3.5 h-3.5 text-emerald-400"}):(0,h.jsx)(bO.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{className:"hidden lg:inline",children:x?"Copied!":"Copy Path"})]}),(0,h.jsx)("button",{onClick:()=>q(a=>!a),className:`p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer ${p?"text-teal-400":""}`,title:`Toggle Transparent Checkerboard (${p?"ON":"OFF"})`,children:(0,h.jsx)(ew.f,{className:"w-3.5 h-3.5"})}),(0,h.jsxs)("div",{className:"flex items-center gap-1 bg-[#1e1e1e] border border-[#3e3e42] rounded px-1 py-0.5",children:[(0,h.jsx)("button",{onClick:()=>{g(a=>Math.max(Number((a-.25).toFixed(2)),.25))},className:"p-0.5 text-slate-400 hover:text-white transition-colors cursor-pointer",title:"Zoom Out",children:(0,h.jsx)(b_.f,{className:"w-3.5 h-3.5"})}),(0,h.jsxs)("button",{onClick:()=>{g(1),k({x:0,y:0})},className:"text-[10px] font-mono font-bold text-teal-300 px-1 hover:text-white cursor-pointer",title:"Reset Zoom to 100%",children:[Math.round(100*f),"%"]}),(0,h.jsx)("button",{onClick:()=>{g(a=>Math.min(Number((a+.25).toFixed(2)),5))},className:"p-0.5 text-slate-400 hover:text-white transition-colors cursor-pointer",title:"Zoom In",children:(0,h.jsx)(b$.f,{className:"w-3.5 h-3.5"})})]}),(0,h.jsx)("button",{onClick:()=>{if(!z.current||!r.width||!r.height)return;let a=z.current.clientWidth-40,b=z.current.clientHeight-40;g(Number(Math.min(a/r.width,b/r.height,1).toFixed(2))),k({x:0,y:0})},className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer",title:"Fit to Screen",children:(0,h.jsx)(a6.f,{className:"w-3.5 h-3.5"})}),c&&d&&(0,h.jsxs)("button",{onClick:d,className:"flex items-center gap-1 px-2 py-1 rounded bg-[#2d2d2d] hover:bg-[#383838] border border-[#3e3e42] text-xs text-amber-300 hover:text-white transition-colors cursor-pointer",title:"View & Edit SVG Source Code",children:[(0,h.jsx)(ex.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{className:"hidden sm:inline",children:"SVG Code"})]}),(0,h.jsx)("a",{href:B,target:"_blank",rel:"noopener noreferrer",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer",title:"Open raw image in browser",children:(0,h.jsx)(dG.f,{className:"w-3.5 h-3.5"})}),e&&(0,h.jsx)("button",{onClick:e,className:"p-1 rounded text-slate-400 hover:text-rose-400 hover:bg-[#383838] transition-colors cursor-pointer",title:"Close image tab",children:(0,h.jsx)(bD.X,{className:"w-3.5 h-3.5"})})]})]}),(0,h.jsxs)("div",{ref:z,onWheel:a=>{a.preventDefault(),a.deltaY<0?g(a=>Math.min(Number((a+.1).toFixed(2)),5)):g(a=>Math.max(Number((a-.1).toFixed(2)),.25))},onMouseDown:a=>{0===a.button&&(m(!0),o({x:a.clientX-j.x,y:a.clientY-j.y}))},onMouseMove:a=>{l&&k({x:a.clientX-n.x,y:a.clientY-n.y})},onMouseUp:F,onMouseLeave:F,className:`flex-1 relative overflow-hidden flex items-center justify-center ${l?"cursor-grabbing":"cursor-grab"} ${p?"bg-[#141414] [background-image:linear-gradient(45deg,#1f1f1f_25%,transparent_25%),linear-gradient(-45deg,#1f1f1f_25%,transparent_25%),linear-gradient(45deg,transparent_75%,#1f1f1f_75%),linear-gradient(-45deg,transparent_75%,#1f1f1f_75%)] [background-size:20px_20px] [background-position:0_0,0_10px,10px_-10px,-10px_0px]":"bg-[#121212]"}`,children:[!t&&!v&&(0,h.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 text-slate-400",children:[(0,h.jsx)(aN.f,{className:"w-6 h-6 animate-spin text-teal-400"}),(0,h.jsx)("span",{className:"text-xs font-mono",children:"Loading image..."})]}),v?(0,h.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 p-6 text-center",children:[(0,h.jsx)("div",{className:"w-10 h-10 rounded-full bg-rose-500/10 border border-rose-500/30 flex items-center justify-center text-rose-400",children:(0,h.jsx)(eu.f,{className:"w-5 h-5"})}),(0,h.jsx)("h4",{className:"text-sm font-semibold text-rose-300",children:"Cannot display image"}),(0,h.jsxs)("p",{className:"text-xs text-slate-400 max-w-md font-mono",children:["Unable to load image from ",B]})]}):(0,h.jsx)("div",{style:{transform:`translate(${j.x}px, ${j.y}px) scale(${f})`,transformOrigin:"center center",transition:l?"none":"transform 0.15s ease-out"},className:"inline-block transition-transform select-none",children:(0,h.jsx)("img",{ref:A,src:B,alt:C,onLoad:a=>{let{naturalWidth:b,naturalHeight:c}=a.target;s({width:b,height:c}),u(!0),w(!1)},onError:()=>{u(!1),w(!0)},draggable:!1,className:`max-w-none shadow-2xl rounded-sm ${t?"opacity-100":"opacity-0"}`})}),(0,h.jsxs)("div",{className:"absolute bottom-3 left-3 bg-[#1e1e1e]/90 backdrop-blur-xs border border-[#3e3e42] rounded px-2.5 py-1 text-[10px] text-slate-400 flex items-center gap-2 pointer-events-none",children:[(0,h.jsx)(ev.f,{className:"w-3 h-3 text-teal-400"}),(0,h.jsx)("span",{children:"Drag to pan · Scroll to zoom"})]})]})]})}var ez=a.i(23169);function eA({content:a="",filePath:b="",className:c=""}){return(0,h.jsx)("div",{className:`h-full w-full overflow-y-auto bg-[#1e1e1e] p-6 lg:p-8 select-text ${c}`,children:(0,h.jsx)("div",{className:"max-w-4xl mx-auto bg-[#1e1e1e] pb-16",children:(0,h.jsx)(ez.f,{content:a})})})}function eB({filePath:a,initialContent:b=null,readOnly:c=!1,onClose:d,onSave:e}){let[f,g]=(0,i.useState)(b||""),[j,k]=(0,i.useState)(b||""),[l,m]=(0,i.useState)(null),[n,o]=(0,i.useState)(!b),[p,q]=(0,i.useState)(null),[r,s]=(0,i.useState)(!1),[t,u]=(0,i.useState)(!1),[v,w]=(0,i.useState)(!1),[x,y]=(0,i.useState)("on"),[z,A]=(0,i.useState)(!0),[B,C]=(0,i.useState)("vs-dark"),[D,E]=(0,i.useState)('ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace'),[F,G]=(0,i.useState)(13),[H,I]=(0,i.useState)("preview"),[J,K]=(0,i.useState)("image"),L=(0,i.useMemo)(()=>a?a.split("/").pop()||a:"untitled",[a]);(0,i.useEffect)(()=>{let a=()=>{let a=(0,dl._)();"light-plus"===a.theme?C("vs"):C("vs-dark"),E((0,dl.l)("mono")),a.fontSize&&G(parseInt(a.fontSize,10)||13)};return a(),window.addEventListener(dl.D,a),()=>window.removeEventListener(dl.D,a)},[]);let M=(0,i.useCallback)(async()=>{if(a){o(!0),q(null);try{let b=await fetch(`/api/workspace/file-content?path=${encodeURIComponent(a)}`),c=await b.json();if(!b.ok)throw Error(c.error||"Failed to load file content");g(c.content||""),k(c.content||""),m(c)}catch(a){q(a.message)}finally{o(!1)}}},[a]);(0,i.useEffect)(()=>{M()},[M]);let N=(0,i.useMemo)(()=>f!==j,[f,j]),O=async()=>{if(a&&!c&&!t){u(!0);try{let b=await fetch("/api/workspace/file-content",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a,content:f})}),c=await b.json();if(!b.ok)throw Error(c.error||"Save failed");k(f),w(!0),setTimeout(()=>w(!1),2e3),e?.(a,f)}catch(a){alert(`Save error: ${a.message}`)}finally{u(!1)}}};(0,i.useEffect)(()=>{let a=a=>{(a.metaKey||a.ctrlKey)&&"s"===a.key&&(a.preventDefault(),O())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[f,a,c]);let P=(0,i.useMemo)(()=>f?f.split("\n").length:0,[f]),Q=l?.language||"plaintext",R=!!(l?.isImage&&!l?.isSvg),S=!!l?.isSvg,T="markdown"===Q||L.endsWith(".md")||L.endsWith(".markdown")||L.endsWith(".mdx");return!R||n||p?!S||"image"!==J||n||p?(0,h.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#1e1e1e] text-slate-200 overflow-hidden select-text",children:[(0,h.jsxs)("header",{className:"h-[36px] min-h-[36px] bg-[#252526] border-b border-[#2b2b2b] px-3 flex items-center justify-between shrink-0 select-none text-xs",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-0 overflow-hidden",children:[(0,h.jsx)(by,{filename:L,size:15}),(0,h.jsx)("span",{className:"font-semibold text-white truncate max-w-[200px]",title:L,children:L}),N&&(0,h.jsx)("span",{className:"w-2 h-2 rounded-full bg-cyan-400 shrink-0",title:"Modified"}),(0,h.jsx)("span",{className:"text-slate-500 font-mono text-[10px] hidden md:inline truncate max-w-[320px]",title:a,children:a})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[T&&(0,h.jsxs)("div",{className:"flex items-center bg-[#1e1e1e] border border-[#3e3e42] rounded p-0.5 text-[10px]",children:[(0,h.jsx)("button",{onClick:()=>I("edit"),className:`px-2 py-0.5 rounded transition-colors cursor-pointer ${"edit"===H?"bg-[#007acc] text-white font-semibold shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Monaco Source Editor",children:"Code"}),(0,h.jsx)("button",{onClick:()=>I("preview"),className:`px-2 py-0.5 rounded transition-colors cursor-pointer ${"preview"===H?"bg-[#007acc] text-white font-semibold shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Formatted Markdown Preview",children:"Preview"}),(0,h.jsx)("button",{onClick:()=>I("split"),className:`px-2 py-0.5 rounded transition-colors cursor-pointer ${"split"===H?"bg-[#007acc] text-white font-semibold shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Side-by-side Edit & Live Preview",children:"Split"})]}),S&&"code"===J&&(0,h.jsxs)("button",{onClick:()=>K("image"),className:"flex items-center gap-1 px-2 py-0.5 rounded bg-[#1e1e1e] hover:bg-[#333333] border border-[#3e3e42] text-[10px] text-teal-300 hover:text-white transition-colors cursor-pointer",title:"Switch to Rendered SVG Image View",children:[(0,h.jsx)(ev.f,{className:"w-3 h-3"}),(0,h.jsx)("span",{children:"Image View"})]}),(0,h.jsxs)("div",{className:"hidden sm:flex items-center gap-2 text-[10px] font-mono text-slate-400 border-r border-[#3e3e42] pr-2.5",children:[(0,h.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-[#1e1e1e] border border-[#3e3e42] text-cyan-300 font-bold uppercase",children:Q}),(0,h.jsxs)("span",{children:[P," lines"]}),(0,h.jsx)("span",{children:"UTF-8"})]}),(0,h.jsxs)("button",{onClick:()=>{f&&(navigator.clipboard.writeText(f),s(!0),setTimeout(()=>s(!1),2e3))},className:`flex items-center gap-1 px-2 py-1 rounded text-xs transition-colors cursor-pointer border ${r?"bg-emerald-500/20 border-emerald-500/40 text-emerald-300 font-semibold":"bg-[#2d2d2d] hover:bg-[#383838] border-[#3e3e42] text-slate-300 hover:text-white"}`,title:"Copy file content to clipboard",children:[r?(0,h.jsx)(bP.f,{className:"w-3.5 h-3.5 text-emerald-400"}):(0,h.jsx)(bO.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{className:"hidden lg:inline",children:r?"Copied!":"Copy"})]}),!c&&(0,h.jsxs)("button",{onClick:O,disabled:!N||t,className:`flex items-center gap-1 px-2.5 py-1 rounded text-xs transition-colors cursor-pointer border font-semibold ${v?"bg-emerald-600 text-white border-emerald-500":N?"bg-[#007acc] hover:bg-[#0062a3] text-white border-[#007acc] shadow-sm animate-pulse":"bg-[#2d2d2d] border-[#3e3e42] text-slate-500 cursor-not-allowed opacity-50"}`,title:"Save changes (Cmd+S / Ctrl+S)",children:[(0,h.jsx)(eo,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{className:"hidden sm:inline",children:t?"Saving...":v?"Saved!":"Save"})]}),(!T||"preview"!==H)&&(0,h.jsx)("button",{onClick:()=>y(a=>"on"===a?"off":"on"),className:`p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer ${"on"===x?"text-cyan-400":""}`,title:`Toggle Word Wrap (${"on"===x?"ON":"OFF"})`,children:(0,h.jsx)(eq,{className:"w-3.5 h-3.5"})}),(!T||"preview"!==H)&&(0,h.jsx)("button",{onClick:()=>A(a=>!a),className:`p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer ${z?"text-cyan-400":""}`,title:`Toggle Minimap (${z?"Show":"Hide"})`,children:z?(0,h.jsx)(er.f,{className:"w-3.5 h-3.5"}):(0,h.jsx)(et,{className:"w-3.5 h-3.5"})}),(0,h.jsx)("button",{onClick:M,className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer",title:"Reload from disk",children:(0,h.jsx)(aN.f,{className:`w-3.5 h-3.5 ${n?"animate-spin text-emerald-400":""}`})}),d&&(0,h.jsx)("button",{onClick:d,className:"p-1 rounded text-slate-400 hover:text-rose-400 hover:bg-[#383838] transition-colors cursor-pointer",title:"Close editor tab",children:(0,h.jsx)(bD.X,{className:"w-3.5 h-3.5"})})]})]}),(0,h.jsx)("div",{className:"flex-1 relative overflow-hidden bg-[#1e1e1e]",children:n?(0,h.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 text-slate-400",children:[(0,h.jsx)(aN.f,{className:"w-6 h-6 animate-spin text-[#007acc]"}),(0,h.jsxs)("span",{className:"text-xs font-mono",children:["Loading ",L,"..."]})]}):p?(0,h.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 p-6 text-center",children:[(0,h.jsx)("div",{className:"w-10 h-10 rounded-full bg-rose-500/10 border border-rose-500/30 flex items-center justify-center text-rose-400",children:(0,h.jsx)(eu.f,{className:"w-5 h-5"})}),(0,h.jsx)("h4",{className:"text-sm font-semibold text-rose-300",children:"Cannot load file"}),(0,h.jsx)("p",{className:"text-xs text-slate-400 max-w-md font-mono",children:p}),(0,h.jsx)("button",{onClick:M,className:"px-3 py-1.5 rounded bg-[#252526] hover:bg-[#333333] border border-[#3e3e42] text-xs text-slate-200 cursor-pointer",children:"Retry"})]}):T&&"preview"===H?(0,h.jsx)(eA,{content:f,filePath:a}):T&&"split"===H?(0,h.jsxs)("div",{className:"flex h-full w-full divide-x divide-[#2b2b2b]",children:[(0,h.jsx)("div",{className:"w-1/2 h-full overflow-hidden",children:(0,h.jsx)(em,{height:"100%",path:a,language:Q,value:f,onChange:a=>g(a||""),theme:B,options:{readOnly:c,fontSize:F,fontFamily:D,minimap:{enabled:z},scrollBeyondLastLine:!1,wordWrap:x,automaticLayout:!0,tabSize:2,bracketPairColorization:{enabled:!0},lineNumbers:"on",renderLineHighlight:"all",smoothScrolling:!0,cursorBlinking:"smooth"}})}),(0,h.jsx)("div",{className:"w-1/2 h-full overflow-hidden bg-[#1e1e1e]",children:(0,h.jsx)(eA,{content:f,filePath:a})})]}):(0,h.jsx)(em,{height:"100%",path:a,language:Q,value:f,onChange:a=>g(a||""),theme:B,options:{readOnly:c,fontSize:F,fontFamily:D,minimap:{enabled:z},scrollBeyondLastLine:!1,wordWrap:x,automaticLayout:!0,tabSize:2,bracketPairColorization:{enabled:!0},lineNumbers:"on",renderLineHighlight:"all",smoothScrolling:!0,cursorBlinking:"smooth"}})})]}):(0,h.jsx)(ey,{filePath:a,fileMeta:l,isSvg:!0,onToggleSvgSource:()=>K("code"),onClose:d}):(0,h.jsx)(ey,{filePath:a,fileMeta:l,onClose:d})}var eC=a.i(9705);a.i(49448);var eD=a.i(62008),eE=a.i(38766);let eF={name:"shield-check",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]};eF.node;let eG=(0,aP.f)(eF);function eH({isOpen:a,onClose:b}){let[c,d]=(0,i.useState)((0,bR.F)());return(0,i.useEffect)(()=>{let a=a=>{d(a.detail||(0,bR.F)())};return window.addEventListener(bR.o,a),()=>window.removeEventListener(bR.o,a)},[]),(0,h.jsx)(eD.f,{isOpen:a,onClose:b,title:`Supporter Store & Vault (${bB.E} Tech Items & 3D Effects)`,description:"Support the developer to maintain the project and unlock custom AGMon virtual office decorations",size:"full",footer:(0,h.jsxs)("div",{className:"flex items-center justify-between w-full text-xs text-slate-400",children:[(0,h.jsx)("div",{className:"flex items-center gap-2",children:c.isSupporter?(0,h.jsxs)("span",{className:"flex items-center gap-1.5 text-amber-400 font-semibold",children:[(0,h.jsx)(eG,{className:"w-4 h-4 text-amber-400"}),(0,h.jsxs)("span",{children:["Status: VIP Supporter Activated (All ",bB.E," items unlocked)"]})]}):(0,h.jsx)("span",{children:"100% of AGMon core engineering features remain completely free"})}),(0,h.jsx)(eE.f,{variant:"ghost",size:"sm",onClick:b,children:"Close"})]}),children:(0,h.jsx)("div",{className:"h-[80vh] -mx-4 -mt-2 -mb-4 overflow-hidden rounded-md border border-[#333333]",children:(0,h.jsx)(eC.f,{hideHeader:!0,onClose:b})})})}function eI({isOpen:a=!1,onClose:b,initialTab:c="themes"}){let[d,e]=(0,i.useState)(c||"themes"),[f,g]=(0,i.useState)(dl.s);if((0,i.useEffect)(()=>{a&&(g((0,dl._)()),e(c||"themes"))},[a,c]),(0,i.useEffect)(()=>{let a=a=>{a.detail&&g(a.detail)};return window.addEventListener(dl.D,a),()=>window.removeEventListener(dl.D,a)},[]),!a)return null;let j=(a,b)=>{let c={...f,[a]:b};g(c),(0,dl.Y)(c)};return(0,h.jsx)("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm animate-in fade-in",children:(0,h.jsxs)("div",{className:"w-full max-w-2xl bg-[var(--bg-editor)] border border-[var(--border-card)] rounded-xl shadow-2xl overflow-hidden flex flex-col text-[var(--text-main)] font-sans max-h-[85vh]",children:[(0,h.jsxs)("div",{className:"h-[46px] min-h-[46px] bg-[var(--bg-card)] border-b border-[var(--border-subtle)] px-4 flex items-center justify-between shrink-0 select-none",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)(a$.f,{className:"w-4 h-4 text-[var(--accent-primary)]"}),(0,h.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-[var(--text-bright)]",children:"Preferences: Theme & Typography (VS Code Settings)"})]}),(0,h.jsx)("button",{onClick:b,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-bright)] hover:bg-[var(--bg-hover)] transition-colors cursor-pointer",title:"Close (Escape)",children:(0,h.jsx)(bD.X,{className:"w-4 h-4"})})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-[var(--border-subtle)] bg-[var(--bg-card-inner)] shrink-0 select-none",children:[(0,h.jsxs)("button",{type:"button",onClick:()=>e("themes"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-semibold transition-colors cursor-pointer ${"themes"===d?"bg-[var(--bg-card)] text-[var(--text-bright)] border border-[var(--border-card)] shadow-xs":"text-[var(--text-muted)] hover:text-[var(--text-bright)]"}`,children:[(0,h.jsx)(a$.f,{className:"w-3.5 h-3.5 text-[var(--accent-primary)]"}),(0,h.jsxs)("span",{children:["Color Themes (",dl.z.length,")"]})]}),(0,h.jsxs)("button",{type:"button",onClick:()=>e("fonts"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-semibold transition-colors cursor-pointer ${"fonts"===d?"bg-[var(--bg-card)] text-[var(--text-bright)] border border-[var(--border-card)] shadow-xs":"text-[var(--text-muted)] hover:text-[var(--text-bright)]"}`,children:[(0,h.jsx)(bY,{className:"w-3.5 h-3.5 text-[var(--accent-secondary)]"}),(0,h.jsx)("span",{children:"Typography & Fonts"})]})]}),(0,h.jsx)("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:"themes"===d?(0,h.jsxs)("div",{className:"space-y-3",children:[(0,h.jsx)("div",{className:"text-xs text-[var(--text-muted)]",children:"Choose color theme for workbench, dialogs, sidebar, and toolbars:"}),(0,h.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:dl.z.map(a=>{let b=f.theme===a.id;return(0,h.jsxs)("div",{onClick:()=>{var b;let c;return b=a.id,void(g(c={...f,theme:b}),(0,dl.Y)(c))},className:`group relative p-3 rounded-lg border transition-all cursor-pointer flex flex-col justify-between space-y-2.5 ${b?"bg-[var(--bg-card)] border-[var(--accent-primary)] shadow-md shadow-[var(--accent-primary)]/10 ring-1 ring-[var(--accent-primary)]/40":"bg-[var(--bg-card-inner)] border-[var(--border-card)] hover:border-[var(--accent-primary)]/50 hover:bg-[var(--bg-card)]"}`,children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)("span",{className:"font-bold text-xs text-[var(--text-bright)]",children:a.name}),(0,h.jsx)("span",{className:"text-[9px] px-1.5 py-0.2 rounded border border-[var(--border-card)] text-[var(--text-muted)] uppercase font-mono bg-[var(--bg-card)]",children:a.category})]}),b&&(0,h.jsx)("div",{className:"w-4 h-4 rounded-full bg-[var(--accent-primary)] text-[var(--text-on-accent,#ffffff)] flex items-center justify-center shrink-0",children:(0,h.jsx)(bP.f,{className:"w-2.5 h-2.5"})})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 h-3 rounded overflow-hidden p-0.5 bg-black/10 dark:bg-black/40 border border-[var(--border-card)]",children:[(0,h.jsx)("span",{className:"h-full flex-1 rounded-xs",style:{backgroundColor:a.colors.workbench},title:`Workbench: ${a.colors.workbench}`}),(0,h.jsx)("span",{className:"h-full flex-1 rounded-xs",style:{backgroundColor:a.colors.editor},title:`Editor: ${a.colors.editor}`}),(0,h.jsx)("span",{className:"h-full flex-1 rounded-xs",style:{backgroundColor:a.colors.sidebar},title:`Sidebar: ${a.colors.sidebar}`}),(0,h.jsx)("span",{className:"h-full w-4 rounded-xs",style:{backgroundColor:a.colors.accent},title:`Accent: ${a.colors.accent}`})]}),(0,h.jsx)("p",{className:"text-[11px] text-[var(--text-muted)] leading-relaxed",children:a.description})]},a.id)})})]}):(0,h.jsxs)("div",{className:"space-y-4 text-xs",children:[(0,h.jsxs)("div",{className:"p-3 rounded-lg bg-[var(--bg-card-inner)] border border-[var(--border-card)] space-y-2",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsx)("span",{className:"font-bold text-[var(--text-bright)] uppercase tracking-wider text-[11px]",children:"1. UI Font Family"}),(0,h.jsx)("span",{className:"text-[10px] text-[var(--text-muted)] font-mono",children:"--font-family-ui"})]}),(0,h.jsx)("select",{value:f.uiFont,onChange:a=>j("uiFont",a.target.value),className:"w-full bg-[var(--bg-card)] text-[var(--text-main)] border border-[var(--border-card)] rounded px-3 py-1.5 text-xs outline-none focus:border-[var(--accent-primary)] cursor-pointer",children:dl.M.map(a=>(0,h.jsx)("option",{value:a.id,className:"bg-[var(--bg-card)] text-[var(--text-main)]",children:a.name},a.id))}),(0,h.jsx)("div",{className:"p-2 rounded bg-[var(--bg-card)] border border-[var(--border-card)] text-[var(--text-main)] text-xs",style:{fontFamily:"var(--font-family-ui)"},children:"UI Preview: Agent Factory - Realtime multi-agent activity and telemetry monitor."})]}),(0,h.jsxs)("div",{className:"p-3 rounded-lg bg-[var(--bg-card-inner)] border border-[var(--border-card)] space-y-2",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsx)("span",{className:"font-bold text-[var(--text-bright)] uppercase tracking-wider text-[11px]",children:"2. Monospace Font (Code & Console)"}),(0,h.jsx)("span",{className:"text-[10px] text-[var(--text-muted)] font-mono",children:"--font-family-mono"})]}),(0,h.jsx)("select",{value:f.codeFont,onChange:a=>j("codeFont",a.target.value),className:"w-full bg-[var(--bg-card)] text-[var(--text-main)] border border-[var(--border-card)] rounded px-3 py-1.5 text-xs outline-none focus:border-[var(--accent-primary)] cursor-pointer",children:dl.Q.map(a=>(0,h.jsx)("option",{value:a.id,className:"bg-[var(--bg-card)] text-[var(--text-main)]",children:a.name},a.id))}),(0,h.jsx)("div",{className:"p-2 rounded bg-[var(--bg-chat-code)] border border-[var(--border-card)] text-[var(--text-chat-code)] font-mono text-[11px] leading-relaxed",style:{fontFamily:"var(--font-family-mono)"},children:'const agent = { id: "gemini-3.8-flash", tokens: 142857, state: "streaming" };'})]}),(0,h.jsxs)("div",{className:"p-3 rounded-lg bg-[var(--bg-card-inner)] border border-[var(--border-card)] space-y-2",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsx)("span",{className:"font-bold text-[var(--text-bright)] uppercase tracking-wider text-[11px]",children:"3. Base Font Size"}),(0,h.jsx)("span",{className:"text-[10px] text-[var(--text-muted)] font-mono",children:"--font-size-ui"})]}),(0,h.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:dl.J.map(a=>(0,h.jsx)("button",{type:"button",onClick:()=>j("fontSize",a.id),className:`p-2 rounded border text-xs font-semibold transition-colors cursor-pointer text-center ${f.fontSize===a.id?"bg-[var(--accent-primary)]/15 border-[var(--accent-primary)] text-[var(--accent-primary)] font-bold shadow-xs":"bg-[var(--bg-card)] border-[var(--border-card)] text-[var(--text-muted)] hover:text-[var(--text-bright)] hover:bg-[var(--bg-hover)]"}`,children:a.label},a.id))})]})]})}),(0,h.jsxs)("div",{className:"h-[46px] min-h-[46px] bg-[var(--bg-card)] border-t border-[var(--border-subtle)] px-4 flex items-center justify-between shrink-0 select-none",children:[(0,h.jsxs)("button",{onClick:()=>{g(dl.s),(0,dl.Y)(dl.s)},className:"flex items-center gap-1.5 px-2.5 py-1 rounded bg-[var(--bg-card-inner)] hover:bg-[var(--bg-hover)] text-[var(--text-muted)] hover:text-[var(--text-bright)] border border-[var(--border-card)] text-xs transition-colors cursor-pointer",title:"Restore default settings",children:[(0,h.jsx)(l.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{children:"Reset to Defaults"})]}),(0,h.jsx)("button",{onClick:b,className:"px-4 py-1.5 rounded bg-[var(--accent-primary)] hover:opacity-90 text-[var(--text-on-accent,#ffffff)] text-xs font-semibold transition-colors cursor-pointer",children:"Done"})]})]})})}var eJ=a.i(85573);let eK={"gemini-3.8-flash":{input:.075,output:.3,cached:.01875},"gemini-2.5-flash":{input:.075,output:.3,cached:.01875},"gemini-1.5-flash":{input:.075,output:.3,cached:.01875},"gemini-3.8-pro":{input:1.25,output:5,cached:.3125},"gemini-3.1-pro":{input:1.25,output:5,cached:.3125},"gemini-2.5-pro":{input:1.25,output:5,cached:.3125},"gemini-1.5-pro":{input:1.25,output:5,cached:.3125},"claude-opus-5-5":{input:4,output:20,cached:.2},"claude-sonnet-5-5":{input:2,output:10,cached:.1},"claude-haiku-5-5":{input:.1,output:.5,cached:.01},"claude-fable-5":{input:10,output:50,cached:1},"claude-mythos-5":{input:10,output:50,cached:1},"claude-opus-4-8":{input:5,output:25,cached:.5},"claude-opus-4-7":{input:5,output:25,cached:.5},"claude-opus-4-6":{input:5,output:25,cached:.5},"claude-opus-4-5":{input:5,output:25,cached:.5},"claude-sonnet-4-6":{input:3,output:15,cached:.3},"claude-sonnet-4-5":{input:3,output:15,cached:.3},"claude-haiku-4-5":{input:1,output:5,cached:.1},"claude-3-7-sonnet":{input:3,output:15,cached:.3},"claude-3-5-sonnet":{input:3,output:15,cached:.3},"claude-3-5-haiku":{input:.8,output:4,cached:.08},"claude-3-opus":{input:15,output:75,cached:1.5},"claude-3-haiku":{input:.25,output:1.25,cached:.025},"gpt-4o-mini":{input:.15,output:.6,cached:.075},"gpt-4o":{input:2.5,output:10,cached:1.25},minimax:{input:.3,output:1.2,cached:.3}},eL=Object.keys(eK).sort((a,b)=>b.length-a.length);function eM(a,b){if(!a)return null;let c=function(a){let b=(a||"").toLowerCase();if(!b)return null;for(let a of eL)if(b.includes(a))return eK[a];return null}(b);return c?(a.input||0)*(c.input/1e6)+(a.output||0)*(c.output/1e6)+(a.cached||0)*(c.cached/1e6):null}let eN={name:"skip-back",size:24,node:[["path",{d:"M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z",key:"15892j"}],["path",{d:"M3 20V4",key:"1ptbpl"}]]};eN.node;let eO=(0,aP.f)(eN),eP={name:"skip-forward",size:24,node:[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]]};eP.node;let eQ=(0,aP.f)(eP);var eR=a.i(92378),eS=a.i(7746),eT=a.i(42103);function eU(a){if(isNaN(a)||a<0)return"00:00";let b=Math.floor(a/60),c=Math.floor(a%60);return`${String(b).padStart(2,"0")}:${String(c).padStart(2,"0")}`}function eV({replay:a,onClose:b,className:c=""}){let{sessionInfo:d,keyframes:e=[],totalSteps:f=0,currentStepIndex:g=0,currentKeyframe:j,currentTime:k=0,totalElapsedSeconds:m=0,isPlaying:n=!1,playbackSpeed:o=2,play:p,pause:q,togglePlay:r,seekToStep:s,stepForward:t,stepBackward:u,setPlaybackSpeed:v,reset:w}=a,[x,y]=(0,i.useState)(null),z=(0,i.useMemo)(()=>f<=1?[]:e.map((a,b)=>{let c=b/(f-1)*100,d="bg-slate-500";return"prompt"===a.milestoneType?d="bg-amber-400":"file_write"===a.type?d="bg-purple-400":"tool"===a.milestoneType?d="bg-cyan-400":"error"===a.milestoneType?d="bg-rose-500":"finish"===a.milestoneType&&(d="bg-emerald-400"),{idx:b,pct:c,color:d,type:a.type,title:a.title,summary:a.summary}}),[e,f]);return e&&0!==e.length?(0,h.jsxs)("div",{className:`bg-[#181818]/95 backdrop-blur-md border-t border-[#3e3e42] p-2 select-none shadow-2xl flex flex-col gap-2 text-slate-200 ${c}`,style:{colorScheme:"dark"},children:[(0,h.jsxs)("div",{className:"relative flex flex-col gap-1 px-2 pt-1",children:[(0,h.jsxs)("div",{className:"relative w-full h-5 flex items-center",children:[(0,h.jsx)("div",{className:"absolute inset-x-0 h-1 bg-[#252526] rounded-full pointer-events-none overflow-hidden",children:(0,h.jsx)("div",{className:"h-full bg-[#007acc] transition-all duration-75",style:{width:`${f>1?g/(f-1)*100:0}%`}})}),(0,h.jsx)("div",{className:"absolute inset-x-0 h-full pointer-events-none flex items-center",children:z.map(a=>(0,h.jsx)("div",{className:`absolute w-2 h-2 rounded-full -translate-x-1/2 ${a.color} transition-transform ${x===a.idx||g===a.idx?"scale-150 ring-2 ring-white z-20":"opacity-80"}`,style:{left:`${a.pct}%`}},a.idx))}),(0,h.jsx)("input",{type:"range",min:0,max:Math.max(0,f-1),value:g,onChange:a=>s(parseInt(a.target.value,10)),className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer z-30",title:"Drag to scrub timeline"})]}),(0,h.jsxs)("div",{className:"flex items-center justify-between text-[11px] font-mono text-slate-400",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 truncate",children:[(0,h.jsxs)("span",{className:"text-[#007acc] font-bold",children:["Step ",g+1,"/",f]}),(0,h.jsx)("span",{className:"text-slate-600",children:"•"}),(0,h.jsx)("span",{className:"text-white truncate font-sans",children:j?.title||"Event"}),j?.activeTool&&(0,h.jsx)(eT.f,{variant:"type",badgeSize:"xs",className:"shrink-0 font-mono",children:j.activeTool})]}),(0,h.jsx)("div",{className:"flex items-center gap-2 shrink-0",children:(0,h.jsxs)("span",{children:[eU(k)," / ",eU(m)]})})]})]}),(0,h.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 px-2 border-t border-[#252526] pt-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(eE.f,{variant:"secondary",size:"icon-sm",onClick:w,title:"Rewind to start (Home)",children:(0,h.jsx)(l.f,{className:"w-3.5 h-3.5"})}),(0,h.jsx)(eE.f,{variant:"secondary",size:"icon-sm",onClick:u,disabled:g<=0,title:"Step backward (←)",children:(0,h.jsx)(eO,{className:"w-3.5 h-3.5"})}),(0,h.jsx)(eE.f,{variant:"primary",size:"sm",onClick:r,className:"px-3",title:n?"Pause (Space)":"Play (Space)",leftIcon:n?(0,h.jsx)(bK.f,{className:"w-3.5 h-3.5"}):(0,h.jsx)(bJ.f,{className:"w-3.5 h-3.5 fill-current"}),children:n?"Pause":"Play"}),(0,h.jsx)(eE.f,{variant:"secondary",size:"icon-sm",onClick:t,disabled:g>=f-1,title:"Step forward (→)",children:(0,h.jsx)(eQ,{className:"w-3.5 h-3.5"})}),(0,h.jsxs)("div",{className:"flex items-center gap-1 pl-2 border-l border-[#333]",children:[(0,h.jsx)("span",{className:"text-[10px] text-slate-400 font-medium",children:"Speed:"}),(0,h.jsx)("div",{className:"flex items-center bg-[#252526] border border-[#3e3e42] rounded p-0.5 text-[10px]",children:[{label:"1x",value:1},{label:"2x",value:2},{label:"5x",value:5},{label:"10x",value:10}].map(a=>(0,h.jsx)("button",{type:"button",onClick:()=>v(a.value),className:`px-1.5 py-0.5 rounded transition-colors cursor-pointer ${o===a.value?"bg-[#007acc] text-white font-bold":"text-slate-400 hover:text-white"}`,children:a.label},a.value))})]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-3 text-xs font-mono",children:[(0,h.jsxs)("div",{className:"hidden sm:flex items-center gap-1.5 text-slate-400",children:[(0,h.jsx)("span",{className:"text-[10px] uppercase text-slate-500",children:"Session:"}),(0,h.jsxs)("span",{className:"text-white truncate max-w-[140px]",title:d?.id,children:[d?.id?.slice(0,14),"..."]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1.5 text-emerald-400",children:[(0,h.jsx)(eR.f,{className:"w-3 h-3 text-cyan-400"}),(0,h.jsxs)("span",{children:[(j?.cumulativeTokens||0).toLocaleString()," tks"]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1.5 text-amber-300",children:[(0,h.jsx)(eS.f,{className:"w-3 h-3 text-amber-400"}),(0,h.jsxs)("span",{children:["$",(j?.cumulativeCost||0).toFixed(4)]})]}),b&&(0,h.jsx)(eE.f,{variant:"ghost",size:"xs",onClick:b,className:"text-slate-400 hover:text-white ml-1",title:"Exit Replay mode",leftIcon:(0,h.jsx)(bD.X,{className:"w-3 h-3"}),children:"Exit Replay"})]})]})]}):null}var eW=a.i(59944),eX=a.i(44451),eY=a.i(24613),eZ=a.i(13412),e$=a.i(8311);let e_={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};e_.node;let e0=(0,aP.f)(e_);function e1({isOpen:a,onClose:b,replay:c,onOpenConversation:d}){let{currentKeyframe:e,currentStepIndex:f=0,totalSteps:g=0,currentTime:k=0,totalElapsedSeconds:l=0,stepBackward:m,stepForward:n,sessionInfo:o={}}=c||{},[p,q]=(0,i.useState)(!1);if(!a||!e)return null;let r=a=>{a&&(navigator.clipboard.writeText(a),q(!0),setTimeout(()=>q(!1),2e3))},s={user_input:{label:"User Prompt",variant:"warning",icon:eX.f,color:"text-amber-400",bg:"bg-amber-950/40 border-amber-500/30"},thought:{label:"AI Chain of Thought",variant:"info",icon:eW.f,color:"text-cyan-400",bg:"bg-cyan-950/40 border-cyan-500/30"},tool_call:{label:"Tool Call",variant:"primary",icon:eY.f,color:"text-[#007acc]",bg:"bg-blue-950/40 border-blue-500/30"},file_write:{label:"File Write / Edit",variant:"tool",icon:ex.f,color:"text-purple-400",bg:"bg-purple-950/40 border-purple-500/30"},assistant_reply:{label:"Assistant Reply",variant:"success",icon:be.f,color:"text-emerald-400",bg:"bg-emerald-950/40 border-emerald-500/30"},finish:{label:"Session Finished",variant:"success",icon:eZ.f,color:"text-emerald-400",bg:"bg-emerald-950/40 border-emerald-500/30"}}[e.type]||{label:e.type||"Event",variant:"default",icon:e0,color:"text-slate-400",bg:"bg-slate-900 border-slate-800"},t=s.icon,u="error"===e.milestoneType,v=e.details||{},w=v.args&&Object.keys(v.args).length>0,x=!!v.output;return(0,h.jsx)(eD.f,{isOpen:a,onClose:b,title:(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)(t,{className:`w-4 h-4 ${u?"text-rose-400":s.color}`}),(0,h.jsxs)("span",{className:"text-white font-semibold",children:["Event Details • Step ",f+1,"/",g]}),(0,h.jsx)(eT.f,{variant:u?"danger":s.variant,badgeSize:"xs",className:"uppercase tracking-wider font-mono text-[10px]",children:u?"Error":s.label})]}),description:(0,h.jsxs)("div",{className:"flex items-center gap-3 text-xs text-slate-400 mt-1",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1 font-mono",children:[(0,h.jsx)(e$.f,{className:"w-3 h-3 text-slate-500"}),e.elapsedSeconds,"s (",new Date(e.timestamp).toLocaleTimeString(),")"]}),(0,h.jsx)("span",{children:"•"}),(0,h.jsxs)("span",{className:"flex items-center gap-1 text-cyan-400 font-mono",children:[(0,h.jsx)(eR.f,{className:"w-3 h-3"}),(e.cumulativeTokens||0).toLocaleString()," tokens"]}),(0,h.jsx)("span",{children:"•"}),(0,h.jsxs)("span",{className:"flex items-center gap-1 text-amber-300 font-mono",children:[(0,h.jsx)(eS.f,{className:"w-3 h-3"}),"$",(e.cumulativeCost||0).toFixed(4)]})]}),size:"lg",footer:(0,h.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)(eE.f,{variant:"secondary",size:"sm",onClick:m,disabled:f<=0,leftIcon:(0,h.jsx)(bE.f,{className:"w-3.5 h-3.5"}),children:"Previous"}),(0,h.jsx)(eE.f,{variant:"secondary",size:"sm",onClick:n,disabled:f>=g-1,rightIcon:(0,h.jsx)(bm.f,{className:"w-3.5 h-3.5"}),children:"Next"})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[d&&(0,h.jsx)(eE.f,{variant:"secondary",size:"sm",onClick:()=>{b(),d(o?.id||c?.sessionId)},leftIcon:(0,h.jsx)(j.f,{className:"w-3.5 h-3.5 text-cyan-400"}),children:"View Conversation"}),(0,h.jsx)(eE.f,{variant:"secondary",size:"sm",onClick:b,children:"Close"})]})]}),children:(0,h.jsxs)("div",{className:"space-y-4 max-h-[65vh] overflow-y-auto pr-1",children:[(0,h.jsxs)("div",{className:`p-3 rounded-lg border ${s.bg} space-y-1`,children:[(0,h.jsxs)("div",{className:"text-xs font-semibold text-white flex items-center justify-between",children:[(0,h.jsx)("span",{children:e.title}),e.activeTool&&(0,h.jsx)(eT.f,{variant:"type",badgeSize:"xs",className:"font-mono",children:e.activeTool})]}),e.summary&&(0,h.jsx)("p",{className:"text-xs text-slate-300 leading-relaxed",children:e.summary})]}),"user_input"===e.type&&(0,h.jsxs)("div",{className:"space-y-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(eX.f,{className:"w-3.5 h-3.5 text-amber-400"}),"User Prompt Message"]}),(0,h.jsx)(eE.f,{variant:"ghost",size:"xs",onClick:()=>r(e.content),leftIcon:p?(0,h.jsx)(bP.f,{className:"w-3 h-3 text-emerald-400"}):(0,h.jsx)(bO.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,h.jsx)("pre",{className:"p-3 bg-[#141414] border border-[#2b2b2b] rounded-lg text-xs font-sans text-slate-200 whitespace-pre-wrap leading-relaxed max-h-80 overflow-y-auto",children:e.content||"No text content."})]}),"thought"===e.type&&(0,h.jsxs)("div",{className:"space-y-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(eW.f,{className:"w-3.5 h-3.5 text-cyan-400"}),"AI Reasoning (Chain of Thought)"]}),(0,h.jsx)(eE.f,{variant:"ghost",size:"xs",onClick:()=>r(e.content),leftIcon:p?(0,h.jsx)(bP.f,{className:"w-3 h-3 text-emerald-400"}):(0,h.jsx)(bO.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,h.jsx)("pre",{className:"p-3 bg-[#12161f] border border-cyan-900/40 rounded-lg text-xs font-mono text-cyan-200/90 whitespace-pre-wrap leading-relaxed max-h-80 overflow-y-auto",children:e.content})]}),"file_write"===e.type&&v.args?.ReplacementContent&&(0,h.jsxs)("div",{className:"space-y-2",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(ex.f,{className:"w-3.5 h-3.5 text-purple-400"}),"Code Changes (Diff Preview)"]}),v.targetFile&&(0,h.jsx)("span",{className:"text-[10px] font-mono text-purple-300 truncate max-w-[260px]",children:v.targetFile})]}),v.args.TargetContent&&(0,h.jsxs)("div",{className:"space-y-1",children:[(0,h.jsx)("span",{className:"text-[10px] font-bold text-rose-400 uppercase tracking-wider block",children:"- Original Content (Replaced)"}),(0,h.jsx)("pre",{className:"p-2.5 bg-rose-950/20 border border-rose-500/30 rounded-lg text-xs font-mono text-rose-300 whitespace-pre-wrap leading-relaxed max-h-48 overflow-y-auto",children:v.args.TargetContent})]}),(0,h.jsxs)("div",{className:"space-y-1",children:[(0,h.jsx)("span",{className:"text-[10px] font-bold text-emerald-400 uppercase tracking-wider block",children:"+ New Content (Added)"}),(0,h.jsx)("pre",{className:"p-2.5 bg-emerald-950/20 border border-emerald-500/30 rounded-lg text-xs font-mono text-emerald-300 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:v.args.ReplacementContent})]})]}),"file_write"===e.type&&!v.args?.ReplacementContent&&v.args?.CodeContent&&(0,h.jsxs)("div",{className:"space-y-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(ex.f,{className:"w-3.5 h-3.5 text-purple-400"}),"Created File Content"]}),v.targetFile&&(0,h.jsx)("span",{className:"text-[10px] font-mono text-purple-300 truncate max-w-[260px]",children:v.targetFile})]}),(0,h.jsx)("pre",{className:"p-3 bg-[#101010] border border-purple-500/30 rounded-lg text-xs font-mono text-purple-200 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:v.args.CodeContent})]}),("tool_call"===e.type||"file_write"===e.type)&&w&&(0,h.jsxs)("div",{className:"space-y-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(e0,{className:"w-3.5 h-3.5 text-blue-400"}),"Arguments (",e.activeTool,")"]}),v.targetFile&&(0,h.jsx)("span",{className:"text-[11px] font-mono text-purple-300 truncate max-w-[280px]",children:v.targetFile})]}),(0,h.jsx)("pre",{className:"p-3 bg-[#141414] border border-[#2b2b2b] rounded-lg text-xs font-mono text-slate-300 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(v.args,null,2)})]}),("tool_call"===e.type||"file_write"===e.type)&&x&&(0,h.jsxs)("div",{className:"space-y-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(be.f,{className:"w-3.5 h-3.5 text-emerald-400"}),"Execution Output"]}),(0,h.jsx)(eE.f,{variant:"ghost",size:"xs",onClick:()=>r(v.output),leftIcon:p?(0,h.jsx)(bP.f,{className:"w-3 h-3 text-emerald-400"}):(0,h.jsx)(bO.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,h.jsx)("pre",{className:"p-3 bg-[#101010] border border-[#2b2b2b] rounded-lg text-xs font-mono text-emerald-400/90 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:v.output})]}),"assistant_reply"===e.type&&(0,h.jsxs)("div",{className:"space-y-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(be.f,{className:"w-3.5 h-3.5 text-emerald-400"}),"Assistant Response"]}),(0,h.jsx)(eE.f,{variant:"ghost",size:"xs",onClick:()=>r(e.content),leftIcon:p?(0,h.jsx)(bP.f,{className:"w-3 h-3 text-emerald-400"}):(0,h.jsx)(bO.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,h.jsx)("pre",{className:"p-3 bg-[#141414] border border-[#2b2b2b] rounded-lg text-xs font-sans text-slate-200 whitespace-pre-wrap leading-relaxed max-h-80 overflow-y-auto",children:e.content})]}),"finish"===e.type&&(0,h.jsxs)("div",{className:"p-4 bg-emerald-950/20 border border-emerald-500/30 rounded-lg space-y-3",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 text-emerald-400 font-bold text-sm",children:[(0,h.jsx)(eZ.f,{className:"w-5 h-5"}),"Session Summary"]}),(0,h.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-xs",children:[(0,h.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"TOTAL DURATION"}),(0,h.jsxs)("span",{className:"font-mono text-white text-sm font-semibold",children:[l,"s"]})]}),(0,h.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"TOTAL STEPS"}),(0,h.jsxs)("span",{className:"font-mono text-white text-sm font-semibold",children:[g," events"]})]}),(0,h.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"TOTAL TOKENS"}),(0,h.jsx)("span",{className:"font-mono text-cyan-400 text-sm font-semibold",children:(e.cumulativeTokens||0).toLocaleString()})]}),(0,h.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"ESTIMATED COST"}),(0,h.jsxs)("span",{className:"font-mono text-amber-300 text-sm font-semibold",children:["$",(e.cumulativeCost||0).toFixed(4)]})]})]})]})]})})}var e2=a.i(13608);function e3({replay:a,onExit:b,onOpenConversation:c,className:d="",children:e}){let[f,g]=(0,i.useState)(!1),[k,l]=(0,i.useState)(!0),{sessionInfo:m={},currentKeyframe:n,currentStepIndex:o=0,totalSteps:p=0,isPlaying:q=!1,togglePlay:r,stepForward:s,stepBackward:t,seekToStep:u}=a||{};return(0,i.useEffect)(()=>{let a=a=>{let b=document.activeElement?.tagName?.toLowerCase();"input"!==b&&"textarea"!==b&&("Space"===a.code?(a.preventDefault(),r?.()):"ArrowLeft"===a.code?(a.preventDefault(),t?.()):"ArrowRight"===a.code?(a.preventDefault(),s?.()):"Home"===a.code?(a.preventDefault(),u?.(0)):"End"===a.code?(a.preventDefault(),u?.(Math.max(0,p-1))):"i"!==a.key&&"I"!==a.key||a.metaKey||a.ctrlKey||g(a=>!a))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[r,t,s,u,p]),(0,h.jsxs)("div",{className:`relative flex flex-col h-full w-full overflow-hidden ${d}`,children:[(0,h.jsxs)("div",{className:"h-9 min-h-[36px] bg-[#1a1f2c]/90 border-b border-[#2d3748] px-3 flex items-center justify-between z-30 select-none backdrop-blur-md",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,h.jsxs)("span",{className:"flex h-2 w-2 relative",children:[(0,h.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"}),(0,h.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cyan-500"})]}),(0,h.jsx)(eT.f,{variant:"type",badgeSize:"xs",className:"font-mono uppercase font-bold tracking-wider",children:"Time-Machine Replay"}),(0,h.jsx)("span",{className:"text-slate-500 text-xs hidden sm:inline",children:"•"}),(0,h.jsx)("span",{className:"text-xs text-slate-300 font-mono truncate max-w-[200px]",title:m?.id,children:m?.id?`${m.id.slice(0,16)}...`:"Session"}),m?.model&&(0,h.jsxs)("span",{className:"text-[11px] text-slate-400 font-mono hidden md:inline",children:["(",m.model,")"]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[c&&(0,h.jsx)(eE.f,{variant:"secondary",size:"xs",onClick:()=>c(m?.id||a?.sessionId),leftIcon:(0,h.jsx)(j.f,{className:"w-3 h-3 text-cyan-400"}),title:"View full conversation transcript for this session",children:"View Conversation"}),(0,h.jsx)(eE.f,{variant:"secondary",size:"xs",onClick:()=>g(!0),leftIcon:(0,h.jsx)(bM.f,{className:"w-3 h-3 text-cyan-400"}),title:"Inspect event details and parameters (Key: I)",children:"Step Details"}),(0,h.jsx)(eE.f,{variant:"ghost",size:"xs",onClick:b,leftIcon:(0,h.jsx)(bD.X,{className:"w-3.5 h-3.5"}),className:"text-slate-400 hover:text-white hover:bg-rose-950/40 hover:border-rose-500/40",title:"Exit Replay and return to live stream",children:"Exit Replay"})]})]}),(0,h.jsxs)("div",{className:"relative flex-1 overflow-hidden",children:[e,n&&(0,h.jsx)("div",{className:"absolute top-3 right-3 z-20 max-w-sm pointer-events-auto",children:(0,h.jsxs)("div",{className:"bg-[#18181b]/90 border border-[#3f3f46] rounded-xl shadow-2xl backdrop-blur-md overflow-hidden transition-all",children:[(0,h.jsxs)("div",{onClick:()=>l(!k),className:"px-3 py-2 bg-[#27272a]/70 flex items-center justify-between cursor-pointer hover:bg-[#27272a] transition-colors",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(a=>{switch(a){case"user_input":return(0,h.jsx)(eX.f,{className:"w-3.5 h-3.5 text-amber-400"});case"thought":return(0,h.jsx)(eW.f,{className:"w-3.5 h-3.5 text-cyan-400"});case"file_write":return(0,h.jsx)(ex.f,{className:"w-3.5 h-3.5 text-purple-400"});case"tool_call":return(0,h.jsx)(eY.f,{className:"w-3.5 h-3.5 text-[#007acc]"});case"finish":return(0,h.jsx)(eZ.f,{className:"w-3.5 h-3.5 text-emerald-400"});default:return(0,h.jsx)(be.f,{className:"w-3.5 h-3.5 text-slate-400"})}})(n.type),(0,h.jsx)("span",{className:"text-xs font-semibold text-white truncate",children:n.title||"Agent Activity"})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1.5 text-slate-400",children:[(0,h.jsxs)("span",{className:"text-[10px] font-mono",children:[o+1,"/",p]}),k?(0,h.jsx)(e2.f,{className:"w-3 h-3"}):(0,h.jsx)(bl.f,{className:"w-3 h-3"})]})]}),k&&(0,h.jsxs)("div",{className:"p-3 space-y-2 text-xs",children:[(0,h.jsx)("p",{className:"text-slate-300 leading-relaxed font-sans line-clamp-3",children:n.summary||n.content?.slice(0,150)||"Executing task..."}),(0,h.jsxs)("div",{className:"flex items-center justify-between pt-1 border-t border-[#27272a] text-[11px]",children:[n.activeTool?(0,h.jsxs)("div",{className:"flex items-center gap-1.5 font-mono text-cyan-400 truncate",children:[(0,h.jsx)(eY.f,{className:"w-3 h-3 text-[#007acc] shrink-0"}),(0,h.jsx)("span",{className:"truncate",children:n.activeTool})]}):(0,h.jsxs)("span",{className:"text-[10px] text-slate-500 font-mono",children:["Step ",o+1]}),c&&(0,h.jsxs)("button",{type:"button",onClick:()=>c(m?.id||a?.sessionId),className:"flex items-center gap-1 text-[11px] text-cyan-400 hover:text-cyan-300 hover:underline cursor-pointer ml-auto shrink-0",title:"View conversation transcript",children:[(0,h.jsx)(j.f,{className:"w-3 h-3"}),(0,h.jsx)("span",{children:"Conversation"})]})]})]})]})})]}),(0,h.jsx)(eV,{replay:a,onClose:b,className:"z-30 shrink-0"}),(0,h.jsx)(e1,{isOpen:f,onClose:()=>g(!1),replay:a,onOpenConversation:c})]})}let e4={isLeftSidebarVisible:!0,isBottomPanelVisible:!0,isRightSidebarVisible:!1,activeActivityView:"explorer",activeRightSidebarTab:"chat",activeBottomTab:"logs",activeEditorTab:"canvas",openedTabs:[{id:"canvas",title:"Virtual Office",type:"canvas",closable:!1}]};function e5({traces:a=[],office:b={workstations:[],stats:{}},mode:c="live",mockPreset:d="cases",onModeChange:e,onPresetChange:f,connected:g=!0,live:m=!0,isRefreshing:n=!1,onRefresh:o,soundEnabled:p=!1,onToggleSound:q,notifEnabled:r=!1,onToggleNotif:s}){let[t,u]=(0,i.useState)(e4),[v,w]=(0,i.useState)(!1),[x,y]=(0,i.useState)(null),[z,A]=(0,i.useState)("canvas"),[B,C]=(0,i.useState)("agents"),[D,E]=(0,i.useState)(!1),[F,G]=(0,i.useState)(!1),[H,I]=(0,i.useState)(!1),[J,K]=(0,i.useState)("themes"),[L,M]=(0,i.useState)(!1),[N,O]=(0,i.useState)(!1),P=(0,i.useCallback)(a=>{O(b=>{let c="boolean"==typeof a?a:!b;return c?(A("canvas"),"u">typeof document&&document.documentElement?.requestFullscreen&&!document.fullscreenElement&&document.documentElement.requestFullscreen().catch(()=>{})):"u">typeof document&&document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{}),c})},[]);(0,i.useEffect)(()=>{let a=()=>{"u">typeof document&&!document.fullscreenElement&&N&&O(!1)};return document.addEventListener("fullscreenchange",a),()=>document.removeEventListener("fullscreenchange",a)},[N]),(0,i.useEffect)(()=>{let a=(0,bR.F)();M(!!a.isSupporter),(0,eJ.n)(a);let b=a=>{M(!!(a.detail||(0,bR.F)()).isSupporter)};return window.addEventListener(bR.o,b),()=>window.removeEventListener(bR.o,b)},[]);let[Q,R]=(0,i.useState)(null),S=function(a=null){let[b,c]=(0,i.useState)(a),[d,e]=(0,i.useState)(!1),[f,g]=(0,i.useState)(null),[h,j]=(0,i.useState)({sessionInfo:{},keyframes:[],totalElapsedSeconds:0,totalTokens:0,totalCost:0}),[k,l]=(0,i.useState)(0),[m,n]=(0,i.useState)(!1),[o,p]=(0,i.useState)(2),q=(0,i.useRef)(null),r=(0,i.useRef)(null),s=(0,i.useCallback)(async a=>{if(a){e(!0),g(null),n(!1),l(0);try{let b=await fetch(`/api/sessions/${encodeURIComponent(a)}/transcript`);if(!b.ok)throw Error(`Failed to load session transcript: HTTP ${b.status}`);let d=await b.json(),e=function(a){if(!a||!Array.isArray(a.turns))return{sessionInfo:{},keyframes:[],totalElapsedSeconds:0,totalTokens:0,totalCost:0};let b=a.session||{},c=a.turns||[],d=b.model||null,e=b.cli||"antigravity",f=[],g=0,h=0,i=0,j=0,k=Date.now();b.startedAt?k=new Date(b.startedAt).getTime():c.length>0&&c[0].timestamp&&(k=new Date(c[0].timestamp).getTime()),c.forEach((a,b)=>{let c=a.timestamp?new Date(a.timestamp).getTime():k+5e3*b,e=Math.max(0,Math.round((c-k)/1e3));a.tokens&&(h+=a.tokens.input||0,i+=a.tokens.output||0,j+=a.tokens.cached||0);let l=h+i+j,m=eM({input:h,output:i,cached:j},d);if("user"===a.role)return void f.push({stepIndex:g++,turnIndex:b,timestamp:a.timestamp||new Date(c).toISOString(),elapsedSeconds:e,type:"user_input",milestoneType:"prompt",agentState:"thinking",title:"User Prompt",summary:a.content?a.content.slice(0,80)+(a.content.length>80?"...":""):"User message",content:a.content||"",cumulativeTokens:l,cumulativeCost:m,activeTool:null});a.thinking&&f.push({stepIndex:g++,turnIndex:b,timestamp:a.timestamp||new Date(c).toISOString(),elapsedSeconds:e,type:"thought",milestoneType:"thought",agentState:"thinking",title:"AI Chain of Thought",summary:a.thinking.slice(0,90)+(a.thinking.length>90?"...":""),content:a.thinking,cumulativeTokens:l,cumulativeCost:m,activeTool:null});let n=a.toolCalls||[];if(n.forEach((d,h)=>{let i=e+(h+1)*2,j="replace_file_content"===d.name||"write_to_file"===d.name||d.name?.includes("edit")||d.name?.includes("write"),k="run_command"===d.name||"bash"===d.name||"terminal"===d.name,n=d.name?.includes("search")||d.name?.includes("grep")||d.name?.includes("view"),o="tool";j?o="file_write":k?o="command":n&&(o="search"),f.push({stepIndex:g++,turnIndex:b,toolIndex:h,timestamp:a.timestamp||new Date(c+2e3*h).toISOString(),elapsedSeconds:i,type:j?"file_write":"tool_call",milestoneType:"error"===d.status?"error":"tool",agentState:j?"typing":"running_tool",title:`Tool Call: ${d.name||"tool"}`,summary:d.summary||d.action||d.name,details:{id:d.id,name:d.name,type:o,summary:d.summary,args:d.args||{},output:d.output||"",status:d.status||"completed",targetFile:d.args?.TargetFile||d.args?.AbsolutePath||null},cumulativeTokens:l,cumulativeCost:m,activeTool:d.name})}),a.content){let d=e+(n.length>0?(n.length+1)*2:1);f.push({stepIndex:g++,turnIndex:b,timestamp:a.timestamp||new Date(c+1e3*d).toISOString(),elapsedSeconds:d,type:"assistant_reply",milestoneType:"reply",agentState:"typing",title:"Assistant Reply",summary:a.content.slice(0,90)+(a.content.length>90?"...":""),content:a.content,cumulativeTokens:l,cumulativeCost:m,activeTool:null})}});let l=f[f.length-1],m=l?l.elapsedSeconds+2:5;f.push({stepIndex:g++,timestamp:new Date().toISOString(),elapsedSeconds:m,type:"finish",milestoneType:"finish",agentState:"done",title:"Session Completed",summary:`Completed ${c.length} turns • ${f.length} events`,content:"All tasks completed as instructed.",cumulativeTokens:h+i+j,cumulativeCost:eM({input:h,output:i,cached:j},d),activeTool:null});let n=h+i+j,o=eM({input:h,output:i,cached:j},d);return{sessionInfo:{id:b.id||"session",cli:e,model:d,cwd:b.cwd||"",startedAt:b.startedAt,turnsCount:c.length,totalSteps:f.length},keyframes:f,totalElapsedSeconds:m,totalTokens:n,totalCost:o}}(d);j(e),c(a),l(0)}catch(a){console.error("[useSessionReplay] Load error:",a),g(a.message||"Failed to load session data")}finally{e(!1)}}},[]);(0,i.useEffect)(()=>{a&&s(a)},[a,s]);let{keyframes:t,totalElapsedSeconds:u,sessionInfo:v,totalTokens:w,totalCost:x}=h,y=t.length,z=(0,i.useMemo)(()=>{if(0===t.length)return null;let a=Math.min(Math.max(0,k),t.length-1);return t[a]},[t,k]),A=z?z.elapsedSeconds:0,B=u>0?A/u:0,C=(0,i.useCallback)(a=>{l(b=>Math.min(Math.max(0,a),y-1))},[y]),D=(0,i.useCallback)(a=>{if(0===t.length)return;let b=Math.min(Math.max(0,a),1)*u,c=0,d=1/0;t.forEach((a,e)=>{let f=Math.abs(a.elapsedSeconds-b);f<d&&(d=f,c=e)}),C(c)},[t,u,C]),E=(0,i.useCallback)(()=>{C(k+1)},[k,C]),F=(0,i.useCallback)(()=>{C(k-1)},[k,C]),G=(0,i.useCallback)(()=>{k>=y-1&&l(0),n(!0),r.current=performance.now()},[k,y]),H=(0,i.useCallback)(()=>{n(!1),q.current&&cancelAnimationFrame(q.current)},[]),I=(0,i.useCallback)(()=>{m?H():G()},[m,G,H]),J=(0,i.useCallback)(()=>{H(),l(0)},[H]);return(0,i.useEffect)(()=>{if(!m||0===t.length)return;let a=0,b=1200/o,c=d=>{r.current||(r.current=d);let e=d-r.current;r.current=d,(a+=e)>=b&&(a=0,l(a=>a>=y-1?(n(!1),a):a+1)),q.current=requestAnimationFrame(c)};return r.current=performance.now(),q.current=requestAnimationFrame(c),()=>{q.current&&cancelAnimationFrame(q.current)}},[m,t.length,y,o]),{sessionId:b,loading:d,error:f,sessionInfo:v,keyframes:t,totalSteps:y,currentStepIndex:k,currentKeyframe:z,currentTime:A,totalElapsedSeconds:u,progress:B,isPlaying:m,playbackSpeed:o,totalTokens:w,totalCost:x,loadSession:s,play:G,pause:H,togglePlay:I,seekToStep:C,seekToProgress:D,stepForward:E,stepBackward:F,setPlaybackSpeed:p,reset:J}}(Q),T=(0,i.useCallback)(b=>{let c=b||x||a[0]?.connectionId||a[0]?.traceId||"default-session";R(c),y(c),A("canvas")},[x,a]),U=(0,i.useCallback)(()=>{R(null)},[]),[V,W]=(0,i.useState)(()=>[{id:"canvas",title:"Virtual Office",type:"canvas",closable:!1}]);(0,i.useEffect)(()=>{(0,dl.p)();let a={...e4};u(a),a.activeEditorTab&&A(a.activeEditorTab),a.openedTabs&&Array.isArray(a.openedTabs)&&a.openedTabs.length>0&&W(a.openedTabs),w(!0)},[]),(0,i.useEffect)(()=>{},[t,v]),(0,i.useEffect)(()=>{},[z]);let X=(0,i.useMemo)(()=>Q&&S.currentKeyframe?function(a,b={}){if(!a)return null;let c=b.id||"replay-session",d=b.cli||"antigravity",e=b.model||"gemini-3.8-flash",f="app"===b.clientType,g="antigravity"===d?"Google":"Anthropic",h="mcp",i=(a.activeTool||a.details?.name||"").toLowerCase();i.includes("bash")||i.includes("command")||i.includes("terminal")||"run_command"===i?h="bash":i.includes("read")||i.includes("view")||"view_file"===i?h="read":i.includes("edit")||i.includes("write")||"replace_file_content"===i||"write_to_file"===i?h="edit":i.includes("search")||i.includes("grep")||i.includes("find")?h="search":i.includes("web")||i.includes("browse")||i.includes("url")?h="web":(i.includes("memory")||i.includes("remember")||i.includes("recall"))&&(h="memory");let j="streaming",k="streaming";"user_input"===a.type||"thought"===a.type?(j="pending",k="pending"):"finish"===a.type?(j="done",k="happy"):"error"===a.milestoneType&&(j="error",k="error");let l=a.activeTool?[{id:a.details?.id||"tool-0",tool:h,type:h,name:a.activeTool,status:a.details?.status||"completed"}]:[];return{connectionId:c,traceId:c,account:`${d.toUpperCase()}: ${c.slice(0,10)}`,model:e,provider:g,cli:d,clientType:f?"app":"cli",state:j,mode:k,isLooping:!1,tools:a.activeTool?[h]:[],toolCalls:l,activeTool:a.activeTool||null,tokens:{input:null,output:null,cached:null},totalTokens:a.cumulativeTokens??null,cost:a.cumulativeCost??null,elapsedMs:1e3*(a.elapsedSeconds||0),currentCommand:a.title||"",summary:a.summary||"",isReplay:!0,logs:[{id:`replay-log-${a.stepIndex}`,time:new Date(a.timestamp||Date.now()).toLocaleTimeString(),level:"error"===a.milestoneType?"error":"info",message:`[Replay #${a.stepIndex+1}] ${a.title}: ${a.summary}`}]}}(S.currentKeyframe,S.sessionInfo):null,[Q,S.currentKeyframe,S.sessionInfo]),Y=(0,i.useMemo)(()=>X?[X]:a,[X,a]),Z=(0,i.useMemo)(()=>X?dk(Y):b,[X,Y,b]),$=(0,i.useMemo)(()=>x?Z.workstations.find(a=>a.connectionId===x||a.traceId===x||a.traces?.[0]?.traceId===x)||Y.find(a=>a.connectionId===x||a.traceId===x||a.traces?.[0]?.traceId===x)||{connectionId:x,traceId:x,account:x.length>20?`${x.slice(0,16)}...`:x,model:S?.sessionInfo?.model||"AI Agent",provider:S?.sessionInfo?.provider||"antigravity"}:null,[Z.workstations,Y,x,S?.sessionInfo]),_=(0,i.useCallback)(a=>{a&&(y(a),u(a=>({...a,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"})))},[]),aa=(0,i.useCallback)(a=>{y(a),a&&u(a=>({...a,isRightSidebarVisible:!0}))},[]),ab=(0,i.useCallback)(a=>{if(!a)return;let b=`agent-${a.connectionId}`;W(c=>c.find(a=>a.id===b)?c:[...c,{id:b,title:a.account||`Desk #${a.deskIndex+1}`,type:"agent",agentData:a,closable:!0}]),A(b)},[]),ac=(0,i.useCallback)(a=>{W(b=>{let c=b.filter(b=>b.id!==a);return c.length>0?c:[{id:"canvas",title:"Virtual Office",type:"canvas",closable:!1}]}),A(b=>b===a?"canvas":b)},[]),ad=(0,i.useCallback)(()=>{W(a=>a.find(a=>"reports"===a.id)?a:[...a,{id:"reports",title:"Token Analytics",type:"reports",closable:!0}]),A("reports")},[]),ae=(0,i.useCallback)(()=>{W(a=>a.find(a=>"network"===a.id)?a:[...a,{id:"network",title:"Multi-Agent Graph",type:"network",closable:!0}]),A("network")},[]),af=(0,i.useCallback)(()=>{W(a=>a.find(a=>"store"===a.id)?a:[...a,{id:"store",title:"Supporter Store",type:"store",closable:!0}]),A("store")},[]),ag=(0,i.useCallback)(a=>{if(!a||!a.path)return;let b=`file-${a.path}`,c=a.name||a.path.split("/").pop();W(d=>d.find(a=>a.id===b)?d:[...d,{id:b,title:c,type:"file",filePath:a.path,closable:!0}]),A(b)},[]),ah=(0,i.useCallback)(()=>{u(a=>({...a,isLeftSidebarVisible:!0})),C("files")},[]);(0,i.useEffect)(()=>{let a=a=>{let b=navigator.platform.toUpperCase().indexOf("MAC")>=0?a.metaKey:a.ctrlKey;if(b&&a.shiftKey&&("p"===a.key||"P"===a.key)){a.preventDefault(),E(a=>!a);return}if(b&&!a.shiftKey&&!a.altKey&&("b"===a.key||"B"===a.key)){a.preventDefault(),u(a=>({...a,isLeftSidebarVisible:!a.isLeftSidebarVisible}));return}if(b&&("j"===a.key||"J"===a.key||"`"===a.key)){a.preventDefault(),u(a=>({...a,isBottomPanelVisible:!a.isBottomPanelVisible}));return}if(b&&a.altKey&&("b"===a.key||"B"===a.key)){a.preventDefault(),u(a=>({...a,isRightSidebarVisible:!a.isRightSidebarVisible}));return}if("Escape"===a.key&&N){a.preventDefault(),P(!1);return}if(a.shiftKey&&("f"===a.key||"F"===a.key)&&!b&&!a.altKey){let b=document.activeElement?.tagName?.toLowerCase();if("input"!==b&&"textarea"!==b){a.preventDefault(),P();return}}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[N,P]);let ai=(0,i.useCallback)(()=>{},[]),aj=(0,i.useMemo)(()=>V.find(a=>a.id===z)||V[0],[V,z]),ak=(0,i.useMemo)(()=>{if("telemetry"!==z)return"";let a=Y.length>30?Y.slice(-30):Y;try{return JSON.stringify(a,null,2)}catch{return"[]"}},[z,Y]);return(0,h.jsxs)("div",{className:"flex h-screen w-screen flex-col overflow-hidden bg-[#181818] text-[#cccccc] font-sans antialiased",children:[(0,h.jsx)(ba,{stats:b.stats,mode:c,mockPreset:d,onModeChange:e,onPresetChange:f,isRefreshing:n,onRefresh:o,soundEnabled:p,onToggleSound:q,notifEnabled:r,onToggleNotif:s,onOpenCommandPalette:()=>E(!0),onOpenReports:ad,onOpenStore:af,onOpenThemeSettings:()=>{K("themes"),I(!0)},isSupporter:L,layout:t,onToggleLeftSidebar:()=>u(a=>({...a,isLeftSidebarVisible:!a.isLeftSidebarVisible})),onToggleBottomPanel:()=>u(a=>({...a,isBottomPanelVisible:!a.isBottomPanelVisible})),onToggleRightSidebar:()=>u(a=>({...a,isRightSidebarVisible:!a.isRightSidebarVisible})),isZenFullscreen:N,onToggleZenFullscreen:P}),(0,h.jsxs)("div",{className:"flex flex-1 overflow-hidden relative",children:[(0,h.jsx)(bk,{activeView:t.activeActivityView,isLeftSidebarVisible:t.isLeftSidebarVisible,activeLeftSidebarTab:B,isRightSidebarVisible:t.isRightSidebarVisible,activeRightSidebarTab:t.activeRightSidebarTab||"chat",onOpenStore:af,onViewChange:a=>{"chat"===a?u(a=>{let b=a.isRightSidebarVisible&&"chat"===a.activeRightSidebarTab;return{...a,isRightSidebarVisible:!b,activeRightSidebarTab:"chat"}}):"files"===a?(u(a=>({...a,isLeftSidebarVisible:!a.isLeftSidebarVisible||"files"!==B,activeActivityView:"files"})),C("files")):"explorer"===a?(u(a=>({...a,isLeftSidebarVisible:!a.isLeftSidebarVisible||"agents"!==B,activeActivityView:"explorer"})),C("agents")):"office"===a?A("canvas"):"network"===a?ae():"reports"===a?ad():"telemetry"===a?(W(a=>a.find(a=>"telemetry"===a.id)?a:[...a,{id:"telemetry",title:"Live Telemetry",type:"telemetry",closable:!0}]),A("telemetry")):"store"===a?af():u(b=>({...b,activeActivityView:a,isLeftSidebarVisible:b.activeActivityView!==a||!b.isLeftSidebarVisible}))},agentCount:b.stats?.busy||0,isBottomPanelVisible:t.isBottomPanelVisible,onToggleBottomPanel:()=>u(a=>({...a,isBottomPanelVisible:!a.isBottomPanelVisible})),onOpenSettings:()=>{K("themes"),I(!0)}}),(0,h.jsxs)(aE,{orientation:"horizontal",className:"flex-1 h-full overflow-hidden",onLayoutChange:ai,children:[t.isLeftSidebarVisible&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(aF,{id:"left-sidebar-panel",defaultSize:"260px",minSize:"180px",maxSize:"450px",className:"overflow-hidden h-full",children:(0,h.jsx)(bC,{workstations:Z.workstations,selectedId:x,onSelectAgent:aa,onOpenAgentTab:ab,stats:Z.stats,onRefresh:o,onStartReplay:T,onViewConversation:_,onOpenFile:ag,onOpenStore:af,activeSidebarTab:B,onActiveSidebarTabChange:C})}),(0,h.jsx)(aJ,{className:"w-1 bg-[#181818] hover:bg-[#007acc] active:bg-[#007acc] transition-colors cursor-col-resize z-20 shrink-0"})]}),(0,h.jsx)(aF,{id:"center-main-panel",minSize:"350px",className:"overflow-hidden flex flex-col h-full bg-[#1e1e1e]",children:(0,h.jsxs)(aE,{orientation:"vertical",className:"h-full w-full overflow-hidden",onLayoutChange:ai,children:[(0,h.jsxs)(aF,{id:"editor-area-panel",minSize:"160px",className:"overflow-hidden flex flex-col h-full",children:[(0,h.jsx)(bF,{tabs:V,activeTabId:z,onSelectTab:A,onCloseTab:ac,isZenFullscreen:N,onToggleZenFullscreen:P}),(0,h.jsx)("div",{className:"flex-1 relative overflow-hidden bg-[#070b12]",children:Q?(0,h.jsx)(e3,{replay:S,onExit:U,onOpenConversation:_,children:(0,h.jsx)("div",{className:"absolute inset-0",children:"network"===z?(0,h.jsx)(dH,{traces:Y,selectedTraceId:x,onSelectTrace:a=>{y(a.traceId||a.connectionId),u(a=>({...a,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"}))}}):(0,h.jsx)(dF,{traces:Y,selectedId:x,onSelect:a=>aa(a),isZenFullscreen:N,onToggleZenFullscreen:P,soundEnabled:p,onToggleSound:q})})}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:`absolute inset-0 transition-opacity ${"canvas"===z?"opacity-100 z-10":"opacity-0 pointer-events-none z-0"} ${N?"!fixed !inset-0 !z-40 !w-screen !h-screen !rounded-none !border-none":""}`,children:(0,h.jsx)(dF,{traces:Y,selectedId:x,onSelect:a=>aa(a),isZenFullscreen:N,onToggleZenFullscreen:P,soundEnabled:p,onToggleSound:q})}),"telemetry"===z&&(0,h.jsxs)("div",{className:"absolute inset-0 p-4 overflow-auto font-mono text-xs bg-[var(--bg-editor)] text-[var(--text-main)]",children:[(0,h.jsxs)("div",{className:"mb-3 flex items-center justify-between pb-2 border-b border-[var(--border-subtle)]",children:[(0,h.jsx)("h3",{className:"font-bold text-sm text-[var(--accent-primary)]",children:"Realtime Telemetry Snapshots"}),(0,h.jsxs)("span",{className:"text-[var(--text-muted)]",children:[Y.length," active sessions",Y.length>30?" (latest 30)":""]})]}),(0,h.jsx)("pre",{className:"bg-[var(--bg-chat-code)] p-4 rounded border border-[var(--border-card)] text-[11px] text-[var(--text-chat-code)] leading-relaxed overflow-x-auto",children:ak})]}),aj?.type==="agent"&&(0,h.jsx)("div",{className:"absolute inset-0 p-4 overflow-auto bg-[var(--bg-editor)] text-[var(--text-main)]",children:(0,h.jsx)("div",{className:"max-w-3xl mx-auto space-y-4",children:(0,h.jsxs)("div",{className:"flex items-center justify-between p-4 bg-[var(--bg-card)] rounded-lg border border-[var(--border-card)]",children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("h2",{className:"text-base font-bold text-[var(--text-bright)]",children:aj.title}),(0,h.jsxs)("p",{className:"text-xs text-[var(--text-muted)]",children:["Connection ID: ",aj.agentData?.connectionId]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsxs)("button",{onClick:()=>T(aj.agentData?.connectionId),className:"px-3.5 py-1.5 bg-[var(--accent-primary)] hover:opacity-90 text-[var(--text-on-accent,#ffffff)] rounded text-xs font-semibold cursor-pointer flex items-center gap-1.5 shadow-sm",title:"Replay Session (Default)",children:[(0,h.jsx)(l.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{children:"Replay Session"})]}),(0,h.jsxs)("button",{onClick:()=>_(aj.agentData?.connectionId),className:"px-3.5 py-1.5 bg-[var(--bg-card-inner)] hover:bg-[var(--bg-hover)] border border-[var(--border-card)] text-[var(--text-main)] hover:text-[var(--text-bright)] rounded text-xs font-semibold cursor-pointer flex items-center gap-1.5",title:"Pin live chat transcript to Right Sidebar",children:[(0,h.jsx)(j.f,{className:"w-3.5 h-3.5 text-[var(--accent-secondary)]"}),(0,h.jsx)("span",{children:"Pin to Sidebar"})]}),(0,h.jsxs)("button",{onClick:()=>{(0,aK.f)(aj.agentData?.connectionId)},className:"px-3.5 py-1.5 bg-[var(--bg-card-inner)] hover:bg-[var(--bg-hover)] border border-[var(--border-card)] text-[var(--accent-primary)] hover:text-[var(--text-bright)] rounded text-xs font-semibold cursor-pointer flex items-center gap-1.5",title:"Open in Detached Window (VS Code style)",children:[(0,h.jsx)(k.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{children:"New Window"})]})]})]})})}),"reports"===z&&(0,h.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-[#181818] z-20",children:(0,h.jsx)(dI.f,{onClose:()=>ac("reports"),onStartReplay:T,onViewConversation:_})}),"network"===z&&(0,h.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-slate-950 z-20",children:(0,h.jsx)(dH,{traces:Y,selectedTraceId:x,onSelectTrace:a=>{y(a.traceId||a.connectionId),u(a=>({...a,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"}))}})}),aj?.type==="file"&&(0,h.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-[#1e1e1e] z-20",children:(0,h.jsx)(eB,{filePath:aj.filePath,onClose:()=>ac(z)})}),("store"===z||aj?.type==="store")&&(0,h.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-[#181818] z-20",children:(0,h.jsx)(eC.f,{hideHeader:!1,onClose:()=>ac("store")})})]})})]}),t.isBottomPanelVisible&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(aJ,{className:"h-1 bg-[#181818] hover:bg-[#007acc] active:bg-[#007acc] transition-colors cursor-row-resize z-20 shrink-0"}),(0,h.jsx)(aF,{id:"bottom-panel",defaultSize:"220px",minSize:"90px",maxSize:"600px",className:"overflow-hidden bg-[#181818]",children:(0,h.jsx)(bL,{traces:Y,activeTab:t.activeBottomTab,onTabChange:a=>u(b=>({...b,activeBottomTab:a})),onClose:()=>u(a=>({...a,isBottomPanelVisible:!1}))})})]})]})}),t.isRightSidebarVisible&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(aJ,{className:"w-1 bg-[#181818] hover:bg-[#007acc] active:bg-[#007acc] transition-colors cursor-col-resize z-20 shrink-0"}),(0,h.jsx)(aF,{id:"right-sidebar-panel",defaultSize:"360px",minSize:"260px",maxSize:"750px",className:"overflow-hidden h-full bg-[#252526]",children:(0,h.jsx)(bS,{selectedAgent:$,workstations:Z.workstations,activeTab:t.activeRightSidebarTab||"chat",onTabChange:a=>u(b=>({...b,activeRightSidebarTab:a})),onSelectAgent:aa,onClose:()=>u(a=>({...a,isRightSidebarVisible:!1})),onStartReplay:T})})]})]})]}),(0,h.jsx)(bV,{mode:c,connected:g,live:m,stats:Z.stats,selectedAgent:$,soundEnabled:p,isBottomOpen:t.isBottomPanelVisible,onToggleBottom:()=>u(a=>({...a,isBottomPanelVisible:!a.isBottomPanelVisible}))}),(0,h.jsx)(bZ,{isOpen:D,onClose:()=>E(!1),onToggleLeftSidebar:()=>u(a=>({...a,isLeftSidebarVisible:!a.isLeftSidebarVisible})),onToggleBottomPanel:()=>u(a=>({...a,isBottomPanelVisible:!a.isBottomPanelVisible})),onToggleRightSidebar:()=>u(a=>({...a,isRightSidebarVisible:!a.isRightSidebarVisible})),onToggleZenFullscreen:P,onOpenChatSidebar:()=>u(a=>({...a,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"})),onOpenFilesExplorer:ah,onOpenThemeSettings:()=>{K("themes"),I(!0)},onOpenFontSettings:()=>{K("fonts"),I(!0)},onToggleSound:q,onToggleNotif:s,onRefresh:o,onSetMode:e,onSelectPreset:f,onOpenReports:ad,onOpenStore:af,onStartReplay:T}),(0,h.jsx)(eH,{isOpen:F,onClose:()=>G(!1)}),(0,h.jsx)(eI,{isOpen:H,onClose:()=>I(!1),initialTab:J})]})}var e6=a.i(50636);function e7(){let[a,b]=(0,i.useState)(!1),[c,d]=(0,i.useState)(null);return((0,i.useEffect)(()=>{let a=null,c=async()=>{try{let c=await fetch("/api/version");if(c.ok){let e=await c.json();a?e.version&&e.version!==a&&(d(e.version),b(!0)):a=e.version}}catch{}};c();let e=setInterval(c,6e4);return()=>clearInterval(e)},[]),a)?(0,h.jsxs)("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 rounded-full border border-emerald-500/40 bg-slate-900/95 px-4 py-2 shadow-2xl backdrop-blur-md animate-in slide-in-from-bottom-4 duration-300",children:[(0,h.jsx)("span",{className:"flex h-2 w-2 rounded-full bg-emerald-400 animate-ping"}),(0,h.jsxs)("span",{className:"text-xs text-slate-200 flex items-center gap-1.5",children:[(0,h.jsx)(a_.f,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}),(0,h.jsxs)("span",{children:["New version available ",c?`(${c})`:""]})]}),(0,h.jsx)("button",{onClick:()=>{},className:"rounded-full bg-emerald-500 hover:bg-emerald-400 px-3 py-1 text-xs font-semibold text-slate-950 transition-colors shadow-sm",children:"Update now"}),(0,h.jsx)("button",{onClick:()=>b(!1),className:"text-slate-400 hover:text-slate-200 p-1 ml-1 rounded hover:bg-slate-800 transition-colors","aria-label":"Dismiss",children:(0,h.jsx)(bD.X,{className:"w-3.5 h-3.5"})})]}):null}var e8=a.i(67207),e9=a.i(73958);a.s(["default",0,function(){let[a,b]=(0,i.useState)("live"),[c,d]=(0,i.useState)("cases"),[e,f]=(0,i.useState)(!1),[g,j]=(0,i.useState)(!1);(0,i.useEffect)(()=>{f(!(0,e8.p)()),j((0,e9.p)())},[]);let{traces:k,connected:l,live:m,isRefreshing:n,refresh:o}=(0,e6.f)({mode:a,preset:c}),p=(0,i.useMemo)(()=>dk(k),[k]);return(0,h.jsxs)("main",{className:"h-screen w-screen overflow-hidden bg-[var(--bg-workbench)]",children:[(0,h.jsx)(e7,{}),(0,h.jsx)(e5,{traces:k,office:p,mode:a,mockPreset:c,onModeChange:a=>b(a),onPresetChange:a=>d(a),connected:l,live:m,isRefreshing:n,onRefresh:o,soundEnabled:e,onToggleSound:()=>{f((0,e8.Z)())},notifEnabled:g,onToggleNotif:()=>{j((0,e9.i)())}})]})}],85690)}];
|
|
1
|
+
module.exports=[85690,a=>{"use strict";let b,c,d,e;var f,g,h=a.i(87924),i=a.i(72131),j=a.i(28423),k=a.i(63359),l=a.i(33838);function m(a){let b=(0,i.useId)();return`${a??b}`}let n=i.useEffect;function o(a){let b=(0,i.useRef)(a);return n(()=>{b.current=a},[a]),(0,i.useCallback)((...a)=>b.current?.(...a),[b])}function p(...a){return o(b=>{a.forEach(a=>{if(a)switch(typeof a){case"function":a(b);break;case"object":a.current=b}})})}function q(a,b="Assertion error"){if(!a)throw Error(b)}(0,i.createContext)(null);class r{#a={};addListener(a,b){let c=this.#a[a];return void 0===c?this.#a[a]=[b]:c.includes(b)||c.push(b),()=>{this.removeListener(a,b)}}emit(a,b){let c=this.#a[a];if(void 0!==c)if(1===c.length)c[0].call(null,b);else{let a=!1,d=null,e=Array.from(c);for(let c=0;c<e.length;c++){let f=e[c];try{f.call(null,b)}catch(b){null===d&&(a=!0,d=b)}}if(a)throw d}}removeAllListeners(){this.#a={}}removeListener(a,b){let c=this.#a[a];if(void 0!==c){let a=c.indexOf(b);a>=0&&c.splice(a,1)}}}let s={cursorFlags:0,state:"inactive"},t=new r;function u(a){return t.addListener("change",a)}function v(a){let b=s;s=a,"active"===b.state&&"active"!==a.state&&b.didPointerMove&&b.hitRegions.forEach(({separator:a})=>{a&&a.element.ownerDocument.activeElement===a.element&&a.element.blur()}),t.emit("change",{prev:b,next:a})}let w=a=>a,x=()=>{};function y(){return void 0===c&&(c=!1),c}let z=new WeakMap;function A(a){if(!a.defaultView||!a.adoptedStyleSheets)return;let{prevStyle:b,styleSheet:c}=z.get(a)??{};void 0===c&&(c=new a.defaultView.CSSStyleSheet,a.adoptedStyleSheets&&(Object.isExtensible(a.adoptedStyleSheets)?a.adoptedStyleSheets.push(c):a.adoptedStyleSheets=[...a.adoptedStyleSheets,c]));let d=s;switch(d.state){case"active":case"hover":{let a=function({cursorFlags:a,axes:b,state:c}){let d=0,e=0;switch(c){case"active":case"hover":b.forEach(a=>{if(!a.mutableState.disableCursor)switch(a.orientation){case"horizontal":d++;break;case"vertical":e++}})}if(0!==d||0!==e){if("active"===c&&a&&y()){let b=(4&a)!=0,c=(8&a)!=0;if((1&a)!=0)return b?"se-resize":c?"ne-resize":"e-resize";if((2&a)!=0)return b?"sw-resize":c?"nw-resize":"w-resize";if(b)return"s-resize";if(c)return"n-resize"}return y()?d>0&&e>0?"move":d>0?"ew-resize":"ns-resize":d>0&&e>0?"grab":d>0?"col-resize":"row-resize"}}({cursorFlags:d.cursorFlags,axes:d.hitRegions.map(a=>a.axis),state:d.state}),e=`*, *:hover {cursor: ${a} !important; }`;if(b===e)return;b=e,a?0===c.cssRules.length?c.insertRule(e):c.replaceSync(e):1===c.cssRules.length&&c.deleteRule(0);break}case"inactive":b=void 0,1===c.cssRules.length&&c.deleteRule(0)}z.set(a,{prevStyle:b,styleSheet:c})}function B({axis:a}){let{layoutStrategy:b,orientation:c,items:d}=a;return b?b.calculateAvailableSize():d.reduce((a,b)=>a+="horizontal"===c?b.element.offsetWidth:b.element.offsetHeight,0)}function C(a,b){let c=a.compareDocumentPosition(b);return c&Node.DOCUMENT_POSITION_DISCONNECTED?0:c&Node.DOCUMENT_POSITION_FOLLOWING?-1:c&Node.DOCUMENT_POSITION_PRECEDING?1:0}function D(a,b){return Array.from(b).sort((b,c)=>{var d,e,f,g;let h,i,j="horizontal"===a?(d=b,e=c,0!=(h=d.element.offsetLeft-e.element.offsetLeft)?h:d.element.offsetWidth-e.element.offsetWidth):(f=b,g=c,0!=(i=f.element.offsetTop-g.element.offsetTop)?i:f.element.offsetHeight-g.element.offsetHeight);return 0!==j?j:C(b.element,c.element)})}function E(a){return null!==a&&"object"==typeof a&&"nodeType"in a&&a.nodeType===Node.ELEMENT_NODE}function F(a,b){return{x:a.x>=b.left&&a.x<=b.right?0:Math.min(Math.abs(a.x-b.left),Math.abs(a.x-b.right)),y:a.y>=b.top&&a.y<=b.bottom?0:Math.min(Math.abs(a.y-b.top),Math.abs(a.y-b.bottom))}}function G({expandHitTargets:a=!0,axis:c,includeDisabled:d=!1}){if(c.layoutStrategy)return c.layoutStrategy.calculateHitRegions({expandHitTargets:a,axis:c,includeDisabled:d});let{element:e,orientation:f,items:g,separators:h}=c,i=D(f,Array.from(e.children).filter(E).filter(a=>!a.hasAttribute("data-resize-preview")).map(a=>({element:a}))).map(({element:a})=>a),j=[],k=!1,l=!1,m=-1,n,o=-1,p=0,r,s=[];{let a=-1;for(let b of i)b.hasAttribute("data-panel")&&(a++,b.hasAttribute("data-disabled")||(p++,-1===m&&(m=a),o=a))}if(d||p>1){let e=-1;for(let p of i)if(p.hasAttribute("data-panel")){e++;let h=g.find(a=>a.element===p);if(h){if(r){let g,i=r.element.getBoundingClientRect(),t=p.getBoundingClientRect();if(l){let a="horizontal"===f?new DOMRect(i.right,i.top,0,i.height):new DOMRect(i.left,i.bottom,i.width,0),b="horizontal"===f?new DOMRect(t.left,t.top,0,t.height):new DOMRect(t.left,t.top,t.width,0);switch(s.length){case 0:g=[a,b];break;case 1:{let c=s[0],d=function({orientation:a,rects:b,targetRect:c}){let d={x:c.x+c.width/2,y:c.y+c.height/2},e,f=Number.MAX_VALUE;for(let c of b){let{x:b,y:g}=F(d,c),h="horizontal"===a?b:g;h<f&&(f=h,e=c)}return q(e,"No rect found"),e}({orientation:f,rects:[i,t],targetRect:c.element.getBoundingClientRect()});g=[c,d===i?b:a];break}default:g=s}}else g=s.length?s:["horizontal"===f?new DOMRect(i.right,t.top,t.left-i.right,t.height):new DOMRect(t.left,i.bottom,t.width,t.top-i.bottom)];for(let f of g){let g=function({expandHitTargets:a,axis:c,rect:d}){let e=a?(void 0===b&&(b="function"==typeof matchMedia&&!!matchMedia("(pointer:coarse)").matches),b)?c.resizeTargetMinimumSize.coarse:c.resizeTargetMinimumSize.fine:0;if(d.width<e){let a=e-d.width;d=new DOMRect(d.x-a/2,d.y,d.width+a,d.height)}if(d.height<e){let a=e-d.height;d=new DOMRect(d.x,d.y-a/2,d.width,d.height+a)}return d}({expandHitTargets:a,axis:c,rect:"width"in f?f:f.element.getBoundingClientRect()}),i=e<=m||e>o;!d&&(k||i)||(n??=B({axis:c}),j.push({axis:c,axisSize:n,items:[r,h],separator:"width"in f?void 0:f,rect:g})),k=!1}}l=!1,r=h,s=[]}}else if(p.hasAttribute("data-separator")){null!==p.ariaDisabled&&(k=!0);let a=h.find(a=>a.element===p);a?s.push(a):(r=void 0,s=[])}else l=!0}return j}function H({axisSize:a,itemElement:b,styleProp:c}){let d,[e,f]=function(a){switch(typeof a){case"number":return[a,"px"];case"string":{let b=parseFloat(a);return a.endsWith("%")?[b,"%"]:a.endsWith("px")?[b,"px"]:a.endsWith("rem")?[b,"rem"]:a.endsWith("em")?[b,"em"]:a.endsWith("vh")?[b,"vh"]:a.endsWith("vw")?[b,"vw"]:[b,"%"]}}}(c);switch(f){case"%":d=e/100*a;break;case"px":d=e;break;case"rem":d=e*parseFloat(getComputedStyle(b.ownerDocument.documentElement).fontSize);break;case"em":d=e*parseFloat(getComputedStyle(b).fontSize);break;case"vh":d=e/100*window.innerHeight;break;case"vw":d=e/100*window.innerWidth}return d}function I(a){return parseFloat(a.toFixed(3))}function J(a){let{items:b}=a,c=B({axis:a});return 0===c?b.map(a=>({groupResizeBehavior:a.constraintProps.groupResizeBehavior,collapsedSize:0,collapsible:!0===a.constraintProps.collapsible,defaultSize:void 0,disabled:a.constraintProps.disabled,minSize:0,maxSize:100,itemId:a.id})):b.map(a=>{let b,d,{element:e,constraintProps:f}=a,g=0;void 0!==f.collapsedSize&&(g=I(H({axisSize:c,itemElement:e,styleProp:f.collapsedSize})/c*100)),void 0!==f.collapsedThreshold&&(b=I(H({axisSize:c,itemElement:e,styleProp:f.collapsedThreshold})/c*100)),void 0!==f.defaultSize&&(d=I(H({axisSize:c,itemElement:e,styleProp:f.defaultSize})/c*100));let h=0;void 0!==f.minSize&&(h=I(H({axisSize:c,itemElement:e,styleProp:f.minSize})/c*100));let i=100;return void 0!==f.maxSize&&(i=I(H({axisSize:c,itemElement:e,styleProp:f.maxSize})/c*100)),{groupResizeBehavior:f.groupResizeBehavior,collapsedSize:g,collapsedThreshold:b,collapsible:!0===f.collapsible,defaultSize:d,disabled:f.disabled,minSize:h,maxSize:i,itemId:a.id}})}let K=new Map,L=new r;function M(a,b){for(let[b]of K)if(b.id===a)return b}function N(a,b){for(let[b,c]of K)if(b.id===a)return c;if(b)throw Error(`Could not find data for Group with id ${a}`)}function O(a,b){return L.addListener("axisChange",c=>{c.axis.id===a&&b(c)})}function P(a,b,c){let d=K.get(a);(K=new Map(K)).set(a,b),L.emit("axisChange",{axis:a,isUserInteraction:c?.isUserInteraction===!0,prev:d,next:b})}function Q(a,b,c=0){return Math.abs(I(a)-I(b))<=c}function R(a,b){return Q(a,b)?0:a>b?1:-1}function S({overrideDisabledItems:a,itemConstraints:b,prevSize:c,size:d}){let{collapsedSize:e=0,collapsedThreshold:f,collapsible:g,disabled:h,maxSize:i=100,minSize:j=0}=b;if(h&&!a)return c;if(0>R(d,j))if(g){let a=f??(j-e)/2,b=0>=R(c,e),g=R(d,b?e+a:j-a);d=0>=R(d,e)||g<0||void 0!==f&&b&&0===g?e:j}else d=j;return I(d=Math.min(i,d))}function T({delta:a,initialLayout:b,itemConstraints:c,pivotIndices:d,prevLayout:e,trigger:f}){if(Q(a,0))return b;let g="imperative-api"===f,h=c.map(({itemId:a})=>b[a]),i=c.map(({itemId:a})=>e[a]),j=[...h],[k,l]=d;q(null!=k,"Invalid first pivot index"),q(null!=l,"Invalid second pivot index");let m=0;if("keyboard"===f){{let b=a<0?l:k,d=c[b];q(d,`Panel constraints not found for index ${b}`);let{collapsedSize:e=0,collapsible:f,minSize:g=0}=d;if(f){let c=h[b];if(q(null!=c,`Previous layout not found for panel index ${b}`),Q(c,e)){let b=g-c;R(b,Math.abs(a))>0&&(a=a<0?0-b:b)}}}{let b=a<0?k:l,d=c[b];q(d,`No panel constraints found for index ${b}`);let{collapsedSize:e=0,collapsible:f,minSize:g=0}=d;if(f){let c=h[b];if(q(null!=c,`Previous layout not found for panel index ${b}`),Q(c,g)){let b=c-e;R(b,Math.abs(a))>0&&(a=a<0?0-b:b)}}}}else{let b=a<0?l:k,d=c[b];q(d,`Panel constraints not found for index ${b}`);let e=h[b],{collapsedSize:f,collapsedThreshold:g,collapsible:i,minSize:j}=d;if(i&&0>R(e,j)){let b=j-f;if(0>R(e+Math.abs(a),j)){let c=R(Math.abs(a),g??b/2),d=void 0===g&&a<0;a=c>0||0===c&&d?a<0?-b:b:0}}}{let b=a<0?1:-1,d=a<0?l:k,e=0;for(;;){let a=h[d];if(q(null!=a,`Previous layout not found for panel index ${d}`),e+=S({overrideDisabledItems:g,itemConstraints:c[d],prevSize:a,size:100})-a,(d+=b)<0||d>=c.length)break}let f=Math.min(Math.abs(a),Math.abs(e));a=a<0?0-f:f}{let b=a<0?k:l;for(;b>=0&&b<c.length;){let d=Math.abs(a)-Math.abs(m),e=h[b];q(null!=e,`Previous layout not found for panel index ${b}`);let f=e-d,i=S({overrideDisabledItems:g,itemConstraints:c[b],prevSize:e,size:f});if(!Q(e,i)&&(m+=e-i,j[b]=i,m.toFixed(3).localeCompare(Math.abs(a).toFixed(3),void 0,{numeric:!0})>=0))break;a<0?b--:b++}}if(function(a,b){if(a.length!==b.length)return!1;for(let c=0;c<a.length;c++)if(a[c]!=b[c])return!1;return!0}(i,j))return e;{let b=a<0?l:k,d=h[b];q(null!=d,`Previous layout not found for panel index ${b}`);let e=d+m,f=S({overrideDisabledItems:g,itemConstraints:c[b],prevSize:d,size:e});if(j[b]=f,!Q(f,e)){let b=e-f,d=a<0?l:k;for(;d>=0&&d<c.length;){let e=j[d];q(null!=e,`Previous layout not found for panel index ${d}`);let f=e+b,h=S({overrideDisabledItems:g,itemConstraints:c[d],prevSize:e,size:f});if(Q(e,h)||(b-=h-e,j[d]=h),Q(b,0))break;a>0?d--:d++}}}return Q(Object.values(j).reduce((a,b)=>b+a,0),100,.1)?j.reduce((a,b,d)=>(a[c[d].itemId]=b,a),{}):e}function U(a,b){if(Object.keys(a).length!==Object.keys(b).length)return!1;for(let c in a)if(void 0===b[c]||0!==R(a[c],b[c]))return!1;return!0}function V({commit:a,document:b,event:c,hitRegions:d,initialLayoutMap:e,mountedAxes:f,pointerDownAtPoint:g,prevCursorFlags:h}){let i=0,j=s,k="active"===j.state?j.previews:[],l=new Map("active"===j.state?j.previewLayoutMap:void 0);d.forEach(b=>{let{axis:d,axisSize:h}=b,{orientation:j,items:m}=d;if(a&&"separator"!==d.resizePreviewMode)return;let{disableCursor:n}=d.mutableState,o=0;o=g?"horizontal"===j?(c.clientX-g.x)/h*100:(c.clientY-g.y)/h*100:"horizontal"===j?c.clientX<0?-100:100:c.clientY<0?-100:100;let p=e.get(d),q=f.get(d);if(!p||!q)return;let{defaultLayoutDeferred:r,derivedItemConstraints:s,axisSize:t,layout:u,separatorToItems:v}=q;if(s&&u&&v){let c="separator"===d.resizePreviewMode?l.get(d)??u:u,e=T({delta:o,initialLayout:p,itemConstraints:s,pivotIndices:b.items.map(a=>m.indexOf(a)),prevLayout:c,trigger:"mouse-or-touch"});if("separator"===d.resizePreviewMode&&!a&&!U(e,c)){l.set(d,e);let a=0,b=m.map(b=>h/100*(a+=e[b.id]-p[b.id]));k=k.map(a=>{if(a.axis!==d)return a;let c=b[a.itemIndex];return c===a.offset?a:{...a,offset:c}})}if(U(e,c)&&0!==o&&!n)switch(j){case"horizontal":i|=o<0?1:2;break;case"vertical":i|=o<0?4:8}("separator"!==d.resizePreviewMode||a)&&!U(e,u)&&P(b.axis,{defaultLayoutDeferred:r,derivedItemConstraints:s,axisSize:t,layout:e,requestedAxisSize:t,requestedLayout:e,separatorToItems:v})}});let m=0;0===c.movementX?m|=3&h:m|=3&i,0===c.movementY?m|=12&h:m|=12&i;let n="active"===j.state&&(c.clientX!==j.pointerDownAtPoint.x||c.clientY!==j.pointerDownAtPoint.y);(function(a,b=[],c,d=!1){let e=s,f={...s};f.cursorFlags=a,"active"===f.state&&(f.didPointerMove||=d,f.previews=b,c&&(f.previewLayoutMap=c)),s=f,t.emit("change",{prev:e,next:f})})(m,k,l,n),A(b)}function W(a,b){let c=s,d=K,e=!1;return"active"===c.state&&(V({commit:!0,document:a,event:b,hitRegions:c.hitRegions,initialLayoutMap:c.initialLayoutMap,mountedAxes:d,pointerDownAtPoint:c.pointerDownAtPoint,prevCursorFlags:c.cursorFlags}),v({cursorFlags:0,state:"inactive"}),c.hitRegions.length>0&&(A(a),e=!0,c.hitRegions.forEach(a=>{if(!d.has(a.axis))return;let b=N(a.axis.id,!0);P(a.axis,b,{isUserInteraction:!0})}))),e}function X(a){a.defaultPrevented||W(a.currentTarget,a)}let Y=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Z(a){let b=a.length;for(;b--;){let c=a[b];if(q(c,"Missing node"),function(a){let b,c=getComputedStyle(a);return!!("fixed"===c.position||"auto"!==c.zIndex&&("static"!==c.position||"flex"===(b=getComputedStyle(aa(a)??a).display)||"inline-flex"===b)||1>+c.opacity||"transform"in c&&"none"!==c.transform||"webkitTransform"in c&&"none"!==c.webkitTransform||"mixBlendMode"in c&&"normal"!==c.mixBlendMode||"filter"in c&&"none"!==c.filter||"webkitFilter"in c&&"none"!==c.webkitFilter||"isolation"in c&&"isolate"===c.isolation||Y.test(c.willChange)||"touch"===c.webkitOverflowScrolling)}(c))return c}return null}function $(a){return a&&Number(getComputedStyle(a).zIndex)||0}function _(a){let b=[];for(;a;)b.push(a),a=aa(a);return b}function aa(a){let{parentNode:b}=a;return null!==b&&"object"==typeof b&&"nodeType"in b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}function ab(a,b){let c=[];return b.forEach((b,d)=>{if(d.disabled)return;let e=G({axis:d}),f=function(a,b,c){let d,e={x:1/0,y:1/0};for(let f of b){let b=F(c,f.rect);switch(a){case"horizontal":(b.x<e.x||b.x===e.x&&b.y<=e.y)&&(d=f,e=b);break;case"vertical":(b.y<e.y||b.y===e.y&&b.x<=e.x)&&(d=f,e=b)}}return d?{distance:e,hitRegion:d}:void 0}(d.orientation,e,{x:a.clientX,y:a.clientY});f&&f.distance.x<=0&&f.distance.y<=0&&function({axisElement:a,hitRegion:b,pointerEventTarget:c}){if(E(c)){let b=c.closest("dialog");if(b&&!b.contains(a)&&function(a){try{return a.matches(":modal")}catch{return!1}}(b))return!1}if(!E(c)||c.contains(a)||a.contains(c))return!0;if(function(a,b){let c;if(a===b)throw Error("Cannot compare node with itself");let d={a:_(a),b:_(b)};for(;d.a.at(-1)===d.b.at(-1);)c=d.a.pop(),d.b.pop();q(c,"Stacking order can only be calculated for elements with a common ancestor");let e={a:$(Z(d.a)),b:$(Z(d.b))};if(e.a===e.b){let a=c.childNodes,b={a:d.a.at(-1),b:d.b.at(-1)},e=a.length;for(;e--;){let c=a[e];if(c===b.a)return 1;if(c===b.b)return -1}}return Math.sign(e.a-e.b)}(c,a)>0){let e=c;for(;e;){var d;if(e.contains(a))break;if(d=e.getBoundingClientRect(),d.x<b.x+b.width&&d.x+d.width>b.x&&d.y<b.y+b.height&&d.y+d.height>b.y)return!1;e=e.parentElement}}return!0}({axisElement:d.element,hitRegion:f.hitRegion.rect,pointerEventTarget:a.target})&&c.push(f.hitRegion)}),c}function ac({layout:a,itemConstraints:b}){let c=b.map(({itemId:b})=>a[b]),d=[...c],e=d.reduce((a,b)=>a+b,0);if(Object.keys(a).length!==b.length)throw Error(`Invalid ${b.length} panel layout: ${Object.values(a).map(a=>`${a}%`).join(", ")}`);if(!Q(e,100)&&d.length>0)for(let a=0;a<b.length;a++){let b=d[a];q(null!=b,`No layout data found for index ${a}`);let c=100/e*b;d[a]=c}let f=0;for(let a=0;a<b.length;a++){let e=c[a];q(null!=e,`No layout data found for index ${a}`);let g=d[a];q(null!=g,`No layout data found for index ${a}`);let h=S({overrideDisabledItems:!0,itemConstraints:b[a],prevSize:e,size:g});g!=h&&(f+=g-h,d[a]=h)}if(!Q(f,0))for(let a=0;a<b.length;a++){let c=d[a];q(null!=c,`No layout data found for index ${a}`);let e=c+f,g=S({overrideDisabledItems:!0,itemConstraints:b[a],prevSize:c,size:e});if(c!==g&&(f-=g-c,d[a]=g,Q(f,0)))break}return d.reduce((a,c,d)=>(a[b[d].itemId]=c,a),{})}function ad({axisId:a,itemId:b}){let c=()=>{for(let[b,{defaultLayoutDeferred:c,derivedItemConstraints:d,layout:e,axisSize:f,separatorToItems:g}]of K)if(b.id===a)return{defaultLayoutDeferred:c,derivedItemConstraints:d,axis:b,axisSize:f,layout:e,separatorToItems:g};throw Error(`Group ${a} not found`)},d=()=>{let a=c().derivedItemConstraints.find(a=>a.itemId===b);if(void 0!==a)return a;throw Error(`Panel constraints not found for Panel ${b}`)},e=()=>{let a=c().axis.items.find(a=>a.id===b);if(void 0!==a)return a;throw Error(`Layout not found for Panel ${b}`)},f=()=>{let a=c().layout[b];if(void 0!==a)return a;throw Error(`Layout not found for Panel ${b}`)},g=a=>{if(a===f())return;let{defaultLayoutDeferred:d,derivedItemConstraints:e,axis:g,axisSize:h,layout:i,separatorToItems:j}=c(),k=ac({layout:(({nextSize:a,items:c,prevLayout:d,derivedItemConstraints:e})=>{let g=f(),h=c.findIndex(a=>a.id===b),i=0===h,j=h===c.length-1;if(j&&a<g&&(i||c.slice(0,h).every((a,b)=>{let c=e[b];return c?.collapsible&&Q(c.collapsedSize,d[c.itemId])}))){let a=c.slice(0,h).reduce((a,b)=>a+d[b.id],0);return{...d,[b]:I(100-a)}}return T({delta:j?g-a:a-g,initialLayout:d,itemConstraints:e,pivotIndices:j?[h-1,h]:[h,h+1],prevLayout:d,trigger:"imperative-api"})})({nextSize:a,items:g.items,prevLayout:i,derivedItemConstraints:e}),itemConstraints:e});U(i,k)||P(g,{defaultLayoutDeferred:d,derivedItemConstraints:e,axisSize:h,layout:k,requestedAxisSize:h,requestedLayout:k,separatorToItems:j})};return{collapse:()=>{let{collapsible:a,collapsedSize:b}=d(),{mutableValues:c}=e(),h=f();a&&h!==b&&(c.expandToSize=h,g(b))},expand:()=>{let{collapsible:a,collapsedSize:b,minSize:c}=d(),{mutableValues:h}=e(),i=f();if(a&&i===b){let a=h.expandToSize??c;0===a&&(a=1),g(a)}},getSize:()=>{let{axis:a}=c(),d=f(),{element:g}=e();return{asPercentage:d,inPixels:a.layoutStrategy?a.layoutStrategy.getItemSizeInPixels(b):"horizontal"===a.orientation?g.offsetWidth:g.offsetHeight}},isCollapsed:()=>{let{collapsible:a,collapsedSize:b}=d(),c=f();return a&&Q(b,c)},resize:a=>{let{axis:b}=c(),{element:d}=e(),f=B({axis:b});g(I(H({axisSize:f,itemElement:d,styleProp:a})/f*100))}}}function ae(a){a.defaultPrevented||ab(a,K).forEach(b=>{if(b.separator&&!b.separator.disableDoubleClick){let c=b.items.find(a=>void 0!==a.constraintProps.defaultSize);if(c){let d=c.constraintProps.defaultSize,e=ad({axisId:b.axis.id,itemId:c.id});e&&void 0!==d&&(e.resize(d),a.preventDefault())}}})}function af(a){for(let[b]of K)if(b.separators.some(b=>b.element===a))return b;throw Error("Could not find parent Group for separator element")}function ag({axisId:a}){let b=()=>{for(let[b,c]of K)if(b.id===a)return{axis:b,...c};throw Error(`Could not find Group with id "${a}"`)};return{getLayout(){let{defaultLayoutDeferred:a,layout:c}=b();return a?{}:c},setLayout(a){let{defaultLayoutDeferred:c,derivedItemConstraints:d,axis:e,axisSize:f,layout:g,separatorToItems:h}=b(),i=ac({layout:a,itemConstraints:d});return c?g:(U(g,i)||P(e,{defaultLayoutDeferred:c,derivedItemConstraints:d,axisSize:f,layout:i,requestedAxisSize:f,requestedLayout:i,separatorToItems:h}),i)}}}function ah(a,b){let c=af(a),d=N(c.id,!0),e=c.separators.find(b=>b.element===a);q(e,"Matching separator not found");let f=d.separatorToItems.get(e);q(f,"Matching panels not found");let g=f.map(a=>c.items.indexOf(a)),h=ag({axisId:c.id}).getLayout(),i=ac({layout:T({delta:b,initialLayout:h,itemConstraints:d.derivedItemConstraints,pivotIndices:g,prevLayout:h,trigger:"keyboard"}),itemConstraints:d.derivedItemConstraints});U(h,i)||P(c,{defaultLayoutDeferred:d.defaultLayoutDeferred,derivedItemConstraints:d.derivedItemConstraints,axisSize:d.axisSize,layout:i,requestedAxisSize:d.axisSize,requestedLayout:i,separatorToItems:d.separatorToItems},{isUserInteraction:!0})}function ai(a){if(a.defaultPrevented)return;let b=a.currentTarget,c=af(b);if(!(c.disabled||c.separators.find(a=>a.element===b)?.disabled))switch(a.key){case"ArrowDown":a.preventDefault(),"vertical"===c.orientation&&ah(b,5);break;case"ArrowLeft":a.preventDefault(),"horizontal"===c.orientation&&ah(b,-5);break;case"ArrowRight":a.preventDefault(),"horizontal"===c.orientation&&ah(b,5);break;case"ArrowUp":a.preventDefault(),"vertical"===c.orientation&&ah(b,-5);break;case"End":a.preventDefault(),ah(b,100);break;case"Enter":{a.preventDefault();let{derivedItemConstraints:d,layout:e,separatorToItems:f}=N(c.id,!0),g=c.separators.find(a=>a.element===b);q(g,"Matching separator not found");let h=f.get(g);q(h,"Matching panels not found");let i=h[0],j=d.find(a=>a.itemId===i.id);if(q(j,"Panel metadata not found"),j.collapsible){let a=e[i.id];ah(b,(j.collapsedSize===a?c.mutableState.expandedItemSizes[i.id]??j.minSize:j.collapsedSize)-a)}break}case"F6":{a.preventDefault();let b=c.separators.map(a=>a.element),d=Array.from(b).findIndex(b=>b===a.currentTarget);q(null!==d,"Index not found");let e=a.shiftKey?d>0?d-1:b.length-1:d+1<b.length?d+1:0;b[e].focus({preventScroll:!0});break}case"Home":a.preventDefault(),ah(b,-100)}}function aj(a){let b=s;if("active"!==b.state)return!1;let c=K;return b.previewLayoutMap.forEach((a,b)=>{let d=c.get(b);"separator"===b.resizePreviewMode&&d&&!U(a,d.layout)&&P(b,{...d,layout:a,requestedAxisSize:d.axisSize,requestedLayout:a})}),v({cursorFlags:0,state:"inactive"}),b.hitRegions.forEach(a=>{if(!c.has(a.axis))return;let b=N(a.axis.id,!0);P(a.axis,b,{isUserInteraction:!0})}),A(a),!0}function ak(a){let b=s;if("active"!==b.state)return;let c=b.hitRegions.flatMap(({separator:a})=>a?[a.element]:[]);!c.some(b=>b===a.target)||c.some(b=>b.hasPointerCapture?.(a.pointerId))||aj(a.currentTarget)}function al(a){aj(a.currentTarget)}function am(a){if(a.defaultPrevented||"mouse"===a.pointerType&&a.button>0)return;let b=K,c=ab(a,b);if(0===c.length)return;let d=new Map,e=!1;c.forEach(a=>{a.separator&&(e||(e=!0,a.separator.element.focus({focusVisible:!1,preventScroll:!0})));let c=b.get(a.axis);c&&d.set(a.axis,c.layout)});let f=Array.from(d.keys()).flatMap(a=>"separator"===a.resizePreviewMode?function(a,b){let{element:c,orientation:d,items:e}=a,f=c.getBoundingClientRect(),g="horizontal"===d;return G({expandHitTargets:!1,axis:a,includeDisabled:!0}).map(({items:d,rect:h,separator:i},j)=>{let k=e.indexOf(d[0]),l=g?h.left+h.width/2:h.top+h.height/2;return{active:b.some(b=>b.axis===a&&b.items[0]===d[0]&&(i||b.separator?b.separator===i:Q(l,g?b.rect.left+b.rect.width/2:b.rect.top+b.rect.height/2))),axis:a,key:i?`separator-${i.id}`:`panel-${d[0].id}-${j}`,offset:0,itemIndex:k,rect:new DOMRect((g&&!i?l:h.left)-f.left-c.clientLeft+c.scrollLeft,(!g&&!i?l:h.top)-f.top-c.clientTop+c.scrollTop,g&&!i?0:h.width,!g&&!i?0:h.height),separator:i}})}(a,c):[]);v({cursorFlags:0,didPointerMove:!1,hitRegions:c,initialLayoutMap:d,pointerDownAtPoint:{x:a.clientX,y:a.clientY},previewLayoutMap:new Map(d),previews:f,state:"active"}),a.preventDefault()}function an(a){let b=K,c=s;"active"===c.state&&V({commit:!1,document:a.currentTarget,event:a,hitRegions:c.hitRegions,initialLayoutMap:c.initialLayoutMap,mountedAxes:b,prevCursorFlags:c.cursorFlags})}function ao(a){if(a.defaultPrevented)return;let b=s,c=K;if("active"===b.state){if(0===a.buttons)return void aj(a.currentTarget);for(let c of b.hitRegions)if(c.separator){let{element:b}=c.separator;b.isConnected&&!b.hasPointerCapture?.(a.pointerId)&&b.setPointerCapture?.(a.pointerId)}V({commit:!1,document:a.currentTarget,event:a,hitRegions:b.hitRegions,initialLayoutMap:b.initialLayoutMap,mountedAxes:c,pointerDownAtPoint:b.pointerDownAtPoint,prevCursorFlags:b.cursorFlags})}else{let d=ab(a,c);0===d.length?"inactive"!==b.state&&v({cursorFlags:0,state:"inactive"}):v({cursorFlags:0,hitRegions:d,state:"hover"}),A(a.currentTarget)}}function ap(a){a.relatedTarget instanceof HTMLIFrameElement&&"hover"===s.state&&v({cursorFlags:0,state:"inactive"})}function aq(a){a.defaultPrevented||("mouse"!==a.pointerType||!(a.button>0))&&W(a.currentTarget,a)&&a.preventDefault()}function ar(a){a.target===a.currentTarget&&aj(a.currentTarget.document)}function as({axis:a,itemConstraints:b}){let c=a.items.map(({id:a})=>a).join(","),d=a.mutableState.defaultLayout;return a.mutableState.layouts[c]??(d&&function(a,b){let c=a.map(a=>a.id),d=Object.keys(b);if(c.length!==d.length)return!1;for(let a of c)if(!d.includes(a))return!1;return!0}(a.items,d)?d:function(a){let b=0,c=0,d={};for(let e of a)if(void 0!==e.defaultSize){b++;let a=I(e.defaultSize);c+=a,d[e.itemId]=a}else d[e.itemId]=void 0;let e=a.length-b;if(0!==e){let b=I((100-c)/e);for(let c of a)void 0===c.defaultSize&&(d[c.itemId]=b)}return d}(b))}function at({itemIds:a,layout:b}){return ac({layout:b,itemConstraints:a.map(a=>({collapsedSize:0,collapsible:!1,defaultSize:void 0,disabled:void 0,itemId:a,maxSize:100,minSize:0}))})}function au(a,b){if(Object.keys(a).length!==Object.keys(b).length)return!1;for(let c in a)if(a[c]!==b[c])return!1;return!0}let av=new Map;function aw(a){let b=(0,i.useRef)({...a});return n(()=>{for(let c in a)b.current[c]=a[c]},[a]),b.current}let ax=(0,i.createContext)(null);function ay({attributes:a,axisId:b,axisOrientation:c,children:d,className:e,disableCursor:f,disabled:g,disableDoubleClick:j,elementRef:k,id:l,isSharedHitRegion:m,preview:o,registerSeparator:q,requiredStyle:r,style:t,styleDefaults:w,tabIndex:x=0,updateSeparatorProps:y}){let z,A,B=aw({disabled:g,disableDoubleClick:j,children:d,className:e,preview:o,style:t}),[C,D]=(0,i.useState)({}),[E,F]=(0,i.useState)("inactive"),[G,H]=(0,i.useState)(!1),I=(0,i.useRef)(null),J=(0,i.useRef)(null),K=p(I,k);return n(()=>{let a=I.current;if(null!==a){let c={disabled:B.disabled,disableDoubleClick:B.disableDoubleClick,element:a,id:l,get children(){return B.children},get className(){return B.className},get preview(){return B.preview},get style(){return B.style}};J.current=c;let d=q(c),e=u(a=>{F("inactive"!==a.next.state&&a.next.hitRegions.some(a=>a.separator===c||(m?.(a)??!1))?a.next.state:"inactive")}),f=O(b,a=>{let{derivedItemConstraints:b,layout:d,separatorToItems:e}=a.next,f=e.get(c);if(f){let c=f[0],e=b.findIndex(a=>a.itemId===c.id),{layoutStrategy:g}=a.axis;D({...function({layout:a,itemConstraints:b,itemId:c,itemIndex:d}){let e,f,g=a[c],h=b.find(a=>a.itemId===c);if(h){let i=h.maxSize,j=h.collapsible?h.collapsedSize:h.minSize,k=[d,d+1];f=ac({layout:T({delta:j-g,initialLayout:a,itemConstraints:b,pivotIndices:k,prevLayout:a}),itemConstraints:b})[c],e=ac({layout:T({delta:i-g,initialLayout:a,itemConstraints:b,pivotIndices:k,prevLayout:a}),itemConstraints:b})[c]}return{valueControls:c,valueMax:e,valueMin:f,valueNow:g}}({layout:d,itemConstraints:b,itemId:c.id,itemIndex:e}),...g?.getItemAriaControls&&{valueControls:g.getItemAriaControls(c.id)}})}});return()=>{J.current=null,e(),f(),d()}}},[b,l,m,q,B]),n(()=>{let a=J.current;a&&"active"===s.state&&s.previews.some(b=>b.separator===a)&&v({...s,previews:s.previews.map(b=>b.separator===a?{...b}:b)})},[o]),(0,i.useEffect)(()=>{y(l,{disabled:g,disableDoubleClick:j})},[g,j,l,y]),g&&!f&&(z="not-allowed"),A=g?"disabled":"active"===E?"active":G?"focus":E,(0,h.jsx)("div",{...a,"aria-controls":C.valueControls,"aria-disabled":g||void 0,"aria-orientation":"horizontal"===c?"vertical":"horizontal","aria-valuemax":C.valueMax,"aria-valuemin":C.valueMin,"aria-valuenow":C.valueNow,children:d,className:e,"data-separator":A,"data-testid":l,id:l,onBlur:()=>H(!1),onFocus:()=>H(!0),ref:K,role:"separator",style:{...w,cursor:z,...t,...r,touchAction:"none"},tabIndex:g?void 0:x})}function az({separator:a}){let{element:b}=a,c=(0,i.useRef)(null);return n(()=>{let a=b.cloneNode(!0),d=[b,...b.querySelectorAll("*")],e=[a,...a.querySelectorAll("*")],f=b.ownerDocument.defaultView;return d.forEach((a,b)=>{let c=e[b];if(c instanceof f.HTMLElement||c instanceof f.SVGElement){let b=f.getComputedStyle(a);for(let a=0;a<b.length;a++){let d=b.item(a);c.style.setProperty(d,b.getPropertyValue(d))}}c.removeAttribute("data-testid"),c.removeAttribute("id")}),Object.assign(a.style,{boxSizing:"border-box",height:"100%",margin:"0",position:"static",transform:"none",width:"100%"}),c.current.appendChild(a),()=>a.remove()},[b]),(0,h.jsx)("div",{ref:c,style:{height:"100%",opacity:.65,pointerEvents:"none",width:"100%"}})}function aA(){let a=(0,i.useContext)(ax);return q(a,"Group Context not found; did you render a Panel or Separator outside of a Group?"),a}function aB(a){let{registerOverlay:b}=aA(),c=(0,i.useRef)(a);au(c.current,a)||(c.current=a);let d=c.current;return n(()=>b(d),[b,d]),null}function aC({active:a,orientation:b,style:c,...d}){let e;switch(b){case"horizontal":e={height:"100%",minWidth:"1px"};break;case"vertical":e={minHeight:"1px",width:"100%"}}return(0,h.jsx)("div",{...d,"data-separator-overlay":a?"active":"inactive",style:{...e,...c,flexShrink:0,pointerEvents:"none"}})}function aD({overlay:a,preview:b}){let{axis:c,offset:d,rect:e,separator:f}=b,g="horizontal"===c.orientation,j=f?.preview,k=a;return(0,i.isValidElement)(j)&&j.type===aB&&(k=j.props,j=void 0),null==j&&(k?j=(0,h.jsx)(aC,{...k,active:b.active,orientation:c.orientation}):f&&(j=(0,h.jsx)(az,{separator:f}))),(0,h.jsx)("div",{"aria-hidden":"true","data-resize-preview":!0,inert:!0,style:{height:e.height,left:e.left,pointerEvents:"none",position:"absolute",top:e.top,transform:g?`translateX(${d}px)`:`translateY(${d}px)`,width:e.width},children:j})}function aE({children:a,className:b,defaultLayout:c,disableCursor:d,disabled:e,elementRef:f,groupRef:g,id:j,onLayoutChange:k,onLayoutChanged:l,orientation:r="horizontal",resizePreviewMode:t="panel",resizeTargetMinimumSize:x={coarse:20,fine:10},style:y,...z}){let E,F=(0,i.useRef)({onLayoutChange:{},onLayoutChanged:{}}),H=o(a=>{U(F.current.onLayoutChange,a)||(F.current.onLayoutChange=a,k?.(a))}),L=o((a,b,c)=>{U(F.current.onLayoutChanged,a)||(F.current.onLayoutChanged=a,l?.(a,{isUserInteraction:b,requestedLayout:c}))}),R=m(j),[S,T]=(0,i.useState)(),V=function({groupId:a,resizePreviewMode:b}){let[c,d]=(0,i.useState)([]),e=(0,i.useRef)(c);return n(()=>{let c=c=>{let f=M(a),g="separator"===b&&"active"===c.state?c.previews.filter(a=>a.axis===f&&(a.active||!Q(a.offset,0))):[],h=e.current;h.length===g.length&&g.every((a,b)=>a===h[b])||(e.current=g,d(g))};if("separator"!==b)return void c(s);let f=u(({next:a})=>c(a));return c(s),f},[a,b]),c}({groupId:R,resizePreviewMode:t}),W=(0,i.useRef)(null),[Y,Z]=function(){let[a,b]=(0,i.useState)({});return[a,(0,i.useCallback)(()=>b({}),[])]}(),$=(0,i.useRef)([]),_=(0,i.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),aa=p(W,f);E=(0,i.useRef)({getLayout:()=>({}),setLayout:w}),(0,i.useImperativeHandle)(g,()=>E.current,[]),n(()=>{Object.assign(E.current,ag({axisId:R}))});let ab=o((a,b)=>{let d=N(a);return d?{flexGrow:d.layout[b]??1}:c?.[b]?{flexGrow:c?.[b]}:void 0}),ad=aw({defaultLayout:c,disableCursor:d,resizeTargetMinimumSize:x}),af=(0,i.useMemo)(()=>({get disableCursor(){return!!ad.disableCursor},getPanelStyles:ab,id:R,orientation:r,registerPanel:a=>{let b=_.current;return b.panels=D(r,[...b.panels,a]),Z(),()=>{b.panels=b.panels.filter(b=>b!==a),Z()}},registerOverlay:a=>(T(a),()=>{T(void 0)}),registerSeparator:a=>{let b=_.current;return b.separators=D(r,[...b.separators,a]),Z(),()=>{b.separators=b.separators.filter(b=>b!==a),Z()}},updatePanelProps:(a,{disabled:b})=>{let c=_.current.panels.find(b=>b.id===a);c&&(c.constraintProps.disabled=b);let d=M(R),e=N(R);d&&e&&P(d,{...e,derivedItemConstraints:J(d)})},updateSeparatorProps:(a,{disabled:b,disableDoubleClick:c})=>{let d=_.current.separators.find(b=>b.id===a);d&&(d.disabled=b,d.disableDoubleClick=c)}}),[ab,R,Z,r,ad]),ah=(0,i.useRef)(null);return n(()=>{var a;let b,c,d,f,g,h,i,j,k,l,m,n,o,p=W.current;if(null===p)return;let u=_.current;if(u.panels=D(r,u.panels),u.separators=D(r,u.separators),$.current=Array.from([...u.panels.map(({element:a})=>a),...u.separators.map(({element:a})=>a)]).sort(C),void 0!==ad.defaultLayout&&Object.keys(ad.defaultLayout).length===u.panels.length)for(let a of(o={},u.panels)){let b=ad.defaultLayout[a.id];void 0!==b&&(o[a.id]=b)}let w={disabled:!!e,element:p,id:R,mutableState:{defaultLayout:o,disableCursor:!!ad.disableCursor,expandedItemSizes:_.current.lastExpandedPanelSizes,layouts:_.current.layouts},orientation:r,items:u.panels,resizePreviewMode:t,get resizeTargetMinimumSize(){return ad.resizeTargetMinimumSize},separators:u.separators};ah.current=w;let x=(b=!0,q((a=w).element.ownerDocument.defaultView,"Cannot register an unmounted Group"),c=a.element.ownerDocument.defaultView.ResizeObserver,d=new Set,f=new Set,(g=new c(c=>{for(let d of c){let{borderBoxSize:c,target:e}=d;if(e===a.element){if(b){let b=B({axis:a});if(0===b)return;let c=N(a.id);if(!c)return;let d=J(a),e=c.requestedAxisSize,f=c.requestedLayout;c.defaultLayoutDeferred&&(e=b,f=at({itemIds:a.items.map(({id:a})=>a),layout:as({axis:a,itemConstraints:d})}));let g=ac({layout:function({axis:a,nextAxisSize:b,prevAxisSize:c,prevLayout:d}){if(c<=0||b<=0||c===b)return d;let e=0,f=0,g=!1,h=new Map,i=[];for(let j of a.items){let a=d[j.id]??0;if("preserve-pixel-size"===j.constraintProps.groupResizeBehavior){g=!0;let d=I(a/100*c/b*100);h.set(j.id,d),e+=d}else i.push(j.id),f+=a}if(!g||0===i.length)return d;let j=100-e,k={...d};if(h.forEach((a,b)=>{k[b]=a}),f>0)for(let a of i){let b=d[a]??0;k[a]=I(b/f*j)}else{let a=I(j/i.length);for(let b of i)k[b]=a}return k}({axis:a,nextAxisSize:b,prevAxisSize:e,prevLayout:f}),itemConstraints:d});if(!c.defaultLayoutDeferred&&U(c.layout,g)&&function(a,b){return a.length===b.length&&a.every((a,c)=>au(a,b[c]))}(c.derivedItemConstraints,d)&&c.axisSize===b)continue;P(a,{defaultLayoutDeferred:!1,derivedItemConstraints:d,axisSize:b,layout:g,requestedAxisSize:e,requestedLayout:f,separatorToItems:c.separatorToItems})}}else!function(a,b,c){if(!c[0])return;let d=a.items.find(a=>a.element===b);if(!d||!d.onResize)return;let e=B({axis:a}),f="horizontal"===a.orientation?d.element.offsetWidth:d.element.offsetHeight,g=d.mutableValues.prevSize,h={asPercentage:I(f/e*100),inPixels:f};d.mutableValues.prevSize=h,d.onResize(h,d.id,g)}(a,e,c)}})).observe(a.element),a.items.forEach(a=>{q(!d.has(a.id),`Panel ids must be unique; id "${a.id}" was used more than once`),d.add(a.id),a.onResize&&g.observe(a.element)}),h=B({axis:a}),i=J(a),k=ac({layout:j=as({axis:a,itemConstraints:i}),itemConstraints:i}),m=(l=a.element.ownerDocument).defaultView,av.set(l,(av.get(l)??0)+1),n=new Map,G({axis:a,includeDisabled:!0}).forEach(a=>{a.separator&&n.set(a.separator,a.items)}),P(a,{defaultLayoutDeferred:0===h,derivedItemConstraints:i,axisSize:h,layout:k,requestedAxisSize:h,requestedLayout:at({itemIds:a.items.map(({id:a})=>a),layout:j}),separatorToItems:n}),a.separators.forEach(a=>{q(!f.has(a.id),`Separator ids must be unique; id "${a.id}" was used more than once`),f.add(a.id),a.element.addEventListener("keydown",ai)}),1===av.get(l)&&(l.addEventListener("contextmenu",X,!0),l.addEventListener("dblclick",ae,!0),l.addEventListener("lostpointercapture",ak,!0),l.addEventListener("pointercancel",al,!0),l.addEventListener("pointerdown",am,!0),l.addEventListener("pointerleave",an),l.addEventListener("pointermove",ao),l.addEventListener("pointerout",ap),l.addEventListener("pointerup",aq,!0),m?.addEventListener("blur",ar)),function(){b=!1,av.set(l,Math.max(0,(av.get(l)??0)-1)),(K=new Map(K)).delete(a),function(a){if("inactive"===s.state)return!1;let b=s.hitRegions.filter(b=>b.axis!==a),c="active"===s.state&&s.previews.some(b=>b.axis===a);if(b.length===s.hitRegions.length&&!c)return!1;if(0===b.length)v({cursorFlags:0,state:"inactive"});else if("active"===s.state){let c=new Map(s.initialLayoutMap),d=new Map(s.previewLayoutMap);c.delete(a),d.delete(a),v({...s,cursorFlags:0,hitRegions:b,initialLayoutMap:c,previewLayoutMap:d,previews:s.previews.filter(b=>b.axis!==a)})}else v({...s,hitRegions:b});return!0}(a)&&A(l),a.separators.forEach(a=>{a.element.removeEventListener("keydown",ai)}),av.get(l)||(l.removeEventListener("contextmenu",X,!0),l.removeEventListener("dblclick",ae,!0),l.removeEventListener("lostpointercapture",ak,!0),l.removeEventListener("pointercancel",al,!0),l.removeEventListener("pointerdown",am,!0),l.removeEventListener("pointerleave",an),l.removeEventListener("pointermove",ao),l.removeEventListener("pointerout",ap),l.removeEventListener("pointerup",aq,!0),m?.removeEventListener("blur",ar)),g.disconnect()}),{defaultLayoutDeferred:y,derivedItemConstraints:z,layout:E,requestedLayout:F}=N(w.id,!0);!y&&z.length>0&&(H(E),L(E,!1,F));let M=O(R,a=>{let{defaultLayoutDeferred:b,derivedItemConstraints:c,layout:d,requestedLayout:e}=a.next;if(b||0===c.length)return;!function({derivedItemConstraints:a,axis:b,layout:c,prevLayout:d,requestedLayout:e}){let f=b.items.map(({id:a})=>a).join(",");b.mutableState.layouts[f]=e,d&&a.forEach(a=>{if(a.collapsible){let e=Q(a.collapsedSize,c[a.itemId]),f=Q(a.collapsedSize,d[a.itemId]);e&&!f&&(b.mutableState.expandedItemSizes[a.itemId]=d[a.itemId])}})}({derivedItemConstraints:c,axis:w,layout:d,prevLayout:a.prev?.layout,requestedLayout:e});let f=s,g="active"!==f.state||!f.hitRegions.some(a=>a.axis===w);H(d),g&&L(d,a.isUserInteraction,e)});return()=>{ah.current=null,x(),M()}},[e,R,L,H,r,Y,t,ad]),n(()=>{(function(a){for(let b=1;b<a.length;b++)if(C(a[b-1],a[b])>0)return!1;return!0})($.current)||Z()}),(0,i.useEffect)(()=>{let a=ah.current;a&&(a.mutableState.defaultLayout=c,a.mutableState.disableCursor=!!d)}),(0,h.jsx)(ax.Provider,{value:af,children:(0,h.jsxs)("div",{...z,className:b,"data-group":!0,"data-testid":R,id:R,ref:aa,style:{height:"100%",width:"100%",overflow:"hidden",position:"separator"===t?"relative":void 0,...y,display:"flex",flexDirection:"horizontal"===r?"row":"column",flexWrap:"nowrap",touchAction:"horizontal"===r?"pan-y":"pan-x"},children:[a,V.map(a=>(0,h.jsx)(aD,{overlay:S,preview:a},a.key))]})})}function aF({children:a,className:b,collapsedSize:c="0%",collapsedThreshold:d,collapsible:e=!1,defaultSize:f,disabled:g,elementRef:j,groupResizeBehavior:k="preserve-relative-size",id:l,maxSize:q="100%",minSize:r="0%",onResize:s,panelRef:t,style:u,...v}){let w,y=!!l,z=m(l),A=aw({disabled:g}),B=(0,i.useRef)(null),C=p(B,j),{getPanelStyles:D,id:E,orientation:F,registerPanel:G,updatePanelProps:H}=aA(),I=null!==s,J=o((a,b,c)=>{s?.(a,l,c)});n(()=>{let a=B.current;if(null!==a)return G({element:a,id:z,idIsStable:y,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:I?J:void 0,constraintProps:{groupResizeBehavior:k,collapsedSize:c,collapsedThreshold:d,collapsible:e,defaultSize:f,disabled:A.disabled,maxSize:q,minSize:r}})},[k,c,d,e,f,I,z,y,q,r,J,G,A]),(0,i.useEffect)(()=>{H(z,{disabled:g})},[g,z,H]),function(a,b){let{id:c}=aA(),d=(0,i.useRef)({collapse:x,expand:x,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:x});(0,i.useImperativeHandle)(b,()=>d.current,[]),n(()=>{Object.assign(d.current,ad({axisId:c,itemId:a}))})}(z,t);let K=()=>{let a=D(E,z);if(a)return JSON.stringify(a)},L=(0,i.useSyncExternalStore)(a=>O(E,a),K,K);return w=L?JSON.parse(L):void 0!==f?{flexGrow:void 0,flexShrink:void 0,flexBasis:f}:{flexGrow:1},(0,h.jsx)("div",{...v,"data-disabled":g||void 0,"data-panel":!0,"data-testid":z,id:z,ref:C,style:{...aG,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...w},children:(0,h.jsx)("div",{className:b,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...u,touchAction:"horizontal"===F?"pan-y":"pan-x"},children:a})})}aB.displayName="SeparatorOverlay",aE.displayName="Group",aF.displayName="Panel";let aG={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0},aH={flexBasis:"auto"},aI={flexGrow:0,flexShrink:0};function aJ({children:a,className:b,disabled:c,disableDoubleClick:d,elementRef:e,id:f,preview:g,style:i,...j}){let k=m(f),{disableCursor:l,id:n,orientation:o,registerSeparator:p,updateSeparatorProps:q}=aA();return(0,h.jsx)(ay,{attributes:j,axisId:n,axisOrientation:o,className:b,disableCursor:l,disabled:c,disableDoubleClick:d,elementRef:e,id:k,preview:g,registerSeparator:p,requiredStyle:aI,style:i,styleDefaults:aH,updateSeparatorProps:q,children:a})}aJ.displayName="Separator";var aK=a.i(45050),aL=a.i(82260),aM=a.i(33540),aN=a.i(48819),aO=a.i(2276),aP=a.i(64831);let aQ={name:"volume-x",size:24,node:[["path",{d:"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z",key:"1p7khw"}],["path",{d:"m16.5 14.5 5-5",key:"cul3yw"}],["path",{d:"m16.5 9.5 5 5",key:"1akey5"}]]};aQ.node;let aR=(0,aP.f)(aQ),aS={name:"bell",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]};aS.node;let aT=(0,aP.f)(aS),aU={name:"bell-off",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]};aU.node;let aV=(0,aP.f)(aU),aW={name:"radio",size:24,node:[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]};aW.node;let aX=(0,aP.f)(aW);var aY=a.i(83248),aZ=a.i(55699),a$=a.i(1195),a_=a.i(86708);let a0={name:"list-filter",size:24,node:[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]]};a0.node;let a1=(0,aP.f)(a0);var a2=a.i(8311);let a3={name:"panel-left",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],aliases:["sidebar"]};a3.node;let a4=(0,aP.f)(a3),a5={name:"panel-bottom",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]};a5.node;let a6=(0,aP.f)(a5),a7={name:"panel-right",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]};a7.node;let a8=(0,aP.f)(a7);var a9=a.i(86461),ba=a.i(73819);function bb({isLeftSidebarVisible:a,isBottomPanelVisible:b,isRightSidebarVisible:c,onToggleLeftSidebar:d,onToggleBottomPanel:e,onToggleRightSidebar:f,isZenFullscreen:g=!1,onToggleZenFullscreen:i=null}){let j=a=>`inline-flex items-center justify-center p-1 rounded transition-colors ${a?"bg-[#007acc]/20 border border-[#007acc]/50 text-[#4fc1ff]":"border border-transparent text-[#858585] hover:text-[#cccccc] hover:bg-[#2a2d2e]"}`;return(0,h.jsxs)("div",{"data-testid":"layout-toggles-group",className:"inline-flex items-center gap-0.5 bg-[#252526] p-0.5 rounded border border-[#333333]",children:[(0,h.jsx)("button",{type:"button","data-testid":"toggle-left-sidebar",title:"Toggle Primary Sidebar (Cmd+B / Ctrl+B)",onClick:d,className:j(a),children:(0,h.jsx)(a4,{className:"w-3.5 h-3.5"})}),(0,h.jsx)("button",{type:"button","data-testid":"toggle-bottom-panel",title:"Toggle Bottom Panel (Cmd+J / Ctrl+J)",onClick:e,className:j(b),children:(0,h.jsx)(a6,{className:"w-3.5 h-3.5"})}),(0,h.jsx)("button",{type:"button","data-testid":"toggle-right-sidebar",title:"Toggle Secondary Sidebar (Live Chat & Inspector - Cmd+Alt+B)",onClick:f,className:j(c),children:(0,h.jsx)(a8,{className:"w-3.5 h-3.5"})}),i&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:"w-[1px] h-3 bg-[#333333] my-auto mx-0.5"}),(0,h.jsx)("button",{type:"button","data-testid":"toggle-zen-fullscreen",title:g?"Thoát chế độ toàn màn hình Chill Mode (ESC)":"Chế độ Chill toàn màn hình Virtual Office (Shift+F / ESC để thoát)",onClick:i,className:`inline-flex items-center justify-center p-1 rounded transition-colors ${g?"bg-amber-500/20 border border-amber-500/50 text-amber-300 shadow-sm":"border border-transparent text-[#858585] hover:text-[#4fc1ff] hover:bg-[#2a2d2e]"}`,children:g?(0,h.jsx)(ba.f,{className:"w-3.5 h-3.5 text-amber-400"}):(0,h.jsx)(a9.f,{className:"w-3.5 h-3.5"})})]})]})}let bc=[{id:"showcase",label:"All Items Showcase (24)"},{id:"cases",label:"Edge Cases & Items (17)"},{id:"showcase_skins",label:"Skins & Outfits (15)"},{id:"showcase_props",label:"Tech Props & Gadgets (14)"},{id:"showcase_pets",label:"Pets & Companions (12)"},{id:"showcase_auras",label:"Particle Auras & VFX (12)"},{id:"showcase_trophies",label:"Trophies & Badges (12)"},{id:"storm",label:"Storm (30 Agents)"},{id:"busy",label:"Busy (8 Agents)"},{id:"idle",label:"Idle (2 Agents)"},{id:"errors",label:"Error States"}];function bd({stats:a={},traces:b=[],totalCount:c=0,top:d=20,onTopChange:e,timeframe:f="24h",onTimeframeChange:g,mode:i="live",mockPreset:j="cases",onModeChange:k,onPresetChange:l,isRefreshing:m=!1,onRefresh:n,soundEnabled:o=!1,onToggleSound:p,notifEnabled:q=!1,onToggleNotif:r,onOpenCommandPalette:s,onOpenReports:t,onOpenStore:u,onOpenThemeSettings:v,isSupporter:w=!1,layout:x,onToggleLeftSidebar:y,onToggleBottomPanel:z,onToggleRightSidebar:A,isZenFullscreen:B=!1,onToggleZenFullscreen:C=null}){return(0,h.jsxs)("header",{className:"h-[34px] min-h-[34px] bg-[#1e1e1e] border-b border-[#2b2b2b] flex items-center justify-between px-3 text-[#cccccc] text-xs select-none shrink-0 z-40",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-[200px]",children:[(0,h.jsx)("div",{className:"flex h-5 w-5 items-center justify-center rounded bg-gradient-to-br from-emerald-500 to-cyan-600 shadow-sm shadow-emerald-500/20",children:(0,h.jsx)(aL.f,{className:"w-3.5 h-3.5 text-white"})}),(0,h.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,h.jsx)("span",{className:"font-bold text-[#e1e1e1] tracking-wide text-[11px]",children:"AGMON"}),(0,h.jsx)("span",{className:"rounded bg-[#2d2d2d] px-1.5 py-0.2 text-[9px] font-medium text-slate-400 border border-[#3e3e42]",children:"v0.2.0"})]}),(0,h.jsxs)("div",{className:"hidden lg:flex items-center gap-1 bg-[#252526] px-1.5 py-0.5 rounded text-[10px] text-emerald-400 border border-[#333333]",children:[(0,h.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),(0,h.jsx)("span",{children:"Multi-Provider"})]})]}),(0,h.jsxs)("div",{onClick:s,title:"Search sessions or run commands (Cmd+Shift+P / Ctrl+Shift+P)",className:"flex items-center justify-between w-[320px] max-w-[35vw] h-6 bg-[#252526] border border-[#3e3e42] hover:border-[#007acc] rounded px-2 cursor-pointer transition-colors text-slate-400 group",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 overflow-hidden",children:[(0,h.jsx)(aM.f,{className:"w-3 h-3 text-slate-500 group-hover:text-slate-300 shrink-0"}),(0,h.jsx)("span",{className:"text-[11px] truncate",children:"Search agents, logs, commands..."})]}),(0,h.jsx)("kbd",{className:"hidden sm:inline-block text-[9px] font-mono bg-[#1e1e1e] border border-[#3e3e42] rounded px-1 text-slate-400",children:"Cmd+Shift+P"})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-[240px] justify-end",children:[(0,h.jsxs)("div",{onClick:t,title:"Click to view detailed Token & Cost Analytics",className:"hidden xl:flex items-center gap-1.5 bg-[#252526] hover:bg-[#2d2d2e] border border-[#333333] hover:border-[#007acc] px-2 py-0.5 rounded text-[11px] cursor-pointer transition-colors",children:[(0,h.jsx)("span",{className:"text-slate-400",children:"Desks:"}),(0,h.jsx)("span",{className:"font-bold text-slate-200",children:c>0&&b.length>0&&b.length<c?`${b.length}/${c}`:a?.agents??b.length??0}),(0,h.jsx)("span",{className:"text-slate-600",children:"|"}),(0,h.jsx)("span",{className:"text-slate-400",children:"Active:"}),(0,h.jsx)("span",{className:"font-bold text-cyan-400",children:a?.busy??0}),(0,h.jsx)("span",{className:"text-slate-600",children:"|"}),(0,h.jsx)("span",{className:"text-slate-400",children:"Tokens:"}),(0,h.jsx)("span",{className:"font-bold text-emerald-400",children:a?.tokensLabel??"0k"})]}),(0,h.jsxs)("div",{"data-testid":"telemetry-filter-controls",title:"Filter active conversations by quantity and time range",className:"flex items-center rounded bg-[#252526] border border-[#333333] px-1.5 py-0.5 text-[11px] text-slate-300 gap-1.5 shadow-sm",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1 text-slate-400",children:[(0,h.jsx)(a1,{className:"w-3 h-3 text-cyan-400 shrink-0"}),(0,h.jsx)("span",{className:"hidden 2xl:inline text-[10px] uppercase font-bold tracking-wider text-slate-400",children:"Filter"})]}),(0,h.jsxs)("select",{"data-testid":"filter-top-select","aria-label":"Filter Top Conversations",value:d,onChange:a=>e?.("all"===a.target.value?"all":Number(a.target.value)),className:"bg-transparent text-[11px] text-slate-200 outline-none cursor-pointer hover:text-white font-medium pr-0.5",children:[(0,h.jsx)("option",{value:10,className:"bg-[#1e1e1e] text-slate-200",children:"Top 10"}),(0,h.jsx)("option",{value:20,className:"bg-[#1e1e1e] text-slate-200",children:"Top 20"}),(0,h.jsx)("option",{value:30,className:"bg-[#1e1e1e] text-slate-200",children:"Top 30"}),(0,h.jsx)("option",{value:50,className:"bg-[#1e1e1e] text-slate-200",children:"Top 50"}),(0,h.jsx)("option",{value:"all",className:"bg-[#1e1e1e] text-slate-200",children:"All Desks"})]}),(0,h.jsx)("span",{className:"text-slate-600",children:"|"}),(0,h.jsxs)("div",{className:"flex items-center gap-1",children:[(0,h.jsx)(a2.f,{className:"w-3 h-3 text-amber-400 shrink-0"}),(0,h.jsxs)("select",{"data-testid":"filter-timeframe-select","aria-label":"Filter Time Range",value:f,onChange:a=>g?.(a.target.value),className:"bg-transparent text-[11px] text-slate-200 outline-none cursor-pointer hover:text-white font-medium",children:[(0,h.jsx)("option",{value:"1h",className:"bg-[#1e1e1e] text-slate-200",children:"1h"}),(0,h.jsx)("option",{value:"6h",className:"bg-[#1e1e1e] text-slate-200",children:"6h"}),(0,h.jsx)("option",{value:"24h",className:"bg-[#1e1e1e] text-slate-200",children:"24h"}),(0,h.jsx)("option",{value:"3d",className:"bg-[#1e1e1e] text-slate-200",children:"3d"}),(0,h.jsx)("option",{value:"7d",className:"bg-[#1e1e1e] text-slate-200",children:"7d"}),(0,h.jsx)("option",{value:"all",className:"bg-[#1e1e1e] text-slate-200",children:"All time"})]})]}),c>0&&b.length>0&&b.length<c&&(0,h.jsxs)("span",{title:`Showing ${b.length} of ${c} recorded conversations`,className:"hidden lg:inline-flex items-center px-1.5 py-0.2 rounded text-[10px] font-mono bg-cyan-950/60 text-cyan-300 border border-cyan-800/50",children:[b.length,"/",c]})]}),(0,h.jsxs)("button",{onClick:t,title:"Open Token & Cost Analytics",className:"flex items-center gap-1.5 px-2 py-0.5 rounded bg-[#252526] hover:bg-[#2e2e30] border border-[#333333] hover:border-[#007acc] text-slate-300 hover:text-white text-[11px] transition-colors",children:[(0,h.jsx)(aY.f,{className:"w-3 h-3 text-amber-400"}),(0,h.jsx)("span",{className:"hidden md:inline font-medium",children:"Reports"})]}),(0,h.jsxs)("button",{onClick:u,title:"Supporter Store: Skins, Pets, Ambience & Coffee",className:`flex items-center gap-1.5 px-2.5 py-0.5 rounded border text-[11px] transition-all cursor-pointer ${w?"bg-amber-500/20 border-amber-500/50 text-amber-300 hover:bg-amber-500/30 shadow-sm shadow-amber-500/10":"bg-amber-500/10 hover:bg-amber-500/20 border-amber-500/40 hover:border-amber-400 text-amber-300 hover:text-white"}`,children:[(0,h.jsx)(aZ.f,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),(0,h.jsx)("span",{className:"font-semibold text-amber-300",children:w?"VIP Supporter":"Store"})]}),(0,h.jsxs)("button",{onClick:v,title:"Color Themes & Font Customization (Preferences)",className:"flex items-center gap-1.5 px-2 py-0.5 rounded bg-[#252526] hover:bg-[#2e2e30] border border-[#333333] hover:border-[#007acc] text-slate-300 hover:text-white text-[11px] transition-colors cursor-pointer",children:[(0,h.jsx)(a$.f,{className:"w-3 h-3 text-cyan-400"}),(0,h.jsx)("span",{className:"hidden lg:inline font-medium",children:"Themes"})]}),(0,h.jsxs)("div",{className:"flex items-center rounded bg-[#252526] border border-[#333333] p-0.5 text-[11px]",children:[(0,h.jsxs)("button",{onClick:()=>k?.("live"),title:"Connect live log watchers ~/.gemini and ~/.claude",className:`flex items-center gap-1 rounded px-2 py-0.5 font-medium transition-colors ${"live"===i?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30":"text-slate-400 hover:text-slate-200"}`,children:[(0,h.jsx)(aX,{className:`w-2.5 h-2.5 ${"live"===i?"text-emerald-400 animate-pulse":"text-slate-500"}`}),"Live"]}),(0,h.jsx)("button",{onClick:()=>k?.("mock"),title:"Simulated multi-agent mock telemetry",className:`flex items-center gap-1 rounded px-2 py-0.5 font-medium transition-colors ${"mock"===i?"bg-[#333333] text-slate-200":"text-slate-400 hover:text-slate-200"}`,children:"Mock"}),"mock"===i&&(0,h.jsx)("select",{value:j,onChange:a=>l?.(a.target.value),className:"bg-transparent px-1 py-0.5 text-[10px] text-slate-300 outline-none cursor-pointer border-l border-[#333333] ml-1",children:bc.map(a=>(0,h.jsx)("option",{value:a.id,className:"bg-[#1e1e1e] text-slate-200",children:a.label},a.id))})]}),(0,h.jsxs)("button",{type:"button",onClick:()=>{k?.("mock"),l?.("showcase")},title:"Quickly showcase all 24 item archetypes in action",className:`flex items-center gap-1 px-2 py-0.5 rounded text-[11px] font-semibold border transition-all ${"mock"===i&&"showcase"===j?"bg-cyan-500/20 text-cyan-300 border-cyan-500/50 shadow-sm shadow-cyan-500/20":"bg-[#252526] text-slate-300 border-[#333333] hover:text-cyan-300 hover:border-cyan-500/40"}`,children:[(0,h.jsx)(a_.f,{className:"w-3 h-3 text-cyan-400"}),(0,h.jsx)("span",{children:"Items Showcase"})]}),(0,h.jsx)("button",{onClick:n,title:"Force refresh connections & data",className:"flex h-6 w-6 items-center justify-center rounded border border-[#333333] bg-[#252526] text-slate-400 hover:text-slate-200 hover:border-[#444444] transition-colors",children:(0,h.jsx)(aN.f,{className:`w-3 h-3 ${m?"animate-spin text-emerald-400":""}`})}),(0,h.jsx)("button",{onClick:p,title:o?"Sound effects: ON":"Sound effects: OFF",className:`flex h-6 w-6 items-center justify-center rounded border transition-colors ${o?"border-emerald-500/50 bg-emerald-500/20 text-emerald-300":"border-[#333333] bg-[#252526] text-slate-500 hover:text-slate-300"}`,children:o?(0,h.jsx)(aO.f,{className:"w-3 h-3"}):(0,h.jsx)(aR,{className:"w-3 h-3"})}),(0,h.jsx)("button",{onClick:r,title:q?"Desktop notifications: ON":"Desktop notifications: OFF",className:`flex h-6 w-6 items-center justify-center rounded border transition-colors ${q?"border-amber-500/50 bg-amber-500/20 text-amber-300":"border-[#333333] bg-[#252526] text-slate-500 hover:text-slate-300"}`,children:q?(0,h.jsx)(aT,{className:"w-3 h-3"}):(0,h.jsx)(aV,{className:"w-3 h-3"})}),(0,h.jsx)(bb,{isLeftSidebarVisible:x?.isLeftSidebarVisible,isBottomPanelVisible:x?.isBottomPanelVisible,isRightSidebarVisible:x?.isRightSidebarVisible,onToggleLeftSidebar:y,onToggleBottomPanel:z,onToggleRightSidebar:A,isZenFullscreen:B,onToggleZenFullscreen:C})]})]})}let be={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]};be.node;let bf=(0,aP.f)(be);var bg=a.i(38688),bh=a.i(57307);let bi={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};bi.node;let bj=(0,aP.f)(bi);var bk=a.i(55771);let bl={name:"files",size:24,node:[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]};bl.node;let bm=(0,aP.f)(bl);function bn({activeView:a="explorer",onViewChange:b,onOpenStore:c,agentCount:d=0,isLeftSidebarVisible:e=!0,activeLeftSidebarTab:f="agents",isRightSidebarVisible:g=!1,activeRightSidebarTab:i="chat",isBottomPanelVisible:k=!1,onToggleBottomPanel:l,onOpenSettings:m}){let n=[{id:"explorer",title:"Explorer: Agents & Sessions (Ctrl+Shift+E)",icon:bf,badge:d>0?d:void 0},{id:"files",title:"Workspace Files: File Tree & Code Editor",icon:bm},{id:"chat",title:"Live Chat / Transcript (Sidebar)",icon:j.f},{id:"office",title:"Virtual 2D Office View (Canvas)",icon:aL.f},{id:"network",title:"Multi-Agent Collaboration DAG Graph",icon:bk.f},{id:"reports",title:"Token & AI Cost Analytics",icon:aY.f},{id:"telemetry",title:"Live Telemetry & Traces",icon:bg.f},{id:"store",title:"Supporter Store: Skins, Pets & Ambience",icon:aZ.f}];return(0,h.jsxs)("aside",{"data-testid":"activity-bar",className:"w-12 h-full bg-[#181818] flex flex-col justify-between items-center border-r border-[#2b2b2b] py-2 shrink-0 z-30 select-none",children:[(0,h.jsxs)("div",{className:"flex flex-col gap-1 w-full items-center",children:[n.map(d=>{let j="chat"===d.id?g&&"chat"===i:"files"===d.id?e&&"files"===f:"explorer"===d.id?e&&"agents"===f:a===d.id,k=d.icon;return(0,h.jsxs)("button",{onClick:()=>{"store"===d.id?c?.():b?.(d.id)},title:d.title,className:`w-full py-2.5 flex justify-center items-center relative transition-colors ${j?"text-white border-l-2 border-[#007acc] bg-[#252526]/50":"store"===d.id?"text-amber-400 hover:text-amber-300 hover:bg-[#252526]/40 border-l-2 border-transparent":"text-[#858585] hover:text-[#cccccc] border-l-2 border-transparent"}`,children:[(0,h.jsx)(k,{className:`w-5 h-5 ${"store"===d.id?"text-amber-400":""}`}),void 0!==d.badge&&(0,h.jsx)("span",{className:"absolute top-1.5 right-1.5 bg-[#007acc] text-white text-[9px] font-bold px-1 rounded-full leading-none min-w-3 text-center",children:d.badge})]},d.id)}),(0,h.jsx)("button",{onClick:l,title:k?"Hide Terminal & Logs (Cmd+J)":"Show Terminal & Logs (Cmd+J)",className:`w-full py-2.5 flex justify-center items-center relative transition-colors ${k?"text-cyan-400 border-l-2 border-cyan-500/50":"text-[#858585] hover:text-[#cccccc] border-l-2 border-transparent"}`,children:(0,h.jsx)(bh.f,{className:"w-5 h-5"})})]}),(0,h.jsx)("div",{className:"flex flex-col gap-1 w-full items-center",children:(0,h.jsx)("button",{onClick:m,title:"System Settings & Watchers",className:"w-full py-2.5 flex justify-center items-center text-[#858585] hover:text-[#cccccc] transition-colors border-l-2 border-transparent",children:(0,h.jsx)(bj,{className:"w-5 h-5"})})})]})}var bo=a.i(89027),bp=a.i(41146);let bq={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};bq.node;let br=(0,aP.f)(bq),bs={name:"folder-open",size:24,node:[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]};bs.node;let bt=(0,aP.f)(bs);var bu=a.i(85953),bv=a.i(63145);let bw={name:"blocks",size:24,node:[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]]};bw.node;let bx=(0,aP.f)(bw);var by=a.i(5004);let bz={name:"square-terminal",size:24,node:[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],aliases:["terminal-square"]};bz.node;let bA=(0,aP.f)(bz),bB={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};bB.node;let bC=(0,aP.f)(bB);function bD({filename:a="",isFolder:b=!1,isOpen:c=!1,size:d=14,className:e=""}){if(b)return c?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${e}`,children:[(0,h.jsx)("path",{d:"M1.5 3A1.5 1.5 0 0 1 3 1.5h3.293a1.5 1.5 0 0 1 1.06.44l1.207 1.207a.5.5 0 0 0 .354.146H13A1.5 1.5 0 0 1 14.5 4.793V6H3a1.5 1.5 0 0 0-1.42 1.027L.5 11V3a1.5 1.5 0 0 1 1-1.5z",fill:"#c99e55"}),(0,h.jsx)("path",{d:"M2 13.5l1.8-6.2c.16-.54.66-.9 1.22-.9h9.46c.72 0 1.22.68 1.03 1.36l-1.5 5.2a1.5 1.5 0 0 1-1.44 1.04H3.5A1.5 1.5 0 0 1 2 13.5z",fill:"#e8a838"})]}):(0,h.jsx)("svg",{width:d,height:d,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${e}`,children:(0,h.jsx)("path",{d:"M1.5 3A1.5 1.5 0 0 1 3 1.5h3.293a1.5 1.5 0 0 1 1.06.44l1.207 1.207a.5.5 0 0 0 .354.146H13A1.5 1.5 0 0 1 14.5 4.793V12A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V3z",fill:"#dcb67a"})});let f=(a||"").toLowerCase();return f.endsWith(".js")||f.endsWith(".jsx")||f.endsWith(".mjs")||f.endsWith(".cjs")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f7df1e"}),(0,h.jsx)("text",{x:"3",y:"12",fill:"#000000",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"9.5",children:f.endsWith(".jsx")?"JSX":"JS"})]}):f.endsWith(".ts")||f.endsWith(".tsx")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#3178c6"}),(0,h.jsx)("text",{x:"2.5",y:"12",fill:"#ffffff",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"9.5",children:f.endsWith(".tsx")?"TSX":"TS"})]}):f.endsWith(".json")||f.endsWith(".jsonl")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f1c40f",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"3.5",y:"12",fill:"#f1c40f",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"10",children:"{}"})]}):f.endsWith(".md")||f.endsWith(".markdown")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#519aba",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"2",y:"11.5",fill:"#519aba",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8.5",children:"MD"})]}):f.endsWith(".html")||f.endsWith(".htm")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#e44d26",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"1",y:"11.5",fill:"#e44d26",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8",children:"</>"})]}):f.endsWith(".css")||f.endsWith(".scss")||f.endsWith(".sass")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#42a5f5",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"2",y:"11.5",fill:"#42a5f5",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8.5",children:"#"})]}):f.endsWith(".java")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f89820",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"1.5",y:"11.5",fill:"#f89820",fontFamily:"var(--font-family-ui, sans-serif)",fontWeight:"bold",fontSize:"8.5",children:"JAVA"})]}):f.endsWith(".py")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#3776ab",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"2.5",y:"11.5",fill:"#3776ab",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"9",children:"PY"})]}):f.endsWith(".sql")||f.endsWith(".ddl")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#00bcd4",fillOpacity:"0.2"}),(0,h.jsx)("path",{d:"M8 2C4.69 2 2 3.12 2 4.5v7C2 12.88 4.69 14 8 14s6-1.12 6-2.5v-7C14 3.12 11.31 2 8 2zm0 1.5c2.76 0 4.5.83 4.5 1s-1.74 1-4.5 1-4.5-.83-4.5-1 1.74-1 4.5-1zm-4.5 3.32c1.07.47 2.68.68 4.5.68s3.43-.21 4.5-.68v1.73c0 .17-1.74 1-4.5 1s-4.5-.83-4.5-1V6.82zm0 3.5c1.07.47 2.68.68 4.5.68s3.43-.21 4.5-.68v1.73c0 .17-1.74 1-4.5 1s-4.5-.83-4.5-1v-1.73z",fill:"#00bcd4"})]}):f.endsWith(".png")||f.endsWith(".jpg")||f.endsWith(".jpeg")||f.endsWith(".gif")||f.endsWith(".webp")||f.endsWith(".ico")||f.endsWith(".bmp")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#26a69a",fillOpacity:"0.2",stroke:"#26a69a",strokeWidth:"0.8"}),(0,h.jsx)("circle",{cx:"5",cy:"5.5",r:"1.5",fill:"#26a69a"}),(0,h.jsx)("path",{d:"M2.5 13.5l4-5 3.5 4 2-2.5 2 3.5h-11.5z",fill:"#26a69a"})]}):f.endsWith(".svg")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#ff7043",fillOpacity:"0.2",stroke:"#ff7043",strokeWidth:"0.8"}),(0,h.jsx)("text",{x:"1",y:"11.5",fill:"#ff7043",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"7.5",children:"SVG"})]}):"dockerfile"===f||f.startsWith("dockerfile.")||f.endsWith(".dockerfile")||f.includes("docker-compose")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#2496ed",fillOpacity:"0.2"}),(0,h.jsx)("path",{d:"M13.8 6.8c-.3-.2-.8-.2-1.1 0-.1-.6-.5-1.1-1.1-1.3l-.4-.1-.2.4c-.2.5-.2 1 0 1.5-.4.2-.8.5-1.2.9H2.5c-.3 0-.5.2-.5.5v3.5c0 1.7 1.3 3 3 3h5.2c2.5 0 4.6-1.8 4.8-4.3.4-.6.6-1.3.6-2 0-.8-.4-1.4-1-1.8-.2-.1-.5-.2-.8-.3zM4 6.5h1.5v1.5H4V6.5zm2 0h1.5v1.5H6V6.5zm2 0h1.5v1.5H8V6.5zm2 0h1.5v1.5H10V6.5z",fill:"#2496ed"})]}):f.startsWith(".git")||f.includes("git")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#f05032",fillOpacity:"0.15"}),(0,h.jsx)("circle",{cx:"5",cy:"5",r:"1.5",fill:"#f05032"}),(0,h.jsx)("circle",{cx:"11",cy:"5",r:"1.5",fill:"#f05032"}),(0,h.jsx)("circle",{cx:"8",cy:"11.5",r:"1.5",fill:"#f05032"}),(0,h.jsx)("path",{d:"M5 6.5v2a3 3 0 0 0 3 3M11 6.5v2a3 3 0 0 1-3 3",stroke:"#f05032",strokeWidth:"1.2",fill:"none"})]}):f.endsWith(".yaml")||f.endsWith(".yml")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#cb171e",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"1",y:"11.5",fill:"#e06c75",fontFamily:"var(--font-family-ui, system-ui, sans-serif)",fontWeight:"bold",fontSize:"7.5",children:"YML"})]}):f.endsWith(".toml")||f.endsWith(".ini")||f.endsWith(".conf")||f.endsWith(".cfg")||f.endsWith(".properties")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#61afef",fillOpacity:"0.2"}),(0,h.jsx)("circle",{cx:"8",cy:"8",r:"3",stroke:"#61afef",strokeWidth:"1.2",fill:"none"}),(0,h.jsx)("circle",{cx:"8",cy:"8",r:"1",fill:"#61afef"}),(0,h.jsx)("path",{d:"M8 2.5v2M8 11.5v2M2.5 8h2M11.5 8h2",stroke:"#61afef",strokeWidth:"1.2"})]}):f.endsWith(".sh")||f.endsWith(".bash")||f.endsWith(".zsh")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#89d185",fillOpacity:"0.2"}),(0,h.jsx)("path",{d:"M4 5l3 3-3 3",stroke:"#89d185",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),(0,h.jsx)("line",{x1:"8.5",y1:"11",x2:"12",y2:"11",stroke:"#89d185",strokeWidth:"1.5",strokeLinecap:"round"})]}):f.includes("lock")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#e5c07b",fillOpacity:"0.2"}),(0,h.jsx)("rect",{x:"4.5",y:"7",width:"7",height:"6",rx:"1",fill:"#e5c07b"}),(0,h.jsx)("path",{d:"M6 7V5a2 2 0 1 1 4 0v2",stroke:"#e5c07b",strokeWidth:"1.2",fill:"none"})]}):f.endsWith(".xml")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#e74c3c",fillOpacity:"0.2"}),(0,h.jsx)("text",{x:"1",y:"11.5",fill:"#e74c3c",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"bold",fontSize:"8",children:"</>"})]}):f.startsWith(".env")||f.includes("config")?(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",className:`shrink-0 ${e}`,children:[(0,h.jsx)("rect",{width:"16",height:"16",rx:"2",fill:"#9b59b6",fillOpacity:"0.2"}),(0,h.jsx)("circle",{cx:"8",cy:"8",r:"3.5",stroke:"#bb86fc",strokeWidth:"1.2",fill:"none"}),(0,h.jsx)("circle",{cx:"8",cy:"8",r:"1.5",fill:"#03dac6"})]}):(0,h.jsxs)("svg",{width:d,height:d,viewBox:"0 0 16 16",fill:"none",className:`shrink-0 ${e}`,children:[(0,h.jsx)("path",{d:"M3 2a1 1 0 0 1 1-1h5.5l3.5 3.5V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2z",stroke:"#858585",strokeWidth:"1.2",fill:"#1e1e1e"}),(0,h.jsx)("path",{d:"M9 1v4h4",stroke:"#858585",strokeWidth:"1.2"}),(0,h.jsx)("line",{x1:"5",y1:"8",x2:"11",y2:"8",stroke:"#858585",strokeWidth:"1",strokeLinecap:"round"}),(0,h.jsx)("line",{x1:"5",y1:"11",x2:"9",y2:"11",stroke:"#858585",strokeWidth:"1",strokeLinecap:"round"})]})}function bE({entry:a,depth:b=0,expandedPaths:c,toggleFolder:d,onOpenFile:e,searchQuery:f}){let g=!!c[a.path],[j,k]=(0,i.useState)(null),[l,m]=(0,i.useState)(!1);(0,i.useEffect)(()=>{a.isDirectory&&g&&null===j&&!l&&(m(!0),fetch(`/api/workspace/files?path=${encodeURIComponent(a.path)}`).then(a=>a.json()).then(a=>{k(a.entries||[])}).catch(()=>k([])).finally(()=>m(!1)))},[a.isDirectory,a.path,g,j,l]);let n=(0,i.useMemo)(()=>!f||a.name.toLowerCase().includes(f.toLowerCase()),[a.name,f]);return a.isDirectory?(0,h.jsxs)("div",{className:"flex flex-col",children:[(0,h.jsxs)("div",{onClick:()=>d(a.path),className:"flex items-center gap-1.5 py-1 px-2 text-xs text-slate-300 hover:text-white hover:bg-[#2a2d2e] rounded cursor-pointer transition-colors select-none",style:{paddingLeft:`${14*b+8}px`},title:a.path,children:[g?(0,h.jsx)(bo.f,{className:"w-3.5 h-3.5 text-slate-400 shrink-0"}):(0,h.jsx)(bp.f,{className:"w-3.5 h-3.5 text-slate-400 shrink-0"}),(0,h.jsx)(bD,{isFolder:!0,isOpen:g,size:14}),(0,h.jsx)("span",{className:"font-medium text-[11px] truncate",children:a.name}),l&&(0,h.jsx)(aN.f,{className:"w-2.5 h-2.5 animate-spin text-cyan-400 ml-auto"})]}),g&&j&&(0,h.jsx)("div",{className:"flex flex-col",children:0===j.length?(0,h.jsx)("div",{className:"text-[10px] text-slate-500 italic py-0.5",style:{paddingLeft:`${(b+1)*14+18}px`},children:"(Empty folder)"}):j.map(a=>(0,h.jsx)(bE,{entry:a,depth:b+1,expandedPaths:c,toggleFolder:d,onOpenFile:e,searchQuery:f},a.path))})]}):n?(0,h.jsxs)("div",{onClick:()=>e?.(a),className:"flex items-center gap-1.5 py-1 px-2 text-xs text-slate-300 hover:text-white hover:bg-[#2a2d2e] rounded cursor-pointer transition-colors select-none group",style:{paddingLeft:`${14*b+20}px`},title:`${a.name} (${a.size?`${Math.round(a.size/1024)} KB`:""})`,children:[(0,h.jsx)(bD,{filename:a.name,size:14}),(0,h.jsx)("span",{className:"text-[11px] text-slate-300 group-hover:text-cyan-300 truncate",children:a.name}),a.size>0&&(0,h.jsx)("span",{className:"text-[9px] text-slate-600 font-mono ml-auto opacity-0 group-hover:opacity-100 transition-opacity",children:a.size>1048576?`${(a.size/1048576).toFixed(1)}M`:`${Math.round(a.size/1024)}k`})]}):null}function bF({onOpenFile:a,initialPath:b=""}){let[c,d]=(0,i.useState)(b),[e,f]=(0,i.useState)(null),[g,j]=(0,i.useState)([]),[k,l]=(0,i.useState)(!1),[m,n]=(0,i.useState)(""),[o,p]=(0,i.useState)({}),q=(0,i.useCallback)(async a=>{l(!0);try{let b=a?`/api/workspace/files?path=${encodeURIComponent(a)}`:"/api/workspace/files",c=await fetch(b),e=await c.json();c.ok&&(j(e.entries||[]),d(e.currentPath||""),f(e.parentPath||null))}catch{}finally{l(!1)}},[]);(0,i.useEffect)(()=>{q(b)},[b,q]);let r=(0,i.useCallback)(a=>{p(b=>({...b,[a]:!b[a]}))},[]),s=(0,i.useMemo)(()=>c?c.split("/").pop()||c:"Workspace",[c]);return(0,h.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#181818] text-slate-200 overflow-hidden text-xs",children:[(0,h.jsxs)("div",{className:"h-[30px] min-h-[30px] px-2.5 bg-[#252526] border-b border-[#2b2b2b] flex items-center justify-between shrink-0 select-none",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[(0,h.jsx)(bt,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),(0,h.jsx)("span",{className:"font-bold text-[11px] uppercase tracking-wider text-slate-300 truncate",title:c,children:s})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[e&&(0,h.jsx)("button",{onClick:()=>{e&&q(e)},className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors cursor-pointer",title:"Navigate up one directory",children:(0,h.jsx)(bC,{className:"w-3.5 h-3.5"})}),(0,h.jsx)("button",{onClick:()=>q(c),className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors cursor-pointer",title:"Refresh file explorer",children:(0,h.jsx)(aN.f,{className:`w-3.5 h-3.5 ${k?"animate-spin text-emerald-400":""}`})})]})]}),(0,h.jsx)("div",{className:"p-2 border-b border-[#2b2b2b] bg-[#1e1e1e]/60",children:(0,h.jsxs)("div",{className:"flex items-center gap-1.5 bg-[#252526] border border-[#3e3e42] focus-within:border-[#007acc] rounded px-2 py-1",children:[(0,h.jsx)(aM.f,{className:"w-3 h-3 text-slate-500 shrink-0"}),(0,h.jsx)("input",{type:"text",value:m,onChange:a=>n(a.target.value),placeholder:"Search files...",className:"bg-transparent text-[11px] text-slate-200 outline-none w-full placeholder:text-slate-500"})]})}),(0,h.jsx)("div",{className:"flex-1 overflow-y-auto p-1 py-1.5 space-y-0.5",children:k&&0===g.length?(0,h.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"Loading files..."}):0===g.length?(0,h.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs italic",children:"No files found"}):g.map(b=>(0,h.jsx)(bE,{entry:b,depth:0,expandedPaths:o,toggleFolder:r,onOpenFile:a,searchQuery:m},b.path))})]})}var bG=a.i(13503);function bH({workstations:a=[],selectedId:b=null,onSelectAgent:c,onOpenAgentTab:d,stats:e={},onRefresh:f,onStartReplay:g,onViewConversation:k,onOpenFile:m,onOpenStore:n,activeSidebarTab:o,onActiveSidebarTabChange:p}){let[q,r]=(0,i.useState)("agents"),s=void 0!==o?o:q,t=p||r,[u,v]=(0,i.useState)(""),[w,x]=(0,i.useState)(""),[y,z]=(0,i.useState)({agents:!0,folders:!0,metrics:!1}),A=a=>{z(b=>({...b,[a]:!b[a]}))},B=(0,i.useMemo)(()=>{if(!w.trim())return a;let b=w.toLowerCase();return a.filter(a=>a.account?.toLowerCase().includes(b)||a.sessionTitle?.toLowerCase().includes(b)||a.lastText?.toLowerCase().includes(b)||a.connectionId?.toLowerCase().includes(b)||a.provider?.toLowerCase().includes(b)||a.model?.toLowerCase().includes(b)||a.activeTool?.toLowerCase().includes(b))},[a,w]),C=(0,i.useMemo)(()=>{let a={extensions:[],desktop:[],codexDesktop:[],codexCli:[],geminiApp:[],geminiCli:[],claude:[],other:[]};return B.forEach(b=>{let c=(b.provider||"").toLowerCase(),d=(b.clientType||"").toLowerCase(),e=(b.cli||"").toLowerCase(),f=(b.connectionId||"").toLowerCase(),g=(b.model||"").toLowerCase(),h="codex"===e||c.includes("codex")||f.includes("codex"),i="extension"===d||"ide"===d||f.includes("extension"),j="desktop"===d||f.includes("desktop"),k="claude"===e||c.includes("claude")||c.includes("anthropic")||g.includes("claude");h?i?a.extensions.push(b):j||"app"===d||f.includes("app")?a.codexDesktop.push(b):a.codexCli.push(b):i?a.extensions.push(b):j?a.desktop.push(b):"app"===d||c.includes("app")||f.includes("app")?a.geminiApp.push(b):k?a.claude.push(b):c.includes("gemini")||"antigravity"===e||"cli"===d?a.geminiCli.push(b):a.other.push(b)}),a},[B]),D=(a,e)=>{let f=b===a.connectionId,i=a.state||"idle",m=a.account||"agent-factory",n=a.sessionTitle||m,o="app"===a.clientType||(a.provider||"").includes("(app)"),p="extension"===a.clientType||(a.provider||"").includes("extension")||(a.connectionId||"").toLowerCase().includes("extension"),q="desktop"===a.clientType||(a.connectionId||"").toLowerCase().includes("desktop"),r="codex"===a.cli||(a.connectionId||"").toLowerCase().includes("codex"),s=a.lastText?`${"assistant"===a.lastTextRole?"AI: ":"user"===a.lastTextRole?"You: ":""}${a.lastText}`:`${m} \xb7 ${a.model||"AI Agent"}${a.activeTool?` \xb7 ${a.activeTool}`:""}`;return(0,h.jsxs)("div",{onClick:()=>{c?.(a.connectionId),d?.(a)},className:`group flex items-center justify-between px-3 py-2 cursor-pointer text-xs transition-colors border-l-2 ${f?"bg-[#37373d] text-white border-[#007acc]":"hover:bg-[#2a2d2e] text-[#cccccc] border-transparent"}`,children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1 mr-2",children:[(0,h.jsx)("span",{className:`w-2 h-2 rounded-full shrink-0 ${"error"===i?"bg-rose-500":"streaming"===i||"busy"===i||"working"===i?"bg-emerald-400 animate-pulse shadow-sm shadow-emerald-400":"bg-slate-500"}`}),(0,h.jsxs)("div",{className:"flex flex-col min-w-0 flex-1",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between gap-1.5 min-w-0",children:[(0,h.jsx)("span",{className:"font-medium truncate text-[11px] text-slate-200",title:n,children:n}),r?(0,h.jsx)("span",{className:`shrink-0 text-[9px] font-bold px-1 rounded uppercase tracking-wider border ${p?"bg-sky-950/80 text-sky-300 border-sky-500/40":"bg-teal-950/80 text-teal-300 border-teal-500/40"}`,children:p?"EXT":q||o?"DESK":"CLI"}):p?(0,h.jsx)("span",{className:"shrink-0 bg-sky-950/80 text-sky-300 border border-sky-500/40 text-[9px] font-bold px-1 rounded uppercase tracking-wider",children:"EXT"}):q?(0,h.jsx)("span",{className:"shrink-0 bg-orange-950/80 text-orange-300 border border-orange-500/40 text-[9px] font-bold px-1 rounded uppercase tracking-wider",children:"DESK"}):o?(0,h.jsx)("span",{className:"shrink-0 bg-purple-950/80 text-purple-300 border border-purple-500/40 text-[9px] font-bold px-1 rounded uppercase tracking-wider",children:"APP"}):(0,h.jsx)("span",{className:"shrink-0 bg-emerald-950/80 text-emerald-300 border border-emerald-500/40 text-[9px] font-bold px-1 rounded uppercase tracking-wider",children:"CLI"})]}),(0,h.jsx)("p",{className:"truncate text-[10px] leading-4 text-slate-400 mt-0.5",title:s,children:s})]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[g&&(0,h.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),g(a.connectionId)},className:"opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-[#3e3e42] text-cyan-400 hover:text-white transition-all cursor-pointer",title:"Replay Session (Default)",children:(0,h.jsx)(l.f,{className:"w-3 h-3"})}),k&&(0,h.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),k(a.connectionId)},className:"opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-[#3e3e42] text-slate-400 hover:text-cyan-300 transition-all cursor-pointer",title:"View conversation transcript",children:(0,h.jsx)(j.f,{className:"w-3 h-3"})}),(0,h.jsx)("span",{className:"text-[10px] text-slate-500 font-mono group-hover:text-slate-300",children:a.totalLabel||"0k"})]})]},a.traceId||a.connectionId||`agent-${e}`)};return(0,h.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#1e1e1e] text-[#cccccc] select-none overflow-hidden",children:[(0,h.jsxs)("div",{className:"h-[35px] min-h-[35px] bg-[#252526] border-b border-[#2b2b2b] px-2 flex items-center justify-between",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1",children:[(0,h.jsxs)("button",{onClick:()=>t("agents"),className:`flex items-center gap-1.5 px-2 py-1 rounded text-[11px] font-semibold transition-colors cursor-pointer ${"agents"===s?"bg-[#1e1e1e] text-white border border-[#3e3e42]":"text-slate-400 hover:text-slate-200"}`,title:"View active AI Agents & Sessions",children:[(0,h.jsx)(aL.f,{className:"w-3.5 h-3.5 text-cyan-400"}),(0,h.jsxs)("span",{children:["Agents (",a.length,")"]})]}),(0,h.jsxs)("button",{onClick:()=>t("files"),className:`flex items-center gap-1.5 px-2 py-1 rounded text-[11px] font-semibold transition-colors cursor-pointer ${"files"===s?"bg-[#1e1e1e] text-white border border-[#3e3e42]":"text-slate-400 hover:text-slate-200"}`,title:"Browse Workspace & Project Files",children:[(0,h.jsx)(bf,{className:"w-3.5 h-3.5 text-amber-400"}),(0,h.jsx)("span",{children:"Files"})]})]}),(0,h.jsx)("div",{className:"flex items-center gap-1",children:(0,h.jsx)("button",{onClick:f,title:"Refresh",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors cursor-pointer",children:(0,h.jsx)(aN.f,{className:"w-3 h-3"})})})]}),"files"===s?(0,h.jsx)(bF,{onOpenFile:m,initialPath:u}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:"p-2 border-b border-[#2b2b2b] bg-[#1e1e1e]",children:(0,h.jsxs)("div",{className:"flex items-center gap-1.5 bg-[#252526] border border-[#3e3e42] focus-within:border-[#007acc] rounded px-2 py-1",children:[(0,h.jsx)(aM.f,{className:"w-3 h-3 text-slate-500 shrink-0"}),(0,h.jsx)("input",{type:"text",value:w,onChange:a=>x(a.target.value),placeholder:"Filter agents by name, model...",className:"w-full bg-transparent text-[11px] text-slate-200 outline-none placeholder:text-slate-500"})]})}),(0,h.jsxs)("div",{className:"flex-1 overflow-y-auto divide-y divide-[#2b2b2b]",children:[(0,h.jsxs)("div",{children:[(0,h.jsxs)("button",{type:"button",onClick:()=>A("agents"),className:"w-full flex items-center justify-between px-3 py-1.5 bg-[#252526]/60 hover:bg-[#252526] text-[11px] font-semibold text-slate-300 transition-colors",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1.5",children:[y.agents?(0,h.jsx)(bo.f,{className:"w-3 h-3 text-slate-400"}):(0,h.jsx)(bp.f,{className:"w-3 h-3 text-slate-400"}),(0,h.jsxs)("span",{className:"uppercase text-[10px] tracking-wide",children:["Workstations & Sessions (",B.length,")"]})]}),e?.busy>0&&(0,h.jsxs)("span",{className:"bg-emerald-500/20 text-emerald-400 text-[9px] font-bold px-1.5 py-0.2 rounded-full border border-emerald-500/30",children:[e.busy," active"]})]}),y.agents&&(0,h.jsx)("div",{className:"py-1",children:0===B.length?(0,h.jsx)("div",{className:"px-4 py-3 text-center text-xs text-slate-500 italic",children:"No active agents found"}):(0,h.jsxs)(h.Fragment,{children:[C.extensions?.length>0&&(0,h.jsxs)("div",{className:"mb-2",children:[(0,h.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-sky-400/90 flex items-center gap-1",children:[(0,h.jsx)(bx,{className:"w-2.5 h-2.5"}),(0,h.jsxs)("span",{children:["Extensions & IDEs (",C.extensions.length,")"]})]}),C.extensions.map(D)]}),C.desktop?.length>0&&(0,h.jsxs)("div",{className:"mb-2",children:[(0,h.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-orange-400/90 flex items-center gap-1",children:[(0,h.jsx)(by.f,{className:"w-2.5 h-2.5"}),(0,h.jsxs)("span",{children:["Claude Desktop (",C.desktop.length,")"]})]}),C.desktop.map(D)]}),C.codexDesktop?.length>0&&(0,h.jsxs)("div",{className:"mb-2",children:[(0,h.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-teal-400/90 flex items-center gap-1",children:[(0,h.jsx)(by.f,{className:"w-2.5 h-2.5"}),(0,h.jsxs)("span",{children:["Codex Desktop App (",C.codexDesktop.length,")"]})]}),C.codexDesktop.map(D)]}),C.codexCli?.length>0&&(0,h.jsxs)("div",{className:"mb-2",children:[(0,h.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-teal-400/90 flex items-center gap-1",children:[(0,h.jsx)(bA,{className:"w-2.5 h-2.5"}),(0,h.jsxs)("span",{children:["Codex CLI (",C.codexCli.length,")"]})]}),C.codexCli.map(D)]}),C.geminiApp.length>0&&(0,h.jsxs)("div",{className:"mb-2",children:[(0,h.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-purple-400/80 flex items-center gap-1",children:[(0,h.jsx)(a_.f,{className:"w-2.5 h-2.5"}),(0,h.jsxs)("span",{children:["Antigravity Desktop App (",C.geminiApp.length,")"]})]}),C.geminiApp.map(D)]}),C.geminiCli.length>0&&(0,h.jsxs)("div",{className:"mb-2",children:[(0,h.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-emerald-400/80 flex items-center gap-1",children:[(0,h.jsx)(bu.f,{className:"w-2.5 h-2.5"}),(0,h.jsxs)("span",{children:["Gemini CLI / Antigravity (",C.geminiCli.length,")"]})]}),C.geminiCli.map(D)]}),C.claude.length>0&&(0,h.jsxs)("div",{className:"mb-2",children:[(0,h.jsxs)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-amber-400/80 flex items-center gap-1",children:[(0,h.jsx)(bg.f,{className:"w-2.5 h-2.5"}),(0,h.jsxs)("span",{children:["Claude Code (",C.claude.length,")"]})]}),C.claude.map(D)]}),C.other.length>0&&(0,h.jsxs)("div",{className:"mb-2",children:[(0,h.jsx)("div",{className:"px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-slate-400 flex items-center gap-1",children:(0,h.jsxs)("span",{children:["Other Agents (",C.other.length,")"]})}),C.other.map(D)]})]})})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("button",{type:"button",onClick:()=>A("folders"),className:"w-full flex items-center justify-between px-3 py-1.5 bg-[#252526]/60 hover:bg-[#252526] text-[11px] font-semibold text-slate-300 transition-colors",children:(0,h.jsxs)("div",{className:"flex items-center gap-1.5",children:[y.folders?(0,h.jsx)(bo.f,{className:"w-3 h-3 text-slate-400"}):(0,h.jsx)(bp.f,{className:"w-3 h-3 text-slate-400"}),(0,h.jsx)("span",{className:"uppercase text-[10px] tracking-wide",children:"Watched Brain Directories"})]})}),y.folders&&(0,h.jsxs)("div",{className:"px-3 py-2 space-y-1.5 text-[11px]",children:[(0,h.jsxs)("div",{onClick:()=>{v("~/.gemini/antigravity/brain"),t("files")},className:"flex items-center gap-2 text-slate-400 hover:text-purple-300 cursor-pointer p-1 rounded hover:bg-[#252526] transition-colors",title:"Click to browse Antigravity Brain files",children:[(0,h.jsx)(bt,{className:"w-3.5 h-3.5 text-purple-400 shrink-0"}),(0,h.jsx)("span",{className:"truncate font-mono text-[10px]",children:"~/.gemini/antigravity/brain"})]}),(0,h.jsxs)("div",{onClick:()=>{v("~/.gemini/antigravity-cli/brain"),t("files")},className:"flex items-center gap-2 text-slate-400 hover:text-emerald-300 cursor-pointer p-1 rounded hover:bg-[#252526] transition-colors",title:"Click to browse Antigravity CLI Brain files",children:[(0,h.jsx)(br,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}),(0,h.jsx)("span",{className:"truncate font-mono text-[10px]",children:"~/.gemini/antigravity-cli/brain"})]}),(0,h.jsxs)("div",{onClick:()=>{v("~/.claude/projects"),t("files")},className:"flex items-center gap-2 text-slate-400 hover:text-amber-300 cursor-pointer p-1 rounded hover:bg-[#252526] transition-colors",title:"Click to browse Claude Projects files",children:[(0,h.jsx)(br,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),(0,h.jsx)("span",{className:"truncate font-mono text-[10px]",children:"~/.claude/projects"})]}),(0,h.jsxs)("div",{onClick:()=>{v("~/.codex/sessions"),t("files")},className:"flex items-center gap-2 text-slate-400 hover:text-teal-300 cursor-pointer p-1 rounded hover:bg-[#252526] transition-colors",title:"Click to browse Codex Sessions files",children:[(0,h.jsx)(br,{className:"w-3.5 h-3.5 text-teal-400 shrink-0"}),(0,h.jsx)("span",{className:"truncate font-mono text-[10px]",children:"~/.codex/sessions"})]})]})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("button",{type:"button",onClick:()=>A("metrics"),className:"w-full flex items-center justify-between px-3 py-1.5 bg-[#252526]/60 hover:bg-[#252526] text-[11px] font-semibold text-slate-300 transition-colors",children:(0,h.jsxs)("div",{className:"flex items-center gap-1.5",children:[y.metrics?(0,h.jsx)(bo.f,{className:"w-3 h-3 text-slate-400"}):(0,h.jsx)(bp.f,{className:"w-3 h-3 text-slate-400"}),(0,h.jsx)("span",{className:"uppercase text-[10px] tracking-wide",children:"Factory Overview"})]})}),y.metrics&&(0,h.jsxs)("div",{className:"p-3 space-y-2 text-xs",children:[(0,h.jsxs)("div",{className:"flex justify-between items-center text-slate-400",children:[(0,h.jsx)("span",{children:"Total Workstations:"}),(0,h.jsx)("span",{className:"font-bold text-slate-200",children:e?.agents||0})]}),(0,h.jsxs)("div",{className:"flex justify-between items-center text-slate-400",children:[(0,h.jsx)("span",{children:"Active Agents:"}),(0,h.jsx)("span",{className:"font-bold text-emerald-400",children:e?.busy||0})]}),(0,h.jsxs)("div",{className:"flex justify-between items-center text-slate-400",children:[(0,h.jsx)("span",{children:"Total Tokens:"}),(0,h.jsx)("span",{className:"font-bold text-cyan-400",children:e?.tokensLabel||"0k"})]})]})]}),(0,h.jsx)("div",{className:"p-2 border-t border-[#252526] bg-[#1a1a1b]",children:(0,h.jsxs)("button",{type:"button",onClick:n,className:"w-full flex items-center justify-between p-2 rounded-lg bg-gradient-to-r from-amber-500/15 to-amber-600/10 hover:from-amber-500/25 hover:to-amber-600/20 border border-amber-500/30 text-amber-300 transition-all cursor-pointer text-xs",title:`Open Supporter Store: ${bG.E} Tech Items & 3D Effects`,children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)(bv.f,{className:"w-4 h-4 text-amber-400"}),(0,h.jsxs)("div",{className:"text-left",children:[(0,h.jsx)("div",{className:"font-bold text-white text-[11px] leading-tight",children:"Supporter Store"}),(0,h.jsxs)("div",{className:"text-[10px] text-amber-400/80",children:[bG.E," Tech Items & 3D Effects"]})]})]}),(0,h.jsx)("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-amber-500/20 border border-amber-500/40",children:"Open"})]})})]})]})]})}var bI=a.i(74215),bJ=a.i(7963);function bK({tabs:a=[],activeTabId:b="canvas",onSelectTab:c,onCloseTab:d,isZenFullscreen:e=!1,onToggleZenFullscreen:f=null}){let g=(0,i.useRef)(null);return(0,h.jsxs)("div",{"data-testid":"editor-tabs-bar",className:"h-[35px] min-h-[35px] bg-[#252526] border-b border-[#1e1e1e] flex items-center justify-between select-none overflow-hidden",children:[(0,h.jsx)("div",{ref:g,onWheel:a=>{g.current&&(g.current.scrollLeft+=a.deltaY)},className:"flex items-center h-full overflow-x-auto no-scrollbar scroll-smooth flex-1",style:{scrollbarWidth:"none"},children:a.map(a=>{let e=a.id===b;return(0,h.jsxs)("div",{onClick:()=>c?.(a.id),className:`group flex items-center gap-2 h-full px-3 text-xs cursor-pointer border-r border-[#1e1e1e] transition-colors relative shrink-0 ${e?"bg-[#1e1e1e] text-white border-t-2 border-t-[#007acc]":"bg-[#2d2d2d] text-[#969696] hover:bg-[#252526] hover:text-[#cccccc] border-t-2 border-t-transparent"}`,children:["canvas"===a.type?(0,h.jsx)(aL.f,{className:"w-3.5 h-3.5 text-emerald-400"}):"network"===a.type?(0,h.jsx)(bk.f,{className:"w-3.5 h-3.5 text-indigo-400"}):"telemetry"===a.type?(0,h.jsx)(bg.f,{className:"w-3.5 h-3.5 text-cyan-400"}):"reports"===a.type?(0,h.jsx)(aY.f,{className:"w-3.5 h-3.5 text-amber-400"}):"store"===a.type?(0,h.jsx)(bv.f,{className:"w-3.5 h-3.5 text-amber-400"}):"file"===a.type?(0,h.jsx)(bD,{filename:a.filePath||a.title,size:14}):(0,h.jsx)(bu.f,{className:"w-3.5 h-3.5 text-purple-400"}),(0,h.jsx)("span",{className:"font-medium text-[11px] truncate max-w-[140px]",children:a.title}),!1!==a.closable&&(0,h.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),d?.(a.id)},title:"Close tab",className:"p-0.5 rounded text-slate-500 hover:text-white hover:bg-[#333333] transition-colors opacity-70 group-hover:opacity-100",children:(0,h.jsx)(bI.X,{className:"w-3 h-3"})})]},a.id)})}),(0,h.jsxs)("div",{className:"flex items-center px-2 gap-1 bg-[#252526] border-l border-[#1e1e1e] shrink-0 h-full",children:[f&&"canvas"===b&&(0,h.jsx)("button",{type:"button","data-testid":"editor-zen-fullscreen-btn",onClick:f,title:e?"Thoát toàn màn hình (ESC)":"Chế độ Chill toàn màn hình Virtual Office (Shift+F / ESC để thoát)",className:"p-1 mr-0.5 rounded text-slate-400 hover:text-cyan-300 hover:bg-[#333333] transition-colors cursor-pointer",children:(0,h.jsx)(a9.f,{className:"w-3.5 h-3.5"})}),(0,h.jsx)("button",{onClick:()=>{g.current&&g.current.scrollBy({left:-100,behavior:"smooth"})},title:"Scroll left",className:"p-1 rounded text-slate-500 hover:text-slate-200 transition-colors",children:(0,h.jsx)(bJ.f,{className:"w-3 h-3"})}),(0,h.jsx)("button",{onClick:()=>{g.current&&g.current.scrollBy({left:100,behavior:"smooth"})},title:"Scroll right",className:"p-1 rounded text-slate-500 hover:text-slate-200 transition-colors",children:(0,h.jsx)(bp.f,{className:"w-3 h-3"})})]})]})}var bL=a.i(90702);let bM={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};bM.node;let bN=(0,aP.f)(bM);var bO=a.i(82524),bP=a.i(49140);function bQ({traces:a=[],activeTab:b="logs",onTabChange:c,onClose:d,isMaximized:e=!1,onToggleMaximize:f}){let[g,j]=(0,i.useState)(b),[k,l]=(0,i.useState)(""),[m,n]=(0,i.useState)(!0),[o,p]=(0,i.useState)(null),[q,r]=(0,i.useState)(!1),s=(0,i.useRef)(null);(0,i.useEffect)(()=>{r(!0)},[]),(0,i.useEffect)(()=>{j(b)},[b]);let t=(0,i.useMemo)(()=>{let b=[],c=a=>{if(!q)return"--:--:--";if(a){if("string"==typeof a&&a.includes(":"))return a;let b=new Date(a);if(!isNaN(b.getTime()))return b.toLocaleTimeString()}return new Date().toLocaleTimeString()};a.forEach((a,d)=>{let e=a.account||"Agent",f=a.model||"gemini-3.8-flash",g=a.clientType||(a.provider?.includes("app")?"app":"cli"),h=a.provider||"gemini",i=a.traceId||a.connectionId||`trace-${d}`;Array.isArray(a.logs)&&a.logs.length>0?a.logs.forEach((a,d)=>{let j=(a.type||"").toUpperCase(),k=j.includes("ERR")?"ERROR":j.includes("TOOL")?"TOOL":"STREAM";b.push({id:`${i}-${a.timestamp||d}-${d}`,time:c(a.timestamp),level:k,provider:h,clientType:g,account:e,model:f,message:a.detail||a.summary||"Event recorded",meta:a.summary!==a.detail?a.summary:""})}):(a.activeTool&&b.push({id:`${i}-tool-${a.activeTool}`,time:c(a.timestamp),level:"TOOL",provider:h,clientType:g,account:e,model:f,message:`Executing tool: ${a.activeTool}`,meta:a.activeToolParams||""}),("streaming"===a.state||"busy"===a.state)&&b.push({id:`${i}-stream`,time:c(a.timestamp),level:"STREAM",provider:h,clientType:g,account:e,model:f,message:`Active session processing tokens (${Number.isFinite(a.totalTokens)?`${Math.round(a.totalTokens/1e3)}k`:"unavailable"})`}),"error"===a.state&&b.push({id:`${i}-err`,time:c(a.timestamp),level:"ERROR",provider:h,clientType:g,account:e,model:f,message:`Session encountered error state (${a.error||"failed"})`}))}),0===b.length&&b.push({id:"sys-init",time:q?new Date().toLocaleTimeString():"--:--:--",level:"SYSTEM",provider:"system",clientType:"cli",account:"AGMon Core",message:"Watcher initialized. Monitoring ~/.gemini and ~/.claude directories in real time."});let d=b.length>250?b.slice(-250):b;return o?d.filter(a=>a.time>o):d},[a,o,q]),u=(0,i.useMemo)(()=>{let a=t;if("tools"===g?a=a.filter(a=>"TOOL"===a.level):"problems"===g&&(a=a.filter(a=>"ERROR"===a.level)),k.trim()){let b=k.toLowerCase();a=a.filter(a=>a.message.toLowerCase().includes(b)||a.account.toLowerCase().includes(b)||a.level.toLowerCase().includes(b)||a.model?.toLowerCase().includes(b))}return a},[t,g,k]);(0,i.useEffect)(()=>{m&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[u,m]);let v=[{id:"logs",label:"Agent Output",icon:bh.f,count:t.length},{id:"tools",label:"Tool Executions",icon:bg.f,count:t.filter(a=>"TOOL"===a.level).length},{id:"problems",label:"Problems",icon:bL.f,count:t.filter(a=>"ERROR"===a.level).length}];return(0,h.jsxs)("div",{"data-testid":"bottom-panel-container",className:"flex flex-col h-full w-full bg-[#1e1e1e] text-[#cccccc] select-none overflow-hidden",children:[(0,h.jsxs)("div",{className:"h-[32px] min-h-[32px] bg-[#252526] border-b border-[#2b2b2b] px-2 flex items-center justify-between",children:[(0,h.jsx)("div",{className:"flex items-center h-full gap-1",children:v.map(a=>{let b=g===a.id,d=a.icon;return(0,h.jsxs)("button",{type:"button",onClick:()=>{j(a.id),c?.(a.id)},className:`flex items-center gap-1.5 h-full px-2.5 text-xs transition-colors border-b-2 font-medium ${b?"text-white border-[#007acc] bg-[#1e1e1e]":"text-[#858585] hover:text-[#cccccc] border-transparent"}`,children:[(0,h.jsx)(d,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{className:"text-[11px] uppercase tracking-wider",children:a.label}),a.count>0&&(0,h.jsx)("span",{className:"bg-[#333333] text-slate-300 text-[9px] font-mono px-1 rounded-full",children:a.count})]},a.id)})}),(0,h.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1 bg-[#1e1e1e] border border-[#3e3e42] rounded px-1.5 py-0.5 h-5",children:[(0,h.jsx)(aM.f,{className:"w-2.5 h-2.5 text-slate-500"}),(0,h.jsx)("input",{type:"text",value:k,onChange:a=>l(a.target.value),placeholder:"Filter logs...",className:"bg-transparent text-[10px] text-slate-200 outline-none w-20 sm:w-32 placeholder:text-slate-500"})]}),(0,h.jsx)("button",{onClick:()=>n(a=>!a),title:m?"Pause auto-scroll":"Resume auto-scroll",className:`p-1 rounded text-xs transition-colors ${m?"text-cyan-400 bg-cyan-950/40":"text-slate-500 hover:text-slate-300"}`,children:m?(0,h.jsx)(bP.f,{className:"w-3 h-3"}):(0,h.jsx)(bO.f,{className:"w-3 h-3"})}),(0,h.jsx)("button",{onClick:()=>p(new Date().toLocaleTimeString()),title:"Clear log console",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors",children:(0,h.jsx)(bN,{className:"w-3 h-3"})}),f&&(0,h.jsx)("button",{onClick:f,title:e?"Restore panel size":"Maximize panel",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors",children:e?(0,h.jsx)(ba.f,{className:"w-3 h-3"}):(0,h.jsx)(a9.f,{className:"w-3 h-3"})}),(0,h.jsx)("button",{onClick:d,title:"Close panel (Cmd+J / Ctrl+J)",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#333333] transition-colors",children:(0,h.jsx)(bI.X,{className:"w-3 h-3"})})]})]}),(0,h.jsx)("div",{ref:s,className:"flex-1 p-2 font-mono text-[11px] leading-relaxed overflow-y-auto bg-[#181818] select-text divide-y divide-[#222222]",children:0===u.length?(0,h.jsx)("div",{className:"text-slate-500 italic py-4 text-center",children:"No logs match the current filters"}):u.map(a=>{let b="TOOL"===a.level,c="ERROR"===a.level,d="app"===a.clientType;return(0,h.jsxs)("div",{className:"py-1 flex items-start gap-2 hover:bg-[#202020] px-1 rounded",children:[(0,h.jsx)("span",{suppressHydrationWarning:!0,className:"text-slate-500 shrink-0 text-[10px]",children:a.time}),(0,h.jsx)("span",{className:`px-1 py-0.2 rounded text-[9px] font-bold shrink-0 ${c?"bg-rose-950/80 text-rose-300 border border-rose-500/40":b?"bg-cyan-950/80 text-cyan-300 border border-cyan-500/40":"bg-slate-800 text-slate-300 border border-slate-700"}`,children:a.level}),(0,h.jsx)("span",{className:`px-1 py-0.2 rounded text-[9px] font-bold shrink-0 ${d?"bg-purple-950/80 text-purple-300 border border-purple-500/40":"bg-emerald-950/80 text-emerald-300 border border-emerald-500/40"}`,children:d?"APP":"CLI"}),(0,h.jsxs)("span",{className:"text-slate-300 font-semibold shrink-0",children:["[",a.account,"]"]}),(0,h.jsx)("span",{className:"text-slate-400 break-all",children:a.message}),a.meta&&(0,h.jsx)("span",{className:"text-slate-500 text-[10px] truncate max-w-xs",children:a.meta})]},a.id)})})]})}var bR=a.i(11715),bS=a.i(80447),bT=a.i(85650),bU=a.i(52562),bV=a.i(33364),bW=a.i(14498);function bX({selectedAgent:a=null,workstations:b=[],activeTab:c="chat",onTabChange:d,onSelectAgent:e,onClose:f,onStartReplay:g}){let m,n,o,p,q,r,s,t,u,v,[w,x]=(0,i.useState)(!1),[y,z]=(0,i.useState)(c||"chat"),A=d?c:y,B=a=>{d?d(a):z(a)},C=a?.clientType==="app"||(a?.provider||"").toLowerCase().includes("(app)"),D=a?.state==="streaming"||a?.state==="busy"||a?.state==="working"||a?.mode==="streaming";return(0,h.jsxs)("div",{"data-testid":"secondary-sidebar-container",className:"flex flex-col h-full w-full bg-[var(--bg-editor)] text-[var(--text-main)] select-none overflow-hidden",children:[(0,h.jsxs)("div",{className:"h-[36px] min-h-[36px] bg-[var(--bg-card)] border-b border-[var(--border-subtle)] px-2 flex items-center justify-between shrink-0",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1",children:[(0,h.jsxs)("button",{type:"button",onClick:()=>B("chat"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-semibold transition-colors cursor-pointer ${"chat"===A?"bg-[var(--bg-editor)] text-[var(--accent-primary)] border border-[var(--border-card)]":"text-[var(--text-muted)] hover:text-[var(--text-bright)] hover:bg-[var(--bg-hover)]"}`,title:"View Agent Live Chat & Conversation Transcript",children:[(0,h.jsxs)("div",{className:"relative",children:[(0,h.jsx)(j.f,{className:"w-3.5 h-3.5"}),D&&(0,h.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-1.5 h-1.5 rounded-full bg-cyan-400 animate-ping"})]}),(0,h.jsx)("span",{children:"Live Chat"}),D&&(0,h.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 inline-block ml-0.5"})]}),(0,h.jsxs)("button",{type:"button",onClick:()=>B("inspector"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-semibold transition-colors cursor-pointer ${"inspector"===A?"bg-[var(--bg-editor)] text-[var(--accent-primary)] border border-[var(--border-card)]":"text-[var(--text-muted)] hover:text-[var(--text-bright)] hover:bg-[var(--bg-hover)]"}`,title:"View Agent specs, telemetry, and token usage",children:[(0,h.jsx)(bR.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{children:"Inspector"})]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1",children:["chat"===A&&a&&(0,h.jsx)("button",{onClick:()=>(0,aK.f)(a.connectionId||a.traceId),title:"Open in Detached Window (VS Code style)",className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--accent-primary)] hover:bg-[var(--bg-hover)] transition-colors cursor-pointer",children:(0,h.jsx)(k.f,{className:"w-3.5 h-3.5"})}),(0,h.jsx)("button",{onClick:f,title:"Close Secondary Sidebar (Cmd+Alt+B)",className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-bright)] hover:bg-[var(--bg-hover)] transition-colors cursor-pointer",children:(0,h.jsx)(bI.X,{className:"w-3.5 h-3.5"})})]})]}),(0,h.jsx)("div",{className:"flex-1 overflow-hidden flex flex-col",children:"chat"===A?a?(0,h.jsx)(bV.f,{sessionTrace:a,isSidebar:!0,onClose:f,onStartReplay:g}):(0,h.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col justify-center items-center text-center space-y-4",children:[(0,h.jsx)("div",{className:"w-12 h-12 rounded-full bg-[#252526] border border-[#333333] flex items-center justify-center text-slate-500",children:(0,h.jsx)(j.f,{className:"w-6 h-6"})}),(0,h.jsxs)("div",{className:"space-y-1.5 max-w-[280px]",children:[(0,h.jsx)("h4",{className:"font-bold text-slate-300 text-xs",children:"No Agent Selected"}),(0,h.jsx)("p",{className:"text-[11px] text-slate-400 leading-relaxed",children:"Click any workstation on the virtual office or select an active agent below to inspect live conversation:"})]}),b.length>0&&(0,h.jsxs)("div",{className:"w-full max-w-[280px] space-y-1.5 pt-2 text-left",children:[(0,h.jsxs)("span",{className:"text-[10px] font-bold uppercase tracking-wider text-slate-500 block px-1",children:["Active Agents (",b.length,")"]}),(0,h.jsx)("div",{className:"space-y-1 max-h-[28rem] overflow-y-auto pr-1",children:b.map((a,b)=>{let c="streaming"===a.state||"busy"===a.state||"working"===a.state||"streaming"===a.mode,d=a.account||"agent-factory",f=a.sessionTitle||d,g="app"===a.clientType||(a.provider||"").includes("(app)"),i="extension"===a.clientType||(a.provider||"").includes("extension")||(a.connectionId||"").toLowerCase().includes("extension"),j=a.lastText?`${"assistant"===a.lastTextRole?"AI: ":"user"===a.lastTextRole?"You: ":""}${a.lastText}`:`${d} \xb7 ${a.model||"AI Agent"}${a.activeTool?` \xb7 ${a.activeTool}`:""}`;return(0,h.jsxs)("button",{onClick:()=>e?.(a.connectionId||a.traceId),className:"w-full flex items-center gap-2 p-2 rounded bg-[#252526] hover:bg-[#2d2d2e] border border-[#333333] hover:border-[#007acc] text-left transition-colors cursor-pointer text-slate-300",children:[(0,h.jsx)(aL.f,{className:"w-3.5 h-3.5 text-cyan-400 shrink-0 self-start mt-0.5"}),(0,h.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between gap-1.5 min-w-0",children:[(0,h.jsx)("span",{className:"truncate font-medium text-xs text-slate-200",title:f,children:f}),i?(0,h.jsx)("span",{className:"shrink-0 bg-sky-950/80 text-sky-300 border border-sky-500/40 text-[9px] font-bold px-1 rounded uppercase",children:"EXT"}):g?(0,h.jsx)("span",{className:"shrink-0 bg-purple-950/80 text-purple-300 border border-purple-500/40 text-[9px] font-bold px-1 rounded uppercase",children:"APP"}):(0,h.jsx)("span",{className:"shrink-0 bg-emerald-950/80 text-emerald-300 border border-emerald-500/40 text-[9px] font-bold px-1 rounded uppercase",children:"CLI"})]}),(0,h.jsx)("p",{className:"truncate text-[10px] leading-4 text-slate-400 mt-0.5",title:j,children:j})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[c&&(0,h.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),(0,h.jsx)(bp.f,{className:"w-3.5 h-3.5 text-slate-500"})]})]},a.connectionId||a.traceId||`active-agent-${b}`)})})]})]}):(0,h.jsx)("div",{className:"flex-1 overflow-y-auto p-3 space-y-3 text-xs select-text",children:a?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)("div",{className:"w-6 h-6 rounded bg-[#1e1e1e] flex items-center justify-center border border-[#3e3e42]",children:(0,h.jsx)(bu.f,{className:"w-3.5 h-3.5 text-cyan-400"})}),(0,h.jsxs)("div",{children:[(0,h.jsx)("h3",{className:"font-bold text-slate-200 text-xs",children:a.account||`Desk #${(a.deskIndex??0)+1}`}),(0,h.jsxs)("p",{className:"text-[10px] text-slate-400 font-mono",children:["ID: ",a.connectionId?.slice(0,8),"..."]})]})]}),C?(0,h.jsxs)("span",{className:"bg-purple-950/80 text-purple-300 border border-purple-500/40 text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider flex items-center gap-1",children:[(0,h.jsx)(bS.f,{className:"w-2.5 h-2.5"}),(0,h.jsx)("span",{children:"APP"})]}):(0,h.jsxs)("span",{className:"bg-emerald-950/80 text-emerald-300 border border-emerald-500/40 text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider flex items-center gap-1",children:[(0,h.jsx)(bh.f,{className:"w-2.5 h-2.5"}),(0,h.jsx)("span",{children:"CLI"})]})]}),(0,h.jsxs)("div",{className:"pt-2 border-t border-[#2b2b2b] grid grid-cols-2 gap-2 text-[11px]",children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"PROVIDER"}),(0,h.jsx)("span",{className:"font-semibold text-slate-300 uppercase",children:a.provider||"Unavailable"})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"MODEL"}),(0,h.jsx)("span",{className:"font-semibold text-emerald-400 truncate block",children:a.model||"Unavailable"})]})]})]}),(0,h.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,h.jsx)("span",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider block",children:"CURRENT ACTIVITY"}),(0,h.jsxs)("div",{className:"flex items-center justify-between text-[11px]",children:[(0,h.jsx)("span",{className:"text-slate-400",children:"Status:"}),(0,h.jsx)("span",{className:`font-semibold capitalize px-1.5 py-0.2 rounded text-[10px] ${"streaming"===a.state?"bg-cyan-500/20 text-cyan-300 border border-cyan-500/30":"busy"===a.state?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30":"error"===a.state?"bg-rose-500/20 text-rose-300 border border-rose-500/30":"bg-slate-800 text-slate-400"}`,children:a.state||"Idle"})]}),a.activeTool&&(0,h.jsxs)("div",{className:"pt-1",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[11px] block",children:"Active Tool:"}),(0,h.jsx)("div",{className:"mt-1 bg-[#181818] p-1.5 rounded border border-[#2b2b2b] font-mono text-[10px] text-cyan-300 truncate",children:a.activeTool})]})]}),(m=(0,bW.F)(),n=a?.skin||m?.equippedSkin,o=a?.aura||m?.equippedAura,p=a?.pet||m?.equippedPet,q=a?.props&&a.props.length>0?a.props:m?.equippedProps||[],r=a?.trophy||m?.equippedTrophy,s=n&&"classic"!==n&&"none"!==n?(0,bG.x)(n):null,t=o&&"none"!==o?(0,bG.x)(o):null,u=p&&"none"!==p?(0,bG.x)(p):null,v=r&&"none"!==r?(0,bG.x)(r):null,(0,h.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsxs)("span",{className:"text-[10px] font-bold text-cyan-400 uppercase tracking-wider flex items-center gap-1.5",children:[(0,h.jsx)(a_.f,{className:"w-3 h-3 text-cyan-400"}),(0,h.jsx)("span",{children:"EQUIPPED COSMETICS"})]}),(s||t||u||v||q.length>0)&&(0,h.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-cyan-950/80 text-cyan-300 border border-cyan-500/40 font-mono font-bold",children:"ACTIVE GEAR"})]}),(0,h.jsxs)("div",{className:"space-y-1.5 text-[11px]",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between py-1 border-b border-[#2d2d30]",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Chassis Skin:"}),(0,h.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:s?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("span",{className:"w-2 h-2 rounded-full inline-block border border-white/20",style:{backgroundColor:s.color}}),(0,h.jsx)("span",{className:"text-emerald-400 font-semibold truncate max-w-[120px]",children:s.name}),(0,h.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-slate-800 text-slate-400 border border-slate-700",children:s.archetype})]}):(0,h.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Classic Chassis"})})]}),(0,h.jsxs)("div",{className:"flex items-center justify-between py-1 border-b border-[#2d2d30]",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Particle Aura:"}),(0,h.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:t?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("span",{className:"text-purple-400 font-semibold truncate max-w-[120px]",children:t.name}),(0,h.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-purple-950/60 text-purple-300 border border-purple-800/40",children:t.archetype})]}):(0,h.jsx)("span",{className:"text-slate-500 text-[10px]",children:"None"})})]}),(0,h.jsxs)("div",{className:"py-1 border-b border-[#2d2d30]",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between mb-0.5",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Tech Desk Props:"}),(0,h.jsxs)("span",{className:"text-[9px] text-slate-500 font-mono",children:["(",q.length,")"]})]}),q.length>0?(0,h.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:q.map((a,b)=>{let c=(0,bG.x)(a);return(0,h.jsxs)("span",{className:"text-[9px] px-1.5 py-0.5 rounded bg-cyan-950/60 text-cyan-300 border border-cyan-800/40 font-mono flex items-center gap-1",children:[(0,h.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:c?.color||"#38bdf8"}}),(0,h.jsx)("span",{children:c?.name||a})]},b)})}):(0,h.jsx)("span",{className:"text-slate-500 text-[10px]",children:"Standard Workstation"})]}),(0,h.jsxs)("div",{className:"flex items-center justify-between py-1 border-b border-[#2d2d30]",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Companion Pet:"}),(0,h.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:u?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("span",{className:"text-amber-400 font-semibold truncate max-w-[120px]",children:u.name}),(0,h.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-amber-950/60 text-amber-300 border border-amber-800/40",children:u.archetype})]}):(0,h.jsx)("span",{className:"text-slate-500 text-[10px]",children:"None"})})]}),(0,h.jsxs)("div",{className:"flex items-center justify-between py-1",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px]",children:"Desk Trophy:"}),(0,h.jsx)("div",{className:"flex items-center gap-1.5 font-medium",children:v?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("span",{className:"text-yellow-400 font-semibold truncate max-w-[120px]",children:v.name}),(0,h.jsx)("span",{className:"text-[8px] font-mono px-1 rounded bg-yellow-950/60 text-yellow-300 border border-yellow-800/40",children:v.archetype})]}):(0,h.jsx)("span",{className:"text-slate-500 text-[10px]",children:"None"})})]})]})]})),(0,h.jsxs)("div",{className:"bg-[#252526] border border-[#333333] rounded-lg p-3 space-y-2",children:[(0,h.jsx)("span",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-wider block",children:"TOKEN USAGE"}),(0,h.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-[11px]",children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"Total Tokens"}),(0,h.jsx)("span",{className:"font-bold text-emerald-400 font-mono",children:Number.isFinite(a.totalTokens)?a.totalTokens.toLocaleString():"—"})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("span",{className:"text-slate-500 text-[10px] block",children:"Requests / Steps"}),(0,h.jsx)("span",{className:"font-bold text-slate-300 font-mono",children:Number.isFinite(a.requestCount)?a.requestCount:"—"})]})]})]}),(0,h.jsxs)("div",{className:"space-y-1.5 pt-1",children:[g&&(0,h.jsxs)("button",{onClick:()=>g(a.connectionId||a.traceId),className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#007acc] hover:bg-[#0062a3] text-white font-medium text-xs transition-colors shadow-sm cursor-pointer",children:[(0,h.jsx)(l.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{children:"Replay Session"})]}),(0,h.jsxs)("button",{onClick:()=>B("chat"),className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#252526] hover:bg-[#2d2d2e] text-slate-200 hover:text-white font-medium text-xs transition-colors border border-[#3e3e42] cursor-pointer",children:[(0,h.jsx)(j.f,{className:"w-3.5 h-3.5 text-cyan-400"}),(0,h.jsx)("span",{children:"View Live Chat (Pin to Sidebar)"})]}),(0,h.jsxs)("button",{onClick:()=>(0,aK.f)(a.connectionId||a.traceId),className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#252526] hover:bg-[#2d2d2e] text-slate-300 hover:text-white text-xs transition-colors border border-[#3e3e42] cursor-pointer",children:[(0,h.jsx)(k.f,{className:"w-3.5 h-3.5 text-cyan-400"}),(0,h.jsx)("span",{children:"Open in Detached Window"})]}),(0,h.jsxs)("button",{onClick:()=>{a?.connectionId&&(navigator.clipboard?.writeText(a.connectionId),x(!0),setTimeout(()=>x(!1),2e3))},className:"w-full flex items-center justify-center gap-1.5 py-1.5 px-3 rounded bg-[#252526] hover:bg-[#2d2d2e] text-slate-300 text-xs transition-colors border border-[#3e3e42] cursor-pointer",children:[w?(0,h.jsx)(bU.f,{className:"w-3.5 h-3.5 text-emerald-400"}):(0,h.jsx)(bT.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{children:w?"Connection ID Copied!":"Copy Connection ID"})]})]})]}):(0,h.jsxs)("div",{className:"py-12 text-center text-slate-500 space-y-3",children:[(0,h.jsx)("div",{className:"w-10 h-10 rounded-full bg-[#252526] border border-[#333333] flex items-center justify-center mx-auto text-slate-600",children:(0,h.jsx)(bR.f,{className:"w-5 h-5"})}),(0,h.jsxs)("div",{className:"space-y-1 px-4",children:[(0,h.jsx)("h4",{className:"font-bold text-slate-400 text-xs",children:"No Agent Selected"}),(0,h.jsx)("p",{className:"text-[11px] leading-relaxed",children:"Click any workstation on the virtual office or select from the Explorer list to inspect telemetry and details."})]})]})})})]})}let bY={name:"users",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};bY.node;let bZ=(0,aP.f)(bY);function b$({mode:a="live",connected:b=!0,live:c=!0,stats:d={},selectedAgent:e=null,soundEnabled:f=!1,isBottomOpen:g=!0,onToggleBottom:i}){return(0,h.jsxs)("footer",{"data-testid":"status-bar",className:"h-[22px] min-h-[22px] bg-[#181818] border-t border-[#2b2b2b] px-3 flex items-center justify-between text-[11px] text-[#cccccc] select-none shrink-0 z-30 font-sans",children:[(0,h.jsxs)("div",{className:"flex items-center gap-3",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1.5 hover:text-white cursor-pointer transition-colors",children:[(0,h.jsx)("span",{className:`w-2 h-2 rounded-full ${b&&c?"bg-emerald-400 animate-pulse shadow-sm shadow-emerald-400":"bg-amber-400"}`}),(0,h.jsx)("span",{className:"font-medium text-[10px]",children:"live"===a?"WATCHER: LIVE":"MODE: DEMO MOCK"})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 hover:text-white transition-colors",children:[(0,h.jsx)(bZ,{className:"w-3 h-3 text-[#007acc]"}),(0,h.jsxs)("span",{children:[d?.agents||0," Desks"]})]}),d?.busy>0&&(0,h.jsxs)("div",{className:"flex items-center gap-1 text-emerald-400",children:[(0,h.jsx)(bg.f,{className:"w-3 h-3 animate-spin"}),(0,h.jsxs)("span",{children:[d.busy," Working"]})]})]}),(0,h.jsx)("div",{className:"hidden md:flex items-center gap-2 text-slate-400 text-[10px]",children:e?(0,h.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(bu.f,{className:"w-3 h-3 text-cyan-400"}),(0,h.jsx)("span",{className:"text-slate-200 font-semibold truncate max-w-[200px]",children:e.account||e.connectionId}),(0,h.jsxs)("span",{children:["(",e.model||"gemini-3.8-flash",")"]})]}):(0,h.jsx)("span",{children:"Ready · Real-time monitoring Antigravity, Claude & Codex (CLI & Desktop)"})}),(0,h.jsxs)("div",{className:"flex items-center gap-3",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1 text-slate-400 text-[10px]",children:[f?(0,h.jsx)(aO.f,{className:"w-3 h-3 text-emerald-400"}):(0,h.jsx)(aR,{className:"w-3 h-3 text-slate-500"}),(0,h.jsx)("span",{className:"hidden sm:inline",children:f?"Audio On":"Muted"})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 text-slate-400 font-mono text-[10px]",children:[(0,h.jsx)("span",{children:"Tokens:"}),(0,h.jsx)("span",{className:"text-emerald-400 font-bold",children:d?.tokensLabel||"0k"})]}),(0,h.jsxs)("button",{type:"button",onClick:i,title:g?"Hide Terminal (Cmd+J)":"Show Terminal (Cmd+J)",className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors ${g?"bg-[#007acc]/20 text-[#4fc1ff]":"text-slate-400 hover:text-white hover:bg-[#252526]"}`,children:[(0,h.jsx)(bh.f,{className:"w-3 h-3"}),(0,h.jsx)("span",{className:"text-[10px] hidden sm:inline",children:"Terminal"})]})]})]})}var b_=a.i(8658);let b0={name:"type",size:24,node:[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]]};b0.node;let b1=(0,aP.f)(b0);function b2({isOpen:a=!1,onClose:b,onOpenStore:c,onOpenThemeSettings:d,onOpenFontSettings:e,onToggleLeftSidebar:f,onToggleBottomPanel:g,onToggleRightSidebar:m,onToggleZenFullscreen:n,onOpenChatSidebar:o,onOpenFilesExplorer:p,onToggleSound:q,onToggleNotif:r,onRefresh:s,onSetMode:t,onSelectPreset:u,onOpenReports:v,onStartReplay:w}){let[x,y]=(0,i.useState)(""),z=(0,i.useRef)(null);if((0,i.useEffect)(()=>{a&&(setTimeout(()=>z.current?.focus(),50),y(""))},[a]),(0,i.useEffect)(()=>{let c=c=>{"Escape"===c.key&&a&&b()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a,b]),!a)return null;let A=[{id:"toggle-left",title:"View: Toggle Primary Side Bar",shortcut:"Cmd+B",icon:a4,action:()=>{f(),b()}},{id:"open-files-explorer",title:"File: Open Workspace Files Explorer (Code & Artifacts)",icon:bm,action:()=>{p?.(),b()}},{id:"toggle-bottom",title:"View: Toggle Bottom Panel (Terminal & Logs)",shortcut:"Cmd+J",icon:a6,action:()=>{g(),b()}},{id:"toggle-zen-fullscreen",title:"View: Toggle Virtual Office Chill Mode (Full Screen)",shortcut:"Shift+F",icon:a9.f,action:()=>{n?.(),b()}},{id:"toggle-right",title:"View: Toggle Secondary Side Bar (Live Chat & Inspector)",shortcut:"Cmd+Alt+B",icon:a8,action:()=>{m(),b()}},{id:"open-chat-sidebar",title:"Chat: Pin Live Chat to Sidebar",icon:j.f,action:()=>{o?.(),b()}},{id:"open-chat-new-window",title:"Chat: Move into New Window (Detached)",icon:k.f,action:()=>{(0,aK.f)(),b()}},{id:"preferences-theme",title:"Preferences: Color Theme (VS Code Themes)",icon:a$.f,action:()=>{d?.(),b()}},{id:"preferences-fonts",title:"Preferences: Configure Fonts (UI & Monospace)",icon:b1,action:()=>{e?.(),b()}},{id:"open-reports",title:"Reports: Open Token Usage & Analytics Report",icon:aY.f,action:()=>{v?.(),b()}},{id:"open-store",title:"Store: Open Supporter Store & Character Customization (Buy Me a Coffee)",icon:aZ.f,action:()=>{c?.(),b()}},{id:"start-replay",title:"Time-Machine: Replay Session History",icon:l.f,action:()=>{w?.(),b()}},{id:"refresh-watchers",title:"Watcher: Force Refresh All Watchers & Brain Transcripts",shortcut:"Cmd+R",icon:aN.f,action:()=>{s(),b()}},{id:"live-mode",title:"Mode: Switch to Live Watchers (Realtime ~/.gemini & ~/.claude)",icon:aX,action:()=>{t("live"),b()}},{id:"mock-storm",title:"Preset: Run Storm Demo (30 Agents Stress Test)",icon:b_.f,action:()=>{t("mock"),u("storm"),b()}},{id:"mock-busy",title:"Preset: Run Busy Demo (8 Working Agents)",icon:b_.f,action:()=>{t("mock"),u("busy"),b()}},{id:"toggle-sound",title:"Audio: Toggle 8-bit Sound FX",icon:aO.f,action:()=>{q(),b()}},{id:"toggle-notif",title:"System: Toggle Desktop Notifications",icon:aT,action:()=>{r(),b()}}].filter(a=>a.title.toLowerCase().includes(x.toLowerCase()));return(0,h.jsx)("div",{onClick:b,className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-xs flex items-start justify-center pt-16 px-4",children:(0,h.jsxs)("div",{onClick:a=>a.stopPropagation(),className:"w-full max-w-xl bg-[#252526] border border-[#3e3e42] rounded-lg shadow-2xl overflow-hidden flex flex-col max-h-[420px]",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5 bg-[#1e1e1e] border-b border-[#333333]",children:[(0,h.jsx)(aM.f,{className:"w-4 h-4 text-slate-400 shrink-0"}),(0,h.jsx)("input",{ref:z,type:"text",value:x,onChange:a=>y(a.target.value),placeholder:"Type a command or search actions...",className:"w-full bg-transparent text-xs text-slate-100 outline-none placeholder:text-slate-500"}),(0,h.jsx)("kbd",{className:"text-[10px] bg-[#2a2d2e] border border-[#3e3e42] rounded px-1.5 py-0.5 text-slate-400",children:"Esc"})]}),(0,h.jsx)("div",{className:"flex-1 overflow-y-auto divide-y divide-[#2d2d2d] py-1",children:0===A.length?(0,h.jsx)("div",{className:"p-4 text-center text-xs text-slate-500 italic",children:"No matching commands found"}):A.map(a=>{let b=a.icon;return(0,h.jsxs)("div",{onClick:a.action,className:"flex items-center justify-between px-3 py-2 cursor-pointer hover:bg-[#007acc] hover:text-white text-[#cccccc] text-xs transition-colors group",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,h.jsx)(b,{className:"w-4 h-4 text-slate-400 group-hover:text-white shrink-0"}),(0,h.jsx)("span",{className:"font-medium truncate text-[11px]",children:a.title})]}),a.shortcut&&(0,h.jsx)("kbd",{className:"font-mono text-[9px] bg-[#1e1e1e] group-hover:bg-[#0062a3] border border-[#3e3e42] group-hover:border-transparent px-1.5 py-0.5 rounded text-slate-400 group-hover:text-white shrink-0",children:a.shortcut})]},a.id)})})]})})}var b3=a.i(12265),b4=a.i(72391);let b5={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]};b5.node;let b6=(0,aP.f)(b5);var b7=a.i(44373);let b8={extension:{type:b7.x.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await a.A(7916)}},b9={extension:{type:b7.x.Environment,name:"webworker",priority:0},test:()=>"u">typeof self&&void 0!==self.WorkerGlobalScope,load:async()=>{await a.A(44390)}};a.i(28755),a.i(91540),a.i(68087);var ca=a.i(61607);b7.H.add(b8,b9);var cb=a.i(58422),cc=a.i(67663);async function cd(a={}){return void 0!==e?e:e=await (async()=>{let b=cb.f.get().getNavigator().gpu;if(!b)return!1;try{let c=await b.requestAdapter(a);return await c.requestDevice(),!0}catch(a){return!1}})()}let ce=["webgl","webgpu","canvas"];async function cf(b){let c,e=[];b.preference?Array.isArray(b.preference)?e=b.preference.slice():(e.push(b.preference),ce.forEach(a=>{a!==b.preference&&e.push(a)})):e=ce.slice();let f={};for(let g=0;g<e.length;g++){let h=e[g];if("webgpu"===h&&await cd()){let{WebGPURenderer:d}=await a.A(21326);c=d,f={...b,...b.webgpu};break}if("webgl"===h&&function(a){return void 0!==d?d:d=(()=>{let b={stencil:!0,failIfMajorPerformanceCaveat:a??cc.f.defaultOptions.failIfMajorPerformanceCaveat};try{if(!cb.f.get().getWebGLRenderingContext())return!1;let a=cb.f.get().createCanvas().getContext("webgl",b),c=!!a?.getContextAttributes()?.stencil;if(a){let b=a.getExtension("WEBGL_lose_context");b&&b.loseContext()}return a=null,c}catch(a){return!1}})()}(b.failIfMajorPerformanceCaveat??cc.f.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:d}=await a.A(96549);c=d,f={...b,...b.webgl};break}if("canvas"===h){let{CanvasRenderer:d}=await a.A(10069);c=d,f={...b,...b.canvasOptions};break}}if(delete f.webgpu,delete f.webgl,delete f.canvasOptions,!c)throw Error("No available renderer for the current environment");let g=new c;return await g.init(f),g}var cg=a.i(84764),ch=a.i(99553),ci=a.i(2897);class cj{static init(a){Object.defineProperty(this,"resizeTo",{configurable:!0,set(a){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=a,a&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{let a,b;if(this._resizeTo){if(this._cancelResize(),this._resizeTo===globalThis.window)a=globalThis.innerWidth,b=globalThis.innerHeight;else{let{clientWidth:c,clientHeight:d}=this._resizeTo;a=c,b=d}this.renderer.resize(a,b),this.render()}},this._resizeId=null,this._resizeTo=null,this.resizeTo=a.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}cj.extension=b7.x.Application;var ck=a.i(83019),cl=a.i(83717);class cm{static init(a){a=Object.assign({autoStart:!0,sharedTicker:!1},a),Object.defineProperty(this,"ticker",{configurable:!0,set(a){this._ticker&&this._ticker.remove(this.render,this),this._ticker=a,a&&a.add(this.render,this,ck.f.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=a.sharedTicker?cl.f.shared:new cl.f,a.autoStart&&this.start()}static destroy(){if(this._ticker){let a=this._ticker;this.ticker=null,a.destroy()}}}cm.extension=b7.x.Application,b7.H.add(cj),b7.H.add(cm);let cn=class a{constructor(...a){this.stage=new cg.t,void 0!==a[0]&&(0,ci.K)(ci.e,"Application constructor options are deprecated, please use Application.init() instead.")}async init(b){b={...b},this.stage||(this.stage=new cg.t),this.renderer=await cf(b),a._plugins.forEach(a=>{a.init.call(this,b)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return(0,ci.K)(ci.e,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}get domContainerRoot(){return this.renderer.renderPipes.dom?._domElement}destroy(b=!1,c=!1){let d=a._plugins.slice(0);d.reverse(),d.forEach(a=>{a.destroy.call(this)}),this.stage.destroy(c),this.stage=null,this.renderer.destroy(b),this.renderer=null}};cn._plugins=[],b7.H.handleByList(b7.x.Application,cn._plugins),b7.H.add(ch.L);var co=a.i(98953),cp=a.i(28136),cq=a.i(31394),cr=a.i(94214),cs=a.i(37155),ct=a.i(24869);class cu extends ct.f{constructor(a,b){let{text:c,resolution:d,style:e,anchor:f,width:g,height:h,roundPixels:i,...j}=a;super({...j}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=b,this.text=c??"",this.style=e,this.resolution=d??null,this.allowChildren=!1,this._anchor=new cs.f({_onUpdate:()=>{this.onViewUpdate()}}),f&&(this.anchor=f),this.roundPixels=i??!1,void 0!==g&&(this.width=g),void 0!==h&&(this.height=h)}get anchor(){return this._anchor}set anchor(a){"number"==typeof a?this._anchor.set(a):this._anchor.copyFrom(a)}set text(a){a=a.toString(),this._text!==a&&(this._text=a,this.onViewUpdate())}get text(){return this._text}set resolution(a){this._autoResolution=null===a,this._resolution=a,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(a){a||(a={}),this._style?.off("update",this.onViewUpdate,this),a instanceof this._styleClass?this._style=a:this._style=new this._styleClass(a),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(a){this._setWidth(a,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(a){this._setHeight(a,this.bounds.height)}getSize(a){return a||(a={}),a.width=Math.abs(this.scale.x)*this.bounds.width,a.height=Math.abs(this.scale.y)*this.bounds.height,a}setSize(a,b){"object"==typeof a?(b=a.height??a.width,a=a.width):b??(b=a),void 0!==a&&this._setWidth(a,this.bounds.width),void 0!==b&&this._setHeight(b,this.bounds.height)}containsPoint(a){let b=this.bounds.width,c=this.bounds.height,d=-b*this.anchor.x,e=0;return!!(a.x>=d)&&!!(a.x<=d+b)&&(e=-c*this.anchor.y,!!(a.y>=e)&&!!(a.y<=e+c))||!1}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(a=!1){this._style?.off("update",this.onViewUpdate,this),super.destroy(a),this.owner=null,this._bounds=null,this._anchor=null,("boolean"==typeof a?a:a?.style)&&this._style.destroy(a),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}}var cv=a.i(98063),cw=a.i(31023),cx=a.i(9124),cy=a.i(48732);let cz=null,cA=null;function cB(a,b,c){for(let d=0,e=4*c*b;d<b;++d,e+=4)if(0!==a[e+3])return!1;return!0}function cC(a,b,c,d,e){let f=4*b;for(let b=d,g=d*f+4*c;b<=e;++b,g+=f)if(0!==a[g+3])return!1;return!0}class cD{constructor(a=0,b=0,c=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=a,this.resetTtl=c,this.size=0,this.ttl=b}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(a){if(this.has(a)){let b=this.items[a];delete this.items[a],this.size--,null!==b.prev&&(b.prev.next=b.next),null!==b.next&&(b.next.prev=b.prev),this.first===b&&(this.first=b.next),this.last===b&&(this.last=b.prev)}return this}entries(a=this.keys()){let b=Array(a.length);for(let c=0;c<a.length;c++){let d=a[c];b[c]=[d,this.get(d)]}return b}evict(a=!1){if(a||this.size>0){let a=this.first;delete this.items[a.key],0==--this.size?(this.first=null,this.last=null):(this.first=a.next,this.first.prev=null)}return this}expiresAt(a){let b;return this.has(a)&&(b=this.items[a].expiry),b}get(a){let b=this.items[a];if(void 0!==b)return this.ttl>0&&b.expiry<=Date.now()?void this.delete(a):(this.moveToEnd(b),b.value)}has(a){return a in this.items}moveToEnd(a){this.last!==a&&(null!==a.prev&&(a.prev.next=a.next),null!==a.next&&(a.next.prev=a.prev),this.first===a&&(this.first=a.next),a.prev=this.last,a.next=null,null!==this.last&&(this.last.next=a),this.last=a,null===this.first&&(this.first=a))}keys(){let a=Array(this.size),b=this.first,c=0;for(;null!==b;)a[c++]=b.key,b=b.next;return a}setWithEvicted(a,b,c=this.resetTtl){let d=null;if(this.has(a))this.set(a,b,!0,c);else{this.max>0&&this.size===this.max&&(d={...this.first},this.evict(!0));let c=this.items[a]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:a,prev:this.last,next:null,value:b};1==++this.size?this.first=c:this.last.next=c,this.last=c}return d}set(a,b,c=!1,d=this.resetTtl){let e=this.items[a];return c||void 0!==e?(e.value=b,!1===c&&d&&(e.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(e)):(this.max>0&&this.size===this.max&&this.evict(!0),e=this.items[a]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:a,prev:this.last,next:null,value:b},1==++this.size?this.first=e:this.last.next=e,this.last=e),this}values(a=this.keys()){let b=Array(a.length);for(let c=0;c<a.length;c++)b[c]=this.get(a[c]);return b}}function cE(a){return!!a.tagStyles&&Object.keys(a.tagStyles).length>0}function cF(a){return a.includes("<")}let cG=new Set([10,13]),cH=new Set([9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]),cI=new Set([45,8208,8211,8212,173]),cJ=/(\r\n|\r|\n)/,cK=/(?:\r\n|\r|\n)/;function cL(a){return"string"==typeof a&&cG.has(a.charCodeAt(0))}function cM(a,b){return"string"==typeof a&&cH.has(a.charCodeAt(0))}function cN(a){return"normal"===a||"pre-line"===a}function cO(a){return"normal"===a}function cP(a){if("string"!=typeof a)return"";let b=a.length-1;for(;b>=0&&cM(a[b]);)b--;return b<a.length-1?a.slice(0,b+1):a}function cQ(a){let b=[],c=[];if("string"!=typeof a)return b;for(let d=0;d<a.length;d++){let e=a[d],f=a[d+1];if(cM(e,f)||cL(e)){c.length>0&&(b.push(c.join("")),c.length=0),"\r"===e&&"\n"===f?(b.push("\r\n"),d++):b.push(e);continue}c.push(e),"string"==typeof e&&cI.has(e.charCodeAt(0))&&f&&!cM(f)&&!cL(f)&&(b.push(c.join("")),c.length=0)}return c.length>0&&b.push(c.join("")),b}function cR(a,b,c,d){let e=c(a),f=[];for(let c=0;c<e.length;c++){let g=e[c],h=g,i=1;for(;e[c+i];){let f=e[c+i];if(d(h,f,a,c,b))break;g+=f,h=f,i++}c+=i-1,f.push(g)}return f}let cS=/\r\n|\r|\n/g,cT={willReadFrequently:!0};function cU(a,b,c,d,e){let f=c[a];return"number"!=typeof f&&(f=e(a,b,d)+b,c[a]=f),f}let cV={willReadFrequently:!0},cW=class a{static get experimentalLetterSpacingSupported(){let b=a._experimentalLetterSpacingSupported;if(void 0===b){let c=cb.f.get().getCanvasRenderingContext2D().prototype;b=a._experimentalLetterSpacingSupported="letterSpacing"in c||"textLetterSpacing"in c}return b}constructor(a,b,c,d,e,f,g,h,i,j){this.text=a,this.style=b,this.width=c,this.height=d,this.lines=e,this.lineWidths=f,this.lineHeight=g,this.maxLineWidth=h,this.fontProperties=i,j&&(this.runsByLine=j.runsByLine,this.lineAscents=j.lineAscents,this.lineDescents=j.lineDescents,this.lineHeights=j.lineHeights,this.hasDropShadow=j.hasDropShadow)}static measureText(b=" ",c,d=a._canvas,e=c.wordWrap){let f=`${b}-${c.styleKey}-wordWrap-${e}`;if(a._measurementCache.has(f))return a._measurementCache.get(f);if(cE(c)&&cF(b)){let d=function(a,b,c,d,e,f,g,h,i){let j=function(a,b){let c=[],d=b.tagStyles;if(!cE(b)||!cF(a))return c.push({text:a,style:b}),c;let e=[b],f=[],g="",h=0;for(;h<a.length;){let b=a[h];if("<"===b){let k=a.indexOf(">",h);if(-1===k){g+=b,h++;continue}let l=a.indexOf("<",h+1);if(-1!==l&&l<k){g+=b,h++;continue}let m=a.slice(h+1,k);if(m.startsWith("/")){let b=m.slice(1).trim();if(f.length>0&&f[f.length-1]===b){g.length>0&&(c.push({text:g,style:e[e.length-1]}),g=""),e.pop(),f.pop(),h=k+1;continue}g+=a.slice(h,k+1),h=k+1;continue}{let b=m.trim();if(d[b]){var i,j;g.length>0&&(c.push({text:g,style:e[e.length-1]}),g="");let a=(i=e[e.length-1],j=d[b],i.clone().assign(j));e.push(a),f.push(b),h=k+1;continue}g+=a.slice(h,k+1),h=k+1;continue}}g+=b,h++}return g.length>0&&c.push({text:g,style:e[e.length-1]}),c}(a,b);if(cO(b.whiteSpace))for(let a=0;a<j.length;a++){let b=j[a];j[a]={text:b.text.replace(cS," "),style:b.style}}let k=[],l=[];for(let a of j){let b=a.text.split(cJ);for(let c=0;c<b.length;c++){let d=b[c];"\r\n"===d||"\r"===d||"\n"===d?(k.push(l),l=[]):d.length>0&&l.push({text:d,style:a.style})}}(l.length>0||0===k.length)&&k.push(l);let m=c?function(a,b,c,d,e,f){let{letterSpacing:g,whiteSpace:h,wordWrapWidth:i,breakWords:j}=b,k=cN(h),l=i+g,m={},n="",o=(a,b)=>{let e=`${a}|${b.styleKey}`,f=m[e];if(void 0===f){let g=b._fontString;g!==n&&(c.font=g,n=g),f=d(a,b.letterSpacing,c)+b.letterSpacing,m[e]=f}return f},p=[];for(let b of a){let a=function(a){let b=[],c=!1;for(let d of a){let a=cQ(d.text),e=!0;for(let f of a){let a=cM(f)||cL(f),g=e&&c&&!a;b.push({token:f,style:d.style,continuesFromPrevious:g}),c=!a,e=!1}}return b}(b),c=p.length,d=b=>{let c=0,d=b;do{let{token:b,style:e}=a[d];c+=o(b,e),d++}while(d<a.length&&a[d].continuesFromPrevious)return c},g=b=>{let c=[],d=b;do c.push({token:a[d].token,style:a[d].style}),d++;while(d<a.length&&a[d].continuesFromPrevious)return c},h=[],i=0,m=!k,n=null,q=()=>{n&&n.text.length>0&&h.push(n),n=null},r=()=>{if(q(),h.length>0){let a=h[h.length-1];a.text=cP(a.text),0===a.text.length&&h.pop()}p.push(h),h=[],i=0,m=!1};for(let b=0;b<a.length;b++){let{token:c,style:s,continuesFromPrevious:t}=a[b],u=o(c,s);if(k){let a=cM(c),b=n?.text[n.text.length-1]??h[h.length-1]?.text.slice(-1)??"",d=!!b&&cM(b);if(a&&d)continue}let v=!t,w=v?d(b):u;if(w>l&&v)if(i>0&&r(),j){let a=g(b);for(let b=0;b<a.length;b++){let c=a[b].token,d=a[b].style;for(let a of cR(c,j,f,e)){let b=o(a,d);b+i>l&&r(),n&&n.style===d?n.text+=a:(q(),n={text:a,style:d}),i+=b}}b+=a.length-1}else{let a=g(b);q(),p.push(a.map(a=>({text:a.token,style:a.style}))),m=!1,b+=a.length-1}else if(w+i>l&&v){if(cM(c)){m=!1;continue}r(),n={text:c,style:s},i=u}else if(t&&!j)n&&n.style===s?n.text+=c:(q(),n={text:c,style:s}),i+=u;else{let a=cM(c);if(0===i&&a&&!m)continue;n&&n.style===s?n.text+=c:(q(),n={text:c,style:s}),i+=u}}if(q(),h.length>0){let a=h[h.length-1];a.text=cP(a.text),0===a.text.length&&h.pop()}(h.length>0||p.length===c)&&p.push(h)}return p}(k,b,d,f,h,i):k,n=[],o=[],p=[],q=[],r=[],s=0,t=g(b._fontString);0===t.fontSize&&(t.fontSize=b.fontSize,t.ascent=b.fontSize);let u="",v=!!b.dropShadow,w=b._stroke?.width||0;for(let a of m){let c=0,f=t.ascent,h=t.descent,i="";for(let b of a){let a=b.style._fontString,j=g(a);a!==u&&(d.font=a,u=a),c+=e(b.text,b.style.letterSpacing,d),f=Math.max(f,j.ascent),h=Math.max(h,j.descent),i+=b.text;let k=b.style._stroke?.width||0;k>w&&(w=k),!v&&b.style.dropShadow&&(v=!0)}0===a.length&&(f=t.ascent,h=t.descent),n.push(c),o.push(f),p.push(h),r.push(i);let j=b.lineHeight||f+h;q.push(j+b.leading),s=Math.max(s,c)}let x=w,y=s+x+(b.dropShadow?b.dropShadow.distance:0),z=0;for(let a=0;a<q.length;a++)z+=q[a];return{width:y,height:(z=Math.max(z,q[0]+x))+(b.dropShadow?b.dropShadow.distance:0),lines:r,lineWidths:n,lineHeight:(b.lineHeight||t.fontSize)+b.leading,maxLineWidth:s,fontProperties:t,runsByLine:m,lineAscents:o,lineDescents:p,lineHeights:q,hasDropShadow:v}}(b,c,e,a._context,a._measureText,a._measureTextAdvance,a.measureFont,a.canBreakChars,a.wordWrapSplit),g=new a(b,c,d.width,d.height,d.lines,d.lineWidths,d.lineHeight,d.maxLineWidth,d.fontProperties,{runsByLine:d.runsByLine,lineAscents:d.lineAscents,lineDescents:d.lineDescents,lineHeights:d.lineHeights,hasDropShadow:d.hasDropShadow});return a._measurementCache.set(f,g),g}let g=c._fontString,h=a.measureFont(g);0===h.fontSize&&(h.fontSize=c.fontSize,h.ascent=c.fontSize,h.descent=0);let i=a._context;i.font=g;let j=(e?a._wordWrap(b,c,d):b).split(cK),k=Array(j.length),l=0;for(let b=0;b<j.length;b++){let d=a._measureText(j[b],c.letterSpacing,i);k[b]=d,l=Math.max(l,d)}let m=c._stroke?.width??0,n=c.lineHeight||h.fontSize,o=a._adjustWidthForStyle(l,c),p=Math.max(n,h.fontSize+m)+(j.length-1)*(n+c.leading),q=a._adjustHeightForStyle(p,c),r=new a(b,c,o,q,j,k,n+c.leading,l,h);return a._measurementCache.set(f,r),r}static _adjustWidthForStyle(a,b){let c=a+(b._stroke?.width||0);return b.dropShadow&&(c+=b.dropShadow.distance),c}static _adjustHeightForStyle(a,b){let c=a;return b.dropShadow&&(c+=b.dropShadow.distance),c}static _measureText(b,c,d){let{metricWidth:e,metrics:f,letterSpacingVal:g}=a._measureTextCore(b,c,d),h=-(f.actualBoundingBoxLeft??0),i=(f.actualBoundingBoxRight??0)-h;return f.width>0&&(i+=g),Math.max(e,i)}static _measureTextAdvance(b,c,d){return a._measureTextCore(b,c,d).metricWidth}static _measureTextCore(b,c,d){let e=!1;a.experimentalLetterSpacingSupported&&(a.experimentalLetterSpacing?(d.letterSpacing=`${c}px`,d.textLetterSpacing=`${c}px`,e=!0):(d.letterSpacing="0px",d.textLetterSpacing="0px"));let f=d.measureText(b),g=f.width,h=0;return g>0&&(g+=h=e?-c:(a.graphemeSegmenter(b).length-1)*c),{metricWidth:g,metrics:f,letterSpacingVal:h}}static _wordWrap(b,c,d=a._canvas){return function(a,b,c,d,e,f,g){let h=c.getContext("2d",cT);h.font=b._fontString;let i=0,j="",k=[],l=Object.create(null),{letterSpacing:m,whiteSpace:n}=b,o=cN(n),p=cO(n),q=!o,r=b.wordWrapWidth+m,s=cQ(a);for(let a=0;a<s.length;a++){let c=s[a];if(cL(c)){if(!p){k.push(cP(j)),q=!o,j="",i=0;continue}c=" "}if(o){let a=cM(c),b=cM(j[j.length-1]);if(a&&b)continue}let n=cU(c,m,l,h,d);if(n>r)if(""!==j&&(k.push(cP(j)),j="",i=0),e(c,b.breakWords))for(let a of cR(c,b.breakWords,g,f)){let b=cU(a,m,l,h,d);b+i>r&&(k.push(cP(j)),q=!1,j="",i=0),j+=a,i+=b}else j.length>0&&(k.push(cP(j)),j="",i=0),k.push(cP(c)),q=!1,j="",i=0;else n+i>r&&(q=!1,k.push(cP(j)),j="",i=0),(j.length>0||!cM(c)||q)&&(j+=c,i+=n)}let t=cP(j);return t.length>0&&k.push(t),k.join("\n")}(b,c,d,a._measureTextAdvance,a.canBreakWords,a.canBreakChars,a.wordWrapSplit)}static isBreakingSpace(a,b){return cM(a,b)}static canBreakWords(a,b){return b}static canBreakChars(a,b,c,d,e){return!0}static wordWrapSplit(b){return a.graphemeSegmenter(b)}static measureFont(b){if(a._fonts[b])return a._fonts[b];let c=a._context;c.font=b;let d=c.measureText(a.METRICS_STRING+a.BASELINE_SYMBOL),e=d.actualBoundingBoxAscent??0,f=d.actualBoundingBoxDescent??0,g={ascent:e,descent:f,fontSize:e+f};return a._fonts[b]=g,g}static clearMetrics(b=""){b?delete a._fonts[b]:a._fonts={}}static get _canvas(){if(!a.__canvas){let b;try{let c=new OffscreenCanvas(0,0),d=c.getContext("2d",cV);if(d?.measureText)return a.__canvas=c,c;b=cb.f.get().createCanvas()}catch(a){b=cb.f.get().createCanvas()}b.width=b.height=10,a.__canvas=b}return a.__canvas}static get _context(){return a.__context||(a.__context=a._canvas.getContext("2d",cV)),a.__context}};cW.METRICS_STRING="|ÉqÅ",cW.BASELINE_SYMBOL="M",cW.BASELINE_MULTIPLIER=1.4,cW.HEIGHT_MULTIPLIER=2,cW.graphemeSegmenter=(()=>{if("function"==typeof Intl?.Segmenter){let a=new Intl.Segmenter;return b=>{let c=a.segment(b),d=[],e=0;for(let a of c)d[e++]=a.segment;return d}}return a=>[...a]})(),cW.experimentalLetterSpacing=!1,cW._fonts={},cW._measurementCache=function(a=1e3,b=0,c=!1){if(isNaN(a)||a<0)throw TypeError("Invalid max value");if(isNaN(b)||b<0)throw TypeError("Invalid ttl value");if("boolean"!=typeof c)throw TypeError("Invalid resetTtl value");return new cD(a,b,c)}(1e3);let cX=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function cY(a){let b="number"==typeof a.fontSize?`${a.fontSize}px`:a.fontSize,c=a.fontFamily;Array.isArray(a.fontFamily)||(c=a.fontFamily.split(","));for(let a=c.length-1;a>=0;a--){let b=c[a].trim();/([\"\'])[^\'\"]+\1/.test(b)||cX.includes(b)||(b=`"${b}"`),c[a]=b}return`${a.fontStyle} ${a.fontVariant} ${a.fontWeight} ${b} ${c.join(",")}`}var cZ=a.i(67309),c$=a.i(87069),c_=a.i(71805),c0=a.i(51983),c1=a.i(89376);function c2(a,b,c,d=0,e=0,f=0){if(a.texture===c_.f.WHITE&&!a.fill)return cv.f.shared.setValue(a.color).setAlpha(a.alpha??1).toHexa();if(a.fill){if(a.fill instanceof c1.f){let c=a.fill,d=b.createPattern(c.texture.source.resource,"repeat");return c$.f.applyPatternTransform(d,c.transform,!1),d}else if(a.fill instanceof co.f){let g,h=a.fill,i="linear"===h.type,j="local"===h.textureSpace,k=1,l=1;j&&c&&(k=c.width+d,l=c.height+d);let m=!1;if(i){let{start:a,end:c}=h;g=b.createLinearGradient(a.x*k+e,a.y*l+f,c.x*k+e,c.y*l+f),m=Math.abs(c.x-a.x)<Math.abs((c.y-a.y)*.1)}else{let{center:a,innerRadius:c,outerCenter:d,outerRadius:i}=h;g=b.createRadialGradient(a.x*k+e,a.y*l+f,c*k,d.x*k+e,d.y*l+f,i*k)}if(m&&j&&c){let a=c.lineHeight/l;for(let b=0;b<c.lines.length;b++){let e=(b*c.lineHeight+d/2)/l;h.colorStops.forEach(b=>{let c=e+b.offset*a;c=Math.max(0,Math.min(1,c)),g.addColorStop(Math.floor(1e5*c)/1e5,cv.f.shared.setValue(b.color).toHex())})}}else h.colorStops.forEach(a=>{g.addColorStop(a.offset,cv.f.shared.setValue(a.color).toHex())});return g}}else{let c=b.createPattern(a.texture.source.resource,"repeat"),d=a.matrix.copyTo(cZ.f.shared);return d.scale(a.texture.source.pixelWidth,a.texture.source.pixelHeight),c.setTransform(d),c}return(0,c0.f)("FillStyle not recognised",a),"red"}let c3=new cw.f;function c4(a){let b=0;for(let c=0;c<a.length;c++)32===a.charCodeAt(c)&&b++;return b}let c5=new class{getCanvasAndContext(a){let{text:b,style:c,resolution:d=1}=a,e=c._getFinalPadding(),f=cW.measureText(b||" ",c),g=Math.ceil(Math.ceil(Math.max(1,f.width)+2*e)*d),h=Math.ceil(Math.ceil(Math.max(1,f.height)+2*e)*d),i=cx.f.getOptimalCanvasAndContext(g,h);this._renderTextToCanvas(c,e,d,i,f);let j=c.trim?function(...a){let b=a[0];b.canvas||(b={canvas:a[0],resolution:a[1]});let{canvas:c}=b,d=Math.min(b.resolution??1,1),e=b.width??c.width,f=b.height??c.height,g=b.output;if(cz||((cA=(cz=cb.f.get().createCanvas(256,128)).getContext("2d",{willReadFrequently:!0})).globalCompositeOperation="copy",cA.globalAlpha=1),(cz.width<e||cz.height<f)&&(cz.width=(0,cy.a)(e),cz.height=(0,cy.a)(f)),!cA)throw TypeError("Failed to get canvas 2D context");cA.drawImage(c,0,0,e,f,0,0,e*d,f*d);let h=cA.getImageData(0,0,e,f).data,i=0,j=0,k=e-1,l=f-1;for(;j<f&&cB(h,e,j);)++j;if(j===f)return cw.f.EMPTY;for(;cB(h,e,l);)--l;for(;cC(h,e,i,j,l);)++i;for(;cC(h,e,k,j,l);)--k;return++k,++l,cA.globalCompositeOperation="source-over",cA.strokeRect(i,j,k-i,l-j),cA.globalCompositeOperation="copy",g??(g=new cw.f),g.set(i/d,j/d,(k-i)/d,(l-j)/d),g}({canvas:i.canvas,width:g,height:h,resolution:1,output:c3}):c3.set(0,0,g,h);return{canvasAndContext:i,frame:j}}returnCanvasAndContext(a){cx.f.returnCanvasAndContext(a)}_renderTextToCanvas(a,b,c,d,e){let f,g;if(e.runsByLine&&e.runsByLine.length>0)return void this._renderTaggedTextToCanvas(e,a,b,c,d);let{canvas:h,context:i}=d,j=cY(a),k=e.lines,l=e.lineHeight,m=e.lineWidths,n=e.maxLineWidth,o=e.fontProperties,p=h.height;if(i.resetTransform(),i.scale(c,c),i.textBaseline=a.textBaseline,a._stroke?.width){let b=a._stroke;i.lineWidth=b.width,i.miterLimit=b.miterLimit,i.lineJoin=b.join,i.lineCap=b.cap}i.font=j;let q=a.dropShadow?2:1,r=(a._stroke?.width??0)/2,s=(l-o.fontSize)/2;l-o.fontSize<0&&(s=0);for(let h=0;h<q;++h){let j=a.dropShadow&&0===h,q=j?Math.ceil(Math.max(1,p)+2*b):0,t=q*c;if(j)this._setupDropShadow(i,a,c,t);else{let c=a._gradientBounds,d=a._gradientOffset;if(c){let f={width:c.width,height:c.height,lineHeight:c.height,lines:e.lines};this._setFillAndStrokeStyles(i,a,f,b,r,d?.x??0,d?.y??0)}else d?this._setFillAndStrokeStyles(i,a,e,b,r,d.x,d.y):this._setFillAndStrokeStyles(i,a,e,b,r);i.shadowColor="rgba(0,0,0,0)"}for(let c=0;c<k.length;c++){f=r,g=r+c*l+o.ascent+s,f+=this._getAlignmentOffset(m[c],n,a.align);let e=0;if("justify"===a.align&&a.wordWrap&&c<k.length-1){let a=c4(k[c]);a>0&&(e=(n-m[c])/a)}a._stroke?.width&&this._drawLetterSpacing(k[c],a,d,f+b,g+b-q,!0,e),void 0!==a._fill&&this._drawLetterSpacing(k[c],a,d,f+b,g+b-q,!1,e)}}}_renderTaggedTextToCanvas(a,b,c,d,e){let{canvas:f,context:g}=e,{runsByLine:h,lineWidths:i,maxLineWidth:j,lineAscents:k,lineHeights:l,hasDropShadow:m}=a,n=f.height;g.resetTransform(),g.scale(d,d),g.textBaseline=b.textBaseline;let o=m?2:1,p=b._stroke?.width??0;for(let a of h)for(let b of a){let a=b.style._stroke?.width??0;a>p&&(p=a)}let q=p/2,r=[];for(let a=0;a<h.length;a++){let b=h[a],c=[];for(let a of b){let b=cY(a.style);g.font=b,c.push({width:cW._measureText(a.text,a.style.letterSpacing,g),font:b})}r.push(c)}for(let a=0;a<o;++a){let f=m&&0===a,o=f?Math.ceil(Math.max(1,n)+2*c):0,p=o*d;f||(g.shadowColor="rgba(0,0,0,0)");let s=q;for(let a=0;a<h.length;a++){let m=h[a],n=i[a],t=k[a],u=l[a],v=r[a],w=q;w+=this._getAlignmentOffset(n,j,b.align);let x=0;if("justify"===b.align&&b.wordWrap&&a<h.length-1){let a=0;for(let b of m)a+=c4(b.text);a>0&&(x=(j-n)/a)}let y=s+t,z=w+c;for(let a=0;a<m.length;a++){let b=m[a],{width:h,font:i}=v[a];if(g.font=i,g.textBaseline=b.style.textBaseline,b.style._stroke?.width){let a=b.style._stroke;if(g.lineWidth=a.width,g.miterLimit=a.miterLimit,g.lineJoin=a.join,g.lineCap=a.cap,f)if(b.style.dropShadow)this._setupDropShadow(g,b.style,d,p);else{z+=h+c4(b.text)*x;continue}else{let d=cW.measureFont(i),e=b.style.lineHeight||d.fontSize;g.strokeStyle=c2(a,g,{width:h,height:e,lineHeight:e,lines:[b.text]},2*c,z-c,s)}this._drawLetterSpacing(b.text,b.style,e,z,y+c-o,!0,x)}z+=h+c4(b.text)*x}z=w+c;for(let a=0;a<m.length;a++){let b=m[a],{width:h,font:i}=v[a];if(g.font=i,g.textBaseline=b.style.textBaseline,void 0!==b.style._fill){if(f)if(b.style.dropShadow)this._setupDropShadow(g,b.style,d,p);else{z+=h+c4(b.text)*x;continue}else{let a=cW.measureFont(i),d=b.style.lineHeight||a.fontSize,e={width:h,height:d,lineHeight:d,lines:[b.text]};g.fillStyle=c2(b.style._fill,g,e,2*c,z-c,s)}this._drawLetterSpacing(b.text,b.style,e,z,y+c-o,!1,x)}z+=h+c4(b.text)*x}s+=u}}}_setFillAndStrokeStyles(a,b,c,d,e,f=0,g=0){a.fillStyle=b._fill?c2(b._fill,a,c,2*d,f,g):null,b._stroke?.width&&(a.strokeStyle=c2(b._stroke,a,c,e+2*d,f,g))}_setupDropShadow(a,b,c,d){a.fillStyle="black",a.strokeStyle="black";let e=b.dropShadow,f=e.color,g=e.alpha;a.shadowColor=cv.f.shared.setValue(f).setAlpha(g).toRgbaString();let h=e.blur*c,i=e.distance*c;a.shadowBlur=h,a.shadowOffsetX=Math.cos(e.angle)*i,a.shadowOffsetY=Math.sin(e.angle)*i+d}_getAlignmentOffset(a,b,c){return"right"===c?b-a:"center"===c?(b-a)/2:0}_drawLetterSpacing(a,b,c,d,e,f=!1,g=0){let{context:h}=c,i=b.letterSpacing,j=!1;if(cW.experimentalLetterSpacingSupported&&(cW.experimentalLetterSpacing?(h.letterSpacing=`${i}px`,h.textLetterSpacing=`${i}px`,j=!0):(h.letterSpacing="0px",h.textLetterSpacing="0px")),(0===i||j)&&0===g)return void(f?h.strokeText(a,d,e):h.fillText(a,d,e));if(0!==g&&(0===i||j)){let b=a.split(" "),c=d,i=h.measureText(" ").width;for(let a=0;a<b.length;a++)f?h.strokeText(b[a],c,e):h.fillText(b[a],c,e),c+=h.measureText(b[a]).width+i+g;return}let k=d,l=cW.graphemeSegmenter(a),m=h.measureText(a).width,n=0;for(let a=0;a<l.length;++a){let b=l[a];f?h.strokeText(b,k,e):h.fillText(b,k,e);let c="";for(let b=a+1;b<l.length;++b)c+=l[b];k+=m-(n=h.measureText(c).width)+i," "===b&&(k+=g),m=n}}};var c6=ca,c7=a.i(90423),c8=a.i(96781),c9=a.i(52820);let da=class a extends c6.f{constructor(b={}){super(),this.uid=(0,c7.f)("textStyle"),this._tick=0,this._cachedFontString=null,function(a){if("boolean"==typeof a.dropShadow&&a.dropShadow){let b=da.defaultDropShadow;a.dropShadow={alpha:a.dropShadowAlpha??b.alpha,angle:a.dropShadowAngle??b.angle,blur:a.dropShadowBlur??b.blur,color:a.dropShadowColor??b.color,distance:a.dropShadowDistance??b.distance}}if(void 0!==a.strokeThickness){(0,ci.K)(ci.e,"strokeThickness is now a part of stroke");let b=a.stroke,c={};if(cv.f.isColorLike(b))c.color=b;else if(b instanceof co.f||b instanceof c1.f)c.fill=b;else if(Object.hasOwnProperty.call(b,"color")||Object.hasOwnProperty.call(b,"fill"))c=b;else throw Error("Invalid stroke value.");a.stroke={...c,width:a.strokeThickness}}if(Array.isArray(a.fillGradientStops)){if((0,ci.K)(ci.e,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(a.fill)||0===a.fill.length)throw Error("Invalid fill value. Expected an array of colors for gradient fill.");a.fill.length!==a.fillGradientStops.length&&(0,c0.f)("The number of fill colors must match the number of fill gradient stops.");let b=new co.f({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),c=a.fillGradientStops.slice(),d=a.fill.map(a=>cv.f.shared.setValue(a).toNumber());c.forEach((a,c)=>{b.addColorStop(a,d[c])}),a.fill={fill:b}}}(b);let c=b instanceof a,d=b;c&&(b=d._toObject());let e={...a.defaultTextStyle,...b};for(let a in e)this[a]=e[a];this._tagStyles=b.tagStyles??void 0,this.update(),this._tick=0}get align(){return this._align}set align(a){this._align!==a&&(this._align=a,this.update())}get breakWords(){return this._breakWords}set breakWords(a){this._breakWords!==a&&(this._breakWords=a,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(b){this._dropShadow!==b&&(null!==b&&"object"==typeof b?this._dropShadow=this._createProxy({...a.defaultDropShadow,...b}):this._dropShadow=b?this._createProxy({...a.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(a){this._fontFamily!==a&&(this._fontFamily=a,this.update())}get fontSize(){return this._fontSize}set fontSize(a){this._fontSize!==a&&("string"==typeof a?this._fontSize=parseInt(a,10):this._fontSize=a,this.update())}get fontStyle(){return this._fontStyle}set fontStyle(a){this._fontStyle!==a&&(this._fontStyle=a.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(a){this._fontVariant!==a&&(this._fontVariant=a,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(a){this._fontWeight!==a&&(this._fontWeight=a,this.update())}get leading(){return this._leading}set leading(a){this._leading!==a&&(this._leading=a,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(a){this._letterSpacing!==a&&(this._letterSpacing=a,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(a){this._lineHeight!==a&&(this._lineHeight=a,this.update())}get padding(){return this._padding}set padding(a){this._padding!==a&&(this._padding=a,this.update())}get filters(){return this._filters}set filters(a){this._filters!==a&&(this._filters=Object.freeze(a),this.update())}get trim(){return this._trim}set trim(a){this._trim!==a&&(this._trim=a,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(a){this._textBaseline!==a&&(this._textBaseline=a,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(a){this._whiteSpace!==a&&(this._whiteSpace=a,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(a){this._wordWrap!==a&&(this._wordWrap=a,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(a){this._wordWrapWidth!==a&&(this._wordWrapWidth=a,this.update())}get fill(){return this._originalFill}set fill(a){a!==this._originalFill&&(this._originalFill=a,this._isFillStyle(a)&&(this._originalFill=this._createProxy({...c8.f.defaultFillStyle,...a},()=>{this._fill=(0,c9._)({...this._originalFill},c8.f.defaultFillStyle)})),this._fill=(0,c9._)(0===a?"black":a,c8.f.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(a){a!==this._originalStroke&&(this._originalStroke=a,this._isFillStyle(a)&&(this._originalStroke=this._createProxy({...c8.f.defaultStrokeStyle,...a},()=>{this._stroke=(0,c9.U)({...this._originalStroke},c8.f.defaultStrokeStyle)})),this._stroke=(0,c9.U)(a,c8.f.defaultStrokeStyle),this.update())}get tagStyles(){return this._tagStyles}set tagStyles(a){this._tagStyles!==a&&(this._tagStyles=a??void 0,this.update())}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){let b=a.defaultTextStyle;for(let a in b)this[a]=b[a]}assign(a){for(let b in a)this[b]=a[b];return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return null===this._cachedFontString&&(this._cachedFontString=cY(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new a(this._toObject())}_getFinalPadding(){let a=0;if(this._filters)for(let b=0;b<this._filters.length;b++)a+=this._filters[b].padding;return Math.max(this._padding,a)}destroy(a=!1){if(this.removeAllListeners(),"boolean"==typeof a?a:a?.texture){let b="boolean"==typeof a?a:a?.textureSource;this._fill?.texture&&this._fill.texture.destroy(b),this._originalFill?.texture&&this._originalFill.texture.destroy(b),this._stroke?.texture&&this._stroke.texture.destroy(b),this._originalStroke?.texture&&this._originalStroke.texture.destroy(b)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(a,b){return new Proxy(a,{set:(a,c,d)=>a[c]===d||(a[c]=d,b?.(c,d),this.update(),!0)})}_isFillStyle(a){return(a??null)!==null&&!(cv.f.isColorLike(a)||a instanceof co.f||a instanceof c1.f)}};da.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},da.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let db=!1;var dc=a.i(46629),dd=a.i(98803),de=a.i(28343);class df extends de.f{}class dg{constructor(a){this._renderer=a,a.runners.resolutionChange.add(this),a.runners.contextChange.add(this),this._managedTexts=new dc.f({renderer:a,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(let a in this._managedTexts.items){let b=this._managedTexts.items[a];b?._autoResolution&&b.onViewUpdate()}}contextChange(){for(let a in this._managedTexts.items)this._managedTexts.items[a]?.unload()}validateRenderable(a){let b=this._getGpuText(a),c=a.styleKey;return b.currentKey!==c||a._didTextUpdate}addRenderable(a,b){let c=this._getGpuText(a);if(a._didTextUpdate||c.currentKey!==a.styleKey){let b=a._autoResolution?this._renderer.resolution:a.resolution;(c.currentKey!==a.styleKey||a._resolution!==b)&&this._updateGpuText(a),a._didTextUpdate=!1,function(a,b){let{texture:c,bounds:d}=a,e=b._style._getFinalPadding();(0,dd.f)(d,b._anchor,c);let f=b._anchor._x*e*2,g=b._anchor._y*e*2;d.minX-=e-f,d.minY-=e-g,d.maxX-=e-f,d.maxY-=e-g}(c,a)}this._renderer.renderPipes.batch.addToBatch(c,b)}updateRenderable(a){let b=this._getGpuText(a);b._batcher.updateElement(b)}_updateGpuText(a){let b=this._getGpuText(a);b.texture&&this._renderer.canvasText.decreaseReferenceCount(b.currentKey),a._resolution=a._autoResolution?this._renderer.resolution:a.resolution,b.texture=this._renderer.canvasText.getManagedTexture(a),b.currentKey=a.styleKey}_getGpuText(a){return a._gpuData[this._renderer.uid]||this.initGpuText(a)}initGpuText(a){let b=new df;return b.currentKey="--",b.renderable=a,b.transform=a.groupTransform,b.bounds={minX:0,maxX:1,minY:0,maxY:0},b.roundPixels=this._renderer._roundPixels|a._roundPixels,a._gpuData[this._renderer.uid]=b,this._managedTexts.add(a),b}onTextUnload(a){let b=a._gpuData[this._renderer.uid];if(!b)return;let{canvasText:c}=this._renderer;c.getReferenceCount(b.currentKey)>0?c.decreaseReferenceCount(b.currentKey):b.texture&&c.returnTexture(b.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}dg.extension={type:[b7.x.WebGLPipes,b7.x.WebGPUPipes,b7.x.CanvasPipes],name:"text"};var dh=a.i(36206),di=a.i(38252);class dj{constructor(a,b){this._activeTextures={},this._renderer=a,this._retainCanvasContext=b}getTexture(a,b,c,d){"string"==typeof a&&((0,ci.K)("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),a={text:a,style:c,resolution:b}),a.style instanceof da||(a.style=new da(a.style)),"string"!=typeof a.text&&(a.text=a.text.toString());let{text:e,style:f,textureStyle:g,autoGenerateMipmaps:h}=a,i=a.resolution??this._renderer.resolution,{frame:j,canvasAndContext:k}=c5.getCanvasAndContext({text:e,style:f,resolution:i}),l=(0,di.f)(k.canvas,j.width,j.height,i,h,g?.scaleMode);if(f.trim&&(j.pad(f.padding),l.frame.copyFrom(j),l.frame.scale(1/i),l.updateUvs()),f.filters){let a=this._applyFilters(l,f.filters);return this.returnTexture(l),c5.returnCanvasAndContext(k),a}return this._renderer.texture.initSource(l._source),this._retainCanvasContext||c5.returnCanvasAndContext(k),l}returnTexture(a){let b=a.source,c=b.resource;if(this._retainCanvasContext&&c?.getContext){let a=c.getContext("2d");a&&c5.returnCanvasAndContext({canvas:c,context:a})}b.resource=null,b.uploadMethodId="unknown",b.alphaMode="no-premultiply-alpha",dh.f.returnTexture(a)}renderTextToCanvas(){(0,ci.K)("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(a){a._resolution=a._autoResolution?this._renderer.resolution:a.resolution;let b=a.styleKey;if(this._activeTextures[b])return this._increaseReferenceCount(b),this._activeTextures[b].texture;let c=this.getTexture({text:a.text,style:a.style,resolution:a._resolution,textureStyle:a.textureStyle,autoGenerateMipmaps:a.autoGenerateMipmaps});return this._activeTextures[b]={texture:c,usageCount:1},c}decreaseReferenceCount(a){let b=this._activeTextures[a];b&&(b.usageCount--,0===b.usageCount&&(this.returnTexture(b.texture),this._activeTextures[a]=null))}getReferenceCount(a){return this._activeTextures[a]?.usageCount??0}_increaseReferenceCount(a){this._activeTextures[a].usageCount++}_applyFilters(a,b){let c=this._renderer.renderTarget.renderTarget,d=this._renderer.filter.generateFilteredTexture({texture:a,filters:b});return this._renderer.renderTarget.bind({target:c,clear:!1}),d}destroy(){for(let a in this._renderer=null,this._activeTextures)this._activeTextures[a]&&this.returnTexture(this._activeTextures[a].texture);this._activeTextures=null}}class dk extends dj{constructor(a){super(a,!0)}}dk.extension={type:[b7.x.CanvasSystem],name:"canvasText"};class dl extends dj{constructor(a){super(a,!1)}}dl.extension={type:[b7.x.WebGLSystem,b7.x.WebGPUSystem],name:"canvasText"},b7.H.add(dk),b7.H.add(dl),b7.H.add(dg);class dm extends cu{constructor(...a){let b,c=(("string"==typeof(b=a[0]??{})||a[1])&&((0,ci.K)(ci.e,'use new Text({ text: "hi!", style }) instead'),b={text:b,style:a[1]}),b);super(c,da),this.renderPipeId="text",c.textureStyle&&(this.textureStyle=c.textureStyle instanceof cr.f?c.textureStyle:new cr.f(c.textureStyle),function(a){if(db)return;let b=new cr.f({scaleMode:a.scaleMode});a._resourceId!==b._resourceId&&(db=!0,(0,c0.f)("Text textureStyle: only scaleMode is applied to a text texture, the other fields are ignored"))}(this.textureStyle)),this.autoGenerateMipmaps=c.autoGenerateMipmaps??cq.f.defaultOptions.autoGenerateMipmaps}updateBounds(){let a=this._bounds,b=this._anchor,c=0,d=0;if(this._style.trim){let{frame:a,canvasAndContext:b}=c5.getCanvasAndContext({text:this.text,style:this._style,resolution:1});c5.returnCanvasAndContext(b),c=a.width,d=a.height}else{let a=cW.measureText(this._text,this._style);c=a.width,d=a.height}a.minX=-b._x*c,a.maxX=a.minX+c,a.minY=-b._y*d,a.maxY=a.minY+d}}let dn={pending:0xf59e0b,streaming:2282478,done:3462041,error:0xef4444};function dp(a){return a?a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(1)}k`:String(a):"0"}function dq(a=[]){let b=new Map;for(let c of a){if(!c?.connectionId)continue;let a=b.get(c.connectionId);if(!a){let d=String(c.connectionId||"").toLowerCase(),e=c.clientType||("app"===c.source||d.includes("app")?"app":"extension"===c.source||d.includes("extension")||"ide"===c.source||d.includes("ide")?"extension":"cli");a={connectionId:c.connectionId,account:c.account||c.connectionId,model:c.model,provider:c.provider,cli:c.cli||"agent",clientType:e,source:c.source||e,clientIcon:c.clientIcon,traces:[],tokens:{input:0,output:0,cached:0},totalTokens:null,activeCount:0,errorCount:0,tools:[],errorReason:null,fallbackFrom:null,queued:0,elapsedMs:0,cost:null,pendingCount:0,isLooping:!1,logs:[],skin:c.skin||null,aura:c.aura||null,pet:c.pet||null,props:c.props||[],trophy:c.trophy||null,theme:c.theme||null,sessionTitle:c.sessionTitle||c.account||"agent-factory",lastText:null,lastTextRole:null},b.set(c.connectionId,a)}for(let b of(a.traces.push(c),c.skin&&!a.skin&&(a.skin=c.skin),c.aura&&!a.aura&&(a.aura=c.aura),c.pet&&!a.pet&&(a.pet=c.pet),!c.props?.length||a.props&&a.props.length||(a.props=c.props),c.trophy&&!a.trophy&&(a.trophy=c.trophy),c.theme&&!a.theme&&(a.theme=c.theme),c.isLooping&&(a.isLooping=!0),Array.isArray(c.logs)&&c.logs.length>0&&(a.logs=c.logs),c.currentCommand&&!a.currentCommand&&(a.currentCommand=c.currentCommand),c.sessionTitle&&(a.sessionTitle=c.sessionTitle),c.lastText&&(a.lastText=c.lastText,a.lastTextRole=c.lastTextRole),c.toolCalls||[])){let c=b.tool||b.type;c&&!a.tools.includes(c)&&a.tools.push(c)}a.tokens.input+=c.tokens?.input??0,a.tokens.output+=c.tokens?.output??0,a.tokens.cached+=c.tokens?.cached??0,Number.isFinite(c.totalTokens)&&(a.totalTokens=(a.totalTokens??0)+c.totalTokens),a.queued+=Math.max(1,c.concurrent||1),a.elapsedMs=Math.max(a.elapsedMs,c.elapsedMs??0),Number.isFinite(c.cost)&&(a.cost=(a.cost??0)+c.cost),c.fallback?.from&&!a.fallbackFrom&&(a.fallbackFrom=c.fallback.from),"error"===c.state?(a.errorCount+=1,a.errorReason=a.errorReason||c.error||"error"):("streaming"===c.state||"pending"===c.state)&&(a.activeCount+=1,"pending"===c.state&&(a.pendingCount+=1))}let c=b.size,d=c>35?8:c>18?7:6,e=c>35?175:200,f=c>35?145:170,g=Math.max(1500,60+d*e+120),h=g+360,i=[...b.values()].map((a,b)=>{let c=Math.floor(b/d),g=!!a.isLooping,h=a.errorCount>0?"error":a.activeCount>0?"streaming":"done",i=g?"looping":"error"===h?"error":"streaming"===h?a.pendingCount===a.activeCount?"pending":"streaming":a.elapsedMs>=32e3?"sleeping":"happy",j=a.totalTokens,k=j&&a.tokens.cached>0?Math.round(a.tokens.cached/j*100):null,l=a.account||"agent-factory",m=a.sessionTitle||l;return{...a,deskIndex:b,traceId:a.traces?.[0]?.traceId||a.connectionId,sessionTitle:m,occupied:!0,state:h,mode:i,isLooping:g,logs:a.logs,cachedPct:k,cost:Number.isFinite(a.cost)?Math.round(100*a.cost)/100:null,color:g?0xf43f5e:dn[h],totalTokens:j,totalLabel:null===j?"—":dp(j),count:a.traces.length,x:60+b%d*e,y:820-c*f,depth:1,busy:a.activeCount}}),j=[...new Set(i.map(a=>a.provider).filter(Boolean))],k=j.map((a,b)=>{let c=i.filter(b=>b.provider===a),d=c.reduce((a,b)=>a+b.busy,0),e=c.reduce((a,b)=>a+(b.totalTokens??0),0),f=c.some(a=>"error"===a.state);return{provider:a,x:h,y:480-(j.length-1)*104/2+104*b,busy:d,load:Math.min(1,d/4),overloaded:d>=4,totalTokens:e,totalLabel:dp(e),color:f?dn.error:d>0?dn.streaming:dn.done}}),l=new Set(j),m=new Map;for(let a of i){if(!a.fallbackFrom||!l.has(a.fallbackFrom)||a.fallbackFrom===a.provider)continue;let b=`${a.fallbackFrom}>${a.provider}`,c=m.get(b)||{from:a.fallbackFrom,to:a.provider,count:0};c.count+=1,m.set(b,c)}return{workstations:i,pods:k,fallbacks:[...m.values()],rack:{x:g,y:480,active:i.reduce((a,b)=>a+b.busy,0)},stats:{agents:i.length,busy:i.filter(a=>a.busy>0).length,tokens:i.reduce((a,b)=>a+(b.totalTokens??0),0),tokensLabel:dp(i.reduce((a,b)=>a+(b.totalTokens??0),0))}}}var dr=a.i(96519);function ds(a,b=61695){if(!a)return b;if("number"==typeof a)return a;let c=parseInt(String(a).replace("#","").trim(),16);return Number.isNaN(c)?b:c}function dt(a,b){let c=String(a||"");return c.length>b?`${c.slice(0,b-1)}…`:c}let du=()=>(0,dr.l)("mono"),dv=()=>(0,dr.l)("ui");function dw(...a){return new co.f({type:"linear",start:{x:0,y:0},end:{x:0,y:1},colorStops:a.map((b,c)=>({offset:c/(a.length-1),color:b})),textureSpace:"local"})}let dx=(a,b,c=1)=>({width:a,color:b,alpha:c,cap:"round",join:"round"});function dy({color:a,depth:b=1,scale:c=1,seed:d=0,trimColor:e,mode:f="streaming",clientType:g="cli",skin:h="classic",aura:i="none"}){let j=new cg.t,k="app"===g?9133302:1096065,l="string"==typeof h?(0,bG.x)(h):null,m=!!(l||h&&"classic"!==h&&"none"!==h),n=l?.archetype||("cat"===h?"cyber_cat":"ninja"===h?"stealth_ninja":"hacker"===h?"matrix_hacker":h||"cyber_classic"),o=l?.variant||"tactical_visor",p=l?.color?ds(l.color,e??k):e??k;l?.secondaryColor&&ds(l.secondaryColor,1120295);let q=l?.accentColor?ds(l.accentColor,0xffffff):0xffffff,r=m?1975344:0xf3f5f9,s=m?1119778:0xc9d0dc,t=new cp.f;"mecha_pilot"===n?(t.poly([-22,-30,22,-30,18,-6,-18,-6]).fill({color:1579035}).stroke({width:1.5,color:p}),t.poly([-27,-29,-20,-33,-17,-25,-25,-20]).fill({color:2565930}).stroke({width:1,color:p}),t.poly([27,-29,20,-33,17,-25,25,-20]).fill({color:2565930}).stroke({width:1,color:p}),t.poly([-12,-26,-7,-26,-3,-20,-8,-20]).fill({color:0xeab308}),t.poly([2,-26,7,-26,11,-20,6,-20]).fill({color:0xeab308}),t.rect(-13,-30,2,24).fill({color:p}),t.rect(11,-30,2,24).fill({color:p}),t.circle(0,-14,5.5).fill({color:592139}).stroke({width:1.4,color:p}),t.circle(0,-14,3).fill({color:p}),t.rect(-4,-15,8,2).fill({color:0xffffff})):"stealth_ninja"===n?(t.poly([-16,-30,16,-30,13,-6,-13,-6]).fill({color:593174}).stroke({width:1.4,color:p}),t.poly([-16,-30,5,-14,2,-14,-16,-28]).fill({color:p}),t.poly([-16,-28,-11,-30,14,-9,9,-7]).fill({color:p,alpha:.9}),t.roundRect(-14,-12,28,6,2).fill({color:1973067}).stroke({width:1.2,color:p}),t.poly([3,-7,6,1,4,6,1,1,3,-7]).fill({color:p})):"matrix_hacker"===n?(t.roundRect(-21,-30,42,25,7).fill({color:1184279}).stroke({width:1.5,color:p}),t.roundRect(-18,-32,36,10,4).fill({color:2039592}).stroke({width:1.2,color:p}),t.rect(-7,-23,2,16).fill({color:0xffffff}),t.rect(-7.5,-7,3,4).fill({color:p}),t.rect(5,-23,2,16).fill({color:0xffffff}),t.rect(4.5,-7,3,4).fill({color:p}),t.poly([-15,-14,15,-14,13,-6,-13,-6]).fill({color:592141}).stroke({width:1,color:2565930})):"celestial_astro"===n?(t.poly([-18,-30,18,-30,16,-6,-16,-6]).fill({color:0xf1f5f9}).stroke({width:1.4,color:p}),t.roundRect(-14,-33,28,5,2).fill({color:3359061}).stroke({width:1.2,color:p}),t.roundRect(-24,-31,8,4.5,1).fill({color:0xf59e0b}).stroke({width:.8,color:7877903}),t.roundRect(16,-31,8,4.5,1).fill({color:0xf59e0b}).stroke({width:.8,color:7877903}),t.circle(-7,-17,3.5).fill({color:988970}).stroke({width:1.2,color:p}),t.circle(-7,-17,1.5).fill({color:2278750}),t.circle(7,-17,3.5).fill({color:988970}).stroke({width:1.2,color:p}),t.circle(7,-17,1.5).fill({color:3718648})):(t.poly([-18,-30,18,-30,15,-6,-15,-6]).fill(dw(0xffffff,r,s)).stroke({width:1.2,color:p}),t.poly([-17,-30,-7,-14,-13,-14]).fill({color:856343}),t.poly([17,-30,7,-14,13,-14]).fill({color:856343}),t.poly([-5,-30,0,-18,5,-30]).stroke({width:1.2,color:q,alpha:.85}),t.roundRect(-4.5,-19,9,12,1.5).fill({color:593174}).stroke({width:1,color:p}),t.rect(-3,-17.5,6,4.5).fill({color:p}),t.rect(-3,-11,6,1.5).fill({color:0xffffff}),t.rect(-15,-10,30,4).fill({color:132631}),t.roundRect(-3.5,-11,7,6,1).fill({color:1976635}).stroke({width:1,color:p}));let u=new cp.f;u.roundRect(-10,-36,20,8,4).fill({color:p});let v=new cp.f;v.roundRect(-6,-34,12,3,1.5).fill({color:a});let w=new cp.f,x=new cp.f;for(let[a,b,c]of[[w,-26,-1],[x,18,1]])a.roundRect(b,-28,8,24,4).fill({color:r}),a.roundRect(b,-28,8,8,4).fill({color:0xffffff,alpha:.6}),a.circle(b+4+1.5*c,-2,4.5).stroke({width:2.4,color:r}),a.pivot.set(b+4,-26),a.position.set(b+4,-26);let y=new cp.f;y.circle(-27,-56,8).fill({color:p}),y.circle(27,-56,8).fill({color:p}),y.circle(-27,-56,8).stroke({width:1.5,color:0xffffff,alpha:.5}),y.circle(27,-56,8).stroke({width:1.5,color:0xffffff,alpha:.5}),y.circle(-29,-58,3).fill({color:0xffffff,alpha:.7}),y.circle(25,-58,3).fill({color:0xffffff,alpha:.7}),y.ellipse(0,-56,26,24).fill(dw(m?2963272:0xffffff,r,s)),m&&y.ellipse(0,-56,27,25).stroke({width:2.2,color:p,alpha:.95}),y.ellipse(4,-50,24,21).stroke({width:3,color:7043728,alpha:.25}),y.ellipse(-8,-68,12,5.5).fill({color:0xffffff,alpha:.8}),y.circle(-14,-64,2).fill({color:0xffffff,alpha:.9}),y.ellipse(0,-53,22,17).fill({color:s}),y.ellipse(0,-53,20,15.5).fill({color:988188}),y.ellipse(-5,-58,11,5).fill({color:0xffffff,alpha:.06}),"tactical_visor"===o?(y.roundRect(-24,-66,48,7,2.5).fill({color:988970}),y.roundRect(-24,-66,48,7,2.5).stroke({width:1.6,color:p}),y.poly([-26,-66,-34,-76,-26,-72]).fill({color:p}),y.poly([26,-66,34,-76,26,-72]).fill({color:p}),y.circle(0,-62.5,2.5).fill({color:q})):"laser_scout"===o?(y.circle(8,-57,7).stroke({width:1.6,color:p}),y.circle(8,-57,2.5).fill({color:0xff0000})):"riot_shield"===o?(y.roundRect(-25,-68,50,9,3).fill({color:1975344}),y.roundRect(-25,-68,50,9,3).stroke({width:1.8,color:p}),y.circle(-16,-64,2.5).fill({color:q}),y.circle(16,-64,2.5).fill({color:q})):"cyber_horns"===o?(y.poly([-20,-70,-30,-88,-14,-76]).fill({color:p}),y.poly([20,-70,30,-88,14,-76]).fill({color:p})):"crown_radiator"===o?(y.poly([-16,-72,-14,-86,-8,-74]).fill({color:p}),y.poly([-4,-74,0,-92,4,-74]).fill({color:p}),y.poly([8,-74,14,-86,16,-72]).fill({color:p}),y.circle(0,-70,3).fill({color:q})):"gas_respirator"===o?(y.circle(-14,-44,6).fill({color:1975344}).stroke({width:1.5,color:p}),y.circle(14,-44,6).fill({color:1975344}).stroke({width:1.5,color:p}),y.circle(-14,-44,3).fill({color:p}),y.circle(14,-44,3).fill({color:p})):"prism_goggles"===o?(y.poly([-16,-62,-8,-66,-2,-62,-2,-52,-8,-48,-16,-52]).fill({color:805486}).stroke({width:1.6,color:p}),y.poly([2,-62,8,-66,16,-62,16,-52,8,-48,2,-52]).fill({color:805486}).stroke({width:1.6,color:p}),y.circle(-9,-57,2.5).fill({color:q}),y.circle(9,-57,2.5).fill({color:q})):"samurai_crest"===o?(y.poly([-22,-72,0,-88,22,-72,0,-80]).fill({color:p}),y.circle(0,-78,3).fill({color:q})):"overdrive_vents"===o?(y.poly([-18,-72,-28,-90,-14,-76]).fill({color:p}),y.poly([18,-72,28,-90,14,-76]).fill({color:p})):"holo_shroud"===o?(y.ellipse(0,-66,28,12).stroke({width:1.8,color:p,alpha:.8}),y.circle(0,-78,4).fill({color:q})):"v_fin"===o?(y.poly([-24,-88,-18,-92,0,-76,18,-92,24,-88,0,-72]).fill({color:p}),y.poly([-4,-72,0,-78,4,-72,0,-68]).fill({color:0xef4444})):"blast_shield"===o?(y.roundRect(-24,-68,48,14,3).fill({color:988970}).stroke({width:2,color:p}),y.circle(-18,-80,3.5).fill({color:0xfde047}),y.circle(18,-80,3.5).fill({color:0xfde047})):"eva_horn"===o?(y.poly([-3,-74,0,-98,3,-74]).fill({color:p}),y.roundRect(-28,-48,5,18,2).fill({color:p}),y.roundRect(23,-48,5,18,2).fill({color:p})):"cage_grille"===o?(y.roundRect(-16,-52,32,14,2).fill({color:1579035}).stroke({width:1.6,color:p}),y.roundRect(-22,-86,4,16,1).fill({color:2565930}).stroke({width:1,color:p}),y.roundRect(18,-86,4,16,1).fill({color:2565930}).stroke({width:1,color:p})):"missile_pod"===o?(y.roundRect(-30,-42,8,12,2).fill({color:1841431}).stroke({width:1.5,color:p}),y.roundRect(22,-42,8,12,2).fill({color:1841431}).stroke({width:1.5,color:p}),y.circle(-26,-38,1.5).fill({color:0xef4444}),y.circle(26,-38,1.5).fill({color:0xef4444})):"quad_array"===o?(y.poly([-22,-72,-26,-90,-20,-72]).fill({color:p}),y.poly([-12,-76,-14,-94,-10,-76]).fill({color:p}),y.poly([10,-76,14,-94,12,-76]).fill({color:p}),y.poly([20,-72,26,-90,22,-72]).fill({color:p}),y.circle(-26,-90,2).fill({color:q}),y.circle(26,-90,2).fill({color:q})):"halo_shield"===o?(y.poly([-32,-42,-26,-46,-20,-42,-20,-34,-26,-30,-32,-34]).fill({color:413243}).stroke({width:1.5,color:p}),y.poly([20,-42,26,-46,32,-42,32,-34,26,-30,20,-34]).fill({color:413243}).stroke({width:1.5,color:p})):"ram_horns"===o?(y.poly([-18,-72,-34,-86,-18,-92,-14,-72]).fill({color:p}),y.poly([18,-72,34,-86,18,-92,14,-72]).fill({color:p})):"radar_dish"===o?(y.ellipse(-24,-84,7,12).fill({color:1579035}).stroke({width:1.5,color:p}),y.circle(-24,-84,2).fill({color:q})):"hyper_wings"===o?(y.poly([-26,-46,-44,-64,-34,-40]).fill({color:p}),y.poly([26,-46,44,-64,34,-40]).fill({color:p})):"flowing_headband"===o?(y.roundRect(-24,-66,48,8,2).fill({color:1973067}).stroke({width:1.5,color:p}),y.circle(0,-62,3).fill({color:3718648}),y.poly([24,-62,38,-56,46,-46,36,-48,24,-56]).fill({color:p})):"tactical_cowl"===o?(y.roundRect(-24,-68,48,24,6).fill({color:988970,alpha:.8}).stroke({width:1.4,color:p}),y.circle(6,-57,4.5).stroke({width:1.8,color:2278750}),y.circle(6,-57,1.5).fill({color:2278750})):"oni_mask"===o?(y.poly([-16,-72,-24,-88,-12,-76]).fill({color:0xef4444}),y.poly([16,-72,24,-88,12,-76]).fill({color:0xef4444}),y.poly([-16,-46,-10,-40,0,-42,10,-40,16,-46,12,-36,-12,-36]).fill({color:0xffffff})):"kitsune_ears"===o?(y.poly([-22,-72,-14,-88,-6,-76]).fill({color:1975344}),y.poly([-20,-73,-14,-85,-8,-76]).fill({color:p}),y.poly([6,-76,14,-88,22,-72]).fill({color:1975344}),y.poly([8,-76,14,-85,20,-73]).fill({color:p})):"conical_kasa"===o?(y.poly([-36,-72,0,-92,36,-72]).fill({color:1579035}).stroke({width:1.6,color:p}),y.roundRect(-36,-72,72,2.5,1).fill({color:q})):"twin_katanas"===o?(y.poly([-24,-32,28,-88,25,-88,-27,-32]).fill({color:p}),y.poly([24,-32,-28,-88,-25,-88,27,-32]).fill({color:p})):"tengu_beak"===o?y.poly([-12,-48,0,-34,12,-48,0,-44]).fill({color:988970}).stroke({width:1.5,color:p}):"veil_shroud"===o?y.roundRect(-22,-62,44,26,6).fill({color:988970,alpha:.85}).stroke({width:1.2,color:p}):"scythe_crest"===o?y.poly([-14,-66,0,-88,14,-66,0,-82]).fill({color:p}):"void_mask"===o?(y.roundRect(-18,-62,36,20,4).fill({color:0}).stroke({width:1.8,color:p}),y.circle(0,-52,3).fill({color:p})):"hoodie_cowl"===o?y.roundRect(-28,-74,56,46,14).fill({color:335627,alpha:.9}).stroke({width:1.8,color:p}):"vr_goggles"===o?(y.roundRect(-22,-64,44,15,3).fill({color:537412}).stroke({width:1.8,color:p}),y.circle(-16,-78,2.5).fill({color:q}),y.poly([-16,-64,-16,-78,-14,-78,-14,-64]).fill({color:p})):"daemon_horns"===o?(y.poly([-16,-70,-22,-86,-10,-74]).fill({color:p}),y.poly([16,-70,22,-86,10,-74]).fill({color:p})):"glitch_halo"===o?(y.rect(-28,-76,56,42).stroke({width:1.5,color:p,alpha:.8}),y.rect(-18,-82,12,6).fill({color:p,alpha:.7})):"floating_hud"===o?y.roundRect(24,-78,30,16,2).fill({color:592139}).stroke({width:1,color:p}):"respirator_eq"===o?(y.roundRect(-18,-46,36,10,3).fill({color:988970}).stroke({width:1.2,color:p}),y.rect(-12,-43,4,5).fill({color:2278750}),y.rect(-4,-45,4,7).fill({color:0xeab308}),y.rect(4,-45,4,7).fill({color:0xef4444}),y.rect(12,-43,4,5).fill({color:2278750})):"heatsink_fins"===o?(y.rect(-18,-84,4,14).fill({color:0xea580c}),y.rect(-10,-88,4,18).fill({color:0xea580c}),y.rect(-2,-90,4,20).fill({color:0xea580c}),y.rect(6,-88,4,18).fill({color:0xea580c}),y.rect(14,-84,4,14).fill({color:0xea580c})):"cable_dreads"===o?(y.poly([-22,-62,-32,-48,-28,-12,-26,-12,-30,-48,-20,-62]).fill({color:p}),y.poly([22,-62,32,-48,28,-12,26,-12,30,-48,20,-62]).fill({color:p})):"cyber_skull"===o?(y.circle(-7,-55,4).fill({color:0}).stroke({width:1.5,color:p}),y.circle(7,-55,4).fill({color:0}).stroke({width:1.5,color:p}),y.poly([-8,-40,8,-40,8,-38,-8,-38]).fill({color:p})):"wireframe_cube"===o?(y.rect(-24,-76,48,42).stroke({width:1.6,color:p}),y.rect(-16,-68,32,26).stroke({width:1.2,color:q,alpha:.8})):"bubble_dome"===o?(y.circle(0,-56,28).stroke({width:2.5,color:p,alpha:.9}),y.circle(0,-84,3.5).fill({color:0xfef08a})):"lunar_pack"===o?(y.rect(-20,-86,2,18).fill({color:p}),y.circle(-19,-86,2).fill({color:0xffffff}),y.ellipse(0,-54,24,18).stroke({width:2,color:0xe2e8f0})):"sunburst_halo"===o?(y.ellipse(0,-64,30,8).stroke({width:2,color:p,alpha:.85}),y.circle(0,-76,3).fill({color:0xfef08a}),y.circle(-22,-70,2).fill({color:0xfef08a}),y.circle(22,-70,2).fill({color:0xfef08a})):"saturn_ring"===o?(y.ellipse(0,-56,36,10).stroke({width:2.2,color:p}),y.circle(28,-62,3).fill({color:q})):"star_crown"===o?(y.poly([-16,-74,-12,-86,-8,-76]).fill({color:p}),y.poly([-6,-76,0,-92,6,-76]).fill({color:p}),y.poly([8,-76,12,-86,16,-74]).fill({color:p}),y.circle(0,-74,2.5).fill({color:0xffffff})):"eclipse_corona"===o?(y.ellipse(0,-56,32,18).stroke({width:3,color:p,alpha:.6}),y.circle(0,-56,22).fill({color:0}).stroke({width:1.5,color:p})):"pulsar_spires"===o?(y.poly([-1.5,-78,1.5,-78,1.5,-98,-1.5,-98]).fill({color:p}),y.circle(0,-98,3).fill({color:0xffffff}),y.poly([-1.5,-34,1.5,-34,1.5,-18,-1.5,-18]).fill({color:p}),y.circle(0,-18,3).fill({color:0xffffff})):"aurora_ribbons"===o?y.ellipse(0,-78,24,6).stroke({width:2.5,color:p,alpha:.75}):"angel_wings"===o?(y.poly([-26,-46,-48,-78,-32,-38]).fill({color:p,alpha:.85}),y.poly([26,-46,48,-78,32,-38]).fill({color:p,alpha:.85}),y.ellipse(0,-80,16,5).stroke({width:1.6,color:q})):"singularity_core"===o?(y.ellipse(0,-56,30,26).stroke({width:2,color:0xffffff,alpha:.9}),y.circle(-22,-70,2.5).fill({color:q}),y.circle(22,-42,2.5).fill({color:q})):"stealth_ninja"===n||"ninja"===n?(y.roundRect(-24,-66,48,8,3).fill({color:1973067}).stroke({width:1.5,color:p}),y.circle(0,-62,3).fill({color:3718648})):"mecha_pilot"===n?(y.poly([-22,-72,-18,-90,-12,-70]).fill({color:p}),y.poly([12,-70,18,-90,22,-72]).fill({color:p})):"celestial_astro"===n?y.ellipse(0,-64,30,8).stroke({width:2,color:p,alpha:.85}):"matrix_hacker"===n||"hacker"===n?y.roundRect(-27,-78,54,48,16).fill({color:1120295}).stroke({width:1.6,color:p}):"cyber_cat"===n||"cat"===h?(y.poly([-22,-72,-14,-86,-6,-76]).fill({color:r}),y.poly([-20,-73,-14,-83,-8,-76]).fill({color:0xf472b6,alpha:.8}),y.poly([6,-76,14,-86,22,-72]).fill({color:r}),y.poly([8,-76,14,-83,20,-73]).fill({color:0xf472b6,alpha:.8})):y.poly([-8,-68,0,-78,8,-68]).fill({color:p});let z=null,A="string"==typeof i?(0,bG.x)(i):null,B=A?.archetype||"plasma_ring";i&&"none"!==i&&(z=new cp.f,j.addChildAt(z,0));let C=new cp.f,D=new cp.f;j.addChild(t,u,v,w,x,y,C,D),j.scale.set(c*b);let E=f,F=m?p:a,G=(a,b,c,d,e,f)=>{if("happy"===f)C.moveTo(a-4.6,b+2).arc(a,b+2,4.6,Math.PI,0).stroke(dx(2.6,F,e));else if("sleep"===f)C.moveTo(a-4.6,b).arc(a,b,4.6,0,Math.PI).stroke(dx(2.2,F,.7));else if("x"===f)C.moveTo(a-4,b-4).lineTo(a+4,b+4).stroke(dx(2.6,F,e)),C.moveTo(a+4,b-4).lineTo(a-4,b+4).stroke(dx(2.6,F,e));else if("looping"===f)C.circle(a,b,4.2).stroke(dx(1.8,F,e)),C.circle(a,b,2).stroke(dx(1.4,F,e)),C.circle(a,b,.6).fill({color:F,alpha:e});else{C.ellipse(a,b,c,d).fill({color:F,alpha:.9*e});for(let e=b-d+1;e<b+d;e+=2.4)C.rect(a-c-1,e,2*c+2,1).fill({color:988188,alpha:.55})}};return{root:j,statusDot:v,setMode(a){E=a},animate(a,b=0){let c=j.baseX??j.x,e=E,f=.012*a+c,g=Math.sin(.004*a+.05*c)*(.8+1.4*b),i=0,k=0;"happy"===e&&(g=-(3.2*Math.abs(Math.sin(.005*a+c)))),"sleeping"===e&&(g=1.1*Math.sin(.0016*a+c)+2.2,k=.12+.02*Math.sin(.0016*a+c)),"error"===e&&(i=1.8*Math.sin(.09*a)),"looping"===e&&(i=2.2*Math.sin(.08*a),g=1.6*Math.sin(.015*a),k=.16*Math.sin(.02*a)),j.x=c+i,j.y=(j.baseY||0)+g,j.rotation=k,w.rotation=0,x.rotation=0,"streaming"===e?(w.rotation=.14*Math.sin(f)*(.3+b),x.rotation=-(.14*Math.sin(f+1.3))*(.3+b)):"pending"===e?(w.rotation=2.5+.35*Math.sin(.012*a),x.rotation=-(.06*Math.sin(f+1.3))):"happy"===e?(w.rotation=2.2+.2*Math.sin(.01*a),x.rotation=-2.2-.2*Math.sin(.01*a+1)):"error"===e?(w.rotation=2.7+.1*Math.sin(.08*a),x.rotation=-2.7-.1*Math.sin(.08*a)):"looping"===e?(w.rotation=2.4+.4*Math.sin(.02*a),x.rotation=-2.4-.4*Math.sin(.02*a+1)):"sleeping"===e&&(w.rotation=.05,x.rotation=-.05);let l=Math.sin(.0013*a+2.1*d)>.985,m=.85+.15*Math.sin(.01*a+d);C.clear();let n="happy"===e?"happy":"sleeping"===e?"sleep":"error"===e?"x":"looping"===e?"looping":"scan";if(G(-8,-57,4.8,l?.8:4.4,m,n),G(8,-57,4.8,l?.8:4.4,m,n),"happy"===e?C.moveTo(-6,-48).arc(0,-48,6,0,Math.PI).stroke(dx(2.2,F,.9)):"sleeping"===e?C.circle(0,-45,1.8).stroke(dx(1.6,F,.6)):"error"===e?C.moveTo(-7,-45).lineTo(-3.5,-48).lineTo(0,-45).lineTo(3.5,-48).lineTo(7,-45).stroke(dx(2,F,m)):"looping"===e?C.circle(0,-46,3.2).stroke(dx(2,F,m)):C.ellipse(0,-46,5+3*b,2.4+1.2*b).fill({color:F,alpha:.75*m}),"cat"===h&&(C.moveTo(-12,-47).lineTo(-22,-49).stroke(dx(1.2,0xffffff,.7)),C.moveTo(-12,-44).lineTo(-21,-43).stroke(dx(1.2,0xffffff,.7)),C.moveTo(12,-47).lineTo(22,-49).stroke(dx(1.2,0xffffff,.7)),C.moveTo(12,-44).lineTo(21,-43).stroke(dx(1.2,0xffffff,.7)),C.poly([-2,-48,0,-46,2,-48]).fill({color:0xf472b6})),D.clear(),"sleeping"===e)for(let b=0;b<3;b+=1){let c=(4e-4*a+b/3+.13*d)%1,e=20+16*c,f=-78-30*c,g=3+4*c;D.moveTo(e,f).lineTo(e+g,f).lineTo(e,f+g).lineTo(e+g,f+g).stroke(dx(1.6,0xa5b4cc,1-c))}else if("error"===e||"looping"===e)for(let b=0;b<5;b+=1){let c=(8e-4*a+b/5+.12*d)%1,e=7*Math.sin(8*c+1.3*b)+(b-2)*3.5,f=-76-38*c,g=2.5+7*c;D.circle(e,f,g).fill({color:4937059,alpha:.65*(1-c)})}if(z){z.clear();let b=A?.color?ds(A.color,61695):61695,c=1+.12*Math.sin(.006*a),f="happy"===e?.95:"error"===e?.35+.35*Math.sin(.08*a):"sleeping"===e?.25:.65;if("matrix_rain"===B)for(let c=-3;c<=3;c++){let e=9*c,g=-70+(.002*a+.33*c+.2*d)%1*50;z.moveTo(e,g-8).lineTo(e,g).stroke({width:1.5,color:b,alpha:.8*f}),z.circle(e,g,1.2).fill({color:0xffffff,alpha:f})}else if("quantum_mist"===B){for(let d=0;d<4;d++){let e=.003*a+d*Math.PI/2,g=30*c+4*Math.sin(e),h=14*c+3*Math.cos(e);z.ellipse(0,-42,g,h).stroke({width:1.2,color:b,alpha:.5*f})}z.circle(28*Math.sin(.007*a),-42+11*Math.cos(.007*a),2.2).fill({color:0xffffff,alpha:f})}else if("glitch_halo"===B){let d=2*Math.sin(.09*a);z.roundRect(-30*c+d,-54*c,60*c,24*c,6).stroke({width:2,color:b,alpha:f}),z.circle(2*d,-42,3).stroke({width:1,color:0xffffff,alpha:.7*f})}else z.ellipse(0,-42,34*c,13*c).stroke({width:2,color:b,alpha:f}),z.ellipse(0,-42,26*c,9*c).stroke({width:1.2,color:0xffffff,alpha:.8*f}),"happy"===e&&z.circle(32*Math.sin(.01*a),-42+12*Math.cos(.01*a),2.5).fill({color:0xffffff})}v.alpha=.6+.4*Math.sin(.007*a+d)*(.3+b)},setState(a){v.tint=a}}}function dz(a,{color:b=2282478,size:c=10}={}){return new dm({text:a,style:{fontFamily:dv(),fontSize:c,fill:b,fontWeight:"700"}})}let dA={cap:"round",join:"round"},dB={bash:{label:"Bash",color:3462041,draw(a,b){a.moveTo(-8,-6).lineTo(-2,0).lineTo(-8,6).stroke({width:2.4,color:b,...dA}),a.moveTo(1,7).lineTo(8,7).stroke({width:2.4,color:b,...dA})}},read:{label:"Read",color:6333946,draw(a,b){a.moveTo(-6,-9).lineTo(3,-9).lineTo(7,-5).lineTo(7,9).lineTo(-6,9).closePath().stroke({width:2,color:b,...dA}),a.moveTo(-3,-1).lineTo(4,-1).stroke({width:1.8,color:b,...dA}),a.moveTo(-3,3).lineTo(4,3).stroke({width:1.8,color:b,...dA}),a.moveTo(-3,6.5).lineTo(1,6.5).stroke({width:1.8,color:b,...dA})}},edit:{label:"Edit",color:0xfbbf24,draw(a,b){a.moveTo(-7,8).lineTo(-6,3).lineTo(4,-7).lineTo(8,-3).lineTo(-2,7).closePath().stroke({width:2,color:b,...dA}),a.moveTo(1,-4).lineTo(5,0).stroke({width:1.8,color:b,...dA}),a.moveTo(-8,9.5).lineTo(-1,9.5).stroke({width:1.8,color:b,...dA})}},search:{label:"Search",color:0xf472b6,draw(a,b){a.circle(-2,-2,6).stroke({width:2.2,color:b,...dA}),a.moveTo(2.5,2.5).lineTo(8,8).stroke({width:2.6,color:b,...dA})}},web:{label:"Web",color:2282478,draw(a,b){a.circle(0,0,8.5).stroke({width:2,color:b,...dA}),a.ellipse(0,0,3.6,8.5).stroke({width:1.6,color:b,...dA}),a.moveTo(-8.5,0).lineTo(8.5,0).stroke({width:1.6,color:b,...dA})}},mcp:{label:"MCP",color:0xa78bfa,draw(a,b){a.moveTo(-4,-9).lineTo(-4,-3).stroke({width:2.4,color:b,...dA}),a.moveTo(4,-9).lineTo(4,-3).stroke({width:2.4,color:b,...dA}),a.roundRect(-8,-3,16,9,3).stroke({width:2,color:b,...dA}),a.moveTo(0,6).lineTo(0,10).stroke({width:2.4,color:b,...dA})}},agent:{label:"Subagent",color:0xfb923c,draw(a,b){a.moveTo(0,-4).lineTo(-6,6).stroke({width:1.8,color:b,...dA}),a.moveTo(0,-4).lineTo(6,6).stroke({width:1.8,color:b,...dA}),a.circle(0,-5,3.6).fill({color:b}),a.circle(-6.5,7,3).fill({color:b}),a.circle(6.5,7,3).fill({color:b})}},todo:{label:"Todo",color:9741240,draw(a,b){a.moveTo(-8,-5).lineTo(-6,-3).lineTo(-3,-7).stroke({width:1.8,color:b,...dA}),a.moveTo(1,-5).lineTo(8,-5).stroke({width:1.8,color:b,...dA}),a.moveTo(-8,5).lineTo(-6,7).lineTo(-3,3).stroke({width:1.8,color:b,...dA}),a.moveTo(1,5).lineTo(8,5).stroke({width:1.8,color:b,...dA})}},gitnexus:{label:"GitNexus",color:0xc084fc,draw(a,b){a.moveTo(0,0).lineTo(-6,-6).stroke({width:1.5,color:b,...dA}),a.moveTo(0,0).lineTo(6,-5).stroke({width:1.5,color:b,...dA}),a.moveTo(0,0).lineTo(0,7).stroke({width:1.5,color:b,...dA}),a.circle(0,0,3.2).fill({color:b}),a.circle(-6,-6,2.2).fill({color:b}),a.circle(6,-5,2.2).fill({color:b}),a.circle(0,7,2.2).fill({color:b})}},browser:{label:"Browser",color:440020,draw(a,b){a.roundRect(-8,-7,16,14,2.5).stroke({width:1.8,color:b,...dA}),a.moveTo(-8,-2).lineTo(8,-2).stroke({width:1.4,color:b,...dA}),a.circle(-5,-4.5,1).fill({color:b}),a.circle(-2,-4.5,1).fill({color:b})}},git:{label:"Git",color:0xf97316,draw(a,b){a.moveTo(-4,-7).lineTo(-4,7).stroke({width:2,color:b,...dA}),a.moveTo(-4,2).arc(0,2,4,Math.PI,0).lineTo(4,-3).stroke({width:1.8,color:b,...dA}),a.circle(-4,-6,2.4).fill({color:b}),a.circle(-4,6,2.4).fill({color:b}),a.circle(4,-3,2.4).fill({color:b})}},docker:{label:"Docker",color:3718648,draw(a,b){a.roundRect(-7,1,6,5,1).fill({color:b,alpha:.8}).stroke({width:1.2,color:b,...dA}),a.roundRect(1,1,6,5,1).fill({color:b,alpha:.8}).stroke({width:1.2,color:b,...dA}),a.roundRect(-3,-6,6,5,1).fill({color:b,alpha:.8}).stroke({width:1.2,color:b,...dA})}}},dC={pending:{label:"Queued",color:0xf59e0b,draw(a,b){for(let c of[-7,0,7])a.circle(c,1,2.6).fill({color:b})}},done:{label:"Done",color:3462041,draw(a,b){a.moveTo(-7,0).lineTo(-2,6).lineTo(8,-7).stroke({width:3,color:b,...dA})}},rate_limited:{label:"Rate limit",color:0xef4444,draw(a,b){a.moveTo(-6,-9).lineTo(6,-9).lineTo(-6,9).lineTo(6,9).closePath().stroke({width:2,color:b,...dA}),a.moveTo(-3,6.5).lineTo(3,6.5).stroke({width:2.2,color:b,...dA})}},upstream_timeout:{label:"Timeout",color:0xef4444,draw(a,b){a.circle(0,0,8.5).stroke({width:2,color:b,...dA}),a.moveTo(0,-5).lineTo(0,0).lineTo(4.5,3).stroke({width:2,color:b,...dA})}},quota_exhausted:{label:"Quota",color:0xef4444,draw(a,b){a.roundRect(-8,-5,14,10,2).stroke({width:2,color:b,...dA}),a.rect(6,-2,3,4).fill({color:b}),a.rect(-6,-3,2.6,6).fill({color:b})}},auth_refresh_failed:{label:"Auth",color:0xef4444,draw(a,b){a.circle(-4,0,4.2).stroke({width:2,color:b,...dA}),a.moveTo(0,0).lineTo(8,0).stroke({width:2,color:b,...dA}),a.moveTo(5,0).lineTo(5,4).stroke({width:2,color:b,...dA}),a.moveTo(-9,-8).lineTo(9,8).stroke({width:2.2,color:0xfbbf24,...dA})}},fallback:{label:"Fallback",color:0xfbbf24,draw(a,b){a.moveTo(-8,-4).lineTo(7,-4).stroke({width:2.2,color:b,...dA}),a.moveTo(3,-8).lineTo(8,-4).lineTo(3,0).stroke({width:2.2,color:b,...dA}),a.moveTo(8,5).lineTo(-7,5).stroke({width:2.2,color:b,...dA}),a.moveTo(-3,1).lineTo(-8,5).lineTo(-3,9).stroke({width:2.2,color:b,...dA})}},looping:{label:"Looping",color:0xf43f5e,draw(a,b){a.arc(0,0,6.5,-(.2*Math.PI),1.3*Math.PI).stroke({width:2.2,color:b,...dA}),a.moveTo(4,-6.5).lineTo(7,-3.5).lineTo(1,-3.5).closePath().fill({color:b})}}},dD=Object.keys(dB),dE=["pending","done","rate_limited","upstream_timeout","quota_exhausted","auth_refresh_failed","fallback","looping"];function dF(a,{size:b=1,showLabel:c=!0,label:d}={}){let e=dB[a]||dC[a]||dB.bash,f=new cg.t,g=new cp.f;g.circle(0,0,21).fill({color:e.color,alpha:.18});let h=new cp.f;h.circle(0,0,15).fill({color:988188}),h.circle(0,0,15).stroke({width:2,color:e.color,alpha:.95});let i=new cp.f;if(e.draw(i,e.color),i.scale.set(.95),f.addChild(g,h,i),c){let a=new dm({text:d??e.label,style:{fontFamily:(0,dr.l)("ui"),fontSize:9,fill:e.color,fontWeight:"800"}});a.anchor.set(.5,0),a.y=18,f.addChild(a)}return f.scale.set(b),{root:f,halo:g,tool:a}}let dG={x:-60,y:40,w:2150,h:980},dH=a=>Math.max(0,Math.min(1,a)),dI={streaming:.8,pending:.3,happy:.2,sleeping:0,error:1};async function dJ(a,b,c={}){let d,e,f,g,h=c.selectedId??null,i=c.onSelect,j=!1,k={x:0,y:0},l={x:0,y:0},m=!1,n=new cn;await n.init({canvas:a,preference:"webgl",resizeTo:a.parentElement,background:724758,antialias:!0,resolution:Math.min(globalThis.devicePixelRatio||1,2),autoDensity:!0});let o=n.renderer?.context?.extensions?.loseContext;if(o&&"function"==typeof o.loseContext){let a=o.loseContext.bind(o);o.loseContext=()=>{try{let b=n.renderer?.gl;if(b&&"function"==typeof b.isContextLost&&b.isContextLost())return;a()}catch(a){}}}let p=new cg.t,q=new cg.t,r=new cg.t,s=new cg.t,t=new cg.t,u=new cg.t,v=new cg.t,w=(d=new cg.t,e=new cp.f,f=new cp.f,d.addChild(f,e),g=[],{container:d,setRoutes(a){for(let b of(g.length=0,a)){let a=Math.max(1,Math.min(6,Math.round(6*b.weight)));for(let c=0;c<a;c+=1)g.push({from:b.from,to:b.to,t:(c/a+.1*Math.random())%1,speed:35e-5+6e-4*Math.random()+4e-4*b.weight,color:b.color,size:1.6+2.2*b.weight,shape:b.shape||"circle",arc:b.arc??26})}for(;g.length>700;)g.pop()},animate(a){for(let b of(e.clear(),f.clear(),g)){b.t+=b.speed*a,b.t>1&&(b.t-=1,b.speed=35e-5+6e-4*Math.random());let c=function(a,b,c,d){let e=Math.sin(c*Math.PI)*d;return{x:a.x+(b.x-a.x)*c,y:a.y+(b.y-a.y)*c-e}}(b.from,b.to,b.t,b.arc),d=Math.min(1,6*b.t)*Math.min(1,(1-b.t)*6),g=b.size;if("diamond"===b.shape)e.poly([c.x,c.y-1.5*g,c.x+1.2*g,c.y,c.x,c.y+1.5*g,c.x-1.2*g,c.y]).fill({color:b.color,alpha:d});else if("square"===b.shape){let a=.7*g;e.rect(c.x-a,c.y-a,2*a,2*a).fill({color:b.color,alpha:.9*d})}else e.circle(c.x,c.y,g).fill({color:b.color,alpha:d});f.circle(c.x,c.y,3*g).fill({color:b.color,alpha:.14*d})}}});p.addChild(q,r,w.container,s,t,u,v),n.stage.addChild(p);let x=b,y=new cp.f;function z(a=2150,b=980){dG.w=a,dG.h=b,y.clear();let c=(0,bW.F)(),d=x?.[0]?.theme||c?.equippedOfficeTheme||"theme_default",e=(bG.y.officeThemes||[]).find(a=>a.id===d)||bG.y.officeThemes?.[0],f=e?.palette||{floorGradient:[725016,1449772],gridColor:1712944,gridAlpha:.7,borderColor:2503236,panelRackColor:0xfde047,panelPodColor:2282478},[g,h]=f.floorGradient||[725016,1449772],i=f.gridColor??1712944,j=f.gridAlpha??.7,k=f.borderColor??2503236,l=f.panelRackColor??0xfde047,m=f.panelPodColor??2282478;y.roundRect(dG.x,dG.y,dG.w,dG.h,28).fill(new co.f({type:"linear",start:{x:0,y:0},end:{x:0,y:1},colorStops:[{offset:0,color:g},{offset:1,color:h}],textureSpace:"local"}));for(let a=dG.x+100;a<dG.x+dG.w;a+=100)y.moveTo(a,dG.y+14).lineTo(a,dG.y+dG.h-14).stroke({width:1,color:i,alpha:j});for(let a=dG.y+100;a<dG.y+dG.h;a+=100)y.moveTo(dG.x+14,a).lineTo(dG.x+dG.w-14,a).stroke({width:1,color:i,alpha:j});y.roundRect(dG.x,dG.y,dG.w,dG.h,28).stroke({width:2,color:k,alpha:.9}),y.roundRect(1370,dG.y+120,260,dG.h-240,22).fill({color:l,alpha:.045}),y.roundRect(1750,dG.y+40,220,dG.h-150,22).fill({color:m,alpha:.045})}z(2150,980),y.eventMode="static",y.on("pointertap",()=>{m||O(null)}),q.addChild(y);let A=new cg.t,B=dy({color:0xfde047,trimColor:0xf59e0b,seed:3,scale:.95,mode:"sleeping"});B.root.baseX=0,B.root.baseY=-156,B.root.x=0,B.root.y=-156,A.addChild(B.root);let C=new cp.f;C.roundRect(-70,-170,140,230,10).fill({color:1712685}),C.roundRect(-62,-162,124,60,6).fill({color:2240576}),C.roundRect(-58,40,116,96,6).fill({color:2240576}),A.addChild(C);let D=new cp.f;D.roundRect(-80,-180,160,250,14).fill({color:0xfde047,alpha:.12}),A.addChildAt(D,0);let E=new cp.f;A.addChild(E);let F=new dm({text:"CORE HUB",style:{fontFamily:(0,dr.l)("ui"),fontSize:14,fill:3718648,fontWeight:"800",letterSpacing:2}});F.anchor.set(.5,0),F.y=-92,A.addChild(F);let G=dz("0",{color:0xfde047,size:13});G.anchor.set(.5,0),G.y=4,A.addChild(G),s.addChild(A);let H=[],I=[],J=[],K=[],L=!1,M="";function N(){for(let a of I)a.desk.setSelected(a.ws.connectionId===h)}function O(a){h=a,N(),i?.(a)}function P(a,b=!1){x=a;let c=function(a){if(!Array.isArray(a)||0===a.length)return"0:empty";let b=a.length+":";for(let c=0;c<a.length;c++){let d=a[c];d&&(b+=`${d.connectionId||d.id||c}_${d.state||""}_${d.mode||""}_${+!!d.isLooping}_${d.skin||""}_${d.aura||""}_${d.pet||""}_${d.trophy||""}_${Array.isArray(d.props)?d.props.join(","):d.props||""}_${d.cost||0}_${d.elapsedMs||0}_${d.tokens?.input||0}_${d.tokens?.output||0}_${d.tools?.length||0}_${d.error||""}|`)}return b}(a);if(!b&&c===M&&H.length>0)return;M=c;let d=[],e=[],f=[],g=[],i=(a,b)=>(a.addChild(b),d.push(b),b),j=dq(a),k=new Map(j.pods.map(a=>[a.provider,a])),l=[],n=[...j.workstations].sort((a,b)=>a.y-b.y||a.x-b.x),o=(0,bW.F)();for(let[a,b]of n.entries()){let c=!!b.isLooping,d="app"===b.clientType||String(b.provider||"").toLowerCase().includes("app"),f=b.clientType||(d?"app":"cli"),g=function({color:a,label:b="",meta:c="",provider:d="",clientType:e="cli",elapsedMs:f=0,cost:g=0,cachedPct:h=0,queued:i=1,depth:j=1,isLooping:k=!1,pet:l="none",props:m=[],trophy:n="none"}){let o=new cg.t,p="app"===e||String(d||"").toLowerCase().includes("app"),q=new cp.f;q.ellipse(83,102,93,11).fill({color:0,alpha:.18}),q.ellipse(81,100,.56*150,8).fill({color:0,alpha:.28}),q.roundRect(0,34,150,62,7).fill(dw(2831427,1580326)),q.poly([150,40,159,32,159,88,150,94]).fill({color:1053723}),q.poly([-5,28,8,20,148,20,159,28]).fill({color:6122365}),q.roundRect(-5,26,164,14,6).fill(dw(6648714,3818836)),q.roundRect(-5,26,164,2.5,2).fill({color:0xffffff,alpha:.3}),q.roundRect(0,40,150,2,1).fill({color:0,alpha:.35}),o.addChild(q);let r=Math.min(1,f/4e4),s=f<12e3?3462041:f<26e3?0xfbbf24:0xef4444,t=new cp.f;t.roundRect(10,87,130,4,2).fill({color:988188}),t.roundRect(10,87,Math.max(4,130*r),4,2).fill({color:s}),o.addChild(t);let u=new cp.f;u.roundRect(13,-30,76,62,12).fill({color:a,alpha:.12}),o.addChild(u);let v=new cp.f;v.roundRect(25,-16,58,38,5).fill({color:0,alpha:.35}),v.roundRect(23,-18,58,38,5).fill(dw(2765116,724499)),v.roundRect(27,-14,50,30,3).fill({color:a,alpha:.6});for(let a=0;a<4;a+=1)v.roundRect(31,-9+6*a,18+11*a%22,2.4,1).fill({color:0xffffff,alpha:.5});v.poly([27,-14,53,-14,41,16,27,16]).fill({color:0xffffff,alpha:.07}),v.roundRect(46,20,8,6,2).fill({color:2962753}),o.addChild(v);let w=new cp.f;w.roundRect(29,-13,26,11,2.5).fill({color:p?3868516:413243,alpha:.9}),w.roundRect(29,-13,26,11,2.5).stroke({width:.8,color:p?0xa855f7:366185,alpha:.95}),o.addChild(w);let x=new dm({text:p?"APP":"CLI",style:{fontFamily:du(),fontSize:7,fill:p?0xd8b4fe:7268279,fontWeight:"900"}});x.anchor.set(.5,.5),x.x=42,x.y=-7.5,o.addChild(x);let y=new cp.f;y.roundRect(89,29,34,8,3).fill({color:724499}),y.roundRect(89,27,34,8,3).fill(dw(3884372,2304565)),o.addChild(y);let z=new cp.f,A=Math.min(5,Math.max(1,i));for(let a=0;a<A;a+=1)z.roundRect(-2+a%2,22-3.4*a,22,5,1.5).fill({color:a%2?0xe6edf6:0xcfd8e6}).stroke({width:.6,color:988188,alpha:.5});if(o.addChild(z),i>1){let a=new dm({text:`\xd7${i}`,style:{fontFamily:dv(),fontSize:10,fill:0xfbbf24,fontWeight:"800"}});a.anchor.set(.5,1),a.x=9,a.y=22-3.4*A-1,o.addChild(a)}let B=new dm({text:dt(b,18),style:{fontFamily:dv(),fontSize:11.5,fill:p?0xf5d0fe:0xe6edf6,fontWeight:"700"}});B.anchor.set(.5,0),B.x=75,B.y=42;let C=d?d.toUpperCase():"",D=C?`${C} \xb7 ${dt(c,18)}`:dt(c,28),E=new dm({text:dt(D,28),style:{fontFamily:du(),fontSize:8.5,fill:p?0xd8b4fe:9675189}});E.anchor.set(.5,0),E.x=75,E.y=57;let F=Number.isFinite(f)?f:null,G=Number.isFinite(g)?`$${g.toFixed(2)}`:"—",H=Number.isFinite(h)?`${h}% cached`:"— cached",I=null===F?"—":F>=1e3?`${(F/1e3).toFixed(1)}s`:`${F}ms`,J=new dm({text:`${I} \xb7 ${G} \xb7 ${H}`,style:{fontFamily:du(),fontSize:8.5,fill:s}});J.anchor.set(.5,0),J.x=75,J.y=71,o.addChild(B,E,J);let K=Array.isArray(m)?m:[m],L=K.map(a=>"string"==typeof a?(0,bG.x)(a):a).filter(Boolean),M=K.includes("coffee_machine")||L.some(a=>"espresso_station"===a.archetype||a.id?.includes("prop_3")||a.id?.includes("espresso")),N=K.includes("bonsai")||L.some(a=>"terrarium_bonsai"===a.archetype||a.id?.includes("prop_4")||a.id?.includes("bonsai")),O=L.some(a=>"supercomputer"===a.archetype||a.id?.includes("prop_0")||a.id?.includes("server")),P=L.some(a=>"hologram_emitter"===a.archetype||a.id?.includes("prop_2")||a.id?.includes("holo")),Q=L.some(a=>"dual_monitor"===a.archetype||a.id?.includes("prop_1")||a.id?.includes("monitor")),R=L.some(a=>"arcade_cabinet"===a.archetype||a.id?.includes("arcade")),S=L.some(a=>"lab_oscilloscope"===a.archetype||a.id?.includes("oscilloscope")),T=null;if(M){let a=new cg.t;a.x=118,a.y=12;let b=new cp.f;b.roundRect(0,0,16,20,3).fill(dw(4674921,1976635)),b.roundRect(2,2,12,5,1.5).fill({color:988970}),b.roundRect(3,3,3,3,1).fill({color:3718648}),b.roundRect(2,9,12,9,1).fill({color:988970}),b.roundRect(4,11,7,7,2).fill({color:0xf8fafc}),b.roundRect(5,12,5,2,1).fill({color:7877903}),a.addChild(b),T=new cp.f,a.addChild(T),o.addChild(a)}if(N){let a=new cg.t;a.x=4,a.y=14;let b=new cp.f;b.roundRect(0,10,14,7,2).fill({color:8138002}),b.ellipse(7,6,7,5).fill({color:1409085}),b.circle(4,4,3.8).fill({color:2278750}),b.circle(10,4,3.8).fill({color:1483594}),a.addChild(b),o.addChild(a)}let U=null;if(O){let a=new cg.t;a.x=128,a.y=8;let b=new cp.f;b.roundRect(0,0,14,28,2).fill(dw(1976635,988970)),b.roundRect(0,0,14,28,2).stroke({width:1,color:3359061}),a.addChild(b),U=new cp.f,a.addChild(U),o.addChild(a)}let V=null;if(P){let a=new cg.t;a.x=6,a.y=10;let b=new cp.f;b.ellipse(8,22,9,3.5).fill({color:1976635}),b.ellipse(8,22,9,3.5).stroke({width:1,color:440020}),b.poly([8,22,1,6,15,6]).fill({color:440020,alpha:.2}),a.addChild(b),(V=new cp.f).x=8,V.y=4,V.roundRect(-4,-4,8,8,1).stroke({width:1.2,color:3718648,alpha:.9}),V.roundRect(-4,-4,8,8,1).fill({color:440020,alpha:.4}),a.addChild(V),o.addChild(a)}if(Q){let a=new cg.t;a.x=4,a.y=10;let b=new cp.f;b.roundRect(0,0,14,24,2).fill(dw(1976635,988970)),b.roundRect(0,0,14,24,2).stroke({width:1,color:3718648,alpha:.7}),b.roundRect(2,2,10,20,1).fill({color:132631});for(let a=0;a<4;a++)b.roundRect(3,4+4.5*a,5+a%2*3,1.2,.5).fill({color:a%2?2278750:61695,alpha:.8});a.addChild(b),o.addChild(a)}if(R){let a=new cg.t;a.x=126,a.y=6;let b=new cp.f;b.roundRect(0,0,16,30,2).fill(dw(4988309,1973067)),b.roundRect(0,0,16,30,2).stroke({width:1,color:0xa855f7}),b.roundRect(2,2,12,6,1).fill({color:0xf43f5e}),b.roundRect(2,10,12,11,1).fill({color:395284}),b.circle(5,24,1.5).fill({color:0xf59e0b}),a.addChild(b),o.addChild(a)}let W=null;if(S){let a=new cg.t;a.x=6,a.y=12;let b=new cp.f;b.roundRect(0,0,18,18,2).fill({color:1976635}),b.roundRect(0,0,18,18,2).stroke({width:1,color:1096065}),b.circle(9,9,6.5).fill({color:142370}),a.addChild(b),W=new cp.f,a.addChild(W),o.addChild(a)}if(n&&"none"!==n){let a="string"==typeof n?(0,bG.x)(n):null,b=a?.color?ds(a.color,0xf59e0b):0xf59e0b,c=a?.archetype||"quantum_crystal",d=new cg.t;d.x=136,d.y=16;let e=new cp.f;e.roundRect(-6,8,12,4,1).fill({color:988970}),e.roundRect(-6,8,12,4,1).stroke({width:.8,color:b,alpha:.6}),"golden_key"===c?(e.circle(0,-2,4).stroke({width:1.5,color:b}),e.moveTo(0,2).lineTo(0,8).stroke({width:1.5,color:b}),e.moveTo(0,5).lineTo(2.5,5).stroke({width:1.2,color:b})):"silicon_wafer"===c?(e.circle(0,0,5.5).fill({color:1976635}),e.circle(0,0,5.5).stroke({width:1.2,color:b}),e.moveTo(-4,0).lineTo(4,0).stroke({width:.8,color:3718648,alpha:.8}),e.moveTo(0,-4).lineTo(0,4).stroke({width:.8,color:0xec4899,alpha:.8})):"diamond_bug"===c?(e.ellipse(0,0,4.5,5.5).fill({color:b}),e.circle(0,-3.5,2.5).fill({color:0xffffff}),e.moveTo(-4,-1).lineTo(-6,-3).stroke({width:1,color:b}),e.moveTo(4,-1).lineTo(6,-3).stroke({width:1,color:b})):(e.poly([0,-6,5,2,-5,2]).fill({color:b}),e.poly([0,-6,5,2,0,6,-5,2]).stroke({width:1,color:0xffffff,alpha:.8}),e.circle(0,0,1.5).fill({color:0xffffff})),d.addChild(e),o.addChild(d)}let X=null,Y="string"==typeof l?(0,bG.x)(l):null,Z=Y?.archetype||("cat"===l?"cyber_cat":"shiba"===l?"dozing_shiba":l),$=Y?.color?ds(Y.color,0xf472b6):"dozing_shiba"===Z?0xd97706:0xf472b6;if(l&&"none"!==l){(X=new cg.t).x=24,X.y=80;let a=new cp.f;"cyber_cat"===Z||"cat"===l?(a.ellipse(0,0,11,7).fill({color:$}),a.circle(-7,-2,5.5).fill({color:$}),a.poly([-11,-7,-8,-11,-5,-7]).fill({color:0xf43f5e}),a.poly([-7,-7,-4,-11,-1,-7]).fill({color:0xf43f5e}),a.moveTo(-9,-1).arc(-7,-1,2,0,Math.PI).stroke(dx(1,8917815)),a.ellipse(7,2,5,2.5).fill({color:$})):"dozing_shiba"===Z||"shiba"===l?(a.ellipse(0,0,13,8).fill({color:$}),a.ellipse(2,2,9,4).fill({color:0xfef3c7}),a.circle(-8,-2,6).fill({color:$}),a.poly([-12,-7,-9,-12,-6,-7]).fill({color:0xb45309}),a.poly([-7,-7,-4,-12,-1,-7]).fill({color:0xb45309}),a.moveTo(-10,-1).arc(-8,-1,2,0,Math.PI).stroke(dx(1,7877903)),a.circle(9,-2,4).fill({color:$})):"hover_drone"===Z?(a.ellipse(0,6,12,3.5).stroke({width:1.5,color:$,alpha:.8}),a.circle(0,0,7).fill({color:1976635}),a.circle(0,0,7).stroke({width:1.2,color:$}),a.circle(0,0,3).fill({color:3718648}),a.circle(-1,-1,1).fill({color:0xffffff})):(a.ellipse(0,0,8,10).fill({color:1976635}),a.ellipse(0,0,8,10).stroke({width:1.2,color:$}),a.circle(-3,-4,2.5).fill({color:$}),a.circle(3,-4,2.5).fill({color:$}),a.poly([-1,0,1,0,0,2]).fill({color:0xf59e0b})),X.addChild(a),o.addChild(X)}let _=new cp.f;_.roundRect(-12,-76,174,180,14).stroke({width:2.5,color:0xfde047,alpha:.9}),_.roundRect(-12,-76,174,180,14).fill({color:0xfde047,alpha:.05}),_.visible=!1,o.addChildAt(_,0);let aa=new cp.f;return aa.roundRect(-10,18,170,88,10).stroke({width:3,color:0xf43f5e,alpha:.95}),aa.roundRect(-10,18,170,88,10).fill({color:0xf43f5e,alpha:.08}),aa.visible=!!k,o.addChildAt(aa,0),o.eventMode="static",o.cursor="pointer",o.hitArea=new cw.f(-12,-76,174,180),o.scale.set(j),{root:o,screen:v,glow:u,setSelected(a){_.visible=!!a},setHazard(a){aa.visible=!!a},animate(a,b=0,c="streaming"){if(v.alpha=.7+.12*Math.sin(.008*a+o.x)*(.4+b),u.alpha=.3+.5*b+.08*Math.sin(.004*a+o.x),aa.visible&&(aa.alpha=.45+.45*Math.sin(.008*a)),T&&b>0){T.clear();for(let b=0;b<3;b++){let c=(.001*a+b/3)%1,d=7+3*Math.sin(5*c+b),e=8-12*c;T.circle(d,e,1+1.8*c).fill({color:0xffffff,alpha:.45*(1-c)})}}else T&&T.clear();if(U){U.clear();for(let b=0;b<4;b++){let c=Math.sin(.008*a+1.6*b)>0,d=[2278750,61695,0xf59e0b,0xec4899][b];U.circle(4,4+6*b,1.3).fill({color:c?d:1976635})}}if(V&&(V.rotation=.002*a),W){W.clear(),W.moveTo(3,9);for(let b=3;b<=15;b+=1.5){let c=9+3*Math.sin(.01*a+.8*b);W.lineTo(b,c)}W.stroke({width:1.2,color:3462041,alpha:.9})}X&&("hover_drone"===Z?(X.y=72+4*Math.sin(.005*a),X.scale.y=1):"happy"===c?(X.y=80-7*Math.abs(Math.sin(.008*a)),X.scale.y=1+.15*Math.abs(Math.sin(.008*a))):"sleeping"===c?(X.y=80,X.scale.y=1+.04*Math.sin(.0016*a)):"error"===c?(X.x=24+1.5*Math.sin(.08*a),X.y=80):"looping"===c?X.rotation=.15*Math.sin(.04*a):(X.y=80,X.scale.y=1+.06*Math.sin(.003*a)))}}}({color:b.color,label:b.account,meta:`${b.model||""} \xb7 ${b.totalLabel}`,provider:b.provider,clientType:f,elapsedMs:b.elapsedMs,cost:b.cost,cachedPct:b.cachedPct,queued:b.queued,depth:b.depth,isLooping:c,pet:b.pet||o.equippedPet||"none",props:b.props&&b.props.length>0?b.props:o.equippedProps||[],trophy:b.trophy||o.equippedTrophy||"none"});g.root.x=b.x,g.root.y=b.y,g.root.on("pointertap",a=>{m||(a.stopPropagation(),O(b.connectionId===h?null:b.connectionId))});let j=dy({color:b.color,depth:b.depth,seed:a,mode:b.mode,clientType:f,skin:b.skin||o.equippedSkin||"classic",aura:b.aura||o.equippedAura||"none"});j.root.x=b.x+108,j.root.baseX=b.x+108,j.root.baseY=b.y+34,j.root.y=j.root.baseY,i(s,j.root),i(s,g.root);let n=[];if(b.busy>0||b.tools.length>0)for(let a of b.tools){let c=dF(a,{size:1.05});c.root.x=b.x+28,c.root.y=b.y-50,c.root.visible=!1,i(u,c.root),n.push(c)}let p=null,q=b.isLooping?"looping":"pending"===b.mode?"pending":"happy"===b.mode?"done":"error"===b.mode?dC[b.errorReason]?b.errorReason:"rate_limited":null;if(q&&((p=dF(q,{size:1.05})).root.x=b.x+150+14,p.root.y=b.y-34,i(u,p.root)),b.fallbackFrom){let a=dF("fallback",{size:.85,label:`from ${b.fallbackFrom}`});a.root.x=b.x+150+14,a.root.y=b.y+40,i(u,a.root)}let r=null;if("happy"===b.mode&&b.cost>0){r=new cg.t;let a=new cp.f;a.circle(0,0,6).fill({color:0xfacc15}),a.circle(0,0,6).stroke({width:1.2,color:0xa16207});let c=new dm({text:`+$${b.cost.toFixed(2)}`,style:{fontFamily:(0,dr.l)("ui"),fontSize:11,fill:0xfacc15,fontWeight:"800"}});c.x=10,c.anchor.set(0,.5),r.addChild(a,c),r.x=b.x+16,r.visible=!1,i(u,r)}e.push({desk:g,character:j,ws:b,toolBadges:n,statusBadge:p,coin:r});let t=k.get(b.provider);if(b.busy>0){let a=a=>Math.max(.15,dH(a)),c=a(b.tokens.input/16e3),d=a(b.tokens.output/3200),e=b.tokens.cached>0?a(b.tokens.cached/6500):0,f={x:b.x+75,y:b.y-10},g={x:1500,y:390};l.push({from:f,to:g,color:b.color,weight:c}),t&&(l.push({from:{x:1500,y:440},to:{x:t.x-46,y:t.y},color:t.color,weight:c}),l.push({from:{x:t.x-46,y:t.y+14},to:{x:1520,y:470},color:8843180,weight:d,shape:"diamond",arc:-22})),l.push({from:{x:1480,y:490},to:{x:b.x+100,y:b.y+6},color:8843180,weight:d,shape:"diamond",arc:-22}),e&&l.push({from:{x:b.x+90,y:b.y-20},to:{x:1470,y:360},color:0xcbd5e1,weight:e,shape:"square",arc:44})}}for(let a of j.pods){let b=dy({color:a.color,trimColor:a.color,scale:.55,seed:a.provider.length,mode:a.overloaded?"pending":a.busy>0?"streaming":"sleeping"});b.root.x=a.x+2,b.root.baseX=a.x+2,b.root.baseY=a.y+10,b.root.y=a.y+10,i(s,b.root);let c=new cp.f;c.ellipse(0,34,52,10).fill({color:0,alpha:.35}),c.roundRect(-46,-30,92,62,12).fill({color:1844529}),c.roundRect(-46,-30,92,6,5).fill({color:0xffffff,alpha:.06});let d=a.overloaded?dn.error:a.load>.5?0xfbbf24:3462041;for(let b=0;b<3;b+=1){let e=dH(3*a.load-b);c.roundRect(-38,-18+14*b,76,9,3).fill({color:988188}),e>0&&c.roundRect(-38,-18+14*b,76*e,9,3).fill({color:d,alpha:.9})}c.x=a.x,c.y=a.y,i(s,c);let e=new cp.f;e.x=a.x+34,e.y=a.y-35,i(s,e);let g=new dm({text:a.provider.toUpperCase(),style:{fontFamily:(0,dr.l)("ui"),fontSize:12,fill:0xdce6f2,fontWeight:"800",letterSpacing:1}});g.anchor.set(.5,0),g.x=a.x,g.y=a.y+38,i(s,g);let h=dz(`${a.busy} in flight${a.overloaded?" · FULL":""}`,{color:a.overloaded?dn.error:a.color,size:10});h.anchor.set(.5,0),h.x=a.x,h.y=a.y+53,i(s,h),f.push({pod:a,operator:b,siren:e})}j.fallbacks.forEach((a,b)=>{let c=k.get(a.from),d=k.get(a.to);if(!c||!d)return;let e=1778-b%4*14,f=new cp.f;f.moveTo(c.x-46,c.y).lineTo(e,c.y).stroke({width:2,color:0xfbbf24,alpha:.5}),f.moveTo(d.x-46,d.y).lineTo(e,d.y).stroke({width:2,color:0xfbbf24,alpha:.5}),function(a,b,c,d){let e=Math.sign(d-c)||1;for(let f=c;e>0?f<d-8:f>d+8;f+=14*e)a.moveTo(b,f).lineTo(b,f+8*e).stroke({width:2,color:0xfbbf24,alpha:.8})}(f,e,c.y,d.y);let h=Math.sign(d.y-c.y)||1;f.poly([e-6,d.y-10*h,e+6,d.y-10*h,e,d.y]).fill({color:0xfbbf24}),i(r,f);let j=new dm({text:`FALLBACK \xd7${a.count}`,style:{fontFamily:(0,dr.l)("ui"),fontSize:9,fill:0xfbbf24,fontWeight:"800",letterSpacing:1}});j.anchor.set(1,.5),j.x=e-9,j.y=(c.y+d.y)/2,i(r,j);let l=dy({color:0xfbbf24,trimColor:0xf59e0b,scale:.5,seed:b+5,mode:"streaming"}),m=new cp.f;m.roundRect(-30,-22,14,12,2).fill({color:0xd6a15c}),m.moveTo(-30,-16).lineTo(-16,-16).stroke({width:1.2,color:8145437});let n=new cp.f;l.root.addChild(m,n),i(t,l.root),g.push({drone:l,flame:n,laneX:e,y1:c.y,y2:d.y,offset:900*b})}),A.x=1500,A.y=480,G.text=String(j.rack.active),L=j.rack.active>0,B.setMode(L?"streaming":"sleeping"),w.setRoutes(l);let p=H;for(let a of(H=d,I=e,J=f,K=g,N(),p))try{a.destroy({children:!0})}catch(a){}}function Q(){if(n.screen.width<=0||n.screen.height<=0)return;let a=Math.max(.25,Math.min(n.screen.width/2190,n.screen.height/1020,1));p.scale.set(a),z(Math.max(2150,n.screen.width/a-30),Math.max(980,n.screen.height/a-30)),p.x=(n.screen.width-dG.w*p.scale.x)/2-dG.x*p.scale.x,p.y=(n.screen.height-dG.h*p.scale.y)/2-dG.y*p.scale.y,c.onZoomChange?.(Math.round(100*a))}n.renderer.on("resize",Q);let R=a=>{0===a.button&&(j=!0,m=!1,k={x:a.clientX,y:a.clientY},l={x:p.x,y:p.y})},S=a=>{if(!j)return;let b=a.clientX-k.x,c=a.clientY-k.y;Math.hypot(b,c)>4&&(m=!0),p.x=l.x+b,p.y=l.y+c},T=()=>{j=!1},U=b=>{b.preventDefault();let d=a.getBoundingClientRect(),e=b.clientX-d.left,f=b.clientY-d.top,g=b.deltaY<0?1.08:.92,h=p.scale.x,i=Math.max(.25,Math.min(1.15,h*g));if(.001>Math.abs(i-h))return;let j=(e-p.x)/h,k=(f-p.y)/h;p.scale.set(i),p.x=e-j*i,p.y=f-k*i,c.onZoomChange?.(Math.round(100*i))},V=()=>{Q()},W=null,X=a=>{a.preventDefault(),console.warn("[OfficeScene] WebGL context lost - browser reclaimed GPU memory")},Y=()=>{console.info("[OfficeScene] WebGL context restored by browser"),W&&clearTimeout(W),W=setTimeout(()=>{try{P(x,!0)}catch(a){console.warn("[OfficeScene] Soft rebuild after context restore:",a)}},200)};a.addEventListener("pointerdown",R),window.addEventListener("pointermove",S),window.addEventListener("pointerup",T),a.addEventListener("wheel",U,{passive:!1}),a.addEventListener("dblclick",V),a.addEventListener("webglcontextlost",X,!1),a.addEventListener("webglcontextrestored",Y,!1);let Z=()=>{z(dG.w,dG.h),P(x,!0)};window.addEventListener(bW.o,Z),window.addEventListener(dr.D,Z);let $=0;n.ticker.add(a=>{let b=a.deltaMS;for(let a of($+=b,w.animate(b),I)){let{ws:b}=a,c="streaming"===b.mode?Math.min(1,b.busy/2):dI[b.mode]??0;a.desk.animate($,c,b.mode),a.character.animate($,c);let d=a.toolBadges.length;if(d>0){let c=Math.floor(($+3*b.x)/2200)%d,e=($+3*b.x)%2200/2200;a.toolBadges.forEach((a,d)=>{let f=d===c;if(a.root.visible=f,!f)return;let g=Math.min(Math.min(1,6*e),Math.min(1,(1-e)*6));a.root.scale.set(1.05*(.35+.65*g)),a.root.alpha=g,a.root.y=b.y-50+2.5*Math.sin(.005*$+d),a.halo.scale.set(1+.12*Math.sin(.01*$))})}if(a.statusBadge){let c="error"===b.mode;a.statusBadge.root.y=b.y-34+Math.sin($*(c?.02:.004)+b.x)*(c?3:2),a.statusBadge.halo.scale.set(1+Math.sin($*(c?.016:.008))*(c?.3:.12))}if(a.coin){let c=($+5*b.x)%3400/3400;a.coin.visible=c<.8,a.coin.y=b.y-24-30*c,a.coin.alpha=Math.sin(Math.min(1,c/.8)*Math.PI)}}for(let{pod:a,operator:b,siren:c}of J)if(b.animate($,a.overloaded?1:Math.min(1,a.load)),c.clear(),a.overloaded){let a=Math.sin(.014*$)>0;c.circle(0,0,5).fill({color:0xef4444,alpha:a?1:.35}),c.circle(0,0,13).fill({color:0xef4444,alpha:a?.28:.05})}else c.circle(0,0,3).fill({color:a.busy>0?3462041:4674921,alpha:.9});for(let a of K){let b=($+a.offset)%4500/4500,c=b*b*(3-2*b);a.drone.root.baseX=a.laneX,a.drone.root.baseY=a.y1+(a.y2-a.y1)*c+6,a.drone.animate($,1),a.flame.clear(),a.flame.ellipse(0,16,7+1.5*Math.sin(.04*$),10+3*Math.sin(.05*$)).fill({color:0xfbbf24,alpha:.55}),a.flame.ellipse(0,14,4,6).fill({color:0xfff1b8,alpha:.85}),a.drone.root.alpha=Math.min(1,8*b)*Math.min(1,(1-b)*8)}B.animate($,+!!L),E.clear();for(let a=0;a<5;a+=1)for(let b=0;b<6;b+=1)Math.sin(.006*$+1.7*a+.9*b)>(L?-.2:.6)&&E.circle(-40+16*b,56+14*a,2.4).fill({color:a%3==0?3462041:2282478,alpha:.9});D.alpha=L?.5+.3*Math.sin(.005*$):.15});let _=(a,b)=>{let c=new dm({text:a,style:{fontFamily:(0,dr.l)("ui"),fontSize:11,fill:8227488,fontWeight:"800",letterSpacing:2}});c.x=b,c.y=dG.y+dG.h-52,v.addChild(c)};_("TOOL CALLS",35),dD.forEach((a,b)=>{let c=dF(a,{size:.72});c.root.x=160+65*b,c.root.y=dG.y+dG.h-40,v.addChild(c.root)}),_("STATUS",965),dE.forEach((a,b)=>{let c=dF(a,{size:.72});c.root.x=1050+68*b,c.root.y=dG.y+dG.h-40,v.addChild(c.root)});let aa=new dm({text:"● input ◆ output ■ cached",style:{fontFamily:(0,dr.l)("ui"),fontSize:11,fill:8227488,fontWeight:"700"}});return aa.x=1560,aa.y=dG.y+dG.h-50,v.addChild(aa),P(b),Q(),{app:n,rebuild:P,fit:Q,zoomIn(){let a=Math.min(1.15,1.15*p.scale.x),b=n.screen.width/2,d=n.screen.height/2,e=(b-p.x)/p.scale.x,f=(d-p.y)/p.scale.y;p.scale.set(a),p.x=b-e*a,p.y=d-f*a,c.onZoomChange?.(Math.round(100*a))},zoomOut(){let a=Math.max(.25,.85*p.scale.x),b=n.screen.width/2,d=n.screen.height/2,e=(b-p.x)/p.scale.x,f=(d-p.y)/p.scale.y;p.scale.set(a),p.x=b-e*a,p.y=d-f*a,c.onZoomChange?.(Math.round(100*a))},reset100(){p.scale.set(1),p.x=(n.screen.width-2150)/2-dG.x,p.y=(n.screen.height-980)/2-dG.y,c.onZoomChange?.(100)},setSelected(a){h=a,N()},setOnSelect(a){i=a},destroy:()=>{W&&clearTimeout(W);try{a.removeEventListener("pointerdown",R),window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",T),a.removeEventListener("wheel",U),a.removeEventListener("dblclick",V),a.removeEventListener("webglcontextlost",X),a.removeEventListener("webglcontextrestored",Y),window.removeEventListener(bW.o,Z),window.removeEventListener(dr.D,Z),n.renderer?.off?.("resize",Q)}catch{}try{n.ticker?.stop?.()}catch{}try{let a=n.renderer?.gl;(!a||"function"==typeof a.isContextLost&&a.isContextLost())&&n.renderer?.context?.extensions&&(n.renderer.context.extensions.loseContext=null),n.destroy(!1,{children:!0})}catch(a){console.warn("[OfficeScene] Cleanly handled app.destroy:",a)}}}}function dK({traces:a=[],totalCount:b=0,top:c=20,onTopChange:d=null,timeframe:e="24h",onTimeframeChange:f=null,onStats:g,onSelect:j,selectedId:k=null,isZenFullscreen:l=!1,onToggleZenFullscreen:m=null,soundEnabled:n=!1,onToggleSound:o=null}){let p=(0,i.useRef)(null),q=(0,i.useRef)(null),[r,s]=(0,i.useState)(100),[t,u]=(0,i.useState)(!1),v=(0,i.useRef)({onSelect:j,selectedId:k,traces:a});(0,i.useEffect)(()=>{v.current={onSelect:j,selectedId:k,traces:a}});let[w,x]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let a=!1,b=null,c=p.current;if(!c)return;let d=document.createElement("canvas");return d.style.position="absolute",d.style.inset="0",d.style.width="100%",d.style.height="100%",d.style.display="block",d.style.opacity="0",d.style.transition="opacity 0.2s ease-in-out",c.appendChild(d),(async()=>{try{let c=await dJ(d,v.current.traces,{selectedId:v.current.selectedId,onSelect:a=>v.current.onSelect?.(a),onZoomChange:a=>s(a)});if(a){try{c?.destroy?.()}catch{}try{d.remove()}catch{}return}q.current=b=c,d.style.opacity="1",v.current.traces&&v.current.traces.length>0&&b.rebuild?.(v.current.traces)}catch(b){a||(console.error("[OfficeCanvas] mount failed:",b),x(b?.message||"Failed to start the scene"))}})(),()=>{a=!0;try{b?.destroy?.()}catch(a){console.warn("[OfficeCanvas] Cleanup warning:",a)}q.current=null;try{d.remove()}catch{}}},[]),(0,i.useEffect)(()=>{q.current&&q.current.rebuild?.(a)},[a]),(0,i.useEffect)(()=>{let a=()=>{q.current&&q.current.rebuild?.(v.current.traces,!0)};return window.addEventListener(bW.o,a),()=>window.removeEventListener(bW.o,a)},[]),(0,i.useEffect)(()=>{q.current&&q.current.setSelected?.(k)},[k]),(0,i.useEffect)(()=>{if(!g)return;let a=setInterval(()=>{g?.({mounted:!!q.current})},2e3);return()=>clearInterval(a)},[g]),(0,i.useEffect)(()=>{let a=setTimeout(()=>{q.current?.fit?.()},60);return()=>clearTimeout(a)},[l]),(0,i.useEffect)(()=>{if(l){u(!0);let a=setTimeout(()=>u(!1),3500);return()=>clearTimeout(a)}u(!1)},[l]),(0,i.useEffect)(()=>{if(!l)return;let a=a=>{"Escape"===a.key&&(a.preventDefault(),m?.(!1))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[l,m]),(0,h.jsxs)("div",{className:`relative h-full w-full overflow-hidden bg-[#080d14] ${l?"!fixed !inset-0 !z-[99] !w-screen !h-screen !rounded-none !border-none":"rounded-xl border border-slate-800 shadow-2xl"}`,children:[(0,h.jsx)("div",{ref:p,className:"absolute inset-0"}),w&&(0,h.jsx)("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center text-sm text-rose-400",children:w}),!l&&(0,h.jsxs)("div",{"data-testid":"canvas-filter-pill",className:"absolute top-3 left-3 z-10 hidden sm:flex items-center gap-1.5 px-2.5 py-1 rounded-lg border border-slate-800/80 bg-slate-950/80 backdrop-blur-md shadow-xl text-slate-300 text-xs select-none pointer-events-none",children:[(0,h.jsx)(a1,{className:"w-3 h-3 text-cyan-400 shrink-0"}),(0,h.jsx)("span",{className:"font-semibold text-[11px] text-slate-200",children:"all"===c?"All Desks":`Top ${c}`}),(0,h.jsx)("span",{className:"text-slate-600",children:"·"}),(0,h.jsx)(a2.f,{className:"w-3 h-3 text-amber-400 shrink-0"}),(0,h.jsx)("span",{className:"text-[11px] text-slate-300",children:"all"===e?"All time":e}),b>0&&a.length>0&&a.length<b&&(0,h.jsxs)("span",{title:`Showing ${a.length} of ${b} recorded conversations`,className:"ml-0.5 px-1.5 py-0.2 rounded text-[10px] font-mono bg-cyan-950/60 text-cyan-300 border border-cyan-800/40",children:[a.length,"/",b]})]}),t&&(0,h.jsx)("div",{className:"absolute top-5 left-1/2 -translate-x-1/2 z-30 pointer-events-none transition-all duration-300 animate-in fade-in slide-in-from-top-2",children:(0,h.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 rounded-xl bg-slate-950/90 border border-cyan-500/40 text-cyan-200 text-xs shadow-2xl backdrop-blur-md",children:[(0,h.jsx)(a_.f,{className:"w-4 h-4 text-cyan-400 shrink-0"}),(0,h.jsxs)("span",{children:["Chế độ Chill toàn màn hình · Nhấn ",(0,h.jsx)("kbd",{className:"px-1.5 py-0.5 rounded bg-slate-800 text-amber-300 font-mono text-[10px]",children:"ESC"})," hoặc click nút góc trên để thoát"]})]})}),l&&(0,h.jsxs)("div",{className:"absolute top-4 right-4 z-30 flex items-center gap-2 animate-in fade-in duration-200",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-full bg-slate-950/70 border border-slate-800/80 backdrop-blur-md shadow-xl text-xs text-slate-300 select-none",children:[(0,h.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,h.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),(0,h.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]}),(0,h.jsx)("span",{className:"font-medium text-[11px]",children:"Virtual Office · Chill Mode"}),(0,h.jsxs)("span",{className:"text-[10px] text-slate-400 font-mono",children:["(",a.length," Bots)"]})]}),(0,h.jsxs)("button",{type:"button","data-testid":"exit-zen-fullscreen-btn",onClick:()=>m?.(!1),title:"Thoát chế độ toàn màn hình Chill Mode (ESC)",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-slate-900/80 hover:bg-slate-800 border border-slate-700/60 hover:border-amber-500/50 text-slate-300 hover:text-white backdrop-blur-md shadow-xl transition-all cursor-pointer text-xs font-medium group",children:[(0,h.jsx)(ba.f,{className:"w-3.5 h-3.5 text-amber-400 group-hover:scale-110 transition-transform"}),(0,h.jsx)("span",{className:"text-[11px]",children:"Thoát ESC"})]})]}),(0,h.jsxs)("div",{className:"absolute bottom-3 left-3 z-10 flex items-center gap-1 rounded-lg border border-slate-800/80 bg-slate-950/80 p-1 backdrop-blur-md shadow-xl text-slate-400",children:[(0,h.jsx)("button",{onClick:()=>q.current?.zoomOut?.(),title:"Zoom out",className:"p-1.5 rounded-md hover:bg-slate-800 hover:text-slate-200 transition-colors cursor-pointer",children:(0,h.jsx)(b4.f,{className:"w-3.5 h-3.5"})}),(0,h.jsxs)("button",{onClick:()=>q.current?.reset100?.(),title:"Reset to 100% (1:1 natural scale)",className:"px-2 py-1 rounded-md text-[11px] font-mono hover:bg-slate-800 hover:text-slate-200 transition-colors font-semibold text-slate-300 cursor-pointer",children:[r,"%"]}),(0,h.jsx)("button",{onClick:()=>q.current?.zoomIn?.(),title:"Zoom in",className:"p-1.5 rounded-md hover:bg-slate-800 hover:text-slate-200 transition-colors cursor-pointer",children:(0,h.jsx)(b3.f,{className:"w-3.5 h-3.5"})}),(0,h.jsx)("div",{className:"w-[1px] h-3.5 bg-slate-800 my-auto"}),(0,h.jsx)("button",{onClick:()=>q.current?.fit?.(),title:"Fit to view",className:"p-1.5 rounded-md hover:bg-slate-800 hover:text-slate-200 transition-colors cursor-pointer",children:(0,h.jsx)(a9.f,{className:"w-3.5 h-3.5"})}),m&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:"w-[1px] h-3.5 bg-slate-800 my-auto"}),(0,h.jsx)("button",{type:"button","data-testid":"canvas-camera-zen-fullscreen-btn",onClick:()=>m(!l),title:l?"Thoát toàn màn hình (ESC)":"Chế độ Chill toàn màn hình Virtual Office (ESC để thoát)",className:`p-1.5 rounded-md transition-colors cursor-pointer ${l?"bg-amber-500/20 text-amber-300 hover:bg-amber-500/30":"hover:bg-slate-800 hover:text-cyan-300 text-slate-400"}`,children:l?(0,h.jsx)(ba.f,{className:"w-3.5 h-3.5 text-amber-400"}):(0,h.jsx)(b6,{className:"w-3.5 h-3.5"})})]}),o&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:"w-[1px] h-3.5 bg-slate-800 my-auto"}),(0,h.jsx)("button",{type:"button",onClick:o,title:n?"Âm thanh: BẬT":"Âm thanh: TẮT",className:`p-1.5 rounded-md transition-colors cursor-pointer ${n?"text-emerald-400 hover:bg-slate-800":"text-slate-500 hover:text-slate-300 hover:bg-slate-800"}`,children:n?(0,h.jsx)(aO.f,{className:"w-3.5 h-3.5"}):(0,h.jsx)(aR,{className:"w-3.5 h-3.5"})})]})]})]})}var dL=a.i(68370);function dM({traces:a=[],selectedTraceId:b=null,onSelectTrace:c,activeTurns:d=[],className:e=""}){let f=(0,i.useRef)(null),[g,j]=(0,i.useState)(1),[k,l]=(0,i.useState)({x:100,y:50}),m=(0,i.useRef)(g);m.current=g;let n=(0,i.useRef)(k);n.current=k;let[o,p]=(0,i.useState)(!1),[q,r]=(0,i.useState)({x:0,y:0}),[s,t]=(0,i.useState)(b||a[0]?.traceId||a[0]?.connectionId),u=(0,i.useMemo)(()=>{let b=new Set,c=[];for(let d of a){let a=d.traceId||d.connectionId;!a||b.has(a)||(b.add(a),c.push({id:a,label:`${d.account||d.connectionId} (${d.model||"Gemini"})`}))}return c},[a]);(0,i.useEffect)(()=>{b?t(b):!s&&a.length>0&&t(a[0].traceId||a[0].connectionId)},[b,a,s]);let{nodes:v,edges:w,bounds:x}=(0,i.useMemo)(()=>(function(a=[],b=null,c=[]){if(!Array.isArray(a)||0===a.length)return{nodes:[],edges:[],bounds:{minX:0,maxX:800,minY:0,maxY:600}};let d=a.find(a=>a.traceId===b||a.traces?.[0]?.traceId===b||a.connectionId===b)||a[0],e=[];Array.isArray(c)&&c.forEach((a,b)=>{Array.isArray(a.toolCalls)&&a.toolCalls.forEach(a=>{let c=(a.name||"").toLowerCase();if(c.includes("invoke_subagent")||c.includes("define_subagent")){let c=a.args?.Subagents||a.args?.subagents||a.args;(Array.isArray(c)?c:[c]).forEach((c,f)=>{c&&(c.Role||c.role||c.TypeName||c.name)&&e.push({id:`sub-${b}-${f}-${c.TypeName||c.name||"worker"}`,parentId:d.traceId||d.connectionId,role:c.Role||c.role||"Subagent Worker",typeName:c.TypeName||c.name||"specialist",model:c.Model||c.model||null,prompt:c.Prompt||c.prompt||c.system_prompt||"",workspace:c.Workspace||c.workspace||"inherit",status:"running"===a.status?"streaming":"idle",tokens:null,durationMs:null,isSubagent:!0})})}})});let f=a.filter(a=>!a.parentTraceId);a.filter(a=>a.parentTraceId);let g=[],h=[],i=new Set,j=new Set,k=a=>{!a||!a.id||i.has(a.id)||(i.add(a.id),g.push(a))};(e.length>0?[d]:f.length>0?f:a).forEach(a=>{k({id:a.traceId||a.connectionId,level:0,label:a.account||a.connectionId||"Orchestrator Agent",role:"Lead Orchestrator",model:a.model||null,status:a.state||a.mode||"idle",isLooping:!!a.isLooping,tokens:a.tokens||null,toolsCount:a.tools?.length??a.logs?.length??null,clientType:a.clientType||"cli",color:a.color?`#${a.color.toString(16).padStart(6,"0")}`:"#38bdf8",isRoot:!0,traceRef:a})}),e.length>0&&e.forEach(a=>{var b;k({id:a.id,level:1,parentId:a.parentId,label:a.role,role:a.role,typeName:a.typeName,model:a.model,status:a.status,prompt:a.prompt,tokens:a.tokens,toolsCount:null,clientType:"subagent",color:"#818cf8",isRoot:!1}),!(b={id:`edge-${a.parentId}-${a.id}`,fromId:a.parentId,toId:a.id,active:"streaming"===a.status,label:a.typeName}).id||j.has(b.id)||(j.add(b.id),h.push(b))});let l={};g.forEach(a=>{l[a.level]||(l[a.level]=[]),l[a.level].push(a)});let m=[],n={},o=1;Object.values(l).forEach(a=>{a.length>o&&(o=a.length)});let p=Math.max((320*o-60)/2+100,500);Object.keys(l).forEach(a=>{let b=parseInt(a,10),c=l[b],d=p-(320*c.length-60)/2;c.forEach((a,c)=>{let e=Math.round(d+320*c),f=Math.round(80+280*b),g={...a,x:e,y:f,width:260,height:140};m.push(g),n[a.id]=g})});let q=[];h.forEach(a=>{let b=n[a.fromId],c=n[a.toId];if(b&&c){let d=b.x+b.width/2,e=b.y+b.height,f=c.x+c.width/2,g=c.y,h=Math.max((g-e)/2,40),i=e+h,j=g-h,k=`M ${d} ${e} C ${d} ${i}, ${f} ${j}, ${f} ${g}`;q.push({...a,fromPos:{x:d,y:e},toPos:{x:f,y:g},pathData:k})}});let r=1/0,s=-1/0,t=1/0,u=-1/0;return m.forEach(a=>{a.x<r&&(r=a.x),a.x+a.width>s&&(s=a.x+a.width),a.y<t&&(t=a.y),a.y+a.height>u&&(u=a.y+a.height)}),isFinite(r)||(r=0,s=1e3,t=0,u=700),{nodes:m,edges:q,bounds:{minX:Math.max(0,r-100),maxX:s+100,minY:Math.max(0,t-80),maxY:u+100}}})(a,s,d),[a,s,d]),y=(0,i.useRef)(x);y.current=x;let z=(0,i.useRef)(v.length);z.current=v.length;let A=(0,i.useCallback)(()=>{if(!f.current||0===z.current)return;let{clientWidth:a,clientHeight:b}=f.current,c=y.current,d=c.maxX-c.minX,e=c.maxY-c.minY;if(d<=0||e<=0)return;let g=Math.min(Math.max(Math.min((a-120)/d,(b-120)/e),.3),1.2),h=(c.minX+c.maxX)/2,i=(c.minY+c.maxY)/2,k=a/2-h*g,m=b/2-i*g;j(g),l({x:Math.round(k),y:Math.round(m)})},[]),B=(0,i.useRef)(null);(0,i.useEffect)(()=>{if(s&&s!==B.current&&v.length>0){B.current=s;let a=setTimeout(()=>{A()},100);return()=>clearTimeout(a)}},[s,v.length,A]),(0,i.useEffect)(()=>{let a=()=>p(!1);return window.addEventListener("mouseup",a),()=>window.removeEventListener("mouseup",a)},[]),(0,i.useEffect)(()=>{let a=f.current;if(!a)return;let b=b=>{b.preventDefault();let c=m.current,d=n.current,e=b.deltaY<0?1.08*c:c/1.08;e=Math.min(Math.max(e,.2),3);let f=a.getBoundingClientRect(),g=b.clientX-f.left,h=b.clientY-f.top,i=g-(g-d.x)*(e/c),k=h-(h-d.y)*(e/c);j(e),l({x:Math.round(i),y:Math.round(k)})};return a.addEventListener("wheel",b,{passive:!1}),()=>a.removeEventListener("wheel",b)},[]);let C=v.filter(a=>"streaming"===a.status).length;return(0,h.jsxs)("div",{className:`relative w-full h-full bg-slate-950 overflow-hidden select-none flex flex-col ${e}`,onMouseMove:a=>{o&&l({x:Math.round(a.clientX-q.x),y:Math.round(a.clientY-q.y)})},onMouseUp:()=>{p(!1)},children:[(0,h.jsxs)("div",{className:"absolute top-4 left-4 right-4 z-20 flex items-center justify-between pointer-events-none",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 pointer-events-auto bg-slate-900/90 border border-slate-800 rounded-xl px-3 py-1.5 shadow-xl backdrop-blur-md text-xs",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)("div",{className:"p-1 rounded-lg bg-indigo-500/10 text-indigo-400 border border-indigo-500/20",children:(0,h.jsx)(bk.f,{className:"w-4 h-4"})}),(0,h.jsxs)("div",{children:[(0,h.jsx)("span",{className:"font-semibold text-slate-200 block text-xs",children:"Multi-Agent DAG"}),(0,h.jsxs)("span",{className:"text-[10px] text-slate-400 font-mono",children:[v.length," agents • ",w.length," links ",C>0&&`• ${C} running`]})]})]}),(0,h.jsx)("div",{className:"h-4 w-[1px] bg-slate-800 mx-1"}),(0,h.jsx)("select",{value:s||"",onChange:a=>t(a.target.value),className:"bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1 text-xs text-slate-300 font-mono focus:outline-none focus:border-indigo-500/50 cursor-pointer",children:u.map(a=>(0,h.jsx)("option",{value:a.id,children:a.label},a.id))})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 pointer-events-auto bg-slate-900/90 border border-slate-800 rounded-xl p-1 shadow-xl backdrop-blur-md",children:[(0,h.jsx)("button",{onClick:()=>{let a=m.current,b=n.current,c=Math.min(1.2*a,3);if(f.current){let{clientWidth:d,clientHeight:e}=f.current,g=d/2,h=e/2;l({x:Math.round(g-(g-b.x)*(c/a)),y:Math.round(h-(h-b.y)*(c/a))})}j(c)},className:"p-1.5 rounded-lg text-slate-400 hover:text-slate-200 hover:bg-slate-800 transition-colors",title:"Zoom In (+)",children:(0,h.jsx)(b3.f,{className:"w-4 h-4"})}),(0,h.jsxs)("span",{className:"text-[11px] font-mono text-slate-400 px-2 min-w-12 text-center",children:[Math.round(100*g),"%"]}),(0,h.jsx)("button",{onClick:()=>{let a=m.current,b=n.current,c=Math.max(a/1.2,.2);if(f.current){let{clientWidth:d,clientHeight:e}=f.current,g=d/2,h=e/2;l({x:Math.round(g-(g-b.x)*(c/a)),y:Math.round(h-(h-b.y)*(c/a))})}j(c)},className:"p-1.5 rounded-lg text-slate-400 hover:text-slate-200 hover:bg-slate-800 transition-colors",title:"Zoom Out (-)",children:(0,h.jsx)(b4.f,{className:"w-4 h-4"})}),(0,h.jsx)("div",{className:"h-4 w-[1px] bg-slate-800 mx-0.5"}),(0,h.jsxs)("button",{onClick:A,className:"flex items-center gap-1 px-2.5 py-1 rounded-lg text-xs font-medium text-slate-300 hover:text-white hover:bg-slate-800 transition-colors",title:"Fit to Screen",children:[(0,h.jsx)(a9.f,{className:"w-3.5 h-3.5 text-indigo-400"}),(0,h.jsx)("span",{children:"Fit"})]})]})]}),(0,h.jsxs)("div",{ref:f,onMouseDown:a=>{a.target.closest("button")||a.target.closest(".agent-node-card")||a.target.closest("select")||(p(!0),r({x:a.clientX-n.current.x,y:a.clientY-n.current.y}))},onDoubleClick:a=>{a.target.closest("button")||a.target.closest(".agent-node-card")||a.target.closest("select")||A()},className:"flex-1 w-full h-full relative cursor-grab active:cursor-grabbing overflow-hidden",children:[(0,h.jsxs)("svg",{className:"absolute inset-0 w-full h-full pointer-events-none opacity-20",xmlns:"http://www.w3.org/2000/svg",children:[(0,h.jsx)("defs",{children:(0,h.jsx)("pattern",{id:"dag-grid",width:"28",height:"28",patternUnits:"userSpaceOnUse",children:(0,h.jsx)("circle",{cx:"2",cy:"2",r:"1.2",fill:"#64748b"})})}),(0,h.jsx)("rect",{width:"100%",height:"100%",fill:"url(#dag-grid)"})]}),(0,h.jsxs)("div",{style:{transform:`translate(${k.x}px, ${k.y}px) scale(${g})`,transformOrigin:"0 0",transition:o?"none":"transform 0.1s ease-out"},className:"absolute top-0 left-0",children:[(0,h.jsxs)("svg",{className:"overflow-visible pointer-events-none absolute top-0 left-0",style:{width:1,height:1},children:[(0,h.jsxs)("defs",{children:[(0,h.jsxs)("linearGradient",{id:"edge-pulse-gradient",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,h.jsx)("stop",{offset:"0%",stopColor:"#38bdf8"}),(0,h.jsx)("stop",{offset:"50%",stopColor:"#818cf8"}),(0,h.jsx)("stop",{offset:"100%",stopColor:"#c084fc"})]}),(0,h.jsx)("marker",{id:"dag-arrow",viewBox:"0 0 10 10",refX:"6",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:(0,h.jsx)("path",{d:"M 0 1 L 8 5 L 0 9 z",fill:"#6366f1"})})]}),w.map(a=>{let b=a.active;return(0,h.jsxs)("g",{children:[(0,h.jsx)("path",{d:a.pathData,fill:"none",stroke:"#1e293b",strokeWidth:"4",strokeLinecap:"round"}),(0,h.jsx)("path",{d:a.pathData,fill:"none",stroke:b?"url(#edge-pulse-gradient)":"#475569",strokeWidth:b?"2.5":"1.8",strokeDasharray:b?"8 6":"none",strokeLinecap:"round",className:b?"animate-pulse":""}),(0,h.jsx)("circle",{cx:a.toPos.x,cy:a.toPos.y,r:b?"4.5":"3",fill:b?"#38bdf8":"#64748b",className:b?"animate-ping":""}),a.label&&(0,h.jsxs)("g",{transform:`translate(${(a.fromPos.x+a.toPos.x)/2}, ${(a.fromPos.y+a.toPos.y)/2})`,children:[(0,h.jsx)("rect",{x:"-38",y:"-10",width:"76",height:"20",rx:"6",fill:"#090d16",stroke:"#334155",strokeWidth:"1"}),(0,h.jsx)("text",{x:"0",y:"4",textAnchor:"middle",fill:"#94a3b8",fontSize:"9",fontFamily:"var(--font-family-mono, monospace)",fontWeight:"600",children:a.label})]})]},a.id)})]}),(0,h.jsx)("div",{className:"relative",children:v.map(a=>{let b="streaming"===a.status,d="done"===a.status,e=a.isLooping?{text:"Loop Alert",color:"text-rose-400 bg-rose-500/10 border-rose-500/30",dot:"bg-rose-500 animate-ping"}:b?{text:"Running",color:"text-cyan-300 bg-cyan-500/10 border-cyan-500/30",dot:"bg-cyan-400 animate-ping"}:d?{text:"Completed",color:"text-emerald-300 bg-emerald-500/10 border-emerald-500/30",dot:"bg-emerald-400"}:{text:"Idle",color:"text-slate-400 bg-slate-800/60 border-slate-700/60",dot:"bg-slate-500"};return(0,h.jsxs)("div",{style:{position:"absolute",left:`${a.x}px`,top:`${a.y}px`,width:`${a.width}px`,height:`${a.height}px`},onClick:()=>{a.traceRef&&c?.(a.traceRef)},className:`agent-node-card rounded-2xl border transition-all duration-200 cursor-pointer shadow-xl backdrop-blur-md p-3.5 flex flex-col justify-between select-text group hover:scale-[1.02] ${a.isRoot?"bg-slate-900/95 border-cyan-500/40 hover:border-cyan-400 hover:shadow-cyan-500/10":"bg-slate-900/85 border-slate-800 hover:border-indigo-500/50 hover:shadow-indigo-500/10"}`,children:[(0,h.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,h.jsx)("div",{className:"w-8 h-8 rounded-xl border flex items-center justify-center shrink-0 shadow-inner",style:{borderColor:a.color,backgroundColor:`${a.color}20`},children:(0,h.jsx)(aL.f,{className:"w-4 h-4",style:{color:a.color}})}),(0,h.jsxs)("div",{className:"min-w-0",children:[(0,h.jsx)("div",{className:"font-semibold text-slate-100 text-xs truncate",children:a.label}),(0,h.jsx)("div",{className:"text-[10px] text-slate-400 truncate flex items-center gap-1",children:(0,h.jsx)("span",{children:a.role})})]})]}),(0,h.jsxs)("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[9px] font-mono border font-semibold ${e.color}`,children:[(0,h.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${e.dot}`}),(0,h.jsx)("span",{children:e.text})]})]}),(0,h.jsx)("div",{className:"my-1.5",children:a.prompt?(0,h.jsx)("p",{className:"text-[11px] text-slate-300 font-mono line-clamp-2 leading-relaxed bg-black/40 p-1.5 rounded-lg border border-slate-800/80",children:a.prompt}):(0,h.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] text-slate-400",children:[(0,h.jsx)(bh.f,{className:"w-3 h-3 text-cyan-400 shrink-0"}),(0,h.jsx)("span",{className:"truncate font-mono",children:a.model})]})}),(0,h.jsxs)("div",{className:"flex items-center justify-between pt-1.5 border-t border-slate-800/80 text-[10px] text-slate-400 font-mono",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1",children:[(0,h.jsx)(bu.f,{className:"w-3 h-3 text-indigo-400"}),(0,h.jsx)("span",{className:"truncate max-w-24",children:a.model})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[a.toolsCount>0&&(0,h.jsxs)("span",{children:[a.toolsCount," tools"]}),(0,h.jsx)("button",{onClick:b=>{b.stopPropagation(),a.traceRef&&c?.(a.traceRef)},className:"opacity-0 group-hover:opacity-100 p-1 rounded bg-slate-800 hover:bg-slate-700 text-slate-200 transition-opacity",title:"View chat session for this agent",children:(0,h.jsx)(dL.f,{className:"w-3 h-3"})})]})]})]},a.id)})})]})]})]})}var dN=a.i(12871);function dO(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function dP(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function dQ(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{};b%2?dP(Object(c),!0).forEach(function(b){var d;d=c[b],b in a?Object.defineProperty(a,b,{value:d,enumerable:!0,configurable:!0,writable:!0}):a[b]=d}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):dP(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}return a}function dR(a){return function b(){for(var c=this,d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];return e.length>=a.length?a.apply(this,e):function(){for(var a=arguments.length,d=Array(a),f=0;f<a;f++)d[f]=arguments[f];return b.apply(c,[].concat(e,d))}}}function dS(a){return({}).toString.call(a).includes("Object")}function dT(a){return"function"==typeof a}var dU=dR(function(a,b){throw Error(a[b]||a.default)})({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),dV=function(a,b){return dS(b)||dU("changeType"),Object.keys(b).some(function(b){return!Object.prototype.hasOwnProperty.call(a,b)})&&dU("changeField"),b},dW=function(a){dT(a)||dU("selectorType")},dX=function(a){dT(a)||dS(a)||dU("handlerType"),dS(a)&&Object.values(a).some(function(a){return!dT(a)})&&dU("handlersType")},dY=function(a){a||dU("initialIsRequired"),dS(a)||dU("initialType"),Object.keys(a).length||dU("initialContent")};function dZ(a,b){return dT(b)?b(a.current):b}function d$(a,b){return a.current=dQ(dQ({},a.current),b),b}function d_(a,b,c){return dT(b)?b(a.current):Object.keys(c).forEach(function(c){var d;return null==(d=b[c])?void 0:d.call(b,a.current[c])}),c}var d0={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},d1=(f=function(a,b){throw Error(a[b]||a.default)},function a(){for(var b=this,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return d.length>=f.length?f.apply(this,d):function(){for(var c=arguments.length,e=Array(c),f=0;f<c;f++)e[f]=arguments[f];return a.apply(b,[].concat(d,e))}})(d0),d2=function(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];return function(a){return b.reduceRight(function(a,b){return b(a)},a)}},d3={type:"cancelation",msg:"operation is manually canceled"};function d4(a){var b=!1,c=new Promise(function(c,d){a.then(function(a){return b?d(d3):c(a)}),a.catch(d)});return c.cancel=function(){return b=!0},c}var d5=function(a){if(Array.isArray(a))return a}(g=function(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dY(a),dX(b);var c={current:a},d=dR(d_)(c,b),e=dR(d$)(c),f=dR(dV)(a),g=dR(dZ)(c);return[function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(a){return a};return dW(a),a(c.current)},function(a){(function(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];return function(a){return b.reduceRight(function(a,b){return b(a)},a)}})(d,e,f,g)(a)}]}({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}))||function(a){var b=null==a?null:"u">typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=b){var c,d,e,f,g=[],h=!0,i=!1;try{e=(b=b.call(a)).next,!1;for(;!(h=(c=e.call(b)).done)&&(g.push(c.value),2!==g.length);h=!0);}catch(a){i=!0,d=a}finally{try{if(!h&&null!=b.return&&(f=b.return(),Object(f)!==f))return}finally{if(i)throw d}}return g}}(g)||function(a){if(a){if("string"==typeof a)return dO(a,2);var b=({}).toString.call(a).slice(8,-1);return"Object"===b&&a.constructor&&(b=a.constructor.name),"Map"===b||"Set"===b?Array.from(a):"Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b)?dO(a,2):void 0}}(g)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),d6=d5[0],d7=d5[1];function d8(a){return document.body.appendChild(a)}function d9(a){var b,c,d=d6(function(a){return{config:a.config,reject:a.reject}}),e=(b="".concat(d.config.paths.vs,"/loader.js"),c=document.createElement("script"),b&&(c.src=b),c);return e.onload=function(){return a()},e.onerror=d.reject,e}function ea(){var a=d6(function(a){return{config:a.config,resolve:a.resolve,reject:a.reject}}),b=window.require;b.config(a.config),b(["vs/editor/editor.main"],function(b){var c=b.m||b;eb(c),a.resolve(c)},function(b){a.reject(b)})}function eb(a){d6().monaco||d7({monaco:a})}var ec=new Promise(function(a,b){return d7({resolve:a,reject:b})}),ed=function(){var a=d6(function(a){return{monaco:a.monaco,isInitialized:a.isInitialized,resolve:a.resolve}});if(!a.isInitialized){if(d7({isInitialized:!0}),a.monaco)return a.resolve(a.monaco),d4(ec);if(window.monaco&&window.monaco.editor)return eb(window.monaco),a.resolve(window.monaco),d4(ec);d2(d8,d9)(ea)}return d4(ec)},ee={display:"flex",position:"relative",textAlign:"initial"},ef={width:"100%"},eg={display:"none"},eh={display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"},ei=function({children:a}){return i.default.createElement("div",{style:eh},a)},ej=(0,i.memo)(function({width:a,height:b,isEditorReady:c,loading:d,_ref:e,className:f,wrapperProps:g}){return i.default.createElement("section",{style:{...ee,width:a,height:b},...g},!c&&i.default.createElement(ei,null,d),i.default.createElement("div",{ref:e,style:{...ef,...!c&&eg},className:f}))}),ek=function(a){(0,i.useEffect)(a,[])},el=function(a,b,c=!0){let d=(0,i.useRef)(!0);(0,i.useEffect)(d.current||!c?()=>{d.current=!1}:a,b)};function em(){}function en(a,b,c,d){var e,f,g,h,i,j;return e=a,f=d,e.editor.getModel(eo(e,f))||(g=a,h=b,i=c,j=d,g.editor.createModel(h,i,j?eo(g,j):void 0))}function eo(a,b){return a.Uri.parse(b)}(0,i.memo)(function({original:a,modified:b,language:c,originalLanguage:d,modifiedLanguage:e,originalModelPath:f,modifiedModelPath:g,keepCurrentOriginalModel:h=!1,keepCurrentModifiedModel:j=!1,theme:k="light",loading:l="Loading...",options:m={},height:n="100%",width:o="100%",className:p,wrapperProps:q={},beforeMount:r=em,onMount:s=em}){let[t,u]=(0,i.useState)(!1),[v,w]=(0,i.useState)(!0),x=(0,i.useRef)(null),y=(0,i.useRef)(null),z=(0,i.useRef)(null),A=(0,i.useRef)(s),B=(0,i.useRef)(r),C=(0,i.useRef)(!1);ek(()=>{let a=ed();return a.then(a=>(y.current=a)&&w(!1)).catch(a=>a?.type!=="cancelation"&&console.error("Monaco initialization: error:",a)),()=>{let b;return x.current?(b=x.current?.getModel(),void(h||b?.original?.dispose(),j||b?.modified?.dispose(),x.current?.dispose())):a.cancel()}}),el(()=>{if(x.current&&y.current){let b=x.current.getOriginalEditor(),e=en(y.current,a||"",d||c||"text",f||"");e!==b.getModel()&&b.setModel(e)}},[f],t),el(()=>{if(x.current&&y.current){let a=x.current.getModifiedEditor(),d=en(y.current,b||"",e||c||"text",g||"");d!==a.getModel()&&a.setModel(d)}},[g],t),el(()=>{let a=x.current.getModifiedEditor();a.getOption(y.current.editor.EditorOption.readOnly)?a.setValue(b||""):b!==a.getValue()&&(a.executeEdits("",[{range:a.getModel().getFullModelRange(),text:b||"",forceMoveMarkers:!0}]),a.pushUndoStop())},[b],t),el(()=>{x.current?.getModel()?.original.setValue(a||"")},[a],t),el(()=>{let{original:a,modified:b}=x.current.getModel();y.current.editor.setModelLanguage(a,d||c||"text"),y.current.editor.setModelLanguage(b,e||c||"text")},[c,d,e],t),el(()=>{y.current?.editor.setTheme(k)},[k],t),el(()=>{x.current?.updateOptions(m)},[m],t);let D=(0,i.useCallback)(()=>{if(!y.current)return;B.current(y.current);let h=en(y.current,a||"",d||c||"text",f||""),i=en(y.current,b||"",e||c||"text",g||"");x.current?.setModel({original:h,modified:i})},[c,b,e,a,d,f,g]),E=(0,i.useCallback)(()=>{!C.current&&z.current&&(x.current=y.current.editor.createDiffEditor(z.current,{automaticLayout:!0,...m}),D(),y.current?.editor.setTheme(k),u(!0),C.current=!0)},[m,k,D]);return(0,i.useEffect)(()=>{t&&A.current(x.current,y.current)},[t]),(0,i.useEffect)(()=>{v||t||E()},[v,t,E]),i.default.createElement(ej,{width:o,height:n,isEditorReady:t,loading:l,_ref:z,className:p,wrapperProps:q})});var ep=function(a){let b=(0,i.useRef)();return(0,i.useEffect)(()=>{b.current=a},[a]),b.current},eq=new Map,er=(0,i.memo)(function({defaultValue:a,defaultLanguage:b,defaultPath:c,value:d,language:e,path:f,theme:g="light",line:h,loading:j="Loading...",options:k={},overrideServices:l={},saveViewState:m=!0,keepCurrentModel:n=!1,width:o="100%",height:p="100%",className:q,wrapperProps:r={},beforeMount:s=em,onMount:t=em,onChange:u,onValidate:v=em}){let[w,x]=(0,i.useState)(!1),[y,z]=(0,i.useState)(!0),A=(0,i.useRef)(null),B=(0,i.useRef)(null),C=(0,i.useRef)(null),D=(0,i.useRef)(t),E=(0,i.useRef)(s),F=(0,i.useRef)(),G=(0,i.useRef)(d),H=ep(f),I=(0,i.useRef)(!1),J=(0,i.useRef)(!1);ek(()=>{let a=ed();return a.then(a=>(A.current=a)&&z(!1)).catch(a=>a?.type!=="cancelation"&&console.error("Monaco initialization: error:",a)),()=>B.current?void(F.current?.dispose(),n?m&&eq.set(f,B.current.saveViewState()):B.current.getModel()?.dispose(),B.current.dispose()):a.cancel()}),el(()=>{let g=en(A.current,a||d||"",b||e||"",f||c||"");g!==B.current?.getModel()&&(m&&eq.set(H,B.current?.saveViewState()),B.current?.setModel(g),m&&B.current?.restoreViewState(eq.get(f)))},[f],w),el(()=>{B.current?.updateOptions(k)},[k],w),el(()=>{B.current&&void 0!==d&&(B.current.getOption(A.current.editor.EditorOption.readOnly)?B.current.setValue(d):d!==B.current.getValue()&&(J.current=!0,B.current.executeEdits("",[{range:B.current.getModel().getFullModelRange(),text:d,forceMoveMarkers:!0}]),B.current.pushUndoStop(),J.current=!1))},[d],w),el(()=>{let a=B.current?.getModel();a&&e&&A.current?.editor.setModelLanguage(a,e)},[e],w),el(()=>{void 0!==h&&B.current?.revealLine(h)},[h],w),el(()=>{A.current?.editor.setTheme(g)},[g],w);let K=(0,i.useCallback)(()=>{if(!(!C.current||!A.current)&&!I.current){E.current(A.current);let i=f||c,j=en(A.current,d||a||"",b||e||"",i||"");B.current=A.current?.editor.create(C.current,{model:j,automaticLayout:!0,...k},l),m&&B.current.restoreViewState(eq.get(i)),A.current.editor.setTheme(g),void 0!==h&&B.current.revealLine(h),x(!0),I.current=!0}},[a,b,c,d,e,f,k,l,m,g,h]);return(0,i.useEffect)(()=>{w&&D.current(B.current,A.current)},[w]),(0,i.useEffect)(()=>{y||w||K()},[y,w,K]),G.current=d,(0,i.useEffect)(()=>{w&&u&&(F.current?.dispose(),F.current=B.current?.onDidChangeModelContent(a=>{J.current||u(B.current.getValue(),a)}))},[w,u]),(0,i.useEffect)(()=>{if(w){let a=A.current.editor.onDidChangeMarkers(a=>{let b=B.current.getModel()?.uri;if(b&&a.find(a=>a.path===b.path)){let a=A.current.editor.getModelMarkers({resource:b});v?.(a)}});return()=>{a?.dispose()}}return()=>{}},[w,v]),i.default.createElement(ej,{width:o,height:p,isEditorReady:w,loading:j,_ref:C,className:q,wrapperProps:r})});let es={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};es.node;let et=(0,aP.f)(es),eu={name:"text-wrap",size:24,node:[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],aliases:["wrap-text"]};eu.node;let ev=(0,aP.f)(eu);var ew=a.i(55681);let ex={name:"eye-off",size:24,node:[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};ex.node;let ey=(0,aP.f)(ex);var ez=a.i(97546),eA=a.i(71215),eB=a.i(28749),eC=a.i(40260);function eD({filePath:a,fileMeta:b,isSvg:c=!1,onToggleSvgSource:d,onClose:e}){let[f,g]=(0,i.useState)(1),[j,k]=(0,i.useState)({x:0,y:0}),[l,m]=(0,i.useState)(!1),[n,o]=(0,i.useState)({x:0,y:0}),[p,q]=(0,i.useState)(!0),[r,s]=(0,i.useState)({width:0,height:0}),[t,u]=(0,i.useState)(!1),[v,w]=(0,i.useState)(!1),[x,y]=(0,i.useState)(!1),z=(0,i.useRef)(null),A=(0,i.useRef)(null),B=(0,i.useMemo)(()=>b?.mediaUrl?b.mediaUrl:a?`/api/media?path=${encodeURIComponent(a)}`:"",[b,a]),C=(0,i.useMemo)(()=>b?.name?b.name:a?a.split("/").pop()||a:"image",[b,a]),D=(0,i.useMemo)(()=>{if(b?.ext)return b.ext.replace(".","").toUpperCase();let a=C.split(".");return a.length>1?a.pop().toUpperCase():"IMG"},[b,C]),E=(0,i.useMemo)(()=>{if(!b?.size)return null;let a=b.size;return a>=1048576?`${(a/1048576).toFixed(2)} MB`:`${Math.round(a/1024)} KB`},[b]),F=()=>{m(!1)};return(0,h.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#181818] text-slate-200 overflow-hidden select-none",children:[(0,h.jsxs)("header",{className:"h-[36px] min-h-[36px] bg-[#252526] border-b border-[#2b2b2b] px-3 flex items-center justify-between shrink-0 text-xs z-10",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-0 overflow-hidden",children:[(0,h.jsx)(bD,{filename:C,size:15}),(0,h.jsx)("span",{className:"font-semibold text-white truncate max-w-[200px]",title:C,children:C}),(0,h.jsx)("span",{className:"text-slate-500 font-mono text-[10px] hidden md:inline truncate max-w-[320px]",title:a,children:a})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,h.jsxs)("div",{className:"hidden sm:flex items-center gap-2 text-[10px] font-mono text-slate-400 border-r border-[#3e3e42] pr-2.5",children:[(0,h.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-[#1e1e1e] border border-[#3e3e42] text-teal-300 font-bold uppercase",children:D}),r.width>0&&(0,h.jsxs)("span",{children:[r.width," × ",r.height," px"]}),E&&(0,h.jsx)("span",{children:E})]}),(0,h.jsxs)("button",{onClick:()=>{a&&(navigator.clipboard.writeText(a),y(!0),setTimeout(()=>y(!1),2e3))},className:`flex items-center gap-1 px-2 py-1 rounded text-xs transition-colors cursor-pointer border ${x?"bg-emerald-500/20 border-emerald-500/40 text-emerald-300 font-semibold":"bg-[#2d2d2d] hover:bg-[#383838] border-[#3e3e42] text-slate-300 hover:text-white"}`,title:"Copy absolute file path",children:[x?(0,h.jsx)(bU.f,{className:"w-3.5 h-3.5 text-emerald-400"}):(0,h.jsx)(bT.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{className:"hidden lg:inline",children:x?"Copied!":"Copy Path"})]}),(0,h.jsx)("button",{onClick:()=>q(a=>!a),className:`p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer ${p?"text-teal-400":""}`,title:`Toggle Transparent Checkerboard (${p?"ON":"OFF"})`,children:(0,h.jsx)(eB.f,{className:"w-3.5 h-3.5"})}),(0,h.jsxs)("div",{className:"flex items-center gap-1 bg-[#1e1e1e] border border-[#3e3e42] rounded px-1 py-0.5",children:[(0,h.jsx)("button",{onClick:()=>{g(a=>Math.max(Number((a-.25).toFixed(2)),.25))},className:"p-0.5 text-slate-400 hover:text-white transition-colors cursor-pointer",title:"Zoom Out",children:(0,h.jsx)(b4.f,{className:"w-3.5 h-3.5"})}),(0,h.jsxs)("button",{onClick:()=>{g(1),k({x:0,y:0})},className:"text-[10px] font-mono font-bold text-teal-300 px-1 hover:text-white cursor-pointer",title:"Reset Zoom to 100%",children:[Math.round(100*f),"%"]}),(0,h.jsx)("button",{onClick:()=>{g(a=>Math.min(Number((a+.25).toFixed(2)),5))},className:"p-0.5 text-slate-400 hover:text-white transition-colors cursor-pointer",title:"Zoom In",children:(0,h.jsx)(b3.f,{className:"w-3.5 h-3.5"})})]}),(0,h.jsx)("button",{onClick:()=>{if(!z.current||!r.width||!r.height)return;let a=z.current.clientWidth-40,b=z.current.clientHeight-40;g(Number(Math.min(a/r.width,b/r.height,1).toFixed(2))),k({x:0,y:0})},className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer",title:"Fit to Screen",children:(0,h.jsx)(a9.f,{className:"w-3.5 h-3.5"})}),c&&d&&(0,h.jsxs)("button",{onClick:d,className:"flex items-center gap-1 px-2 py-1 rounded bg-[#2d2d2d] hover:bg-[#383838] border border-[#3e3e42] text-xs text-amber-300 hover:text-white transition-colors cursor-pointer",title:"View & Edit SVG Source Code",children:[(0,h.jsx)(eC.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{className:"hidden sm:inline",children:"SVG Code"})]}),(0,h.jsx)("a",{href:B,target:"_blank",rel:"noopener noreferrer",className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer",title:"Open raw image in browser",children:(0,h.jsx)(dL.f,{className:"w-3.5 h-3.5"})}),e&&(0,h.jsx)("button",{onClick:e,className:"p-1 rounded text-slate-400 hover:text-rose-400 hover:bg-[#383838] transition-colors cursor-pointer",title:"Close image tab",children:(0,h.jsx)(bI.X,{className:"w-3.5 h-3.5"})})]})]}),(0,h.jsxs)("div",{ref:z,onWheel:a=>{a.preventDefault(),a.deltaY<0?g(a=>Math.min(Number((a+.1).toFixed(2)),5)):g(a=>Math.max(Number((a-.1).toFixed(2)),.25))},onMouseDown:a=>{0===a.button&&(m(!0),o({x:a.clientX-j.x,y:a.clientY-j.y}))},onMouseMove:a=>{l&&k({x:a.clientX-n.x,y:a.clientY-n.y})},onMouseUp:F,onMouseLeave:F,className:`flex-1 relative overflow-hidden flex items-center justify-center ${l?"cursor-grabbing":"cursor-grab"} ${p?"bg-[#141414] [background-image:linear-gradient(45deg,#1f1f1f_25%,transparent_25%),linear-gradient(-45deg,#1f1f1f_25%,transparent_25%),linear-gradient(45deg,transparent_75%,#1f1f1f_75%),linear-gradient(-45deg,transparent_75%,#1f1f1f_75%)] [background-size:20px_20px] [background-position:0_0,0_10px,10px_-10px,-10px_0px]":"bg-[#121212]"}`,children:[!t&&!v&&(0,h.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 text-slate-400",children:[(0,h.jsx)(aN.f,{className:"w-6 h-6 animate-spin text-teal-400"}),(0,h.jsx)("span",{className:"text-xs font-mono",children:"Loading image..."})]}),v?(0,h.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 p-6 text-center",children:[(0,h.jsx)("div",{className:"w-10 h-10 rounded-full bg-rose-500/10 border border-rose-500/30 flex items-center justify-center text-rose-400",children:(0,h.jsx)(ez.f,{className:"w-5 h-5"})}),(0,h.jsx)("h4",{className:"text-sm font-semibold text-rose-300",children:"Cannot display image"}),(0,h.jsxs)("p",{className:"text-xs text-slate-400 max-w-md font-mono",children:["Unable to load image from ",B]})]}):(0,h.jsx)("div",{style:{transform:`translate(${j.x}px, ${j.y}px) scale(${f})`,transformOrigin:"center center",transition:l?"none":"transform 0.15s ease-out"},className:"inline-block transition-transform select-none",children:(0,h.jsx)("img",{ref:A,src:B,alt:C,onLoad:a=>{let{naturalWidth:b,naturalHeight:c}=a.target;s({width:b,height:c}),u(!0),w(!1)},onError:()=>{u(!1),w(!0)},draggable:!1,className:`max-w-none shadow-2xl rounded-sm ${t?"opacity-100":"opacity-0"}`})}),(0,h.jsxs)("div",{className:"absolute bottom-3 left-3 bg-[#1e1e1e]/90 backdrop-blur-xs border border-[#3e3e42] rounded px-2.5 py-1 text-[10px] text-slate-400 flex items-center gap-2 pointer-events-none",children:[(0,h.jsx)(eA.f,{className:"w-3 h-3 text-teal-400"}),(0,h.jsx)("span",{children:"Drag to pan · Scroll to zoom"})]})]})]})}var eE=a.i(23169);function eF({content:a="",filePath:b="",className:c=""}){return(0,h.jsx)("div",{className:`h-full w-full overflow-y-auto bg-[#1e1e1e] p-6 lg:p-8 select-text ${c}`,children:(0,h.jsx)("div",{className:"max-w-4xl mx-auto bg-[#1e1e1e] pb-16",children:(0,h.jsx)(eE.f,{content:a})})})}function eG({filePath:a,initialContent:b=null,readOnly:c=!1,onClose:d,onSave:e}){let[f,g]=(0,i.useState)(b||""),[j,k]=(0,i.useState)(b||""),[l,m]=(0,i.useState)(null),[n,o]=(0,i.useState)(!b),[p,q]=(0,i.useState)(null),[r,s]=(0,i.useState)(!1),[t,u]=(0,i.useState)(!1),[v,w]=(0,i.useState)(!1),[x,y]=(0,i.useState)("on"),[z,A]=(0,i.useState)(!0),[B,C]=(0,i.useState)("vs-dark"),[D,E]=(0,i.useState)('ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace'),[F,G]=(0,i.useState)(13),[H,I]=(0,i.useState)("preview"),[J,K]=(0,i.useState)("image"),L=(0,i.useMemo)(()=>a?a.split("/").pop()||a:"untitled",[a]);(0,i.useEffect)(()=>{let a=()=>{let a=(0,dr._)();"light-plus"===a.theme?C("vs"):C("vs-dark"),E((0,dr.l)("mono")),a.fontSize&&G(parseInt(a.fontSize,10)||13)};return a(),window.addEventListener(dr.D,a),()=>window.removeEventListener(dr.D,a)},[]);let M=(0,i.useCallback)(async()=>{if(a){o(!0),q(null);try{let b=await fetch(`/api/workspace/file-content?path=${encodeURIComponent(a)}`),c=await b.json();if(!b.ok)throw Error(c.error||"Failed to load file content");g(c.content||""),k(c.content||""),m(c)}catch(a){q(a.message)}finally{o(!1)}}},[a]);(0,i.useEffect)(()=>{M()},[M]);let N=(0,i.useMemo)(()=>f!==j,[f,j]),O=async()=>{if(a&&!c&&!t){u(!0);try{let b=await fetch("/api/workspace/file-content",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a,content:f})}),c=await b.json();if(!b.ok)throw Error(c.error||"Save failed");k(f),w(!0),setTimeout(()=>w(!1),2e3),e?.(a,f)}catch(a){alert(`Save error: ${a.message}`)}finally{u(!1)}}};(0,i.useEffect)(()=>{let a=a=>{(a.metaKey||a.ctrlKey)&&"s"===a.key&&(a.preventDefault(),O())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[f,a,c]);let P=(0,i.useMemo)(()=>f?f.split("\n").length:0,[f]),Q=l?.language||"plaintext",R=!!(l?.isImage&&!l?.isSvg),S=!!l?.isSvg,T="markdown"===Q||L.endsWith(".md")||L.endsWith(".markdown")||L.endsWith(".mdx");return!R||n||p?!S||"image"!==J||n||p?(0,h.jsxs)("div",{className:"flex flex-col h-full w-full bg-[#1e1e1e] text-slate-200 overflow-hidden select-text",children:[(0,h.jsxs)("header",{className:"h-[36px] min-h-[36px] bg-[#252526] border-b border-[#2b2b2b] px-3 flex items-center justify-between shrink-0 select-none text-xs",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-0 overflow-hidden",children:[(0,h.jsx)(bD,{filename:L,size:15}),(0,h.jsx)("span",{className:"font-semibold text-white truncate max-w-[200px]",title:L,children:L}),N&&(0,h.jsx)("span",{className:"w-2 h-2 rounded-full bg-cyan-400 shrink-0",title:"Modified"}),(0,h.jsx)("span",{className:"text-slate-500 font-mono text-[10px] hidden md:inline truncate max-w-[320px]",title:a,children:a})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[T&&(0,h.jsxs)("div",{className:"flex items-center bg-[#1e1e1e] border border-[#3e3e42] rounded p-0.5 text-[10px]",children:[(0,h.jsx)("button",{onClick:()=>I("edit"),className:`px-2 py-0.5 rounded transition-colors cursor-pointer ${"edit"===H?"bg-[#007acc] text-white font-semibold shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Monaco Source Editor",children:"Code"}),(0,h.jsx)("button",{onClick:()=>I("preview"),className:`px-2 py-0.5 rounded transition-colors cursor-pointer ${"preview"===H?"bg-[#007acc] text-white font-semibold shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Formatted Markdown Preview",children:"Preview"}),(0,h.jsx)("button",{onClick:()=>I("split"),className:`px-2 py-0.5 rounded transition-colors cursor-pointer ${"split"===H?"bg-[#007acc] text-white font-semibold shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Side-by-side Edit & Live Preview",children:"Split"})]}),S&&"code"===J&&(0,h.jsxs)("button",{onClick:()=>K("image"),className:"flex items-center gap-1 px-2 py-0.5 rounded bg-[#1e1e1e] hover:bg-[#333333] border border-[#3e3e42] text-[10px] text-teal-300 hover:text-white transition-colors cursor-pointer",title:"Switch to Rendered SVG Image View",children:[(0,h.jsx)(eA.f,{className:"w-3 h-3"}),(0,h.jsx)("span",{children:"Image View"})]}),(0,h.jsxs)("div",{className:"hidden sm:flex items-center gap-2 text-[10px] font-mono text-slate-400 border-r border-[#3e3e42] pr-2.5",children:[(0,h.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-[#1e1e1e] border border-[#3e3e42] text-cyan-300 font-bold uppercase",children:Q}),(0,h.jsxs)("span",{children:[P," lines"]}),(0,h.jsx)("span",{children:"UTF-8"})]}),(0,h.jsxs)("button",{onClick:()=>{f&&(navigator.clipboard.writeText(f),s(!0),setTimeout(()=>s(!1),2e3))},className:`flex items-center gap-1 px-2 py-1 rounded text-xs transition-colors cursor-pointer border ${r?"bg-emerald-500/20 border-emerald-500/40 text-emerald-300 font-semibold":"bg-[#2d2d2d] hover:bg-[#383838] border-[#3e3e42] text-slate-300 hover:text-white"}`,title:"Copy file content to clipboard",children:[r?(0,h.jsx)(bU.f,{className:"w-3.5 h-3.5 text-emerald-400"}):(0,h.jsx)(bT.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{className:"hidden lg:inline",children:r?"Copied!":"Copy"})]}),!c&&(0,h.jsxs)("button",{onClick:O,disabled:!N||t,className:`flex items-center gap-1 px-2.5 py-1 rounded text-xs transition-colors cursor-pointer border font-semibold ${v?"bg-emerald-600 text-white border-emerald-500":N?"bg-[#007acc] hover:bg-[#0062a3] text-white border-[#007acc] shadow-sm animate-pulse":"bg-[#2d2d2d] border-[#3e3e42] text-slate-500 cursor-not-allowed opacity-50"}`,title:"Save changes (Cmd+S / Ctrl+S)",children:[(0,h.jsx)(et,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{className:"hidden sm:inline",children:t?"Saving...":v?"Saved!":"Save"})]}),(!T||"preview"!==H)&&(0,h.jsx)("button",{onClick:()=>y(a=>"on"===a?"off":"on"),className:`p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer ${"on"===x?"text-cyan-400":""}`,title:`Toggle Word Wrap (${"on"===x?"ON":"OFF"})`,children:(0,h.jsx)(ev,{className:"w-3.5 h-3.5"})}),(!T||"preview"!==H)&&(0,h.jsx)("button",{onClick:()=>A(a=>!a),className:`p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer ${z?"text-cyan-400":""}`,title:`Toggle Minimap (${z?"Show":"Hide"})`,children:z?(0,h.jsx)(ew.f,{className:"w-3.5 h-3.5"}):(0,h.jsx)(ey,{className:"w-3.5 h-3.5"})}),(0,h.jsx)("button",{onClick:M,className:"p-1 rounded text-slate-400 hover:text-white hover:bg-[#383838] transition-colors cursor-pointer",title:"Reload from disk",children:(0,h.jsx)(aN.f,{className:`w-3.5 h-3.5 ${n?"animate-spin text-emerald-400":""}`})}),d&&(0,h.jsx)("button",{onClick:d,className:"p-1 rounded text-slate-400 hover:text-rose-400 hover:bg-[#383838] transition-colors cursor-pointer",title:"Close editor tab",children:(0,h.jsx)(bI.X,{className:"w-3.5 h-3.5"})})]})]}),(0,h.jsx)("div",{className:"flex-1 relative overflow-hidden bg-[#1e1e1e]",children:n?(0,h.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 text-slate-400",children:[(0,h.jsx)(aN.f,{className:"w-6 h-6 animate-spin text-[#007acc]"}),(0,h.jsxs)("span",{className:"text-xs font-mono",children:["Loading ",L,"..."]})]}):p?(0,h.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 p-6 text-center",children:[(0,h.jsx)("div",{className:"w-10 h-10 rounded-full bg-rose-500/10 border border-rose-500/30 flex items-center justify-center text-rose-400",children:(0,h.jsx)(ez.f,{className:"w-5 h-5"})}),(0,h.jsx)("h4",{className:"text-sm font-semibold text-rose-300",children:"Cannot load file"}),(0,h.jsx)("p",{className:"text-xs text-slate-400 max-w-md font-mono",children:p}),(0,h.jsx)("button",{onClick:M,className:"px-3 py-1.5 rounded bg-[#252526] hover:bg-[#333333] border border-[#3e3e42] text-xs text-slate-200 cursor-pointer",children:"Retry"})]}):T&&"preview"===H?(0,h.jsx)(eF,{content:f,filePath:a}):T&&"split"===H?(0,h.jsxs)("div",{className:"flex h-full w-full divide-x divide-[#2b2b2b]",children:[(0,h.jsx)("div",{className:"w-1/2 h-full overflow-hidden",children:(0,h.jsx)(er,{height:"100%",path:a,language:Q,value:f,onChange:a=>g(a||""),theme:B,options:{readOnly:c,fontSize:F,fontFamily:D,minimap:{enabled:z},scrollBeyondLastLine:!1,wordWrap:x,automaticLayout:!0,tabSize:2,bracketPairColorization:{enabled:!0},lineNumbers:"on",renderLineHighlight:"all",smoothScrolling:!0,cursorBlinking:"smooth"}})}),(0,h.jsx)("div",{className:"w-1/2 h-full overflow-hidden bg-[#1e1e1e]",children:(0,h.jsx)(eF,{content:f,filePath:a})})]}):(0,h.jsx)(er,{height:"100%",path:a,language:Q,value:f,onChange:a=>g(a||""),theme:B,options:{readOnly:c,fontSize:F,fontFamily:D,minimap:{enabled:z},scrollBeyondLastLine:!1,wordWrap:x,automaticLayout:!0,tabSize:2,bracketPairColorization:{enabled:!0},lineNumbers:"on",renderLineHighlight:"all",smoothScrolling:!0,cursorBlinking:"smooth"}})})]}):(0,h.jsx)(eD,{filePath:a,fileMeta:l,isSvg:!0,onToggleSvgSource:()=>K("code"),onClose:d}):(0,h.jsx)(eD,{filePath:a,fileMeta:l,onClose:d})}var eH=a.i(9705);a.i(49448);var eI=a.i(62008),eJ=a.i(38766);let eK={name:"shield-check",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]};eK.node;let eL=(0,aP.f)(eK);function eM({isOpen:a,onClose:b}){let[c,d]=(0,i.useState)((0,bW.F)());return(0,i.useEffect)(()=>{let a=a=>{d(a.detail||(0,bW.F)())};return window.addEventListener(bW.o,a),()=>window.removeEventListener(bW.o,a)},[]),(0,h.jsx)(eI.f,{isOpen:a,onClose:b,title:`Supporter Store & Vault (${bG.E} Tech Items & 3D Effects)`,description:"Support the developer to maintain the project and unlock custom AGMon virtual office decorations",size:"full",footer:(0,h.jsxs)("div",{className:"flex items-center justify-between w-full text-xs text-slate-400",children:[(0,h.jsx)("div",{className:"flex items-center gap-2",children:c.isSupporter?(0,h.jsxs)("span",{className:"flex items-center gap-1.5 text-amber-400 font-semibold",children:[(0,h.jsx)(eL,{className:"w-4 h-4 text-amber-400"}),(0,h.jsxs)("span",{children:["Status: VIP Supporter Activated (All ",bG.E," items unlocked)"]})]}):(0,h.jsx)("span",{children:"100% of AGMon core engineering features remain completely free"})}),(0,h.jsx)(eJ.f,{variant:"ghost",size:"sm",onClick:b,children:"Close"})]}),children:(0,h.jsx)("div",{className:"h-[80vh] -mx-4 -mt-2 -mb-4 overflow-hidden rounded-md border border-[#333333]",children:(0,h.jsx)(eH.f,{hideHeader:!0,onClose:b})})})}function eN({isOpen:a=!1,onClose:b,initialTab:c="themes"}){let[d,e]=(0,i.useState)(c||"themes"),[f,g]=(0,i.useState)(dr.s);if((0,i.useEffect)(()=>{a&&(g((0,dr._)()),e(c||"themes"))},[a,c]),(0,i.useEffect)(()=>{let a=a=>{a.detail&&g(a.detail)};return window.addEventListener(dr.D,a),()=>window.removeEventListener(dr.D,a)},[]),!a)return null;let j=(a,b)=>{let c={...f,[a]:b};g(c),(0,dr.Y)(c)};return(0,h.jsx)("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm animate-in fade-in",children:(0,h.jsxs)("div",{className:"w-full max-w-2xl bg-[var(--bg-editor)] border border-[var(--border-card)] rounded-xl shadow-2xl overflow-hidden flex flex-col text-[var(--text-main)] font-sans max-h-[85vh]",children:[(0,h.jsxs)("div",{className:"h-[46px] min-h-[46px] bg-[var(--bg-card)] border-b border-[var(--border-subtle)] px-4 flex items-center justify-between shrink-0 select-none",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)(a$.f,{className:"w-4 h-4 text-[var(--accent-primary)]"}),(0,h.jsx)("h2",{className:"text-xs font-bold uppercase tracking-wider text-[var(--text-bright)]",children:"Preferences: Theme & Typography (VS Code Settings)"})]}),(0,h.jsx)("button",{onClick:b,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-bright)] hover:bg-[var(--bg-hover)] transition-colors cursor-pointer",title:"Close (Escape)",children:(0,h.jsx)(bI.X,{className:"w-4 h-4"})})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-[var(--border-subtle)] bg-[var(--bg-card-inner)] shrink-0 select-none",children:[(0,h.jsxs)("button",{type:"button",onClick:()=>e("themes"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-semibold transition-colors cursor-pointer ${"themes"===d?"bg-[var(--bg-card)] text-[var(--text-bright)] border border-[var(--border-card)] shadow-xs":"text-[var(--text-muted)] hover:text-[var(--text-bright)]"}`,children:[(0,h.jsx)(a$.f,{className:"w-3.5 h-3.5 text-[var(--accent-primary)]"}),(0,h.jsxs)("span",{children:["Color Themes (",dr.z.length,")"]})]}),(0,h.jsxs)("button",{type:"button",onClick:()=>e("fonts"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-semibold transition-colors cursor-pointer ${"fonts"===d?"bg-[var(--bg-card)] text-[var(--text-bright)] border border-[var(--border-card)] shadow-xs":"text-[var(--text-muted)] hover:text-[var(--text-bright)]"}`,children:[(0,h.jsx)(b1,{className:"w-3.5 h-3.5 text-[var(--accent-secondary)]"}),(0,h.jsx)("span",{children:"Typography & Fonts"})]})]}),(0,h.jsx)("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:"themes"===d?(0,h.jsxs)("div",{className:"space-y-3",children:[(0,h.jsx)("div",{className:"text-xs text-[var(--text-muted)]",children:"Choose color theme for workbench, dialogs, sidebar, and toolbars:"}),(0,h.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:dr.z.map(a=>{let b=f.theme===a.id;return(0,h.jsxs)("div",{onClick:()=>{var b;let c;return b=a.id,void(g(c={...f,theme:b}),(0,dr.Y)(c))},className:`group relative p-3 rounded-lg border transition-all cursor-pointer flex flex-col justify-between space-y-2.5 ${b?"bg-[var(--bg-card)] border-[var(--accent-primary)] shadow-md shadow-[var(--accent-primary)]/10 ring-1 ring-[var(--accent-primary)]/40":"bg-[var(--bg-card-inner)] border-[var(--border-card)] hover:border-[var(--accent-primary)]/50 hover:bg-[var(--bg-card)]"}`,children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)("span",{className:"font-bold text-xs text-[var(--text-bright)]",children:a.name}),(0,h.jsx)("span",{className:"text-[9px] px-1.5 py-0.2 rounded border border-[var(--border-card)] text-[var(--text-muted)] uppercase font-mono bg-[var(--bg-card)]",children:a.category})]}),b&&(0,h.jsx)("div",{className:"w-4 h-4 rounded-full bg-[var(--accent-primary)] text-[var(--text-on-accent,#ffffff)] flex items-center justify-center shrink-0",children:(0,h.jsx)(bU.f,{className:"w-2.5 h-2.5"})})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1 h-3 rounded overflow-hidden p-0.5 bg-black/10 dark:bg-black/40 border border-[var(--border-card)]",children:[(0,h.jsx)("span",{className:"h-full flex-1 rounded-xs",style:{backgroundColor:a.colors.workbench},title:`Workbench: ${a.colors.workbench}`}),(0,h.jsx)("span",{className:"h-full flex-1 rounded-xs",style:{backgroundColor:a.colors.editor},title:`Editor: ${a.colors.editor}`}),(0,h.jsx)("span",{className:"h-full flex-1 rounded-xs",style:{backgroundColor:a.colors.sidebar},title:`Sidebar: ${a.colors.sidebar}`}),(0,h.jsx)("span",{className:"h-full w-4 rounded-xs",style:{backgroundColor:a.colors.accent},title:`Accent: ${a.colors.accent}`})]}),(0,h.jsx)("p",{className:"text-[11px] text-[var(--text-muted)] leading-relaxed",children:a.description})]},a.id)})})]}):(0,h.jsxs)("div",{className:"space-y-4 text-xs",children:[(0,h.jsxs)("div",{className:"p-3 rounded-lg bg-[var(--bg-card-inner)] border border-[var(--border-card)] space-y-2",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsx)("span",{className:"font-bold text-[var(--text-bright)] uppercase tracking-wider text-[11px]",children:"1. UI Font Family"}),(0,h.jsx)("span",{className:"text-[10px] text-[var(--text-muted)] font-mono",children:"--font-family-ui"})]}),(0,h.jsx)("select",{value:f.uiFont,onChange:a=>j("uiFont",a.target.value),className:"w-full bg-[var(--bg-card)] text-[var(--text-main)] border border-[var(--border-card)] rounded px-3 py-1.5 text-xs outline-none focus:border-[var(--accent-primary)] cursor-pointer",children:dr.M.map(a=>(0,h.jsx)("option",{value:a.id,className:"bg-[var(--bg-card)] text-[var(--text-main)]",children:a.name},a.id))}),(0,h.jsx)("div",{className:"p-2 rounded bg-[var(--bg-card)] border border-[var(--border-card)] text-[var(--text-main)] text-xs",style:{fontFamily:"var(--font-family-ui)"},children:"UI Preview: Agent Factory - Realtime multi-agent activity and telemetry monitor."})]}),(0,h.jsxs)("div",{className:"p-3 rounded-lg bg-[var(--bg-card-inner)] border border-[var(--border-card)] space-y-2",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsx)("span",{className:"font-bold text-[var(--text-bright)] uppercase tracking-wider text-[11px]",children:"2. Monospace Font (Code & Console)"}),(0,h.jsx)("span",{className:"text-[10px] text-[var(--text-muted)] font-mono",children:"--font-family-mono"})]}),(0,h.jsx)("select",{value:f.codeFont,onChange:a=>j("codeFont",a.target.value),className:"w-full bg-[var(--bg-card)] text-[var(--text-main)] border border-[var(--border-card)] rounded px-3 py-1.5 text-xs outline-none focus:border-[var(--accent-primary)] cursor-pointer",children:dr.Q.map(a=>(0,h.jsx)("option",{value:a.id,className:"bg-[var(--bg-card)] text-[var(--text-main)]",children:a.name},a.id))}),(0,h.jsx)("div",{className:"p-2 rounded bg-[var(--bg-chat-code)] border border-[var(--border-card)] text-[var(--text-chat-code)] font-mono text-[11px] leading-relaxed",style:{fontFamily:"var(--font-family-mono)"},children:'const agent = { id: "gemini-3.8-flash", tokens: 142857, state: "streaming" };'})]}),(0,h.jsxs)("div",{className:"p-3 rounded-lg bg-[var(--bg-card-inner)] border border-[var(--border-card)] space-y-2",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between",children:[(0,h.jsx)("span",{className:"font-bold text-[var(--text-bright)] uppercase tracking-wider text-[11px]",children:"3. Base Font Size"}),(0,h.jsx)("span",{className:"text-[10px] text-[var(--text-muted)] font-mono",children:"--font-size-ui"})]}),(0,h.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:dr.J.map(a=>(0,h.jsx)("button",{type:"button",onClick:()=>j("fontSize",a.id),className:`p-2 rounded border text-xs font-semibold transition-colors cursor-pointer text-center ${f.fontSize===a.id?"bg-[var(--accent-primary)]/15 border-[var(--accent-primary)] text-[var(--accent-primary)] font-bold shadow-xs":"bg-[var(--bg-card)] border-[var(--border-card)] text-[var(--text-muted)] hover:text-[var(--text-bright)] hover:bg-[var(--bg-hover)]"}`,children:a.label},a.id))})]})]})}),(0,h.jsxs)("div",{className:"h-[46px] min-h-[46px] bg-[var(--bg-card)] border-t border-[var(--border-subtle)] px-4 flex items-center justify-between shrink-0 select-none",children:[(0,h.jsxs)("button",{onClick:()=>{g(dr.s),(0,dr.Y)(dr.s)},className:"flex items-center gap-1.5 px-2.5 py-1 rounded bg-[var(--bg-card-inner)] hover:bg-[var(--bg-hover)] text-[var(--text-muted)] hover:text-[var(--text-bright)] border border-[var(--border-card)] text-xs transition-colors cursor-pointer",title:"Restore default settings",children:[(0,h.jsx)(l.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{children:"Reset to Defaults"})]}),(0,h.jsx)("button",{onClick:b,className:"px-4 py-1.5 rounded bg-[var(--accent-primary)] hover:opacity-90 text-[var(--text-on-accent,#ffffff)] text-xs font-semibold transition-colors cursor-pointer",children:"Done"})]})]})})}var eO=a.i(85573);let eP={"gemini-3.8-flash":{input:.075,output:.3,cached:.01875},"gemini-2.5-flash":{input:.075,output:.3,cached:.01875},"gemini-1.5-flash":{input:.075,output:.3,cached:.01875},"gemini-3.8-pro":{input:1.25,output:5,cached:.3125},"gemini-3.1-pro":{input:1.25,output:5,cached:.3125},"gemini-2.5-pro":{input:1.25,output:5,cached:.3125},"gemini-1.5-pro":{input:1.25,output:5,cached:.3125},"claude-opus-5-5":{input:4,output:20,cached:.2},"claude-sonnet-5-5":{input:2,output:10,cached:.1},"claude-haiku-5-5":{input:.1,output:.5,cached:.01},"claude-fable-5":{input:10,output:50,cached:1},"claude-mythos-5":{input:10,output:50,cached:1},"claude-opus-4-8":{input:5,output:25,cached:.5},"claude-opus-4-7":{input:5,output:25,cached:.5},"claude-opus-4-6":{input:5,output:25,cached:.5},"claude-opus-4-5":{input:5,output:25,cached:.5},"claude-sonnet-4-6":{input:3,output:15,cached:.3},"claude-sonnet-4-5":{input:3,output:15,cached:.3},"claude-haiku-4-5":{input:1,output:5,cached:.1},"claude-3-7-sonnet":{input:3,output:15,cached:.3},"claude-3-5-sonnet":{input:3,output:15,cached:.3},"claude-3-5-haiku":{input:.8,output:4,cached:.08},"claude-3-opus":{input:15,output:75,cached:1.5},"claude-3-haiku":{input:.25,output:1.25,cached:.025},"gpt-4o-mini":{input:.15,output:.6,cached:.075},"gpt-4o":{input:2.5,output:10,cached:1.25},minimax:{input:.3,output:1.2,cached:.3}},eQ=Object.keys(eP).sort((a,b)=>b.length-a.length);function eR(a,b){if(!a)return null;let c=function(a){let b=(a||"").toLowerCase();if(!b)return null;for(let a of eQ)if(b.includes(a))return eP[a];return null}(b);return c?(a.input||0)*(c.input/1e6)+(a.output||0)*(c.output/1e6)+(a.cached||0)*(c.cached/1e6):null}let eS={name:"skip-back",size:24,node:[["path",{d:"M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z",key:"15892j"}],["path",{d:"M3 20V4",key:"1ptbpl"}]]};eS.node;let eT=(0,aP.f)(eS),eU={name:"skip-forward",size:24,node:[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]]};eU.node;let eV=(0,aP.f)(eU);var eW=a.i(92378),eX=a.i(7746),eY=a.i(42103);function eZ(a){if(isNaN(a)||a<0)return"00:00";let b=Math.floor(a/60),c=Math.floor(a%60);return`${String(b).padStart(2,"0")}:${String(c).padStart(2,"0")}`}function e$({replay:a,onClose:b,className:c=""}){let{sessionInfo:d,keyframes:e=[],totalSteps:f=0,currentStepIndex:g=0,currentKeyframe:j,currentTime:k=0,totalElapsedSeconds:m=0,isPlaying:n=!1,playbackSpeed:o=2,play:p,pause:q,togglePlay:r,seekToStep:s,stepForward:t,stepBackward:u,setPlaybackSpeed:v,reset:w}=a,[x,y]=(0,i.useState)(null),z=(0,i.useMemo)(()=>f<=1?[]:e.map((a,b)=>{let c=b/(f-1)*100,d="bg-slate-500";return"prompt"===a.milestoneType?d="bg-amber-400":"file_write"===a.type?d="bg-purple-400":"tool"===a.milestoneType?d="bg-cyan-400":"error"===a.milestoneType?d="bg-rose-500":"finish"===a.milestoneType&&(d="bg-emerald-400"),{idx:b,pct:c,color:d,type:a.type,title:a.title,summary:a.summary}}),[e,f]);return e&&0!==e.length?(0,h.jsxs)("div",{className:`bg-[#181818]/95 backdrop-blur-md border-t border-[#3e3e42] p-2 select-none shadow-2xl flex flex-col gap-2 text-slate-200 ${c}`,style:{colorScheme:"dark"},children:[(0,h.jsxs)("div",{className:"relative flex flex-col gap-1 px-2 pt-1",children:[(0,h.jsxs)("div",{className:"relative w-full h-5 flex items-center",children:[(0,h.jsx)("div",{className:"absolute inset-x-0 h-1 bg-[#252526] rounded-full pointer-events-none overflow-hidden",children:(0,h.jsx)("div",{className:"h-full bg-[#007acc] transition-all duration-75",style:{width:`${f>1?g/(f-1)*100:0}%`}})}),(0,h.jsx)("div",{className:"absolute inset-x-0 h-full pointer-events-none flex items-center",children:z.map(a=>(0,h.jsx)("div",{className:`absolute w-2 h-2 rounded-full -translate-x-1/2 ${a.color} transition-transform ${x===a.idx||g===a.idx?"scale-150 ring-2 ring-white z-20":"opacity-80"}`,style:{left:`${a.pct}%`}},a.idx))}),(0,h.jsx)("input",{type:"range",min:0,max:Math.max(0,f-1),value:g,onChange:a=>s(parseInt(a.target.value,10)),className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer z-30",title:"Drag to scrub timeline"})]}),(0,h.jsxs)("div",{className:"flex items-center justify-between text-[11px] font-mono text-slate-400",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 truncate",children:[(0,h.jsxs)("span",{className:"text-[#007acc] font-bold",children:["Step ",g+1,"/",f]}),(0,h.jsx)("span",{className:"text-slate-600",children:"•"}),(0,h.jsx)("span",{className:"text-white truncate font-sans",children:j?.title||"Event"}),j?.activeTool&&(0,h.jsx)(eY.f,{variant:"type",badgeSize:"xs",className:"shrink-0 font-mono",children:j.activeTool})]}),(0,h.jsx)("div",{className:"flex items-center gap-2 shrink-0",children:(0,h.jsxs)("span",{children:[eZ(k)," / ",eZ(m)]})})]})]}),(0,h.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 px-2 border-t border-[#252526] pt-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(eJ.f,{variant:"secondary",size:"icon-sm",onClick:w,title:"Rewind to start (Home)",children:(0,h.jsx)(l.f,{className:"w-3.5 h-3.5"})}),(0,h.jsx)(eJ.f,{variant:"secondary",size:"icon-sm",onClick:u,disabled:g<=0,title:"Step backward (←)",children:(0,h.jsx)(eT,{className:"w-3.5 h-3.5"})}),(0,h.jsx)(eJ.f,{variant:"primary",size:"sm",onClick:r,className:"px-3",title:n?"Pause (Space)":"Play (Space)",leftIcon:n?(0,h.jsx)(bP.f,{className:"w-3.5 h-3.5"}):(0,h.jsx)(bO.f,{className:"w-3.5 h-3.5 fill-current"}),children:n?"Pause":"Play"}),(0,h.jsx)(eJ.f,{variant:"secondary",size:"icon-sm",onClick:t,disabled:g>=f-1,title:"Step forward (→)",children:(0,h.jsx)(eV,{className:"w-3.5 h-3.5"})}),(0,h.jsxs)("div",{className:"flex items-center gap-1 pl-2 border-l border-[#333]",children:[(0,h.jsx)("span",{className:"text-[10px] text-slate-400 font-medium",children:"Speed:"}),(0,h.jsx)("div",{className:"flex items-center bg-[#252526] border border-[#3e3e42] rounded p-0.5 text-[10px]",children:[{label:"1x",value:1},{label:"2x",value:2},{label:"5x",value:5},{label:"10x",value:10}].map(a=>(0,h.jsx)("button",{type:"button",onClick:()=>v(a.value),className:`px-1.5 py-0.5 rounded transition-colors cursor-pointer ${o===a.value?"bg-[#007acc] text-white font-bold":"text-slate-400 hover:text-white"}`,children:a.label},a.value))})]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-3 text-xs font-mono",children:[(0,h.jsxs)("div",{className:"hidden sm:flex items-center gap-1.5 text-slate-400",children:[(0,h.jsx)("span",{className:"text-[10px] uppercase text-slate-500",children:"Session:"}),(0,h.jsxs)("span",{className:"text-white truncate max-w-[140px]",title:d?.id,children:[d?.id?.slice(0,14),"..."]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1.5 text-emerald-400",children:[(0,h.jsx)(eW.f,{className:"w-3 h-3 text-cyan-400"}),(0,h.jsxs)("span",{children:[(j?.cumulativeTokens||0).toLocaleString()," tks"]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1.5 text-amber-300",children:[(0,h.jsx)(eX.f,{className:"w-3 h-3 text-amber-400"}),(0,h.jsxs)("span",{children:["$",(j?.cumulativeCost||0).toFixed(4)]})]}),b&&(0,h.jsx)(eJ.f,{variant:"ghost",size:"xs",onClick:b,className:"text-slate-400 hover:text-white ml-1",title:"Exit Replay mode",leftIcon:(0,h.jsx)(bI.X,{className:"w-3 h-3"}),children:"Exit Replay"})]})]})]}):null}var e_=a.i(59944),e0=a.i(44451),e1=a.i(24613),e2=a.i(13412);let e3={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};e3.node;let e4=(0,aP.f)(e3);function e5({isOpen:a,onClose:b,replay:c,onOpenConversation:d}){let{currentKeyframe:e,currentStepIndex:f=0,totalSteps:g=0,currentTime:k=0,totalElapsedSeconds:l=0,stepBackward:m,stepForward:n,sessionInfo:o={}}=c||{},[p,q]=(0,i.useState)(!1);if(!a||!e)return null;let r=a=>{a&&(navigator.clipboard.writeText(a),q(!0),setTimeout(()=>q(!1),2e3))},s={user_input:{label:"User Prompt",variant:"warning",icon:e0.f,color:"text-amber-400",bg:"bg-amber-950/40 border-amber-500/30"},thought:{label:"AI Chain of Thought",variant:"info",icon:e_.f,color:"text-cyan-400",bg:"bg-cyan-950/40 border-cyan-500/30"},tool_call:{label:"Tool Call",variant:"primary",icon:e1.f,color:"text-[#007acc]",bg:"bg-blue-950/40 border-blue-500/30"},file_write:{label:"File Write / Edit",variant:"tool",icon:eC.f,color:"text-purple-400",bg:"bg-purple-950/40 border-purple-500/30"},assistant_reply:{label:"Assistant Reply",variant:"success",icon:bh.f,color:"text-emerald-400",bg:"bg-emerald-950/40 border-emerald-500/30"},finish:{label:"Session Finished",variant:"success",icon:e2.f,color:"text-emerald-400",bg:"bg-emerald-950/40 border-emerald-500/30"}}[e.type]||{label:e.type||"Event",variant:"default",icon:e4,color:"text-slate-400",bg:"bg-slate-900 border-slate-800"},t=s.icon,u="error"===e.milestoneType,v=e.details||{},w=v.args&&Object.keys(v.args).length>0,x=!!v.output;return(0,h.jsx)(eI.f,{isOpen:a,onClose:b,title:(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)(t,{className:`w-4 h-4 ${u?"text-rose-400":s.color}`}),(0,h.jsxs)("span",{className:"text-white font-semibold",children:["Event Details • Step ",f+1,"/",g]}),(0,h.jsx)(eY.f,{variant:u?"danger":s.variant,badgeSize:"xs",className:"uppercase tracking-wider font-mono text-[10px]",children:u?"Error":s.label})]}),description:(0,h.jsxs)("div",{className:"flex items-center gap-3 text-xs text-slate-400 mt-1",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1 font-mono",children:[(0,h.jsx)(a2.f,{className:"w-3 h-3 text-slate-500"}),e.elapsedSeconds,"s (",new Date(e.timestamp).toLocaleTimeString(),")"]}),(0,h.jsx)("span",{children:"•"}),(0,h.jsxs)("span",{className:"flex items-center gap-1 text-cyan-400 font-mono",children:[(0,h.jsx)(eW.f,{className:"w-3 h-3"}),(e.cumulativeTokens||0).toLocaleString()," tokens"]}),(0,h.jsx)("span",{children:"•"}),(0,h.jsxs)("span",{className:"flex items-center gap-1 text-amber-300 font-mono",children:[(0,h.jsx)(eX.f,{className:"w-3 h-3"}),"$",(e.cumulativeCost||0).toFixed(4)]})]}),size:"lg",footer:(0,h.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)(eJ.f,{variant:"secondary",size:"sm",onClick:m,disabled:f<=0,leftIcon:(0,h.jsx)(bJ.f,{className:"w-3.5 h-3.5"}),children:"Previous"}),(0,h.jsx)(eJ.f,{variant:"secondary",size:"sm",onClick:n,disabled:f>=g-1,rightIcon:(0,h.jsx)(bp.f,{className:"w-3.5 h-3.5"}),children:"Next"})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[d&&(0,h.jsx)(eJ.f,{variant:"secondary",size:"sm",onClick:()=>{b(),d(o?.id||c?.sessionId)},leftIcon:(0,h.jsx)(j.f,{className:"w-3.5 h-3.5 text-cyan-400"}),children:"View Conversation"}),(0,h.jsx)(eJ.f,{variant:"secondary",size:"sm",onClick:b,children:"Close"})]})]}),children:(0,h.jsxs)("div",{className:"space-y-4 max-h-[65vh] overflow-y-auto pr-1",children:[(0,h.jsxs)("div",{className:`p-3 rounded-lg border ${s.bg} space-y-1`,children:[(0,h.jsxs)("div",{className:"text-xs font-semibold text-white flex items-center justify-between",children:[(0,h.jsx)("span",{children:e.title}),e.activeTool&&(0,h.jsx)(eY.f,{variant:"type",badgeSize:"xs",className:"font-mono",children:e.activeTool})]}),e.summary&&(0,h.jsx)("p",{className:"text-xs text-slate-300 leading-relaxed",children:e.summary})]}),"user_input"===e.type&&(0,h.jsxs)("div",{className:"space-y-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(e0.f,{className:"w-3.5 h-3.5 text-amber-400"}),"User Prompt Message"]}),(0,h.jsx)(eJ.f,{variant:"ghost",size:"xs",onClick:()=>r(e.content),leftIcon:p?(0,h.jsx)(bU.f,{className:"w-3 h-3 text-emerald-400"}):(0,h.jsx)(bT.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,h.jsx)("pre",{className:"p-3 bg-[#141414] border border-[#2b2b2b] rounded-lg text-xs font-sans text-slate-200 whitespace-pre-wrap leading-relaxed max-h-80 overflow-y-auto",children:e.content||"No text content."})]}),"thought"===e.type&&(0,h.jsxs)("div",{className:"space-y-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(e_.f,{className:"w-3.5 h-3.5 text-cyan-400"}),"AI Reasoning (Chain of Thought)"]}),(0,h.jsx)(eJ.f,{variant:"ghost",size:"xs",onClick:()=>r(e.content),leftIcon:p?(0,h.jsx)(bU.f,{className:"w-3 h-3 text-emerald-400"}):(0,h.jsx)(bT.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,h.jsx)("pre",{className:"p-3 bg-[#12161f] border border-cyan-900/40 rounded-lg text-xs font-mono text-cyan-200/90 whitespace-pre-wrap leading-relaxed max-h-80 overflow-y-auto",children:e.content})]}),"file_write"===e.type&&v.args?.ReplacementContent&&(0,h.jsxs)("div",{className:"space-y-2",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(eC.f,{className:"w-3.5 h-3.5 text-purple-400"}),"Code Changes (Diff Preview)"]}),v.targetFile&&(0,h.jsx)("span",{className:"text-[10px] font-mono text-purple-300 truncate max-w-[260px]",children:v.targetFile})]}),v.args.TargetContent&&(0,h.jsxs)("div",{className:"space-y-1",children:[(0,h.jsx)("span",{className:"text-[10px] font-bold text-rose-400 uppercase tracking-wider block",children:"- Original Content (Replaced)"}),(0,h.jsx)("pre",{className:"p-2.5 bg-rose-950/20 border border-rose-500/30 rounded-lg text-xs font-mono text-rose-300 whitespace-pre-wrap leading-relaxed max-h-48 overflow-y-auto",children:v.args.TargetContent})]}),(0,h.jsxs)("div",{className:"space-y-1",children:[(0,h.jsx)("span",{className:"text-[10px] font-bold text-emerald-400 uppercase tracking-wider block",children:"+ New Content (Added)"}),(0,h.jsx)("pre",{className:"p-2.5 bg-emerald-950/20 border border-emerald-500/30 rounded-lg text-xs font-mono text-emerald-300 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:v.args.ReplacementContent})]})]}),"file_write"===e.type&&!v.args?.ReplacementContent&&v.args?.CodeContent&&(0,h.jsxs)("div",{className:"space-y-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(eC.f,{className:"w-3.5 h-3.5 text-purple-400"}),"Created File Content"]}),v.targetFile&&(0,h.jsx)("span",{className:"text-[10px] font-mono text-purple-300 truncate max-w-[260px]",children:v.targetFile})]}),(0,h.jsx)("pre",{className:"p-3 bg-[#101010] border border-purple-500/30 rounded-lg text-xs font-mono text-purple-200 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:v.args.CodeContent})]}),("tool_call"===e.type||"file_write"===e.type)&&w&&(0,h.jsxs)("div",{className:"space-y-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(e4,{className:"w-3.5 h-3.5 text-blue-400"}),"Arguments (",e.activeTool,")"]}),v.targetFile&&(0,h.jsx)("span",{className:"text-[11px] font-mono text-purple-300 truncate max-w-[280px]",children:v.targetFile})]}),(0,h.jsx)("pre",{className:"p-3 bg-[#141414] border border-[#2b2b2b] rounded-lg text-xs font-mono text-slate-300 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(v.args,null,2)})]}),("tool_call"===e.type||"file_write"===e.type)&&x&&(0,h.jsxs)("div",{className:"space-y-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(bh.f,{className:"w-3.5 h-3.5 text-emerald-400"}),"Execution Output"]}),(0,h.jsx)(eJ.f,{variant:"ghost",size:"xs",onClick:()=>r(v.output),leftIcon:p?(0,h.jsx)(bU.f,{className:"w-3 h-3 text-emerald-400"}):(0,h.jsx)(bT.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,h.jsx)("pre",{className:"p-3 bg-[#101010] border border-[#2b2b2b] rounded-lg text-xs font-mono text-emerald-400/90 whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:v.output})]}),"assistant_reply"===e.type&&(0,h.jsxs)("div",{className:"space-y-1.5",children:[(0,h.jsxs)("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[(0,h.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,h.jsx)(bh.f,{className:"w-3.5 h-3.5 text-emerald-400"}),"Assistant Response"]}),(0,h.jsx)(eJ.f,{variant:"ghost",size:"xs",onClick:()=>r(e.content),leftIcon:p?(0,h.jsx)(bU.f,{className:"w-3 h-3 text-emerald-400"}):(0,h.jsx)(bT.f,{className:"w-3 h-3"}),children:p?"Copied":"Copy"})]}),(0,h.jsx)("pre",{className:"p-3 bg-[#141414] border border-[#2b2b2b] rounded-lg text-xs font-sans text-slate-200 whitespace-pre-wrap leading-relaxed max-h-80 overflow-y-auto",children:e.content})]}),"finish"===e.type&&(0,h.jsxs)("div",{className:"p-4 bg-emerald-950/20 border border-emerald-500/30 rounded-lg space-y-3",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 text-emerald-400 font-bold text-sm",children:[(0,h.jsx)(e2.f,{className:"w-5 h-5"}),"Session Summary"]}),(0,h.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-xs",children:[(0,h.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"TOTAL DURATION"}),(0,h.jsxs)("span",{className:"font-mono text-white text-sm font-semibold",children:[l,"s"]})]}),(0,h.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"TOTAL STEPS"}),(0,h.jsxs)("span",{className:"font-mono text-white text-sm font-semibold",children:[g," events"]})]}),(0,h.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"TOTAL TOKENS"}),(0,h.jsx)("span",{className:"font-mono text-cyan-400 text-sm font-semibold",children:(e.cumulativeTokens||0).toLocaleString()})]}),(0,h.jsxs)("div",{className:"bg-[#181818] p-2.5 rounded border border-[#2b2b2b]",children:[(0,h.jsx)("span",{className:"text-slate-400 text-[10px] block",children:"ESTIMATED COST"}),(0,h.jsxs)("span",{className:"font-mono text-amber-300 text-sm font-semibold",children:["$",(e.cumulativeCost||0).toFixed(4)]})]})]})]})]})})}var e6=a.i(13608);function e7({replay:a,onExit:b,onOpenConversation:c,className:d="",children:e}){let[f,g]=(0,i.useState)(!1),[k,l]=(0,i.useState)(!0),{sessionInfo:m={},currentKeyframe:n,currentStepIndex:o=0,totalSteps:p=0,isPlaying:q=!1,togglePlay:r,stepForward:s,stepBackward:t,seekToStep:u}=a||{};return(0,i.useEffect)(()=>{let a=a=>{let b=document.activeElement?.tagName?.toLowerCase();"input"!==b&&"textarea"!==b&&("Space"===a.code?(a.preventDefault(),r?.()):"ArrowLeft"===a.code?(a.preventDefault(),t?.()):"ArrowRight"===a.code?(a.preventDefault(),s?.()):"Home"===a.code?(a.preventDefault(),u?.(0)):"End"===a.code?(a.preventDefault(),u?.(Math.max(0,p-1))):"i"!==a.key&&"I"!==a.key||a.metaKey||a.ctrlKey||g(a=>!a))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[r,t,s,u,p]),(0,h.jsxs)("div",{className:`relative flex flex-col h-full w-full overflow-hidden ${d}`,children:[(0,h.jsxs)("div",{className:"h-9 min-h-[36px] bg-[#1a1f2c]/90 border-b border-[#2d3748] px-3 flex items-center justify-between z-30 select-none backdrop-blur-md",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,h.jsxs)("span",{className:"flex h-2 w-2 relative",children:[(0,h.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"}),(0,h.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cyan-500"})]}),(0,h.jsx)(eY.f,{variant:"type",badgeSize:"xs",className:"font-mono uppercase font-bold tracking-wider",children:"Time-Machine Replay"}),(0,h.jsx)("span",{className:"text-slate-500 text-xs hidden sm:inline",children:"•"}),(0,h.jsx)("span",{className:"text-xs text-slate-300 font-mono truncate max-w-[200px]",title:m?.id,children:m?.id?`${m.id.slice(0,16)}...`:"Session"}),m?.model&&(0,h.jsxs)("span",{className:"text-[11px] text-slate-400 font-mono hidden md:inline",children:["(",m.model,")"]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[c&&(0,h.jsx)(eJ.f,{variant:"secondary",size:"xs",onClick:()=>c(m?.id||a?.sessionId),leftIcon:(0,h.jsx)(j.f,{className:"w-3 h-3 text-cyan-400"}),title:"View full conversation transcript for this session",children:"View Conversation"}),(0,h.jsx)(eJ.f,{variant:"secondary",size:"xs",onClick:()=>g(!0),leftIcon:(0,h.jsx)(bR.f,{className:"w-3 h-3 text-cyan-400"}),title:"Inspect event details and parameters (Key: I)",children:"Step Details"}),(0,h.jsx)(eJ.f,{variant:"ghost",size:"xs",onClick:b,leftIcon:(0,h.jsx)(bI.X,{className:"w-3.5 h-3.5"}),className:"text-slate-400 hover:text-white hover:bg-rose-950/40 hover:border-rose-500/40",title:"Exit Replay and return to live stream",children:"Exit Replay"})]})]}),(0,h.jsxs)("div",{className:"relative flex-1 overflow-hidden",children:[e,n&&(0,h.jsx)("div",{className:"absolute top-3 right-3 z-20 max-w-sm pointer-events-auto",children:(0,h.jsxs)("div",{className:"bg-[#18181b]/90 border border-[#3f3f46] rounded-xl shadow-2xl backdrop-blur-md overflow-hidden transition-all",children:[(0,h.jsxs)("div",{onClick:()=>l(!k),className:"px-3 py-2 bg-[#27272a]/70 flex items-center justify-between cursor-pointer hover:bg-[#27272a] transition-colors",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(a=>{switch(a){case"user_input":return(0,h.jsx)(e0.f,{className:"w-3.5 h-3.5 text-amber-400"});case"thought":return(0,h.jsx)(e_.f,{className:"w-3.5 h-3.5 text-cyan-400"});case"file_write":return(0,h.jsx)(eC.f,{className:"w-3.5 h-3.5 text-purple-400"});case"tool_call":return(0,h.jsx)(e1.f,{className:"w-3.5 h-3.5 text-[#007acc]"});case"finish":return(0,h.jsx)(e2.f,{className:"w-3.5 h-3.5 text-emerald-400"});default:return(0,h.jsx)(bh.f,{className:"w-3.5 h-3.5 text-slate-400"})}})(n.type),(0,h.jsx)("span",{className:"text-xs font-semibold text-white truncate",children:n.title||"Agent Activity"})]}),(0,h.jsxs)("div",{className:"flex items-center gap-1.5 text-slate-400",children:[(0,h.jsxs)("span",{className:"text-[10px] font-mono",children:[o+1,"/",p]}),k?(0,h.jsx)(e6.f,{className:"w-3 h-3"}):(0,h.jsx)(bo.f,{className:"w-3 h-3"})]})]}),k&&(0,h.jsxs)("div",{className:"p-3 space-y-2 text-xs",children:[(0,h.jsx)("p",{className:"text-slate-300 leading-relaxed font-sans line-clamp-3",children:n.summary||n.content?.slice(0,150)||"Executing task..."}),(0,h.jsxs)("div",{className:"flex items-center justify-between pt-1 border-t border-[#27272a] text-[11px]",children:[n.activeTool?(0,h.jsxs)("div",{className:"flex items-center gap-1.5 font-mono text-cyan-400 truncate",children:[(0,h.jsx)(e1.f,{className:"w-3 h-3 text-[#007acc] shrink-0"}),(0,h.jsx)("span",{className:"truncate",children:n.activeTool})]}):(0,h.jsxs)("span",{className:"text-[10px] text-slate-500 font-mono",children:["Step ",o+1]}),c&&(0,h.jsxs)("button",{type:"button",onClick:()=>c(m?.id||a?.sessionId),className:"flex items-center gap-1 text-[11px] text-cyan-400 hover:text-cyan-300 hover:underline cursor-pointer ml-auto shrink-0",title:"View conversation transcript",children:[(0,h.jsx)(j.f,{className:"w-3 h-3"}),(0,h.jsx)("span",{children:"Conversation"})]})]})]})]})})]}),(0,h.jsx)(e$,{replay:a,onClose:b,className:"z-30 shrink-0"}),(0,h.jsx)(e5,{isOpen:f,onClose:()=>g(!1),replay:a,onOpenConversation:c})]})}let e8={isLeftSidebarVisible:!0,isBottomPanelVisible:!0,isRightSidebarVisible:!1,activeActivityView:"explorer",activeRightSidebarTab:"chat",activeBottomTab:"logs",activeEditorTab:"canvas",openedTabs:[{id:"canvas",title:"Virtual Office",type:"canvas",closable:!1}]};function e9({traces:a=[],totalCount:b=0,top:c=20,onTopChange:d,timeframe:e="24h",onTimeframeChange:f,office:g={workstations:[],stats:{}},mode:m="live",mockPreset:n="cases",onModeChange:o,onPresetChange:p,connected:q=!0,live:r=!0,isRefreshing:s=!1,onRefresh:t,soundEnabled:u=!1,onToggleSound:v,notifEnabled:w=!1,onToggleNotif:x}){let[y,z]=(0,i.useState)(e8),[A,B]=(0,i.useState)(!1),[C,D]=(0,i.useState)(null),[E,F]=(0,i.useState)("canvas"),[G,H]=(0,i.useState)("agents"),[I,J]=(0,i.useState)(!1),[K,L]=(0,i.useState)(!1),[M,N]=(0,i.useState)(!1),[O,P]=(0,i.useState)("themes"),[Q,R]=(0,i.useState)(!1),[S,T]=(0,i.useState)(!1),U=(0,i.useCallback)(a=>{T(b=>{let c="boolean"==typeof a?a:!b;return c?(F("canvas"),"u">typeof document&&document.documentElement?.requestFullscreen&&!document.fullscreenElement&&document.documentElement.requestFullscreen().catch(()=>{})):"u">typeof document&&document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{}),c})},[]);(0,i.useEffect)(()=>{let a=()=>{"u">typeof document&&!document.fullscreenElement&&S&&T(!1)};return document.addEventListener("fullscreenchange",a),()=>document.removeEventListener("fullscreenchange",a)},[S]),(0,i.useEffect)(()=>{let a=(0,bW.F)();R(!!a.isSupporter),(0,eO.n)(a);let b=a=>{R(!!(a.detail||(0,bW.F)()).isSupporter)};return window.addEventListener(bW.o,b),()=>window.removeEventListener(bW.o,b)},[]);let[V,W]=(0,i.useState)(null),X=function(a=null){let[b,c]=(0,i.useState)(a),[d,e]=(0,i.useState)(!1),[f,g]=(0,i.useState)(null),[h,j]=(0,i.useState)({sessionInfo:{},keyframes:[],totalElapsedSeconds:0,totalTokens:0,totalCost:0}),[k,l]=(0,i.useState)(0),[m,n]=(0,i.useState)(!1),[o,p]=(0,i.useState)(2),q=(0,i.useRef)(null),r=(0,i.useRef)(null),s=(0,i.useCallback)(async a=>{if(a){e(!0),g(null),n(!1),l(0);try{let b=await fetch(`/api/sessions/${encodeURIComponent(a)}/transcript`);if(!b.ok)throw Error(`Failed to load session transcript: HTTP ${b.status}`);let d=await b.json(),e=function(a){if(!a||!Array.isArray(a.turns))return{sessionInfo:{},keyframes:[],totalElapsedSeconds:0,totalTokens:0,totalCost:0};let b=a.session||{},c=a.turns||[],d=b.model||null,e=b.cli||"antigravity",f=[],g=0,h=0,i=0,j=0,k=Date.now();b.startedAt?k=new Date(b.startedAt).getTime():c.length>0&&c[0].timestamp&&(k=new Date(c[0].timestamp).getTime()),c.forEach((a,b)=>{let c=a.timestamp?new Date(a.timestamp).getTime():k+5e3*b,e=Math.max(0,Math.round((c-k)/1e3));a.tokens&&(h+=a.tokens.input||0,i+=a.tokens.output||0,j+=a.tokens.cached||0);let l=h+i+j,m=eR({input:h,output:i,cached:j},d);if("user"===a.role)return void f.push({stepIndex:g++,turnIndex:b,timestamp:a.timestamp||new Date(c).toISOString(),elapsedSeconds:e,type:"user_input",milestoneType:"prompt",agentState:"thinking",title:"User Prompt",summary:a.content?a.content.slice(0,80)+(a.content.length>80?"...":""):"User message",content:a.content||"",cumulativeTokens:l,cumulativeCost:m,activeTool:null});a.thinking&&f.push({stepIndex:g++,turnIndex:b,timestamp:a.timestamp||new Date(c).toISOString(),elapsedSeconds:e,type:"thought",milestoneType:"thought",agentState:"thinking",title:"AI Chain of Thought",summary:a.thinking.slice(0,90)+(a.thinking.length>90?"...":""),content:a.thinking,cumulativeTokens:l,cumulativeCost:m,activeTool:null});let n=a.toolCalls||[];if(n.forEach((d,h)=>{let i=e+(h+1)*2,j="replace_file_content"===d.name||"write_to_file"===d.name||d.name?.includes("edit")||d.name?.includes("write"),k="run_command"===d.name||"bash"===d.name||"terminal"===d.name,n=d.name?.includes("search")||d.name?.includes("grep")||d.name?.includes("view"),o="tool";j?o="file_write":k?o="command":n&&(o="search"),f.push({stepIndex:g++,turnIndex:b,toolIndex:h,timestamp:a.timestamp||new Date(c+2e3*h).toISOString(),elapsedSeconds:i,type:j?"file_write":"tool_call",milestoneType:"error"===d.status?"error":"tool",agentState:j?"typing":"running_tool",title:`Tool Call: ${d.name||"tool"}`,summary:d.summary||d.action||d.name,details:{id:d.id,name:d.name,type:o,summary:d.summary,args:d.args||{},output:d.output||"",status:d.status||"completed",targetFile:d.args?.TargetFile||d.args?.AbsolutePath||null},cumulativeTokens:l,cumulativeCost:m,activeTool:d.name})}),a.content){let d=e+(n.length>0?(n.length+1)*2:1);f.push({stepIndex:g++,turnIndex:b,timestamp:a.timestamp||new Date(c+1e3*d).toISOString(),elapsedSeconds:d,type:"assistant_reply",milestoneType:"reply",agentState:"typing",title:"Assistant Reply",summary:a.content.slice(0,90)+(a.content.length>90?"...":""),content:a.content,cumulativeTokens:l,cumulativeCost:m,activeTool:null})}});let l=f[f.length-1],m=l?l.elapsedSeconds+2:5;f.push({stepIndex:g++,timestamp:new Date().toISOString(),elapsedSeconds:m,type:"finish",milestoneType:"finish",agentState:"done",title:"Session Completed",summary:`Completed ${c.length} turns • ${f.length} events`,content:"All tasks completed as instructed.",cumulativeTokens:h+i+j,cumulativeCost:eR({input:h,output:i,cached:j},d),activeTool:null});let n=h+i+j,o=eR({input:h,output:i,cached:j},d);return{sessionInfo:{id:b.id||"session",cli:e,model:d,cwd:b.cwd||"",startedAt:b.startedAt,turnsCount:c.length,totalSteps:f.length},keyframes:f,totalElapsedSeconds:m,totalTokens:n,totalCost:o}}(d);j(e),c(a),l(0)}catch(a){console.error("[useSessionReplay] Load error:",a),g(a.message||"Failed to load session data")}finally{e(!1)}}},[]);(0,i.useEffect)(()=>{a&&s(a)},[a,s]);let{keyframes:t,totalElapsedSeconds:u,sessionInfo:v,totalTokens:w,totalCost:x}=h,y=t.length,z=(0,i.useMemo)(()=>{if(0===t.length)return null;let a=Math.min(Math.max(0,k),t.length-1);return t[a]},[t,k]),A=z?z.elapsedSeconds:0,B=u>0?A/u:0,C=(0,i.useCallback)(a=>{l(b=>Math.min(Math.max(0,a),y-1))},[y]),D=(0,i.useCallback)(a=>{if(0===t.length)return;let b=Math.min(Math.max(0,a),1)*u,c=0,d=1/0;t.forEach((a,e)=>{let f=Math.abs(a.elapsedSeconds-b);f<d&&(d=f,c=e)}),C(c)},[t,u,C]),E=(0,i.useCallback)(()=>{C(k+1)},[k,C]),F=(0,i.useCallback)(()=>{C(k-1)},[k,C]),G=(0,i.useCallback)(()=>{k>=y-1&&l(0),n(!0),r.current=performance.now()},[k,y]),H=(0,i.useCallback)(()=>{n(!1),q.current&&cancelAnimationFrame(q.current)},[]),I=(0,i.useCallback)(()=>{m?H():G()},[m,G,H]),J=(0,i.useCallback)(()=>{H(),l(0)},[H]);return(0,i.useEffect)(()=>{if(!m||0===t.length)return;let a=0,b=1200/o,c=d=>{r.current||(r.current=d);let e=d-r.current;r.current=d,(a+=e)>=b&&(a=0,l(a=>a>=y-1?(n(!1),a):a+1)),q.current=requestAnimationFrame(c)};return r.current=performance.now(),q.current=requestAnimationFrame(c),()=>{q.current&&cancelAnimationFrame(q.current)}},[m,t.length,y,o]),{sessionId:b,loading:d,error:f,sessionInfo:v,keyframes:t,totalSteps:y,currentStepIndex:k,currentKeyframe:z,currentTime:A,totalElapsedSeconds:u,progress:B,isPlaying:m,playbackSpeed:o,totalTokens:w,totalCost:x,loadSession:s,play:G,pause:H,togglePlay:I,seekToStep:C,seekToProgress:D,stepForward:E,stepBackward:F,setPlaybackSpeed:p,reset:J}}(V),Y=(0,i.useCallback)(b=>{let c=b||C||a[0]?.connectionId||a[0]?.traceId||"default-session";W(c),D(c),F("canvas")},[C,a]),Z=(0,i.useCallback)(()=>{W(null)},[]),[$,_]=(0,i.useState)(()=>[{id:"canvas",title:"Virtual Office",type:"canvas",closable:!1}]);(0,i.useEffect)(()=>{(0,dr.p)();let a={...e8};z(a),a.activeEditorTab&&F(a.activeEditorTab),a.openedTabs&&Array.isArray(a.openedTabs)&&a.openedTabs.length>0&&_(a.openedTabs),B(!0)},[]),(0,i.useEffect)(()=>{},[y,A]),(0,i.useEffect)(()=>{},[E]);let aa=(0,i.useMemo)(()=>V&&X.currentKeyframe?function(a,b={}){if(!a)return null;let c=b.id||"replay-session",d=b.cli||"antigravity",e=b.model||"gemini-3.8-flash",f="app"===b.clientType,g="antigravity"===d?"Google":"Anthropic",h="mcp",i=(a.activeTool||a.details?.name||"").toLowerCase();i.includes("bash")||i.includes("command")||i.includes("terminal")||"run_command"===i?h="bash":i.includes("read")||i.includes("view")||"view_file"===i?h="read":i.includes("edit")||i.includes("write")||"replace_file_content"===i||"write_to_file"===i?h="edit":i.includes("search")||i.includes("grep")||i.includes("find")?h="search":i.includes("web")||i.includes("browse")||i.includes("url")?h="web":(i.includes("memory")||i.includes("remember")||i.includes("recall"))&&(h="memory");let j="streaming",k="streaming";"user_input"===a.type||"thought"===a.type?(j="pending",k="pending"):"finish"===a.type?(j="done",k="happy"):"error"===a.milestoneType&&(j="error",k="error");let l=a.activeTool?[{id:a.details?.id||"tool-0",tool:h,type:h,name:a.activeTool,status:a.details?.status||"completed"}]:[];return{connectionId:c,traceId:c,account:`${d.toUpperCase()}: ${c.slice(0,10)}`,model:e,provider:g,cli:d,clientType:f?"app":"cli",state:j,mode:k,isLooping:!1,tools:a.activeTool?[h]:[],toolCalls:l,activeTool:a.activeTool||null,tokens:{input:null,output:null,cached:null},totalTokens:a.cumulativeTokens??null,cost:a.cumulativeCost??null,elapsedMs:1e3*(a.elapsedSeconds||0),currentCommand:a.title||"",summary:a.summary||"",isReplay:!0,logs:[{id:`replay-log-${a.stepIndex}`,time:new Date(a.timestamp||Date.now()).toLocaleTimeString(),level:"error"===a.milestoneType?"error":"info",message:`[Replay #${a.stepIndex+1}] ${a.title}: ${a.summary}`}]}}(X.currentKeyframe,X.sessionInfo):null,[V,X.currentKeyframe,X.sessionInfo]),ab=(0,i.useMemo)(()=>aa?[aa]:a,[aa,a]),ac=(0,i.useMemo)(()=>aa?dq(ab):g,[aa,ab,g]),ad=(0,i.useMemo)(()=>C?ac.workstations.find(a=>a.connectionId===C||a.traceId===C||a.traces?.[0]?.traceId===C)||ab.find(a=>a.connectionId===C||a.traceId===C||a.traces?.[0]?.traceId===C)||{connectionId:C,traceId:C,account:C.length>20?`${C.slice(0,16)}...`:C,model:X?.sessionInfo?.model||"AI Agent",provider:X?.sessionInfo?.provider||"antigravity"}:null,[ac.workstations,ab,C,X?.sessionInfo]),ae=(0,i.useCallback)(a=>{a&&(D(a),z(a=>({...a,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"})))},[]),af=(0,i.useCallback)(a=>{D(a),a&&z(a=>({...a,isRightSidebarVisible:!0}))},[]),ag=(0,i.useCallback)(a=>{if(!a)return;let b=`agent-${a.connectionId}`;_(c=>c.find(a=>a.id===b)?c:[...c,{id:b,title:a.account||`Desk #${a.deskIndex+1}`,type:"agent",agentData:a,closable:!0}]),F(b)},[]),ah=(0,i.useCallback)(a=>{_(b=>{let c=b.filter(b=>b.id!==a);return c.length>0?c:[{id:"canvas",title:"Virtual Office",type:"canvas",closable:!1}]}),F(b=>b===a?"canvas":b)},[]),ai=(0,i.useCallback)(()=>{_(a=>a.find(a=>"reports"===a.id)?a:[...a,{id:"reports",title:"Token Analytics",type:"reports",closable:!0}]),F("reports")},[]),aj=(0,i.useCallback)(()=>{_(a=>a.find(a=>"network"===a.id)?a:[...a,{id:"network",title:"Multi-Agent Graph",type:"network",closable:!0}]),F("network")},[]),ak=(0,i.useCallback)(()=>{_(a=>a.find(a=>"store"===a.id)?a:[...a,{id:"store",title:"Supporter Store",type:"store",closable:!0}]),F("store")},[]),al=(0,i.useCallback)(a=>{if(!a||!a.path)return;let b=`file-${a.path}`,c=a.name||a.path.split("/").pop();_(d=>d.find(a=>a.id===b)?d:[...d,{id:b,title:c,type:"file",filePath:a.path,closable:!0}]),F(b)},[]),am=(0,i.useCallback)(()=>{z(a=>({...a,isLeftSidebarVisible:!0})),H("files")},[]);(0,i.useEffect)(()=>{let a=a=>{let b=navigator.platform.toUpperCase().indexOf("MAC")>=0?a.metaKey:a.ctrlKey;if(b&&a.shiftKey&&("p"===a.key||"P"===a.key)){a.preventDefault(),J(a=>!a);return}if(b&&!a.shiftKey&&!a.altKey&&("b"===a.key||"B"===a.key)){a.preventDefault(),z(a=>({...a,isLeftSidebarVisible:!a.isLeftSidebarVisible}));return}if(b&&("j"===a.key||"J"===a.key||"`"===a.key)){a.preventDefault(),z(a=>({...a,isBottomPanelVisible:!a.isBottomPanelVisible}));return}if(b&&a.altKey&&("b"===a.key||"B"===a.key)){a.preventDefault(),z(a=>({...a,isRightSidebarVisible:!a.isRightSidebarVisible}));return}if("Escape"===a.key&&S){a.preventDefault(),U(!1);return}if(a.shiftKey&&("f"===a.key||"F"===a.key)&&!b&&!a.altKey){let b=document.activeElement?.tagName?.toLowerCase();if("input"!==b&&"textarea"!==b){a.preventDefault(),U();return}}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[S,U]);let an=(0,i.useCallback)(()=>{},[]),ao=(0,i.useMemo)(()=>$.find(a=>a.id===E)||$[0],[$,E]),ap=(0,i.useMemo)(()=>{if("telemetry"!==E)return"";let a=ab.length>30?ab.slice(-30):ab;try{return JSON.stringify(a,null,2)}catch{return"[]"}},[E,ab]);return(0,h.jsxs)("div",{className:"flex h-screen w-screen flex-col overflow-hidden bg-[#181818] text-[#cccccc] font-sans antialiased",children:[(0,h.jsx)(bd,{stats:g.stats,traces:ab,totalCount:b,top:c,onTopChange:d,timeframe:e,onTimeframeChange:f,mode:m,mockPreset:n,onModeChange:o,onPresetChange:p,isRefreshing:s,onRefresh:t,soundEnabled:u,onToggleSound:v,notifEnabled:w,onToggleNotif:x,onOpenCommandPalette:()=>J(!0),onOpenReports:ai,onOpenStore:ak,onOpenThemeSettings:()=>{P("themes"),N(!0)},isSupporter:Q,layout:y,onToggleLeftSidebar:()=>z(a=>({...a,isLeftSidebarVisible:!a.isLeftSidebarVisible})),onToggleBottomPanel:()=>z(a=>({...a,isBottomPanelVisible:!a.isBottomPanelVisible})),onToggleRightSidebar:()=>z(a=>({...a,isRightSidebarVisible:!a.isRightSidebarVisible})),isZenFullscreen:S,onToggleZenFullscreen:U}),(0,h.jsxs)("div",{className:"flex flex-1 overflow-hidden relative",children:[(0,h.jsx)(bn,{activeView:y.activeActivityView,isLeftSidebarVisible:y.isLeftSidebarVisible,activeLeftSidebarTab:G,isRightSidebarVisible:y.isRightSidebarVisible,activeRightSidebarTab:y.activeRightSidebarTab||"chat",onOpenStore:ak,onViewChange:a=>{"chat"===a?z(a=>{let b=a.isRightSidebarVisible&&"chat"===a.activeRightSidebarTab;return{...a,isRightSidebarVisible:!b,activeRightSidebarTab:"chat"}}):"files"===a?(z(a=>({...a,isLeftSidebarVisible:!a.isLeftSidebarVisible||"files"!==G,activeActivityView:"files"})),H("files")):"explorer"===a?(z(a=>({...a,isLeftSidebarVisible:!a.isLeftSidebarVisible||"agents"!==G,activeActivityView:"explorer"})),H("agents")):"office"===a?F("canvas"):"network"===a?aj():"reports"===a?ai():"telemetry"===a?(_(a=>a.find(a=>"telemetry"===a.id)?a:[...a,{id:"telemetry",title:"Live Telemetry",type:"telemetry",closable:!0}]),F("telemetry")):"store"===a?ak():z(b=>({...b,activeActivityView:a,isLeftSidebarVisible:b.activeActivityView!==a||!b.isLeftSidebarVisible}))},agentCount:g.stats?.busy||0,isBottomPanelVisible:y.isBottomPanelVisible,onToggleBottomPanel:()=>z(a=>({...a,isBottomPanelVisible:!a.isBottomPanelVisible})),onOpenSettings:()=>{P("themes"),N(!0)}}),(0,h.jsxs)(aE,{orientation:"horizontal",className:"flex-1 h-full overflow-hidden",onLayoutChange:an,children:[y.isLeftSidebarVisible&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(aF,{id:"left-sidebar-panel",defaultSize:"260px",minSize:"180px",maxSize:"450px",className:"overflow-hidden h-full",children:(0,h.jsx)(bH,{workstations:ac.workstations,selectedId:C,onSelectAgent:af,onOpenAgentTab:ag,stats:ac.stats,onRefresh:t,onStartReplay:Y,onViewConversation:ae,onOpenFile:al,onOpenStore:ak,activeSidebarTab:G,onActiveSidebarTabChange:H})}),(0,h.jsx)(aJ,{className:"w-1 bg-[#181818] hover:bg-[#007acc] active:bg-[#007acc] transition-colors cursor-col-resize z-20 shrink-0"})]}),(0,h.jsx)(aF,{id:"center-main-panel",minSize:"350px",className:"overflow-hidden flex flex-col h-full bg-[#1e1e1e]",children:(0,h.jsxs)(aE,{orientation:"vertical",className:"h-full w-full overflow-hidden",onLayoutChange:an,children:[(0,h.jsxs)(aF,{id:"editor-area-panel",minSize:"160px",className:"overflow-hidden flex flex-col h-full",children:[(0,h.jsx)(bK,{tabs:$,activeTabId:E,onSelectTab:F,onCloseTab:ah,isZenFullscreen:S,onToggleZenFullscreen:U}),(0,h.jsx)("div",{className:"flex-1 relative overflow-hidden bg-[#070b12]",children:V?(0,h.jsx)(e7,{replay:X,onExit:Z,onOpenConversation:ae,children:(0,h.jsx)("div",{className:"absolute inset-0",children:"network"===E?(0,h.jsx)(dM,{traces:ab,selectedTraceId:C,onSelectTrace:a=>{D(a.traceId||a.connectionId),z(a=>({...a,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"}))}}):(0,h.jsx)(dK,{traces:ab,totalCount:b,top:c,onTopChange:d,timeframe:e,onTimeframeChange:f,selectedId:C,onSelect:a=>af(a),isZenFullscreen:S,onToggleZenFullscreen:U,soundEnabled:u,onToggleSound:v})})}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:`absolute inset-0 transition-opacity ${"canvas"===E?"opacity-100 z-10":"opacity-0 pointer-events-none z-0"} ${S?"!fixed !inset-0 !z-40 !w-screen !h-screen !rounded-none !border-none":""}`,children:(0,h.jsx)(dK,{traces:ab,totalCount:b,top:c,onTopChange:d,timeframe:e,onTimeframeChange:f,selectedId:C,onSelect:a=>af(a),isZenFullscreen:S,onToggleZenFullscreen:U,soundEnabled:u,onToggleSound:v})}),"telemetry"===E&&(0,h.jsxs)("div",{className:"absolute inset-0 p-4 overflow-auto font-mono text-xs bg-[var(--bg-editor)] text-[var(--text-main)]",children:[(0,h.jsxs)("div",{className:"mb-3 flex items-center justify-between pb-2 border-b border-[var(--border-subtle)]",children:[(0,h.jsx)("h3",{className:"font-bold text-sm text-[var(--accent-primary)]",children:"Realtime Telemetry Snapshots"}),(0,h.jsxs)("span",{className:"text-[var(--text-muted)]",children:[ab.length," active sessions",ab.length>30?" (latest 30)":""]})]}),(0,h.jsx)("pre",{className:"bg-[var(--bg-chat-code)] p-4 rounded border border-[var(--border-card)] text-[11px] text-[var(--text-chat-code)] leading-relaxed overflow-x-auto",children:ap})]}),ao?.type==="agent"&&(0,h.jsx)("div",{className:"absolute inset-0 p-4 overflow-auto bg-[var(--bg-editor)] text-[var(--text-main)]",children:(0,h.jsx)("div",{className:"max-w-3xl mx-auto space-y-4",children:(0,h.jsxs)("div",{className:"flex items-center justify-between p-4 bg-[var(--bg-card)] rounded-lg border border-[var(--border-card)]",children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("h2",{className:"text-base font-bold text-[var(--text-bright)]",children:ao.title}),(0,h.jsxs)("p",{className:"text-xs text-[var(--text-muted)]",children:["Connection ID: ",ao.agentData?.connectionId]})]}),(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsxs)("button",{onClick:()=>Y(ao.agentData?.connectionId),className:"px-3.5 py-1.5 bg-[var(--accent-primary)] hover:opacity-90 text-[var(--text-on-accent,#ffffff)] rounded text-xs font-semibold cursor-pointer flex items-center gap-1.5 shadow-sm",title:"Replay Session (Default)",children:[(0,h.jsx)(l.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{children:"Replay Session"})]}),(0,h.jsxs)("button",{onClick:()=>ae(ao.agentData?.connectionId),className:"px-3.5 py-1.5 bg-[var(--bg-card-inner)] hover:bg-[var(--bg-hover)] border border-[var(--border-card)] text-[var(--text-main)] hover:text-[var(--text-bright)] rounded text-xs font-semibold cursor-pointer flex items-center gap-1.5",title:"Pin live chat transcript to Right Sidebar",children:[(0,h.jsx)(j.f,{className:"w-3.5 h-3.5 text-[var(--accent-secondary)]"}),(0,h.jsx)("span",{children:"Pin to Sidebar"})]}),(0,h.jsxs)("button",{onClick:()=>{(0,aK.f)(ao.agentData?.connectionId)},className:"px-3.5 py-1.5 bg-[var(--bg-card-inner)] hover:bg-[var(--bg-hover)] border border-[var(--border-card)] text-[var(--accent-primary)] hover:text-[var(--text-bright)] rounded text-xs font-semibold cursor-pointer flex items-center gap-1.5",title:"Open in Detached Window (VS Code style)",children:[(0,h.jsx)(k.f,{className:"w-3.5 h-3.5"}),(0,h.jsx)("span",{children:"New Window"})]})]})]})})}),"reports"===E&&(0,h.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-[#181818] z-20",children:(0,h.jsx)(dN.f,{onClose:()=>ah("reports"),onStartReplay:Y,onViewConversation:ae})}),"network"===E&&(0,h.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-slate-950 z-20",children:(0,h.jsx)(dM,{traces:ab,selectedTraceId:C,onSelectTrace:a=>{D(a.traceId||a.connectionId),z(a=>({...a,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"}))}})}),ao?.type==="file"&&(0,h.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-[#1e1e1e] z-20",children:(0,h.jsx)(eG,{filePath:ao.filePath,onClose:()=>ah(E)})}),("store"===E||ao?.type==="store")&&(0,h.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-[#181818] z-20",children:(0,h.jsx)(eH.f,{hideHeader:!1,onClose:()=>ah("store")})})]})})]}),y.isBottomPanelVisible&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(aJ,{className:"h-1 bg-[#181818] hover:bg-[#007acc] active:bg-[#007acc] transition-colors cursor-row-resize z-20 shrink-0"}),(0,h.jsx)(aF,{id:"bottom-panel",defaultSize:"220px",minSize:"90px",maxSize:"600px",className:"overflow-hidden bg-[#181818]",children:(0,h.jsx)(bQ,{traces:ab,activeTab:y.activeBottomTab,onTabChange:a=>z(b=>({...b,activeBottomTab:a})),onClose:()=>z(a=>({...a,isBottomPanelVisible:!1}))})})]})]})}),y.isRightSidebarVisible&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(aJ,{className:"w-1 bg-[#181818] hover:bg-[#007acc] active:bg-[#007acc] transition-colors cursor-col-resize z-20 shrink-0"}),(0,h.jsx)(aF,{id:"right-sidebar-panel",defaultSize:"360px",minSize:"260px",maxSize:"750px",className:"overflow-hidden h-full bg-[#252526]",children:(0,h.jsx)(bX,{selectedAgent:ad,workstations:ac.workstations,activeTab:y.activeRightSidebarTab||"chat",onTabChange:a=>z(b=>({...b,activeRightSidebarTab:a})),onSelectAgent:af,onClose:()=>z(a=>({...a,isRightSidebarVisible:!1})),onStartReplay:Y})})]})]})]}),(0,h.jsx)(b$,{mode:m,connected:q,live:r,stats:ac.stats,selectedAgent:ad,soundEnabled:u,isBottomOpen:y.isBottomPanelVisible,onToggleBottom:()=>z(a=>({...a,isBottomPanelVisible:!a.isBottomPanelVisible}))}),(0,h.jsx)(b2,{isOpen:I,onClose:()=>J(!1),onToggleLeftSidebar:()=>z(a=>({...a,isLeftSidebarVisible:!a.isLeftSidebarVisible})),onToggleBottomPanel:()=>z(a=>({...a,isBottomPanelVisible:!a.isBottomPanelVisible})),onToggleRightSidebar:()=>z(a=>({...a,isRightSidebarVisible:!a.isRightSidebarVisible})),onToggleZenFullscreen:U,onOpenChatSidebar:()=>z(a=>({...a,isRightSidebarVisible:!0,activeRightSidebarTab:"chat"})),onOpenFilesExplorer:am,onOpenThemeSettings:()=>{P("themes"),N(!0)},onOpenFontSettings:()=>{P("fonts"),N(!0)},onToggleSound:v,onToggleNotif:x,onRefresh:t,onSetMode:o,onSelectPreset:p,onOpenReports:ai,onOpenStore:ak,onStartReplay:Y}),(0,h.jsx)(eM,{isOpen:K,onClose:()=>L(!1)}),(0,h.jsx)(eN,{isOpen:M,onClose:()=>N(!1),initialTab:O})]})}var fa=a.i(50636);function fb(){let[a,b]=(0,i.useState)(!1),[c,d]=(0,i.useState)(null);return((0,i.useEffect)(()=>{let a=null,c=async()=>{try{let c=await fetch("/api/version");if(c.ok){let e=await c.json();a?e.version&&e.version!==a&&(d(e.version),b(!0)):a=e.version}}catch{}};c();let e=setInterval(c,6e4);return()=>clearInterval(e)},[]),a)?(0,h.jsxs)("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 rounded-full border border-emerald-500/40 bg-slate-900/95 px-4 py-2 shadow-2xl backdrop-blur-md animate-in slide-in-from-bottom-4 duration-300",children:[(0,h.jsx)("span",{className:"flex h-2 w-2 rounded-full bg-emerald-400 animate-ping"}),(0,h.jsxs)("span",{className:"text-xs text-slate-200 flex items-center gap-1.5",children:[(0,h.jsx)(a_.f,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}),(0,h.jsxs)("span",{children:["New version available ",c?`(${c})`:""]})]}),(0,h.jsx)("button",{onClick:()=>{},className:"rounded-full bg-emerald-500 hover:bg-emerald-400 px-3 py-1 text-xs font-semibold text-slate-950 transition-colors shadow-sm",children:"Update now"}),(0,h.jsx)("button",{onClick:()=>b(!1),className:"text-slate-400 hover:text-slate-200 p-1 ml-1 rounded hover:bg-slate-800 transition-colors","aria-label":"Dismiss",children:(0,h.jsx)(bI.X,{className:"w-3.5 h-3.5"})})]}):null}var fc=a.i(67207),fd=a.i(73958);a.s(["default",0,function(){let[a,b]=(0,i.useState)("live"),[c,d]=(0,i.useState)("cases"),[e,f]=(0,i.useState)(!1),[g,j]=(0,i.useState)(!1);(0,i.useEffect)(()=>{f(!(0,fc.p)()),j((0,fd.p)())},[]);let{traces:k,totalCount:l,top:m,setTop:n,timeframe:o,setTimeframe:p,connected:q,live:r,isRefreshing:s,refresh:t}=(0,fa.f)({mode:a,preset:c}),u=(0,i.useMemo)(()=>dq(k),[k]);return(0,h.jsxs)("main",{className:"h-screen w-screen overflow-hidden bg-[var(--bg-workbench)]",children:[(0,h.jsx)(fb,{}),(0,h.jsx)(e9,{traces:k,totalCount:l,top:m,onTopChange:n,timeframe:o,onTimeframeChange:p,office:u,mode:a,mockPreset:c,onModeChange:a=>b(a),onPresetChange:a=>d(a),connected:q,live:r,isRefreshing:s,onRefresh:t,soundEnabled:e,onToggleSound:()=>{f((0,fc.Z)())},notifEnabled:g,onToggleNotif:()=>{j((0,fd.i)())}})]})}],85690)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_app_page_1vqfk0-j72fp6.js.map
|