@johpaz/hive-agents 1.1.1 → 1.1.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.
Files changed (50) hide show
  1. package/README.md +3 -3
  2. package/dist/hive.js +1 -1
  3. package/dist/ui/assets/{A2UIPage-F1sUdZV7.js → A2UIPage-BOR7GzYi.js} +1 -1
  4. package/dist/ui/assets/{AgentCreateForm-CN5Gb9UN.js → AgentCreateForm-Btza1Kiv.js} +1 -1
  5. package/dist/ui/assets/{AgentDetailPage-CzBnoKtH.js → AgentDetailPage-D435IX8G.js} +1 -1
  6. package/dist/ui/assets/{AgentNewPage-AGDjfAVf.js → AgentNewPage-DvP05Ap5.js} +1 -1
  7. package/dist/ui/assets/{AgentsPage-BgKr7pAZ.js → AgentsPage-BT9CssIN.js} +1 -1
  8. package/dist/ui/assets/{ApiClientPage-Dq4nPse4.js → ApiClientPage-Cmo0XBwk.js} +1 -1
  9. package/dist/ui/assets/{ChannelsPage-BuWItmp-.js → ChannelsPage-C53NCtXi.js} +1 -1
  10. package/dist/ui/assets/{DashboardPage-CB1aM87o.js → DashboardPage-DpI54Ot0.js} +1 -1
  11. package/dist/ui/assets/{LoginPage-DBvwBCG6.js → LoginPage-CTc-MbtG.js} +1 -1
  12. package/dist/ui/assets/{LogsPage-Bc-oTBwY.js → LogsPage-D-2DgTQh.js} +1 -1
  13. package/dist/ui/assets/{MeetingPage-C2H5SxaQ.js → MeetingPage-B8Xb1z_0.js} +1 -1
  14. package/dist/ui/assets/{ModelSelector-D0aJvoD9.js → ModelSelector-BcaASPWF.js} +1 -1
  15. package/dist/ui/assets/Office3DPage-6bDnybWI.js +727 -0
  16. package/dist/ui/assets/{ProvidersPage-BBBt4Hcz.js → ProvidersPage-CVK-nKxE.js} +1 -1
  17. package/dist/ui/assets/{RecoverPage-nq901JiE.js → RecoverPage-UL782VIG.js} +1 -1
  18. package/dist/ui/assets/SettingsPage-CHJfutPk.js +9 -0
  19. package/dist/ui/assets/{SetupPage-DeIGn-Uf.js → SetupPage-B_fXVcuJ.js} +1 -1
  20. package/dist/ui/assets/{Vignette-BcPWkNhm.js → Vignette-bSrGVyRd.js} +1 -1
  21. package/dist/ui/assets/{VoicePage-uLWdtoD4.css → VoicePage-CADecxhn.css} +1 -1
  22. package/dist/ui/assets/VoicePage-CdBZrLAm.js +307 -0
  23. package/dist/ui/assets/{WebChatPage-CRDN4OlP.js → WebChatPage-D8KsJqMf.js} +1 -1
  24. package/dist/ui/assets/{bia-BFcUpOu3.glb → bia-csMImkVQ.glb} +0 -0
  25. package/dist/ui/assets/{conversationsStore-BIs0iMhp.js → conversationsStore-8WwqUOpe.js} +1 -1
  26. package/dist/ui/assets/{dialog-DdbsUCv9.js → dialog-DcgGvP2g.js} +1 -1
  27. package/dist/ui/assets/headworklet.min-Bi87kUoI.mjs +1 -0
  28. package/dist/ui/assets/{index-CpzwBwPg.js → index-C5Hhusqq.js} +2 -2
  29. package/dist/ui/assets/index-DmFPF9xQ.css +2 -0
  30. package/dist/ui/assets/model-en-mixed-CfUSaeKF.bin +0 -0
  31. package/dist/ui/assets/useAudioDevices-BO-kUbtK.js +41 -0
  32. package/dist/ui/assets/{useHiveAgentsModelLoad-29pOYRd9.js → useHiveAgentsModelLoad-IOqfYcrC.js} +1 -1
  33. package/dist/ui/assets/{useProviders-CiBi4Dt6.js → useProviders-DsFqfiyM.js} +1 -1
  34. package/dist/ui/index.html +2 -2
  35. package/package.json +1 -1
  36. package/dist/ui/assets/Office3DPage-D5vwZkJa.js +0 -727
  37. package/dist/ui/assets/SettingsPage-DQ5KZPAd.js +0 -9
  38. package/dist/ui/assets/VoicePage-DJYsOsaU.js +0 -307
  39. package/dist/ui/assets/index-BD7hBA1d.css +0 -2
  40. package/dist/ui/assets/useAudioDevices-yU-wu-kt.js +0 -41
  41. /package/dist/ui/assets/{agentCapabilities-PfTEVxG1.js → agentCapabilities-CDSfJWhw.js} +0 -0
  42. /package/dist/ui/assets/{pause-Cm9LzIZK.js → pause-BAMsNQkh.js} +0 -0
  43. /package/dist/ui/assets/{pencil-L3Li7_pz.js → pencil-CKritjT_.js} +0 -0
  44. /package/dist/ui/assets/{play-zqogwA2l.js → play-Cwpe4tp6.js} +0 -0
  45. /package/dist/ui/assets/{plus-Bm08ABhc.js → plus-RD44ce15.js} +0 -0
  46. /package/dist/ui/assets/{radio-Cii1BjMt.js → radio-lFPMHi6-.js} +0 -0
  47. /package/dist/ui/assets/{refresh-cw-DXv3XgEt.js → refresh-cw-DtJMHRHO.js} +0 -0
  48. /package/dist/ui/assets/{rotate-ccw-LoM1AuqK.js → rotate-ccw-b3E_4PoX.js} +0 -0
  49. /package/dist/ui/assets/{search-BMwCI-pX.js → search-z2oZt00P.js} +0 -0
  50. /package/dist/ui/assets/{send-D6fgWV7m.js → send-CpoY_2F-.js} +0 -0
@@ -0,0 +1,727 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{f as t}from"./vendor-charts-K3xcRl0X.js";import{n,t as r}from"./vendor-react-kUOwxn0g.js";import{o as i}from"./vendor-query-Dj8xYhQD.js";import{t as a}from"./createLucideIcon-BRaPSYgN.js";import{t as o}from"./activity-C_GS5wrG.js";import{t as s}from"./arrow-right-BuNjN-bk.js";import{t as c}from"./chevron-down-8GjmTjLR.js";import{t as l}from"./chevron-left-GK4EQOyZ.js";import{t as u}from"./chevron-right-BupZqrxu.js";import{t as d}from"./chevron-up-DZrzJIW8.js";import{t as f}from"./circle-check-BKNT2_q6.js";import{n as p,t as m}from"./useOfficeModel-BaDn7U-X.js";import{t as h}from"./gauge-CEu7PhTW.js";import{t as g}from"./radio-lFPMHi6-.js";import{t as _}from"./send-CpoY_2F-.js";import{t as v}from"./volume-2-EaA0JRvD.js";import{t as y}from"./volume-x-CROXNMGT.js";import{n as b,t as x}from"./wifi-BUJuOcgP.js";import{r as S}from"./gateway-url-BALS_wVh.js";import{N as C,O as w,Q as T,_ as E,at as D,q as O}from"./index-C5Hhusqq.js";import{A as k,At as A,Ct as j,E as M,Mt as N,Ot as P,P as F,Pt as I,Q as L,S as R,X as z,Z as B,b as V,bt as H,c as ee,ct as te,d as ne,f as U,h as re,ht as ie,i as ae,j as oe,jt as W,l as se,lt as ce,m as le,mt as ue,n as de,s as fe,st as pe,t as me,u as he,v as ge,y as G,z as _e}from"./Vignette-bSrGVyRd.js";var ve=a(`Crown`,[[`path`,{d:`M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z`,key:`1vdc57`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),ye=a(`SearchCheck`,[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),K=r(),q=e(t(),1);function be(){let e=(0,K.c)(9),{agents:t,fetchAgents:n}=E(),r=C(we),i=C(Ce),a=C(Se),o=C(xe),s,c;e[0]===n?(s=e[1],c=e[2]):(s=()=>{n()},c=[n],e[0]=n,e[1]=s,e[2]=c),(0,q.useEffect)(s,c);let{coordinator:l,desks:u,interactions:d}=m(t,r,i),f;return e[3]!==l||e[4]!==u||e[5]!==d||e[6]!==o||e[7]!==a?(f={coordinator:l,desks:u,interactions:d,workEvents:a,isConnected:o},e[3]=l,e[4]=u,e[5]=d,e[6]=o,e[7]=a,e[8]=f):f=e[8],f}function xe(e){return e.isConnected}function Se(e){return e.workEvents}function Ce(e){return e.graphEdges}function we(e){return e.graphNodes}function Te(){return typeof window>`u`?!1:window.localStorage.getItem(`office3d-sound`)===`on`}var J=S(e=>({selectedAgentId:null,quality:`high`,motion:`calm`,introDone:!1,soundEnabled:Te(),activeCue:null,select:t=>e({selectedAgentId:t}),setQuality:t=>e({quality:t}),setMotion:t=>e({motion:t}),setIntroDone:()=>e({introDone:!0}),setSoundEnabled:t=>{typeof window<`u`&&window.localStorage.setItem(`office3d-sound`,t?`on`:`off`),e({soundEnabled:t})},setActiveCue:t=>e({activeCue:t})})),Ee=`#a78bfa`,De=`#94a3b8`,Oe={context:`Contexto`,iteration:`Iteración`,parallel:`Paralelismo`};function ke(e){return Oe[e]}function Ae(e){return e?.backend===`kev`?`Kev`:`Jev`}function je(e){return e===`ready`?`activo`:e===`fallback`?`flujo clásico`:`desactivado`}function Me(e){let t=Math.abs(e);return t<1e3?String(Math.round(t)):`${(t/1e3).toLocaleString(`es`,{maximumFractionDigits:1})}k`}function Ne(e){return Math.abs(e)<50?null:`${e>0?`−`:`+`}${Me(e)} tok`}function Pe(e){return e===0?`$0`:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(3)}`}function Fe(){let e=(0,K.c)(6),t=C(Be),n=C(ze),r=C(Re),i,a;e[0]===r?(i=e[1],a=e[2]):(i=()=>{if(C.getState().jevStatus)return;let e=!1;return w(`/api/providers`).then(t=>{let{providers:n}=t,i=n.find(Le)?.jev;!e&&i&&!C.getState().jevStatus&&r(i)}).catch(Ie),()=>{e=!0}},a=[r],e[0]=r,e[1]=i,e[2]=a),(0,q.useEffect)(i,a);let o;return e[3]!==n||e[4]!==t?(o={status:t,decisions:n},e[3]=n,e[4]=t,e[5]=o):o=e[5],o}function Ie(){}function Le(e){return e.id===`openrouter`}function Re(e){return e.setJevStatus}function ze(e){return e.jevDecisions}function Be(e){return e.jevStatus}var Ve=e(n()),He=new W,Ue=new W,We=new W,Ge=new A;function Ke(e,t,n){let r=He.setFromMatrixPosition(e.matrixWorld);r.project(t);let i=n.width/2,a=n.height/2;return[r.x*i+i,-(r.y*a)+a]}function qe(e,t){let n=He.setFromMatrixPosition(e.matrixWorld),r=Ue.setFromMatrixPosition(t.matrixWorld),i=n.sub(r),a=t.getWorldDirection(We);return i.angleTo(a)>Math.PI/2}function Je(e,t,n,r){let i=He.setFromMatrixPosition(e.matrixWorld),a=i.clone();a.project(t),Ge.set(a.x,a.y),n.setFromCamera(Ge,t);let o=n.intersectObjects(r,!0);if(o.length){let e=o[0].distance;return i.distanceTo(n.ray.origin)<e}return!0}function Ye(e,t){if(t instanceof te)return t.zoom;if(t instanceof ce){let n=He.setFromMatrixPosition(e.matrixWorld),r=Ue.setFromMatrixPosition(t.matrixWorld),i=t.fov*Math.PI/180,a=n.distanceTo(r);return 1/(2*Math.tan(i/2)*a)}else return 1}function Xe(e,t,n){if(t instanceof ce||t instanceof te){let r=He.setFromMatrixPosition(e.matrixWorld),i=Ue.setFromMatrixPosition(t.matrixWorld),a=r.distanceTo(i),o=(n[1]-n[0])/(t.far-t.near),s=n[1]-o*t.far;return Math.round(o*a+s)}}var Ze=e=>Math.abs(e)<1e-10?0:e;function Qe(e,t,n=``){let r=`matrix3d(`;for(let n=0;n!==16;n++)r+=Ze(t[n]*e.elements[n])+(n===15?`)`:`,`);return n+r}var $e=(e=>t=>Qe(t,e))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),et=(e=>(t,n)=>Qe(t,e(n),`translate(-50%,-50%)`))(e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1]);function tt(e){return e&&typeof e==`object`&&`current`in e}var nt=q.forwardRef(({children:e,eps:t=.001,style:n,className:r,prepend:i,center:a,fullscreen:o,portal:s,distanceFactor:c,sprite:l=!1,transform:u=!1,occlude:d,onOcclude:f,castShadow:p,receiveShadow:m,material:h,geometry:g,zIndexRange:_=[16777271,0],calculatePosition:v=Ke,as:y=`div`,wrapperClass:b,pointerEvents:x=`auto`,...S},C)=>{let{gl:w,camera:T,scene:E,size:D,raycaster:O,events:k,viewport:A}=le(),[j]=q.useState(()=>document.createElement(y)),M=q.useRef(),N=q.useRef(null),P=q.useRef(0),F=q.useRef([0,0]),I=q.useRef(null),L=q.useRef(null),R=s?.current||k.connected||w.domElement.parentNode,z=q.useRef(null),B=q.useRef(!1),V=q.useMemo(()=>d&&d!==`blending`||Array.isArray(d)&&d.length&&tt(d[0]),[d]);q.useLayoutEffect(()=>{let e=w.domElement;d&&d===`blending`?(e.style.zIndex=`${Math.floor(_[0]/2)}`,e.style.position=`absolute`,e.style.pointerEvents=`none`):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[d]),q.useLayoutEffect(()=>{if(N.current){let e=M.current=Ve.createRoot(j);if(E.updateMatrixWorld(),u)j.style.cssText=`position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;`;else{let e=v(N.current,T,D);j.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return R&&(i?R.prepend(j):R.appendChild(j)),()=>{R&&R.removeChild(j),e.unmount()}}},[R,u]),q.useLayoutEffect(()=>{b&&(j.className=b)},[b]);let H=q.useMemo(()=>u?{position:`absolute`,top:0,left:0,width:D.width,height:D.height,transformStyle:`preserve-3d`,pointerEvents:`none`}:{position:`absolute`,transform:a?`translate3d(-50%,-50%,0)`:`none`,...o&&{top:-D.height/2,left:-D.width/2,width:D.width,height:D.height},...n},[n,a,o,D,u]),ee=q.useMemo(()=>({position:`absolute`,pointerEvents:x}),[x]);q.useLayoutEffect(()=>{if(B.current=!1,u){var t;(t=M.current)==null||t.render(q.createElement(`div`,{ref:I,style:H},q.createElement(`div`,{ref:L,style:ee},q.createElement(`div`,{ref:C,className:r,style:n,children:e}))))}else{var i;(i=M.current)==null||i.render(q.createElement(`div`,{ref:C,style:H,className:r,children:e}))}});let te=q.useRef(!0);U(e=>{if(N.current){T.updateMatrixWorld(),N.current.updateWorldMatrix(!0,!1);let e=u?F.current:v(N.current,T,D);if(u||Math.abs(P.current-T.zoom)>t||Math.abs(F.current[0]-e[0])>t||Math.abs(F.current[1]-e[1])>t){let t=qe(N.current,T),n=!1;V&&(Array.isArray(d)?n=d.map(e=>e.current):d!==`blending`&&(n=[E]));let r=te.current;n?te.current=Je(N.current,T,O,n)&&!t:te.current=!t,r!==te.current&&(f?f(!te.current):j.style.display=te.current?`block`:`none`);let i=Math.floor(_[0]/2),a=d?V?[_[0],i]:[i-1,0]:_;if(j.style.zIndex=`${Xe(N.current,T,a)}`,u){let[e,t]=[D.width/2,D.height/2],n=T.projectionMatrix.elements[5]*t,{isOrthographicCamera:r,top:i,left:a,bottom:o,right:s}=T,u=$e(T.matrixWorldInverse),d=r?`scale(${n})translate(${Ze(-(s+a)/2)}px,${Ze((i+o)/2)}px)`:`translateZ(${n}px)`,f=N.current.matrixWorld;l&&(f=T.matrixWorldInverse.clone().transpose().copyPosition(f).scale(N.current.scale),f.elements[3]=f.elements[7]=f.elements[11]=0,f.elements[15]=1),j.style.width=D.width+`px`,j.style.height=D.height+`px`,j.style.perspective=r?``:`${n}px`,I.current&&L.current&&(I.current.style.transform=`${d}${u}translate(${e}px,${t}px)`,L.current.style.transform=et(f,1/((c||10)/400)))}else{let t=c===void 0?1:Ye(N.current,T)*c;j.style.transform=`translate3d(${e[0]}px,${e[1]}px,0) scale(${t})`}F.current=e,P.current=T.zoom}}if(!V&&z.current&&!B.current)if(u){if(I.current){let e=I.current.children[0];if(e!=null&&e.clientWidth&&e!=null&&e.clientHeight){let{isOrthographicCamera:t}=T;if(t||g)S.scale&&(Array.isArray(S.scale)?S.scale instanceof W?z.current.scale.copy(S.scale.clone().divideScalar(1)):z.current.scale.set(1/S.scale[0],1/S.scale[1],1/S.scale[2]):z.current.scale.setScalar(1/S.scale));else{let t=(c||10)/400,n=e.clientWidth*t,r=e.clientHeight*t;z.current.scale.set(n,r,1)}B.current=!0}}}else{let t=j.children[0];if(t!=null&&t.clientWidth&&t!=null&&t.clientHeight){let e=1/A.factor,n=t.clientWidth*e,r=t.clientHeight*e;z.current.scale.set(n,r,1),B.current=!0}z.current.lookAt(e.camera.position)}});let ne=q.useMemo(()=>({vertexShader:u?void 0:`
2
+ /*
3
+ This shader is from the THREE's SpriteMaterial.
4
+ We need to turn the backing plane into a Sprite
5
+ (make it always face the camera) if "transfrom"
6
+ is false.
7
+ */
8
+ #include <common>
9
+
10
+ void main() {
11
+ vec2 center = vec2(0., 1.);
12
+ float rotation = 0.0;
13
+
14
+ // This is somewhat arbitrary, but it seems to work well
15
+ // Need to figure out how to derive this dynamically if it even matters
16
+ float size = 0.03;
17
+
18
+ vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
19
+ vec2 scale;
20
+ scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
21
+ scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
22
+
23
+ bool isPerspective = isPerspectiveMatrix( projectionMatrix );
24
+ if ( isPerspective ) scale *= - mvPosition.z;
25
+
26
+ vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
27
+ vec2 rotatedPosition;
28
+ rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
29
+ rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
30
+ mvPosition.xy += rotatedPosition;
31
+
32
+ gl_Position = projectionMatrix * mvPosition;
33
+ }
34
+ `,fragmentShader:`
35
+ void main() {
36
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
37
+ }
38
+ `}),[u]);return q.createElement(`group`,se({},S,{ref:N}),d&&!V&&q.createElement(`mesh`,{castShadow:p,receiveShadow:m,ref:z},g||q.createElement(`planeGeometry`,null),h||q.createElement(`shaderMaterial`,{side:2,vertexShader:ne.vertexShader,fragmentShader:ne.fragmentShader})))}),rt=ee>=125?`uv1`:`uv2`,it=new ge,at=new W,ot=class extends k{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type=`LineSegmentsGeometry`,this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute(`position`,new M([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute(`uv`,new M([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new oe(t,6,1);return this.setAttribute(`instanceStart`,new F(n,3,0)),this.setAttribute(`instanceEnd`,new F(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e,t=3){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));let r=new oe(n,t*2,1);return this.setAttribute(`instanceColorStart`,new F(r,t,0)),this.setAttribute(`instanceColorEnd`,new F(r,t,t)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new I(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ge);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),it.setFromBufferAttribute(t),this.boundingBox.union(it))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new j),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let i=0,a=e.count;i<a;i++)at.fromBufferAttribute(e,i),r=Math.max(r,n.distanceToSquared(at)),at.fromBufferAttribute(t,i),r=Math.max(r,n.distanceToSquared(at));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error(`THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.`,this)}}toJSON(){}applyMatrix(e){return console.warn(`THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().`),this.applyMatrix4(e)}},st=class extends ot{constructor(){super(),this.isLineGeometry=!0,this.type=`LineGeometry`}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e,t=3){let n=e.length-t,r=new Float32Array(2*n);if(t===3)for(let i=0;i<n;i+=t)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];else for(let i=0;i<n;i+=t)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5],r[2*i+6]=e[i+6],r[2*i+7]=e[i+7];return super.setColors(r,t),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}},ct=class extends H{constructor(e){super({type:`LineMaterial`,uniforms:P.clone(P.merge([re.common,re.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new A(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}}])),vertexShader:`
39
+ #include <common>
40
+ #include <fog_pars_vertex>
41
+ #include <logdepthbuf_pars_vertex>
42
+ #include <clipping_planes_pars_vertex>
43
+
44
+ uniform float linewidth;
45
+ uniform vec2 resolution;
46
+
47
+ attribute vec3 instanceStart;
48
+ attribute vec3 instanceEnd;
49
+
50
+ #ifdef USE_COLOR
51
+ #ifdef USE_LINE_COLOR_ALPHA
52
+ varying vec4 vLineColor;
53
+ attribute vec4 instanceColorStart;
54
+ attribute vec4 instanceColorEnd;
55
+ #else
56
+ varying vec3 vLineColor;
57
+ attribute vec3 instanceColorStart;
58
+ attribute vec3 instanceColorEnd;
59
+ #endif
60
+ #endif
61
+
62
+ #ifdef WORLD_UNITS
63
+
64
+ varying vec4 worldPos;
65
+ varying vec3 worldStart;
66
+ varying vec3 worldEnd;
67
+
68
+ #ifdef USE_DASH
69
+
70
+ varying vec2 vUv;
71
+
72
+ #endif
73
+
74
+ #else
75
+
76
+ varying vec2 vUv;
77
+
78
+ #endif
79
+
80
+ #ifdef USE_DASH
81
+
82
+ uniform float dashScale;
83
+ attribute float instanceDistanceStart;
84
+ attribute float instanceDistanceEnd;
85
+ varying float vLineDistance;
86
+
87
+ #endif
88
+
89
+ void trimSegment( const in vec4 start, inout vec4 end ) {
90
+
91
+ // trim end segment so it terminates between the camera plane and the near plane
92
+
93
+ // conservative estimate of the near plane
94
+ float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
95
+ float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
96
+ float nearEstimate = - 0.5 * b / a;
97
+
98
+ float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
99
+
100
+ end.xyz = mix( start.xyz, end.xyz, alpha );
101
+
102
+ }
103
+
104
+ void main() {
105
+
106
+ #ifdef USE_COLOR
107
+
108
+ vLineColor = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
109
+
110
+ #endif
111
+
112
+ #ifdef USE_DASH
113
+
114
+ vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
115
+ vUv = uv;
116
+
117
+ #endif
118
+
119
+ float aspect = resolution.x / resolution.y;
120
+
121
+ // camera space
122
+ vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
123
+ vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
124
+
125
+ #ifdef WORLD_UNITS
126
+
127
+ worldStart = start.xyz;
128
+ worldEnd = end.xyz;
129
+
130
+ #else
131
+
132
+ vUv = uv;
133
+
134
+ #endif
135
+
136
+ // special case for perspective projection, and segments that terminate either in, or behind, the camera plane
137
+ // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
138
+ // but we need to perform ndc-space calculations in the shader, so we must address this issue directly
139
+ // perhaps there is a more elegant solution -- WestLangley
140
+
141
+ bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
142
+
143
+ if ( perspective ) {
144
+
145
+ if ( start.z < 0.0 && end.z >= 0.0 ) {
146
+
147
+ trimSegment( start, end );
148
+
149
+ } else if ( end.z < 0.0 && start.z >= 0.0 ) {
150
+
151
+ trimSegment( end, start );
152
+
153
+ }
154
+
155
+ }
156
+
157
+ // clip space
158
+ vec4 clipStart = projectionMatrix * start;
159
+ vec4 clipEnd = projectionMatrix * end;
160
+
161
+ // ndc space
162
+ vec3 ndcStart = clipStart.xyz / clipStart.w;
163
+ vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
164
+
165
+ // direction
166
+ vec2 dir = ndcEnd.xy - ndcStart.xy;
167
+
168
+ // account for clip-space aspect ratio
169
+ dir.x *= aspect;
170
+ dir = normalize( dir );
171
+
172
+ #ifdef WORLD_UNITS
173
+
174
+ // get the offset direction as perpendicular to the view vector
175
+ vec3 worldDir = normalize( end.xyz - start.xyz );
176
+ vec3 offset;
177
+ if ( position.y < 0.5 ) {
178
+
179
+ offset = normalize( cross( start.xyz, worldDir ) );
180
+
181
+ } else {
182
+
183
+ offset = normalize( cross( end.xyz, worldDir ) );
184
+
185
+ }
186
+
187
+ // sign flip
188
+ if ( position.x < 0.0 ) offset *= - 1.0;
189
+
190
+ float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
191
+
192
+ // don't extend the line if we're rendering dashes because we
193
+ // won't be rendering the endcaps
194
+ #ifndef USE_DASH
195
+
196
+ // extend the line bounds to encompass endcaps
197
+ start.xyz += - worldDir * linewidth * 0.5;
198
+ end.xyz += worldDir * linewidth * 0.5;
199
+
200
+ // shift the position of the quad so it hugs the forward edge of the line
201
+ offset.xy -= dir * forwardOffset;
202
+ offset.z += 0.5;
203
+
204
+ #endif
205
+
206
+ // endcaps
207
+ if ( position.y > 1.0 || position.y < 0.0 ) {
208
+
209
+ offset.xy += dir * 2.0 * forwardOffset;
210
+
211
+ }
212
+
213
+ // adjust for linewidth
214
+ offset *= linewidth * 0.5;
215
+
216
+ // set the world position
217
+ worldPos = ( position.y < 0.5 ) ? start : end;
218
+ worldPos.xyz += offset;
219
+
220
+ // project the worldpos
221
+ vec4 clip = projectionMatrix * worldPos;
222
+
223
+ // shift the depth of the projected points so the line
224
+ // segments overlap neatly
225
+ vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
226
+ clip.z = clipPose.z * clip.w;
227
+
228
+ #else
229
+
230
+ vec2 offset = vec2( dir.y, - dir.x );
231
+ // undo aspect ratio adjustment
232
+ dir.x /= aspect;
233
+ offset.x /= aspect;
234
+
235
+ // sign flip
236
+ if ( position.x < 0.0 ) offset *= - 1.0;
237
+
238
+ // endcaps
239
+ if ( position.y < 0.0 ) {
240
+
241
+ offset += - dir;
242
+
243
+ } else if ( position.y > 1.0 ) {
244
+
245
+ offset += dir;
246
+
247
+ }
248
+
249
+ // adjust for linewidth
250
+ offset *= linewidth;
251
+
252
+ // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
253
+ offset /= resolution.y;
254
+
255
+ // select end
256
+ vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
257
+
258
+ // back to clip space
259
+ offset *= clip.w;
260
+
261
+ clip.xy += offset;
262
+
263
+ #endif
264
+
265
+ gl_Position = clip;
266
+
267
+ vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
268
+
269
+ #include <logdepthbuf_vertex>
270
+ #include <clipping_planes_vertex>
271
+ #include <fog_vertex>
272
+
273
+ }
274
+ `,fragmentShader:`
275
+ uniform vec3 diffuse;
276
+ uniform float opacity;
277
+ uniform float linewidth;
278
+
279
+ #ifdef USE_DASH
280
+
281
+ uniform float dashOffset;
282
+ uniform float dashSize;
283
+ uniform float gapSize;
284
+
285
+ #endif
286
+
287
+ varying float vLineDistance;
288
+
289
+ #ifdef WORLD_UNITS
290
+
291
+ varying vec4 worldPos;
292
+ varying vec3 worldStart;
293
+ varying vec3 worldEnd;
294
+
295
+ #ifdef USE_DASH
296
+
297
+ varying vec2 vUv;
298
+
299
+ #endif
300
+
301
+ #else
302
+
303
+ varying vec2 vUv;
304
+
305
+ #endif
306
+
307
+ #include <common>
308
+ #include <fog_pars_fragment>
309
+ #include <logdepthbuf_pars_fragment>
310
+ #include <clipping_planes_pars_fragment>
311
+
312
+ #ifdef USE_COLOR
313
+ #ifdef USE_LINE_COLOR_ALPHA
314
+ varying vec4 vLineColor;
315
+ #else
316
+ varying vec3 vLineColor;
317
+ #endif
318
+ #endif
319
+
320
+ vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
321
+
322
+ float mua;
323
+ float mub;
324
+
325
+ vec3 p13 = p1 - p3;
326
+ vec3 p43 = p4 - p3;
327
+
328
+ vec3 p21 = p2 - p1;
329
+
330
+ float d1343 = dot( p13, p43 );
331
+ float d4321 = dot( p43, p21 );
332
+ float d1321 = dot( p13, p21 );
333
+ float d4343 = dot( p43, p43 );
334
+ float d2121 = dot( p21, p21 );
335
+
336
+ float denom = d2121 * d4343 - d4321 * d4321;
337
+
338
+ float numer = d1343 * d4321 - d1321 * d4343;
339
+
340
+ mua = numer / denom;
341
+ mua = clamp( mua, 0.0, 1.0 );
342
+ mub = ( d1343 + d4321 * ( mua ) ) / d4343;
343
+ mub = clamp( mub, 0.0, 1.0 );
344
+
345
+ return vec2( mua, mub );
346
+
347
+ }
348
+
349
+ void main() {
350
+
351
+ #include <clipping_planes_fragment>
352
+
353
+ #ifdef USE_DASH
354
+
355
+ if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
356
+
357
+ if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
358
+
359
+ #endif
360
+
361
+ float alpha = opacity;
362
+
363
+ #ifdef WORLD_UNITS
364
+
365
+ // Find the closest points on the view ray and the line segment
366
+ vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
367
+ vec3 lineDir = worldEnd - worldStart;
368
+ vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
369
+
370
+ vec3 p1 = worldStart + lineDir * params.x;
371
+ vec3 p2 = rayEnd * params.y;
372
+ vec3 delta = p1 - p2;
373
+ float len = length( delta );
374
+ float norm = len / linewidth;
375
+
376
+ #ifndef USE_DASH
377
+
378
+ #ifdef USE_ALPHA_TO_COVERAGE
379
+
380
+ float dnorm = fwidth( norm );
381
+ alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
382
+
383
+ #else
384
+
385
+ if ( norm > 0.5 ) {
386
+
387
+ discard;
388
+
389
+ }
390
+
391
+ #endif
392
+
393
+ #endif
394
+
395
+ #else
396
+
397
+ #ifdef USE_ALPHA_TO_COVERAGE
398
+
399
+ // artifacts appear on some hardware if a derivative is taken within a conditional
400
+ float a = vUv.x;
401
+ float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
402
+ float len2 = a * a + b * b;
403
+ float dlen = fwidth( len2 );
404
+
405
+ if ( abs( vUv.y ) > 1.0 ) {
406
+
407
+ alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
408
+
409
+ }
410
+
411
+ #else
412
+
413
+ if ( abs( vUv.y ) > 1.0 ) {
414
+
415
+ float a = vUv.x;
416
+ float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
417
+ float len2 = a * a + b * b;
418
+
419
+ if ( len2 > 1.0 ) discard;
420
+
421
+ }
422
+
423
+ #endif
424
+
425
+ #endif
426
+
427
+ vec4 diffuseColor = vec4( diffuse, alpha );
428
+ #ifdef USE_COLOR
429
+ #ifdef USE_LINE_COLOR_ALPHA
430
+ diffuseColor *= vLineColor;
431
+ #else
432
+ diffuseColor.rgb *= vLineColor;
433
+ #endif
434
+ #endif
435
+
436
+ #include <logdepthbuf_fragment>
437
+
438
+ gl_FragColor = diffuseColor;
439
+
440
+ #include <tonemapping_fragment>
441
+ #include <${ee>=154?`colorspace_fragment`:`encodings_fragment`}>
442
+ #include <fog_fragment>
443
+ #include <premultiplied_alpha_fragment>
444
+
445
+ }
446
+ `,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA=`1`:delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return`WORLD_UNITS`in this.defines},set:function(e){e===!0?this.defines.WORLD_UNITS=``:delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return`USE_DASH`in this.defines},set(e){!!e!=`USE_DASH`in this.defines&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH=``:delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return`USE_ALPHA_TO_COVERAGE`in this.defines},set:function(e){!!e!=`USE_ALPHA_TO_COVERAGE`in this.defines&&(this.needsUpdate=!0),e===!0?(this.defines.USE_ALPHA_TO_COVERAGE=``,this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}},lt=new N,ut=new W,dt=new W,Y=new N,X=new N,ft=new N,pt=new W,mt=new B,Z=new _e,ht=new W,gt=new ge,_t=new j,vt=new N,yt,bt;function xt(e,t,n){return vt.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),vt.multiplyScalar(1/vt.w),vt.x=bt/n.width,vt.y=bt/n.height,vt.applyMatrix4(e.projectionMatrixInverse),vt.multiplyScalar(1/vt.w),Math.abs(Math.max(vt.x,vt.y))}function St(e,t){let n=e.matrixWorld,r=e.geometry,i=r.attributes.instanceStart,a=r.attributes.instanceEnd,o=Math.min(r.instanceCount,i.count);for(let r=0,s=o;r<s;r++){Z.start.fromBufferAttribute(i,r),Z.end.fromBufferAttribute(a,r),Z.applyMatrix4(n);let o=new W,s=new W;yt.distanceSqToSegment(Z.start,Z.end,s,o),s.distanceTo(o)<bt*.5&&t.push({point:s,pointOnLine:o,distance:yt.origin.distanceTo(s),object:e,face:null,faceIndex:r,uv:null,[rt]:null})}}function Ct(e,t,n){let r=t.projectionMatrix,i=e.material.resolution,a=e.matrixWorld,o=e.geometry,s=o.attributes.instanceStart,c=o.attributes.instanceEnd,l=Math.min(o.instanceCount,s.count),u=-t.near;yt.at(1,ft),ft.w=1,ft.applyMatrix4(t.matrixWorldInverse),ft.applyMatrix4(r),ft.multiplyScalar(1/ft.w),ft.x*=i.x/2,ft.y*=i.y/2,ft.z=0,pt.copy(ft),mt.multiplyMatrices(t.matrixWorldInverse,a);for(let t=0,o=l;t<o;t++){if(Y.fromBufferAttribute(s,t),X.fromBufferAttribute(c,t),Y.w=1,X.w=1,Y.applyMatrix4(mt),X.applyMatrix4(mt),Y.z>u&&X.z>u)continue;if(Y.z>u){let e=Y.z-X.z,t=(Y.z-u)/e;Y.lerp(X,t)}else if(X.z>u){let e=X.z-Y.z,t=(X.z-u)/e;X.lerp(Y,t)}Y.applyMatrix4(r),X.applyMatrix4(r),Y.multiplyScalar(1/Y.w),X.multiplyScalar(1/X.w),Y.x*=i.x/2,Y.y*=i.y/2,X.x*=i.x/2,X.y*=i.y/2,Z.start.copy(Y),Z.start.z=0,Z.end.copy(X),Z.end.z=0;let o=Z.closestPointToPointParameter(pt,!0);Z.at(o,ht);let l=z.lerp(Y.z,X.z,o),d=l>=-1&&l<=1,f=pt.distanceTo(ht)<bt*.5;if(d&&f){Z.start.fromBufferAttribute(s,t),Z.end.fromBufferAttribute(c,t),Z.start.applyMatrix4(a),Z.end.applyMatrix4(a);let r=new W,i=new W;yt.distanceSqToSegment(Z.start,Z.end,i,r),n.push({point:i,pointOnLine:r,distance:yt.origin.distanceTo(i),object:e,face:null,faceIndex:t,uv:null,[rt]:null})}}}var wt=class extends L{constructor(e=new ot,t=new ct({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type=`LineSegments2`}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let e=0,i=0,a=t.count;e<a;e++,i+=2)ut.fromBufferAttribute(t,e),dt.fromBufferAttribute(n,e),r[i]=i===0?0:r[i-1],r[i+1]=r[i]+ut.distanceTo(dt);let i=new oe(r,2,1);return e.setAttribute(`instanceDistanceStart`,new F(i,1,0)),e.setAttribute(`instanceDistanceEnd`,new F(i,1,1)),this}raycast(e,t){let n=this.material.worldUnits,r=e.camera;r===null&&!n&&console.error(`LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.`);let i=e.params.Line2===void 0?0:e.params.Line2.threshold||0;yt=e.ray;let a=this.matrixWorld,o=this.geometry,s=this.material;bt=s.linewidth+i,o.boundingSphere===null&&o.computeBoundingSphere(),_t.copy(o.boundingSphere).applyMatrix4(a);let c;if(c=n?bt*.5:xt(r,Math.max(r.near,_t.distanceToPoint(yt.origin)),s.resolution),_t.radius+=c,yt.intersectsSphere(_t)===!1)return;o.boundingBox===null&&o.computeBoundingBox(),gt.copy(o.boundingBox).applyMatrix4(a);let l;l=n?bt*.5:xt(r,Math.max(r.near,gt.distanceToPoint(yt.origin)),s.resolution),gt.expandByScalar(l),yt.intersectsBox(gt)!==!1&&(n?St(this,t):Ct(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(lt),this.material.uniforms.resolution.value.set(lt.z,lt.w))}},Tt=class extends wt{constructor(e=new st,t=new ct({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type=`Line2`}},Et=q.forwardRef(function({points:e,color:t=16777215,vertexColors:n,linewidth:r,lineWidth:i,segments:a,dashed:o,...s},c){var l;let u=le(e=>e.size),d=q.useMemo(()=>a?new wt:new Tt,[a]),[f]=q.useState(()=>new ct),p=(n==null||(l=n[0])==null?void 0:l.length)===4?4:3,m=q.useMemo(()=>{let r=a?new ot:new st,i=e.map(e=>{let t=Array.isArray(e);return e instanceof W||e instanceof N?[e.x,e.y,e.z]:e instanceof A?[e.x,e.y,0]:t&&e.length===3?[e[0],e[1],e[2]]:t&&e.length===2?[e[0],e[1],0]:e});if(r.setPositions(i.flat()),n){t=16777215;let e=n.map(e=>e instanceof R?e.toArray():e);r.setColors(e.flat(),p)}return r},[e,a,n,p]);return q.useLayoutEffect(()=>{d.computeLineDistances()},[e,d]),q.useLayoutEffect(()=>{o?f.defines.USE_DASH=``:delete f.defines.USE_DASH,f.needsUpdate=!0},[o,f]),q.useEffect(()=>()=>{m.dispose(),f.dispose()},[m]),q.createElement(`primitive`,se({object:d,ref:c},s),q.createElement(`primitive`,{object:m,attach:`geometry`}),q.createElement(`primitive`,se({object:f,attach:`material`,color:t,vertexColors:!!n,resolution:[u.width,u.height],linewidth:r??i??1,dashed:o,transparent:p===4},s)))}),Dt=new W,Ot=q.forwardRef(function({start:e=[0,0,0],end:t=[0,0,0],mid:n,segments:r=20,...i},a){let o=q.useRef(null);q.useImperativeHandle(a,()=>o.current);let[s]=q.useState(()=>new ue(void 0,void 0,void 0)),c=q.useCallback((e,t,n,r=20)=>(e instanceof W?s.v0.copy(e):s.v0.set(...e),t instanceof W?s.v2.copy(t):s.v2.set(...t),n instanceof W?s.v1.copy(n):Array.isArray(n)?s.v1.set(...n):s.v1.copy(s.v0.clone().add(s.v2.clone().sub(s.v0)).add(Dt.set(0,s.v0.y-s.v2.y,0))),s.getPoints(r)),[]);q.useLayoutEffect(()=>{o.current.setPoints=(e,t,n)=>{let r=c(e,t,n);o.current.geometry&&o.current.geometry.setPositions(r.map(e=>e.toArray()).flat())}},[]);let l=q.useMemo(()=>c(e,t,n,r),[e,t,n,r]);return q.createElement(Et,se({ref:o,points:l},i))}),kt=Object.defineProperty,At=(e,t,n)=>t in e?kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q=(e,t,n)=>(At(e,typeof t==`symbol`?t:t+``,n),n);function jt(e,t,n,r,i){let a;if(e=e.subarray||e.slice?e:e.buffer,n=n.subarray||n.slice?n:n.buffer,e=t?e.subarray?e.subarray(t,i&&t+i):e.slice(t,i&&t+i):e,n.set)n.set(e,r);else for(a=0;a<e.length;a++)n[a+r]=e[a];return n}function Mt(e){return e instanceof Float32Array?e:e instanceof V?e.getAttribute(`position`).array:e.map(e=>{let t=Array.isArray(e);return e instanceof W?[e.x,e.y,e.z]:e instanceof A?[e.x,e.y,0]:t&&e.length===3?[e[0],e[1],e[2]]:t&&e.length===2?[e[0],e[1],0]:e}).flat()}var Nt=class extends V{constructor(){super(),Q(this,`type`,`MeshLine`),Q(this,`isMeshLine`,!0),Q(this,`positions`,[]),Q(this,`previous`,[]),Q(this,`next`,[]),Q(this,`side`,[]),Q(this,`width`,[]),Q(this,`indices_array`,[]),Q(this,`uvs`,[]),Q(this,`counters`,[]),Q(this,`widthCallback`,null),Q(this,`_attributes`),Q(this,`_points`,[]),Q(this,`points`),Q(this,`matrixWorld`,new B),Object.defineProperties(this,{points:{enumerable:!0,get(){return this._points},set(e){this.setPoints(e,this.widthCallback)}}})}setMatrixWorld(e){this.matrixWorld=e}setPoints(e,t){if(e=Mt(e),this._points=e,this.widthCallback=t??null,this.positions=[],this.counters=[],e.length&&e[0]instanceof W)for(let t=0;t<e.length;t++){let n=e[t],r=t/(e.length-1);this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(r),this.counters.push(r)}else for(let t=0;t<e.length;t+=3){let n=t/(e.length-1);this.positions.push(e[t],e[t+1],e[t+2]),this.positions.push(e[t],e[t+1],e[t+2]),this.counters.push(n),this.counters.push(n)}this.process()}compareV3(e,t){let n=e*6,r=t*6;return this.positions[n]===this.positions[r]&&this.positions[n+1]===this.positions[r+1]&&this.positions[n+2]===this.positions[r+2]}copyV3(e){let t=e*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]}process(){let e=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];let t,n;n=this.compareV3(0,e-1)?this.copyV3(e-2):this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(let r=0;r<e;r++){if(this.side.push(1),this.side.push(-1),t=this.widthCallback?this.widthCallback(r/(e-1)):1,this.width.push(t),this.width.push(t),this.uvs.push(r/(e-1),0),this.uvs.push(r/(e-1),1),r<e-1){n=this.copyV3(r),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);let e=r*2;this.indices_array.push(e,e+1,e+2),this.indices_array.push(e+2,e+1,e+3)}r>0&&(n=this.copyV3(r),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}n=this.compareV3(e-1,0)?this.copyV3(1):this.copyV3(e-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),!this._attributes||this._attributes.position.count!==this.counters.length?this._attributes={position:new G(new Float32Array(this.positions),3),previous:new G(new Float32Array(this.previous),3),next:new G(new Float32Array(this.next),3),side:new G(new Float32Array(this.side),1),width:new G(new Float32Array(this.width),1),uv:new G(new Float32Array(this.uvs),2),index:new G(new Uint16Array(this.indices_array),1),counters:new G(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute(`position`,this._attributes.position),this.setAttribute(`previous`,this._attributes.previous),this.setAttribute(`next`,this._attributes.next),this.setAttribute(`side`,this._attributes.side),this.setAttribute(`width`,this._attributes.width),this.setAttribute(`uv`,this._attributes.uv),this.setAttribute(`counters`,this._attributes.counters),this.setAttribute(`position`,this._attributes.position),this.setAttribute(`previous`,this._attributes.previous),this.setAttribute(`next`,this._attributes.next),this.setAttribute(`side`,this._attributes.side),this.setAttribute(`width`,this._attributes.width),this.setAttribute(`uv`,this._attributes.uv),this.setAttribute(`counters`,this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()}advance({x:e,y:t,z:n}){let r=this._attributes.position.array,i=this._attributes.previous.array,a=this._attributes.next.array,o=r.length;jt(r,0,i,0,o),jt(r,6,r,0,o-6),r[o-6]=e,r[o-5]=t,r[o-4]=n,r[o-3]=e,r[o-2]=t,r[o-1]=n,jt(r,6,a,0,o-6),a[o-6]=e,a[o-5]=t,a[o-4]=n,a[o-3]=e,a[o-2]=t,a[o-1]=n,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0}},Pt=`
447
+ #include <common>
448
+ #include <logdepthbuf_pars_vertex>
449
+ #include <fog_pars_vertex>
450
+ #include <clipping_planes_pars_vertex>
451
+
452
+ attribute vec3 previous;
453
+ attribute vec3 next;
454
+ attribute float side;
455
+ attribute float width;
456
+ attribute float counters;
457
+
458
+ uniform vec2 resolution;
459
+ uniform float lineWidth;
460
+ uniform vec3 color;
461
+ uniform float opacity;
462
+ uniform float sizeAttenuation;
463
+
464
+ varying vec2 vUV;
465
+ varying vec4 vColor;
466
+ varying float vCounters;
467
+
468
+ vec2 fix(vec4 i, float aspect) {
469
+ vec2 res = i.xy / i.w;
470
+ res.x *= aspect;
471
+ return res;
472
+ }
473
+
474
+ void main() {
475
+ float aspect = resolution.x / resolution.y;
476
+ vColor = vec4(color, opacity);
477
+ vUV = uv;
478
+ vCounters = counters;
479
+
480
+ mat4 m = projectionMatrix * modelViewMatrix;
481
+ vec4 finalPosition = m * vec4(position, 1.0) * aspect;
482
+ vec4 prevPos = m * vec4(previous, 1.0);
483
+ vec4 nextPos = m * vec4(next, 1.0);
484
+
485
+ vec2 currentP = fix(finalPosition, aspect);
486
+ vec2 prevP = fix(prevPos, aspect);
487
+ vec2 nextP = fix(nextPos, aspect);
488
+
489
+ float w = lineWidth * width;
490
+
491
+ vec2 dir;
492
+ if (nextP == currentP) dir = normalize(currentP - prevP);
493
+ else if (prevP == currentP) dir = normalize(nextP - currentP);
494
+ else {
495
+ vec2 dir1 = normalize(currentP - prevP);
496
+ vec2 dir2 = normalize(nextP - currentP);
497
+ dir = normalize(dir1 + dir2);
498
+
499
+ vec2 perp = vec2(-dir1.y, dir1.x);
500
+ vec2 miter = vec2(-dir.y, dir.x);
501
+ //w = clamp(w / dot(miter, perp), 0., 4. * lineWidth * width);
502
+ }
503
+
504
+ //vec2 normal = (cross(vec3(dir, 0.), vec3(0., 0., 1.))).xy;
505
+ vec4 normal = vec4(-dir.y, dir.x, 0., 1.);
506
+ normal.xy *= .5 * w;
507
+ //normal *= projectionMatrix;
508
+ if (sizeAttenuation == 0.) {
509
+ normal.xy *= finalPosition.w;
510
+ normal.xy /= (vec4(resolution, 0., 1.) * projectionMatrix).xy * aspect;
511
+ }
512
+
513
+ finalPosition.xy += normal.xy * side;
514
+ gl_Position = finalPosition;
515
+ #include <logdepthbuf_vertex>
516
+ #include <fog_vertex>
517
+ vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
518
+ #include <clipping_planes_vertex>
519
+ #include <fog_vertex>
520
+ }
521
+ `,Ft=`
522
+ #include <fog_pars_fragment>
523
+ #include <logdepthbuf_pars_fragment>
524
+ #include <clipping_planes_pars_fragment>
525
+
526
+ uniform sampler2D map;
527
+ uniform sampler2D alphaMap;
528
+ uniform float useGradient;
529
+ uniform float useMap;
530
+ uniform float useAlphaMap;
531
+ uniform float useDash;
532
+ uniform float dashArray;
533
+ uniform float dashOffset;
534
+ uniform float dashRatio;
535
+ uniform float visibility;
536
+ uniform float alphaTest;
537
+ uniform vec2 repeat;
538
+ uniform vec3 gradient[2];
539
+
540
+ varying vec2 vUV;
541
+ varying vec4 vColor;
542
+ varying float vCounters;
543
+
544
+ void main() {
545
+ #include <logdepthbuf_fragment>
546
+ vec4 diffuseColor = vColor;
547
+ if (useGradient == 1.) diffuseColor = vec4(mix(gradient[0], gradient[1], vCounters), 1.0);
548
+ if (useMap == 1.) diffuseColor *= texture2D(map, vUV * repeat);
549
+ if (useAlphaMap == 1.) diffuseColor.a *= texture2D(alphaMap, vUV * repeat).a;
550
+ if (diffuseColor.a < alphaTest) discard;
551
+ if (useDash == 1.) diffuseColor.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));
552
+ diffuseColor.a *= step(vCounters, visibility);
553
+ #include <clipping_planes_fragment>
554
+ gl_FragColor = diffuseColor;
555
+ #include <fog_fragment>
556
+ #include <tonemapping_fragment>
557
+ #include <${parseInt(`185`.replace(/\D+/g,``))>=154?`colorspace_fragment`:`encodings_fragment`}>
558
+ }
559
+ `,It=class extends H{constructor(e){super({uniforms:{...re.fog,lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new R(16777215)},gradient:{value:[new R(16711680),new R(65280)]},opacity:{value:1},resolution:{value:new A(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},useGradient:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new A(1,1)}},vertexShader:Pt,fragmentShader:Ft}),Q(this,`lineWidth`),Q(this,`map`),Q(this,`useMap`),Q(this,`alphaMap`),Q(this,`useAlphaMap`),Q(this,`color`),Q(this,`gradient`),Q(this,`resolution`),Q(this,`sizeAttenuation`),Q(this,`dashArray`),Q(this,`dashOffset`),Q(this,`dashRatio`),Q(this,`useDash`),Q(this,`useGradient`),Q(this,`visibility`),Q(this,`repeat`),this.type=`MeshLineMaterial`,Object.defineProperties(this,{lineWidth:{enumerable:!0,get(){return this.uniforms.lineWidth.value},set(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get(){return this.uniforms.map.value},set(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get(){return this.uniforms.useMap.value},set(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get(){return this.uniforms.alphaMap.value},set(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get(){return this.uniforms.useAlphaMap.value},set(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get(){return this.uniforms.color.value},set(e){this.uniforms.color.value=e}},gradient:{enumerable:!0,get(){return this.uniforms.gradient.value},set(e){this.uniforms.gradient.value=e}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get(){return this.uniforms.sizeAttenuation.value},set(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get(){return this.uniforms.dashArray.value},set(e){this.uniforms.dashArray.value=e,this.useDash=e===0?0:1}},dashOffset:{enumerable:!0,get(){return this.uniforms.dashOffset.value},set(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get(){return this.uniforms.dashRatio.value},set(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get(){return this.uniforms.useDash.value},set(e){this.uniforms.useDash.value=e}},useGradient:{enumerable:!0,get(){return this.uniforms.useGradient.value},set(e){this.uniforms.useGradient.value=e}},visibility:{enumerable:!0,get(){return this.uniforms.visibility.value},set(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get(){return this.uniforms.alphaTest.value},set(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get(){return this.uniforms.repeat.value},set(e){this.uniforms.repeat.value.copy(e)}}}),this.setValues(e)}copy(e){return super.copy(e),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.gradient=e.gradient,this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray=e.dashArray,this.dashOffset=e.dashOffset,this.dashRatio=e.dashRatio,this.useDash=e.useDash,this.useGradient=e.useGradient,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this}},Lt={width:.2,length:1,decay:1,local:!1,stride:0,interval:1},Rt=(e,t=1)=>(e.set(e.subarray(t)),e.fill(-1/0,-t),e);function zt(e,t){let{length:n,local:r,decay:i,interval:a,stride:o}={...Lt,...t},s=q.useRef(),[c]=q.useState(()=>new W);q.useLayoutEffect(()=>{e&&(s.current=Float32Array.from({length:n*10*3},(t,n)=>e.position.getComponent(n%3)))},[n,e]);let l=q.useRef(new W),u=q.useRef(0);return U(()=>{if(e&&s.current){if(u.current===0){let t;r?t=e.position:(e.getWorldPosition(c),t=c);let n=1*i;for(let e=0;e<n;e++)t.distanceTo(l.current)<o||(Rt(s.current,3),s.current.set(t.toArray(),s.current.length-3));l.current.copy(t)}u.current++,u.current%=a}}),s}var Bt=q.forwardRef((e,t)=>{let{children:n}=e,{width:r,length:i,decay:a,local:o,stride:s,interval:c}={...Lt,...e},{color:l=`hotpink`,attenuation:u,target:d}=e,f=le(e=>e.size),p=le(e=>e.scene),m=q.useRef(null),[h,g]=q.useState(null),_=zt(h,{length:i,decay:a,local:o,stride:s,interval:c});q.useEffect(()=>{let e=d?.current||m.current.children.find(e=>e instanceof pe);e&&g(e)},[_,d]);let v=q.useMemo(()=>new Nt,[]),y=q.useMemo(()=>{let e=new It({lineWidth:.1*r,color:l,sizeAttenuation:1,resolution:new A(f.width,f.height)}),t;if(n)if(Array.isArray(n))t=n.find(e=>{let t=e;return typeof t.type==`string`&&t.type===`meshLineMaterial`});else{let e=n;typeof e.type==`string`&&e.type===`meshLineMaterial`&&(t=e)}return typeof t?.props==`object`&&e.setValues(t.props),e},[r,l,f,n]);return q.useEffect(()=>{y.uniforms.resolution.value.set(f.width,f.height)},[f]),U(()=>{_.current&&v.setPoints(_.current,u)}),q.createElement(`group`,null,ne(q.createElement(`mesh`,{ref:t,geometry:v,material:y}),p),q.createElement(`group`,{ref:m},n))}),Vt=(0,q.createContext)(null);function Ht({iterations:e=10,ms:t=250,threshold:n=.75,step:r=.1,factor:i=.5,flipflops:a=1/0,bounds:o=e=>e>100?[60,100]:[40,60],onIncline:s,onDecline:c,onChange:l,onFallback:u,children:d}){let[f,p]=(0,q.useState)(()=>({fps:0,index:0,factor:i,flipped:0,refreshrate:0,fallback:!1,frames:[],averages:[],subscriptions:new Map,subscribe:e=>{let t=Symbol();return f.subscriptions.set(t,e.current),()=>void f.subscriptions.delete(t)}})),m=0;return U(()=>{let{frames:i,averages:d}=f;if(!f.fallback&&d.length<e){i.push(performance.now());let p=i[i.length-1]-i[0];if(p>=t){if(f.fps=Math.round(i.length/p*1e3*1)/1,f.refreshrate=Math.max(f.refreshrate,f.fps),d[f.index++%e]=f.fps,d.length===e){let[t,i]=o(f.refreshrate),p=d.filter(e=>e>=i),h=d.filter(e=>e<t);p.length>e*n&&(f.factor=Math.min(1,f.factor+r),f.flipped++,s&&s(f),f.subscriptions.forEach(e=>e.onIncline&&e.onIncline(f))),h.length>e*n&&(f.factor=Math.max(0,f.factor-r),f.flipped++,c&&c(f),f.subscriptions.forEach(e=>e.onDecline&&e.onDecline(f))),m!==f.factor&&(m=f.factor,l&&l(f),f.subscriptions.forEach(e=>e.onChange&&e.onChange(f))),f.flipped>a&&!f.fallback&&(f.fallback=!0,u&&u(f),f.subscriptions.forEach(e=>e.onFallback&&e.onFallback(f))),f.averages=[]}f.frames=[]}}}),q.createElement(Vt.Provider,{value:f},d)}function Ut(e,t){let n=t.clone(),r=0;e&&(r=e.distanceTo(t),n.add(e).multiplyScalar(.5));let i=Math.max(22,14+r*1.05);return{target:n,position:new W(n.x,n.y+i,n.z+.8)}}var $=i(),Wt=new W(0,46,62),Gt=new W(0,15.5,24.5),Kt=1.35,qt=new W(0,2.2,0),Jt=new W(0,15.5,24.5),Yt=new W(0,3.1,0),Xt=.025;function Zt(e){return 1-(1-e)**3}function Qt(e){let t=(0,K.c)(26),{coordinatorId:n,selectedAgentId:r,swarmRef:i,motion:a}=e,o=(0,q.useRef)(null),s=le(an),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,t[0]=c):c=t[0];let l=c,u=J(rn),d=J(nn),f=J(tn),p=(0,q.useRef)(null),m=(0,q.useRef)(!1),[h]=(0,q.useState)(en),[g]=(0,q.useState)($t),_=(0,q.useRef)(null),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v={position:Jt.clone(),target:qt.clone()},t[1]=v):v=t[1];let y=(0,q.useRef)(v),b=(0,q.useRef)(!1),x,S;t[2]!==f||t[3]!==n||t[4]!==a?(x=()=>{if(a!==`calm`||l){_.current=null;return}f?_.current={sourceId:f.actorId,targetId:f.targetId||n||f.actorId,phase:`focus`}:_.current?.phase===`focus`&&(_.current.phase=`return`)},S=[f,n,a,l],t[2]=f,t[3]=n,t[4]=a,t[5]=x,t[6]=S):(x=t[5],S=t[6]),(0,q.useEffect)(x,S);let C,w;t[7]===r?(C=t[8],w=t[9]):(C=()=>{r?b.current=!0:b.current&&(b.current=!1,_.current={sourceId:null,targetId:``,phase:`return`})},w=[r],t[7]=r,t[8]=C,t[9]=w),(0,q.useEffect)(C,w);let T;t[10]!==s||t[11]!==n||t[12]!==g||t[13]!==h||t[14]!==u||t[15]!==a||t[16]!==r||t[17]!==d||t[18]!==i?(T=(e,t)=>{if(l&&!u){s.position.copy(Jt),s.lookAt(qt),d();return}if(!u){p.current===null&&(p.current=e.clock.elapsedTime,s.position.copy(Wt));let t=Math.min(1,(e.clock.elapsedTime-p.current)/Kt);s.position.lerpVectors(Wt,Gt,Zt(t)),s.lookAt(qt),t>=1&&(y.current.position.copy(Jt),y.current.target.copy(qt),d());return}let c=o.current;if(c){if(!m.current){s.position.copy(Jt),c.target.copy(qt),y.current.position.copy(Jt),y.current.target.copy(qt),c.update(),m.current=!0;return}let e=_.current;if(e&&a===`calm`&&!l){if(e.phase===`focus`){let t=e.sourceId===n?Yt:e.sourceId?i.current.get(e.sourceId)?.pos:null,r=e.targetId===n?Yt:i.current.get(e.targetId)?.pos;if(r){let e=Ut(t??null,r);h.copy(e.target),g.copy(e.position)}}else{let e=r===n?Yt:r?i.current.get(r)?.pos:null;b.current&&e?(h.copy(e),g.set(e.x,e.y+7,e.z+11)):(h.copy(y.current.target),g.copy(y.current.position))}let a=1-.035**t,o=1-.06**t;c.target.lerp(h,a),s.position.lerp(g,o),e.phase===`return`&&c.target.distanceToSquared(h)<Xt&&s.position.distanceToSquared(g)<Xt&&(_.current=null)}else if(b.current&&r&&a===`calm`&&!l){let e=r===n?Yt:i.current.get(r)?.pos;e&&(h.copy(e),g.set(e.x,e.y+7,e.z+11),c.target.lerp(h,1-.035**t),s.position.lerp(g,1-.06**t))}c.update()}},t[10]=s,t[11]=n,t[12]=g,t[13]=h,t[14]=u,t[15]=a,t[16]=r,t[17]=d,t[18]=i,t[19]=T):T=t[19],U(T);let E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{_.current=null,b.current=!1},t[20]=E):E=t[20];let D;t[21]===s?D=t[22]:(D=()=>{let e=o.current;e&&(y.current.position.copy(s.position),y.current.target.copy(e.target))},t[21]=s,t[22]=D);let O;return t[23]!==u||t[24]!==D?(O=(0,$.jsx)(fe,{ref:o,makeDefault:!0,enabled:u,enableDamping:!0,dampingFactor:.06,enablePan:!0,minDistance:9,maxDistance:60,maxPolarAngle:1.42,autoRotate:!1,onStart:E,onEnd:D}),t[23]=u,t[24]=D,t[25]=O):O=t[25],O}function $t(){return Jt.clone()}function en(){return qt.clone()}function tn(e){return e.activeCue}function nn(e){return e.setIntroDone}function rn(e){return e.introDone}function an(e){return e.camera}var on=`
560
+ varying vec3 vWorldPos;
561
+ void main() {
562
+ vec4 world = modelMatrix * vec4(position, 1.0);
563
+ vWorldPos = world.xyz;
564
+ gl_Position = projectionMatrix * viewMatrix * world;
565
+ }
566
+ `,sn=`
567
+ varying vec3 vWorldPos;
568
+ uniform vec3 uColor;
569
+
570
+ // Distancia a aristas de un tiling hexagonal (pointy-top).
571
+ float hexEdge(vec2 p) {
572
+ p.x *= 0.57735 * 2.0;
573
+ p.y += mod(floor(p.x), 2.0) * 0.5;
574
+ p = abs(fract(p) - 0.5);
575
+ return abs(max(p.x * 1.5 + p.y, p.y * 2.0) - 1.0);
576
+ }
577
+
578
+ void main() {
579
+ vec2 uv = vWorldPos.xz;
580
+ float dist = length(uv);
581
+
582
+ // Una referencia espacial estable, sin barridos ni pulsos.
583
+ float g1 = hexEdge(uv * 0.55);
584
+ float g2 = hexEdge(uv * 2.2);
585
+ float lines = smoothstep(0.065, 0.0, g1) * 0.42 + smoothstep(0.035, 0.0, g2) * 0.035;
586
+
587
+ // Fade radial hacia el vacío
588
+ float fade = smoothstep(46.0, 14.0, dist);
589
+ float centerGlow = exp(-dist * 0.11) * 0.12;
590
+
591
+ vec3 col = uColor * (lines + centerGlow);
592
+ float alpha = clamp((lines * 0.22 + centerGlow) * fade, 0.0, 0.22);
593
+ gl_FragColor = vec4(col, alpha);
594
+ }
595
+ `;function cn(){let e=(0,K.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={uColor:{value:new R(`#4f8ff7`)}},e[0]=t):t=e[0];let n=t,r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`mesh`,{rotation:[-Math.PI/2,0,0],position:[0,.01,0],children:[(0,$.jsx)(`circleGeometry`,{args:[48,72]}),(0,$.jsx)(`shaderMaterial`,{vertexShader:on,fragmentShader:sn,uniforms:n,transparent:!0,depthWrite:!1,blending:2})]}),e[1]=r):r=e[1],r}var ln=[0,0,0],un=4.2,dn=4.4,fn=[{radius:7.5,yBase:2.8,inclination:.55},{radius:10.5,yBase:3.8,inclination:.9},{radius:13.5,yBase:4.8,inclination:1.25}],pn=Math.PI*(3-Math.sqrt(5));function mn(e,t){let n=fn[e%fn.length],r=Math.floor(e/fn.length),i=Math.max(1,Math.ceil(t/fn.length));return{radius:n.radius,yBase:n.yBase,inclination:n.inclination,phase:r*Math.PI*2/i+e%fn.length*pn*.37,angularSpeed:.05+e*7%5*.016}}function hn(e,t,n,r,i){return[Math.cos(r)*t,n+Math.sin(r)*e.inclination,Math.sin(r)*t]}function gn(e,t){return e===`disabled`||e===`archived`?0:e===`tool_call`?.65:e===`thinking`?t?.42:.2:e===`stuck`?.08:0}function _n(e,t,n){return e===`disabled`||e===`archived`?20:t?un:n}function vn(e,t,n){return e===`disabled`||e===`archived`?1.4:t?dn:n}var yn=`#f59e0b`;function bn({coordinator:e,active:t,swarmRef:n}){let r=(0,q.useRef)(null),i=(0,q.useRef)(null),a=(0,q.useRef)(null),o=(0,q.useRef)(null),s=(0,q.useRef)(null),c=(0,q.useRef)(null),l=J(t=>!!e&&t.selectedAgentId===e.id),u=J(e=>e.select),d=J(e=>e.motion),f=J(e=>e.activeCue),p=e?.status===`thinking`||e?.status===`tool_call`;return U((l,u)=>{let m=l.clock.elapsedTime,h=!!e&&(f?.actorId===e.id||f?.targetId===e.id),g=f?.actorId===e?.id?f.targetId:f?.actorId,_=g?n.current.get(g)?.pos:null;if(r.current){let e=d===`calm`&&(t||p)?Math.sin(m*2.1)*.04:0;r.current.position.y=1.05+e;let n=d===`calm`?Math.sin(m*.38)*.08:0,i=h&&_?Math.atan2(_.x,_.z):n;r.current.rotation.y=z.damp(r.current.rotation.y,i,4.5,u);let a=h&&d===`calm`?1.08:1,o=z.damp(r.current.scale.x,a,5,u);r.current.scale.setScalar(o)}let v=d===`calm`?Math.sin(m*(h?7:t||p?4.2:1.4))*(h?.34:t||p?.24:.08):0;i.current&&(i.current.rotation.z=.28+v),a.current&&(a.current.rotation.z=-.28-v),o.current&&(o.current.intensity+=((t||p?12:6)-o.current.intensity)*.04),s.current&&(s.current.rotation.y+=u*(h?1.2:.22)),c.current&&(c.current.rotation.z=h&&d===`calm`?Math.sin(m*7)*.08:0)}),(0,$.jsxs)(`group`,{position:ln,children:[(0,$.jsxs)(`mesh`,{position:[0,.3,0],children:[(0,$.jsx)(`cylinderGeometry`,{args:[2.5,2.8,.45,6]}),(0,$.jsx)(`meshStandardMaterial`,{color:`#0b0f1a`,metalness:.7,roughness:.35,emissive:yn,emissiveIntensity:l?.5:.18})]}),(0,$.jsxs)(`mesh`,{position:[0,.54,0],rotation:[-Math.PI/2,0,0],children:[(0,$.jsx)(`ringGeometry`,{args:[1.85,2.22,6]}),(0,$.jsx)(`meshBasicMaterial`,{color:yn,transparent:!0,opacity:l?.9:.48,blending:2})]}),(0,$.jsxs)(`group`,{ref:r,onClick:t=>{t.stopPropagation(),e&&u(l?null:e.id)},onPointerOver:e=>{e.stopPropagation(),document.body.style.cursor=`pointer`},onPointerOut:()=>{document.body.style.cursor=`auto`},children:[(0,$.jsxs)(`mesh`,{position:[0,1.2,0],scale:[.74,1.28,.68],children:[(0,$.jsx)(`sphereGeometry`,{args:[.72,24,20]}),(0,$.jsx)(`meshStandardMaterial`,{color:`#e6a519`,emissive:yn,emissiveIntensity:l?.8:.42,metalness:.34,roughness:.36})]}),[.58,1.02,1.46].map((e,t)=>(0,$.jsxs)(`mesh`,{position:[0,e,0],rotation:[Math.PI/2,0,0],children:[(0,$.jsx)(`torusGeometry`,{args:[.5-t*.035,.075,8,28]}),(0,$.jsx)(`meshStandardMaterial`,{color:`#251807`,metalness:.52,roughness:.48})]},e)),(0,$.jsxs)(`mesh`,{position:[0,-.02,0],rotation:[0,0,Math.PI],children:[(0,$.jsx)(`coneGeometry`,{args:[.14,.52,8]}),(0,$.jsx)(`meshStandardMaterial`,{color:`#ffcf6a`,emissive:yn,emissiveIntensity:.5})]}),(0,$.jsxs)(`mesh`,{position:[0,2.25,0],scale:[1,.9,.82],children:[(0,$.jsx)(`sphereGeometry`,{args:[.7,22,18]}),(0,$.jsx)(`meshStandardMaterial`,{color:`#593c12`,emissive:yn,emissiveIntensity:l?.55:.24,metalness:.48,roughness:.42})]}),(0,$.jsxs)(`mesh`,{position:[0,3.15,0],children:[(0,$.jsx)(`sphereGeometry`,{args:[.54,22,18]}),(0,$.jsx)(`meshStandardMaterial`,{color:`#d69113`,emissive:yn,emissiveIntensity:l?.95:.48,metalness:.38,roughness:.34})]}),[-1,1].map(e=>(0,$.jsxs)(`mesh`,{position:[e*.34,3.2,.4],scale:[1,1.18,.42],children:[(0,$.jsx)(`sphereGeometry`,{args:[.15,12,10]}),(0,$.jsx)(`meshBasicMaterial`,{color:`#fff1a8`})]},e)),(0,$.jsx)(`group`,{ref:c,position:[0,3.55,0],children:[-1,1].map(e=>(0,$.jsxs)(`group`,{rotation:[0,0,e*-.36],children:[(0,$.jsxs)(`mesh`,{position:[e*.22,.28,0],children:[(0,$.jsx)(`capsuleGeometry`,{args:[.035,.42,4,8]}),(0,$.jsx)(`meshBasicMaterial`,{color:`#ffd465`})]}),(0,$.jsxs)(`mesh`,{position:[e*.32,.53,0],children:[(0,$.jsx)(`sphereGeometry`,{args:[.07,8,8]}),(0,$.jsx)(`meshBasicMaterial`,{color:`#fff0a6`})]})]},e))}),(0,$.jsxs)(`group`,{ref:i,position:[.48,2.45,0],children:[(0,$.jsxs)(`mesh`,{position:[.62,.18,0],rotation:[.08,.15,-.18],scale:[1.65,.12,.72],children:[(0,$.jsx)(`sphereGeometry`,{args:[.48,16,12]}),(0,$.jsx)(`meshStandardMaterial`,{color:`#e8f8ff`,emissive:`#8cdcff`,emissiveIntensity:.58,transparent:!0,opacity:.48,side:2,depthWrite:!1})]}),(0,$.jsxs)(`mesh`,{position:[.46,-.34,.05],rotation:[.08,.1,.2],scale:[1.25,.1,.58],children:[(0,$.jsx)(`sphereGeometry`,{args:[.4,14,10]}),(0,$.jsx)(`meshStandardMaterial`,{color:`#dff7ff`,emissive:`#77c8ff`,emissiveIntensity:.42,transparent:!0,opacity:.38,side:2,depthWrite:!1})]})]}),(0,$.jsxs)(`group`,{ref:a,position:[-.48,2.45,0],children:[(0,$.jsxs)(`mesh`,{position:[-.62,.18,0],rotation:[.08,-.15,.18],scale:[1.65,.12,.72],children:[(0,$.jsx)(`sphereGeometry`,{args:[.48,16,12]}),(0,$.jsx)(`meshStandardMaterial`,{color:`#e8f8ff`,emissive:`#8cdcff`,emissiveIntensity:.58,transparent:!0,opacity:.48,side:2,depthWrite:!1})]}),(0,$.jsxs)(`mesh`,{position:[-.46,-.34,.05],rotation:[.08,-.1,-.2],scale:[1.25,.1,.58],children:[(0,$.jsx)(`sphereGeometry`,{args:[.4,14,10]}),(0,$.jsx)(`meshStandardMaterial`,{color:`#dff7ff`,emissive:`#77c8ff`,emissiveIntensity:.42,transparent:!0,opacity:.38,side:2,depthWrite:!1})]})]}),(0,$.jsxs)(`group`,{ref:s,position:[0,4.08,0],children:[(0,$.jsxs)(`mesh`,{rotation:[Math.PI/2,0,0],children:[(0,$.jsx)(`torusGeometry`,{args:[.48,.055,6,6]}),(0,$.jsx)(`meshBasicMaterial`,{color:`#ffe38a`,blending:2})]}),[-.4,0,.4].map((e,t)=>(0,$.jsxs)(`mesh`,{position:[e,t===1?.25:.14,0],children:[(0,$.jsx)(`coneGeometry`,{args:[.11,t===1?.48:.34,5]}),(0,$.jsx)(`meshStandardMaterial`,{color:`#ffd465`,emissive:yn,emissiveIntensity:.9,metalness:.6,roughness:.2})]},e))]})]}),(0,$.jsx)(`pointLight`,{ref:o,position:[0,3,0],color:yn,intensity:6,distance:18,decay:1.8})]})}var xn=`
596
+ varying vec2 vUv;
597
+ void main() {
598
+ vUv = uv;
599
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
600
+ }
601
+ `,Sn=`
602
+ varying vec2 vUv;
603
+ uniform vec3 uColor;
604
+ uniform float uTime;
605
+ uniform float uSpeed;
606
+ uniform float uIntensity;
607
+
608
+ void main() {
609
+ // uv.y recorre la longitud del cilindro (delegante → worker)
610
+ float flow = fract(vUv.y * 3.0 - uTime * uSpeed);
611
+ float packet = smoothstep(0.0, 0.12, flow) * smoothstep(0.42, 0.12, flow);
612
+ float flow2 = fract(vUv.y * 7.0 - uTime * uSpeed * 1.7);
613
+ float packet2 = smoothstep(0.0, 0.06, flow2) * smoothstep(0.2, 0.06, flow2);
614
+
615
+ float core = 0.3 + packet * 1.6 + packet2 * 0.9;
616
+ float ends = smoothstep(0.0, 0.05, vUv.y) * smoothstep(1.0, 0.95, vUv.y);
617
+ float glow = core * uIntensity;
618
+ gl_FragColor = vec4(uColor * glow, clamp(glow * 0.6 * ends, 0.0, 1.0));
619
+ }
620
+ `,Cn=new W(0,4.4,0),wn=new W,Tn=new W,En=new W,Dn=new W,On=new W(0,1,0),kn=new ie;function An(e){let t=(0,K.c)(11),{desks:n,interactions:r,swarmRef:i,coordinatorId:a}=e,o;if(t[0]!==a||t[1]!==n||t[2]!==r||t[3]!==i){let e;t[5]!==a||t[6]!==n||t[7]!==i?(e=e=>(0,$.jsx)(jn,{interaction:e,targetDesk:n.find(t=>t.agent.id===e.targetId)??null,swarmRef:i,coordinatorId:a},e.id),t[5]=a,t[6]=n,t[7]=i,t[8]=e):e=t[8],o=r.map(e),t[0]=a,t[1]=n,t[2]=r,t[3]=i,t[4]=o}else o=t[4];let s;return t[9]===o?s=t[10]:(s=(0,$.jsx)(`group`,{children:o}),t[9]=o,t[10]=s),s}function jn({interaction:e,targetDesk:t,swarmRef:n,coordinatorId:r}){let i=(0,q.useRef)(null),a=(0,q.useRef)(null),o=(0,q.useMemo)(()=>({uTime:{value:0},uColor:{value:new R(t?.color??`#f59e0b`)},uSpeed:{value:.52},uIntensity:{value:.82}}),[t?.color]);return U(t=>{o.uTime.value=t.clock.elapsedTime;let s=n.current.get(e.targetId);if(!s||!i.current)return;if(e.sourceId===r)wn.copy(Cn);else{let t=n.current.get(e.sourceId);if(!t){i.current.visible=!1;return}wn.copy(t.pos)}Tn.copy(s.pos),En.subVectors(Tn,wn);let c=En.length();i.current.visible=c>.5,!(c<=.5)&&(Dn.addVectors(wn,Tn).multiplyScalar(.5),i.current.position.copy(Dn),a.current?.position.copy(Dn),kn.setFromUnitVectors(On,En.normalize()),i.current.quaternion.copy(kn),i.current.scale.set(.055,c,.055))}),(0,$.jsxs)(`group`,{children:[(0,$.jsxs)(`mesh`,{ref:i,visible:!1,children:[(0,$.jsx)(`cylinderGeometry`,{args:[1,1,1,6,1,!0]}),(0,$.jsx)(`shaderMaterial`,{vertexShader:xn,fragmentShader:Sn,uniforms:o,transparent:!0,depthWrite:!1,side:2,blending:2})]}),(0,$.jsx)(`group`,{ref:a,children:(0,$.jsx)(nt,{position:[0,.55,0],center:!0,distanceFactor:24,className:`pointer-events-none select-none`,children:(0,$.jsxs)(`div`,{className:`office3d-beam-label`,style:{"--chip-color":t?.color??`#f59e0b`},children:[(0,$.jsx)(`strong`,{children:e.kind===`reviews`?`REVISIÓN EN CURSO`:`TRABAJO DELEGADO`}),e.taskName&&(0,$.jsx)(`span`,{children:e.taskName})]})})})]})}var Mn=`
621
+ attribute float aSeed;
622
+ uniform float uTime;
623
+ uniform float uPixelRatio;
624
+ varying float vSeed;
625
+ varying float vFade;
626
+
627
+ void main() {
628
+ vSeed = aSeed;
629
+ vec3 pos = position;
630
+ float t = uTime * (0.08 + aSeed * 0.12);
631
+ // Deriva orgánica
632
+ pos.x += sin(uTime * 0.25 + aSeed * 40.0) * 1.6;
633
+ pos.z += cos(uTime * 0.2 + aSeed * 31.0) * 1.6;
634
+ // Ascenso envolvente (polen que sube y reaparece abajo)
635
+ pos.y = mod(position.y + t * 6.0, 22.0);
636
+ vFade = smoothstep(0.0, 3.0, pos.y) * smoothstep(22.0, 16.0, pos.y);
637
+
638
+ vec4 mv = modelViewMatrix * vec4(pos, 1.0);
639
+ gl_PointSize = (1.4 + aSeed * 2.4) * uPixelRatio * (28.0 / -mv.z);
640
+ gl_Position = projectionMatrix * mv;
641
+ }
642
+ `,Nn=`
643
+ uniform vec3 uColor;
644
+ uniform float uOpacity;
645
+ varying float vSeed;
646
+ varying float vFade;
647
+
648
+ void main() {
649
+ vec2 c = gl_PointCoord - 0.5;
650
+ float d = length(c);
651
+ float disc = smoothstep(0.5, 0.05, d);
652
+ gl_FragColor = vec4(uColor * (0.6 + vSeed * 0.8), disc * uOpacity * vFade);
653
+ }
654
+ `,Pn=`
655
+ attribute vec3 aVel;
656
+ attribute float aSeed;
657
+ uniform float uTime;
658
+ uniform float uStart;
659
+ uniform float uPixelRatio;
660
+ varying float vLife;
661
+
662
+ void main() {
663
+ float t = clamp((uTime - uStart) / 1.4, 0.0, 1.0);
664
+ vLife = 1.0 - t;
665
+ vec3 pos = aVel * (t * 3.2 - t * t * 1.1); // desaceleración
666
+ pos.y += t * 1.2; // ligera ascensión
667
+ vec4 mv = modelViewMatrix * vec4(pos, 1.0);
668
+ gl_PointSize = (2.2 + aSeed * 2.0) * vLife * uPixelRatio * (30.0 / -mv.z);
669
+ gl_Position = projectionMatrix * mv;
670
+ }
671
+ `,Fn=`
672
+ uniform vec3 uColor;
673
+ varying float vLife;
674
+ void main() {
675
+ vec2 c = gl_PointCoord - 0.5;
676
+ float disc = smoothstep(0.5, 0.05, length(c));
677
+ gl_FragColor = vec4(uColor * (0.8 + vLife), disc * vLife);
678
+ }
679
+ `,In=780,Ln=42,Rn=22;function zn(){let e=(0,q.useRef)(null),t=le(e=>e.viewport.dpr),n=(0,q.useMemo)(()=>{let e=new V,t=new Float32Array(In*3),n=new Float32Array(In);for(let e=0;e<In;e++){let r=Math.sqrt(Math.random())*Ln,i=Math.random()*Math.PI*2;t[e*3]=Math.cos(i)*r,t[e*3+1]=Math.random()*Rn,t[e*3+2]=Math.sin(i)*r,n[e]=Math.random()}return e.setAttribute(`position`,new M(t,3)),e.setAttribute(`aSeed`,new M(n,1)),e},[]),r=(0,q.useMemo)(()=>({uTime:{value:0},uColor:{value:new R(`#6aa9ff`)},uOpacity:{value:.16},uPixelRatio:{value:t}}),[]);return U(e=>{r.uTime.value=e.clock.elapsedTime,r.uPixelRatio.value=e.viewport.dpr}),(0,$.jsx)(`points`,{geometry:n,frustumCulled:!1,children:(0,$.jsx)(`shaderMaterial`,{ref:e,vertexShader:Mn,fragmentShader:Nn,uniforms:r,transparent:!0,depthWrite:!1,blending:2})})}var Bn=64,Vn=1700,Hn=0;function Un({desks:e,swarmRef:t}){let[n,r]=(0,q.useState)([]),i=(0,q.useRef)(new Map);return(0,q.useEffect)(()=>{let n=i.current;for(let i of e){if(n.get(i.agent.id)===`tool_call`&&i.state!==`tool_call`){let e=t.current.get(i.agent.id);if(e){let t=++Hn;r(n=>[...n,{id:t,position:e.pos.toArray(),color:i.color}]),setTimeout(()=>{r(e=>e.filter(e=>e.id!==t))},Vn)}}n.set(i.agent.id,i.state)}},[e,t]),(0,$.jsx)(`group`,{children:n.map(e=>(0,$.jsx)(Wn,{burst:e},e.id))})}function Wn({burst:e}){let t=(0,q.useMemo)(()=>{let e=new V,t=new Float32Array(Bn*3),n=new Float32Array(Bn*3),r=new Float32Array(Bn);for(let e=0;e<Bn;e++){let t=Math.random()*Math.PI*2,i=Math.acos(2*Math.random()-1),a=.6+Math.random()*1.4;n[e*3]=Math.sin(i)*Math.cos(t)*a,n[e*3+1]=Math.cos(i)*a*.9,n[e*3+2]=Math.sin(i)*Math.sin(t)*a,r[e]=Math.random()}return e.setAttribute(`position`,new M(t,3)),e.setAttribute(`aVel`,new M(n,3)),e.setAttribute(`aSeed`,new M(r,1)),e},[]),n=(0,q.useMemo)(()=>({uTime:{value:0},uStart:{value:-1},uColor:{value:new R(e.color)},uPixelRatio:{value:1}}),[e.color]);return U(e=>{n.uTime.value=e.clock.elapsedTime,n.uStart.value<0&&(n.uStart.value=e.clock.elapsedTime),n.uPixelRatio.value=e.viewport.dpr}),(0,$.jsx)(`points`,{geometry:t,position:e.position,frustumCulled:!1,children:(0,$.jsx)(`shaderMaterial`,{vertexShader:Pn,fragmentShader:Fn,uniforms:n,transparent:!0,depthWrite:!1,blending:2})})}function Gn(e){let t=(0,K.c)(5),{quality:n}=e,r=n===`high`?.52:.32,i;t[0]===r?i=t[1]:(i=(0,$.jsx)(de,{mipmapBlur:!0,intensity:r,luminanceThreshold:.38,luminanceSmoothing:.22}),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(me,{offset:.34,darkness:.38}),t[2]=a):a=t[2];let o;return t[3]===i?o=t[4]:(o=(0,$.jsxs)(ae,{multisampling:0,children:[i,a]}),t[3]=i,t[4]=o),o}var Kn=new W;function qn(e){let t=(0,K.c)(11),{desks:n,swarmRef:r,motion:i}=e,a;if(t[0]!==n){let e;t[2]===n.length?e=t[3]:(e=(e,t)=>[e.agent.id,mn(t,n.length)],t[2]=n.length,t[3]=e),a=new Map(n.map(e)),t[0]=n,t[1]=a}else a=t[1];let o=a,s=(0,q.useRef)(n),c,l;t[4]===n?(c=t[5],l=t[6]):(c=()=>{s.current=n},l=[n],t[4]=n,t[5]=c,t[6]=l),(0,q.useEffect)(c,l);let u;return t[7]!==i||t[8]!==o||t[9]!==r?(u=(e,t)=>{let n=e.clock.elapsedTime,a=r.current;for(let e of s.current){let r=e.agent.id,s=o.get(r);if(!s)continue;let c=a.get(r);if(!c){let[e,t,i]=hn(s,s.radius,s.yBase,s.phase,n);c={pos:new W(e,t,i),prevPos:new W(e,t,i),angle:s.phase,radius:s.radius,y:s.yBase,speedMul:1},a.set(r,c)}let l=!!e.currentTask,u=_n(e.state,l,s.radius),d=vn(e.state,l,s.yBase),f=i===`off`?0:gn(e.state,l),p=1-.12**t;c.radius+=(u-c.radius)*p,c.y+=(d-c.y)*p,c.speedMul+=(f-c.speedMul)*p,c.angle+=s.angularSpeed*c.speedMul*t,c.prevPos.copy(c.pos);let[m,h,g]=hn(s,c.radius,c.y,c.angle,n);Kn.set(m,h,g),i===`calm`&&e.state===`stuck`&&(Kn.x+=Math.sin(n*31+s.phase*7)*.22,Kn.y+=Math.cos(n*41+s.phase*3)*.15,Kn.z+=Math.sin(n*37+s.phase*5)*.22),c.pos.copy(Kn)}for(let e of a.keys())o.has(e)||a.delete(e)},t[7]=i,t[8]=o,t[9]=r,t[10]=u):u=t[10],U(u,-1),null}var Jn={task_delegate:`Delegando tarea`,task_status:`Consultando estado`,web_search:`Buscando en la web`,web_fetch:`Leyendo página web`,browser_navigate:`Navegando`,browser_click:`Haciendo clic`,browser_type:`Escribiendo en la página`,browser_screenshot:`Tomando captura`,computer_use_task:`Operando el navegador`,browser_extract:`Extrayendo datos`,fs_read:`Leyendo archivo`,fs_write:`Escribiendo archivo`,fs_exists:`Verificando archivo`,exec:`Ejecutando comando`,search_knowledge:`Buscando herramientas`,a2ui_create_surface:`Creando interfaz`,a2ui_update_components:`Actualizando interfaz`,a2ui_update_data_model:`Actualizando datos`,memory_write:`Guardando en memoria`,memory_read:`Leyendo memoria`,memory_search:`Buscando en memoria`,save_note:`Guardando nota`,"cron.create":`Programando tarea`,notify:`Enviando aviso`,report_progress:`Reportando avance`};function Yn(e){if(!e)return null;if(Jn[e])return Jn[e];let t=e.split(`__`)[0];if(t&&t!==e)return`Usando ${t}`;let n=e.replace(/[_.]+/g,` `).trim();return n.charAt(0).toUpperCase()+n.slice(1)}var Xn=`
680
+ varying vec3 vNormal;
681
+ varying vec3 vWorldPos;
682
+ varying vec3 vViewDir;
683
+ uniform float uTime;
684
+ uniform float uGlitch;
685
+
686
+ float hash(float n) { return fract(sin(n) * 43758.5453123); }
687
+
688
+ void main() {
689
+ vec3 pos = position;
690
+ if (uGlitch > 0.01) {
691
+ float row = floor(position.y * 14.0 + uTime * 18.0);
692
+ float slice = step(0.94, hash(row));
693
+ pos.x += slice * uGlitch * (hash(uTime * 43.0) - 0.5) * 0.45;
694
+ pos.z += slice * uGlitch * (hash(uTime * 71.0) - 0.5) * 0.2;
695
+ }
696
+ vec4 world = modelMatrix * vec4(pos, 1.0);
697
+ vWorldPos = world.xyz;
698
+ vNormal = normalize(normalMatrix * normal);
699
+ vViewDir = cameraPosition - world.xyz;
700
+ gl_Position = projectionMatrix * viewMatrix * world;
701
+ }
702
+ `,Zn=`
703
+ varying vec3 vNormal;
704
+ varying vec3 vWorldPos;
705
+ varying vec3 vViewDir;
706
+ uniform vec3 uColor;
707
+ uniform float uTime;
708
+ uniform float uIntensity;
709
+ uniform float uGlitch;
710
+ uniform float uOpacity;
711
+
712
+ void main() {
713
+ vec3 n = normalize(vNormal);
714
+ vec3 v = normalize(vViewDir);
715
+ float fresnel = pow(1.0 - abs(dot(n, v)), 2.2);
716
+ float scan = 0.82 + 0.18 * sin(vWorldPos.y * 90.0 - uTime * 6.0);
717
+ float flicker = 0.93 + 0.07 * sin(uTime * 37.0 + vWorldPos.x * 10.0);
718
+ vec3 col = uColor;
719
+ if (uGlitch > 0.01) {
720
+ col = mix(col, vec3(1.0, 0.28, 0.2), uGlitch * 0.65);
721
+ flicker *= 0.75 + 0.25 * step(0.5, fract(uTime * 24.0));
722
+ }
723
+ float alpha = (0.16 + fresnel * 0.95) * scan * flicker * uOpacity;
724
+ vec3 glow = col * (uIntensity * (0.45 + fresnel * 1.7));
725
+ gl_FragColor = vec4(glow, alpha);
726
+ }
727
+ `;function Qn(e){let t=e?.toLowerCase()??``;return/knowledge|memory|rag|embed|document|vector/.test(t)?`knowledge`:/browser|web|search|fetch|http|url/.test(t)?`browser`:/file|code|exec|shell|terminal|git|patch|write|read/.test(t)?`code`:/message|mail|slack|discord|telegram|whatsapp|notify/.test(t)?`communication`:`generic`}function $n(e){let t=(0,K.c)(2),{color:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`meshBasicMaterial`,{color:n,transparent:!0,opacity:.72,wireframe:!0,blending:2,depthWrite:!1}),t[0]=n,t[1]=r),r}function er(e){let t=(0,K.c)(27),{toolName:n,color:r}=e,i=(0,q.useRef)(null),a;t[0]===n?a=t[1]:(a=Qn(n),t[0]=n,t[1]=a);let o=a,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{i.current&&(i.current.rotation.y=i.current.rotation.y+t*.85,i.current.position.y=1.05+Math.sin(e.clock.elapsedTime*2.4)*.08)},t[2]=s):s=t[2],U(s);let c;t[3]!==o||t[4]!==r?(c=o===`browser`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`mesh`,{children:[(0,$.jsx)(`sphereGeometry`,{args:[.42,10,8]}),(0,$.jsx)($n,{color:r})]}),(0,$.jsxs)(`mesh`,{rotation:[Math.PI/2,0,0],children:[(0,$.jsx)(`torusGeometry`,{args:[.53,.035,6,24]}),(0,$.jsx)($n,{color:r})]})]}),t[3]=o,t[4]=r,t[5]=c):c=t[5];let l;t[6]!==o||t[7]!==r?(l=o===`code`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`mesh`,{children:[(0,$.jsx)(`boxGeometry`,{args:[.75,.55,.12]}),(0,$.jsx)($n,{color:r})]}),(0,$.jsxs)(`mesh`,{position:[-.16,0,.1],rotation:[0,0,-.55],children:[(0,$.jsx)(`boxGeometry`,{args:[.06,.32,.05]}),(0,$.jsx)($n,{color:r})]}),(0,$.jsxs)(`mesh`,{position:[.16,0,.1],rotation:[0,0,.55],children:[(0,$.jsx)(`boxGeometry`,{args:[.06,.32,.05]}),(0,$.jsx)($n,{color:r})]})]}),t[6]=o,t[7]=r,t[8]=l):l=t[8];let u;t[9]!==o||t[10]!==r?(u=o===`knowledge`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`mesh`,{children:[(0,$.jsx)(`octahedronGeometry`,{args:[.46,0]}),(0,$.jsx)($n,{color:r})]}),(0,$.jsxs)(`mesh`,{rotation:[Math.PI/2,0,0],children:[(0,$.jsx)(`torusGeometry`,{args:[.58,.025,6,6]}),(0,$.jsx)($n,{color:r})]})]}),t[9]=o,t[10]=r,t[11]=u):u=t[11];let d;t[12]!==o||t[13]!==r?(d=o===`communication`&&(0,$.jsx)($.Fragment,{children:[.25,.42,.59].map(e=>(0,$.jsxs)(`mesh`,{rotation:[0,Math.PI/2,0],children:[(0,$.jsx)(`torusGeometry`,{args:[e,.025,5,20,Math.PI]}),(0,$.jsx)($n,{color:r})]},e))}),t[12]=o,t[13]=r,t[14]=d):d=t[14];let f;t[15]!==o||t[16]!==r?(f=o===`generic`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`mesh`,{children:[(0,$.jsx)(`icosahedronGeometry`,{args:[.4,0]}),(0,$.jsx)($n,{color:r})]}),(0,$.jsxs)(`mesh`,{rotation:[Math.PI/2,0,0],children:[(0,$.jsx)(`torusGeometry`,{args:[.56,.025,5,24]}),(0,$.jsx)($n,{color:r})]})]}),t[15]=o,t[16]=r,t[17]=f):f=t[17];let p;t[18]===r?p=t[19]:(p=(0,$.jsx)(`pointLight`,{color:r,intensity:2.2,distance:4,decay:2}),t[18]=r,t[19]=p);let m;return t[20]!==c||t[21]!==l||t[22]!==u||t[23]!==d||t[24]!==f||t[25]!==p?(m=(0,$.jsxs)(`group`,{ref:i,scale:.7,children:[c,l,u,d,f,p]}),t[20]=c,t[21]=l,t[22]=u,t[23]=d,t[24]=f,t[25]=p,t[26]=m):m=t[26],m}var tr=new W,nr=new B,rr=new ie,ir=new W(0,1,0),ar=new W(0,0,0),or={archived:{flap:0,intensity:.08,opacity:.12},idle:{flap:0,intensity:.45,opacity:.72},thinking:{flap:5,intensity:.85,opacity:.9},tool_call:{flap:8,intensity:1.05,opacity:1},stuck:{flap:2,intensity:.9,opacity:.95},disabled:{flap:0,intensity:.12,opacity:.06}};function sr({desk:e,swarmRef:t}){let{agent:n,state:r,color:i}=e,a=J(e=>e.selectedAgentId===n.id),o=J(e=>e.select),s=J(e=>e.motion),c=J(e=>e.activeCue),l=(0,q.useRef)(null),u=(0,q.useRef)(null),d=(0,q.useRef)(null),f=(0,q.useRef)(null),p=(0,q.useRef)(null),m=(0,q.useRef)(null),h=(0,q.useMemo)(()=>new H({vertexShader:Xn,fragmentShader:Zn,uniforms:{uTime:{value:0},uColor:{value:new R(i)},uIntensity:{value:.65},uGlitch:{value:0},uOpacity:{value:.8}},transparent:!0,depthWrite:!1,side:2,blending:2}),[i]),g=(0,q.useMemo)(()=>new H({vertexShader:Xn,fragmentShader:Zn,uniforms:{uTime:{value:0},uColor:{value:new R(i).lerp(new R(`#ffffff`),.55)},uIntensity:{value:.9},uGlitch:{value:0},uOpacity:{value:.4}},transparent:!0,depthWrite:!1,side:2,blending:2}),[i]),_=(0,q.useMemo)(()=>new R(i),[i]);U((e,i)=>{let o=e.clock.elapsedTime,_=or[r],v=c?.actorId===n.id||c?.targetId===n.id,y=c&&!v&&!a?.28:1;h.uniforms.uTime.value=o,g.uniforms.uTime.value=o;let b=1-.002**i;h.uniforms.uIntensity.value+=(_.intensity-h.uniforms.uIntensity.value)*b,h.uniforms.uOpacity.value+=(_.opacity*y-h.uniforms.uOpacity.value)*b,g.uniforms.uOpacity.value+=(.4*y-g.uniforms.uOpacity.value)*b,h.uniforms.uGlitch.value+=(+(r===`stuck`)-h.uniforms.uGlitch.value)*b;let x=t.current.get(n.id);x&&l.current&&(l.current.position.copy(x.pos),u.current&&(tr.subVectors(x.pos,x.prevPos),tr.lengthSq()>1e-8&&(nr.lookAt(tr,ar,ir),rr.setFromRotationMatrix(nr),u.current.quaternion.slerp(rr,1-.01**i))));let S=s===`calm`&&_.flap>0?Math.sin(o*_.flap)*.45+.2:.15;if(f.current&&(f.current.rotation.z=S),p.current&&(p.current.rotation.z=-S),m.current){let e=r===`disabled`||r===`archived`?0:r===`tool_call`?7:2.6;m.current.intensity+=(e-m.current.intensity)*b}if(d.current){let e=c?.phase===`delegated`&&c.targetId===n.id,t=c?.actorId===n.id&&(c.phase===`completed`||c.phase===`failed`),r=s===`calm`&&e?Math.sin(o*8.5)*.22:s===`calm`&&t?-.16:0;d.current.rotation.x=z.damp(d.current.rotation.x,r,7,i);let a=v&&s===`calm`?1.12:1,l=z.damp(d.current.scale.x,a,6,i);d.current.scale.setScalar(l)}});let v=e=>{e.stopPropagation(),o(a?null:n.id)},y=r===`tool_call`?Yn(e.currentTool):null;return(0,$.jsxs)(`group`,{ref:l,children:[(0,$.jsx)(`group`,{onClick:v,onPointerOver:e=>{e.stopPropagation(),document.body.style.cursor=`pointer`},onPointerOut:()=>{document.body.style.cursor=`auto`},children:(0,$.jsx)(Bt,{width:r===`idle`||r===`disabled`||r===`archived`?0:.65,length:2.2,color:_,attenuation:e=>e*e,children:(0,$.jsx)(`group`,{ref:u,scale:a?.85:.62,children:(0,$.jsxs)(`group`,{ref:d,children:[(0,$.jsx)(`mesh`,{material:h,scale:[.85,.75,1.35],children:(0,$.jsx)(`sphereGeometry`,{args:[.32,14,14]})}),(0,$.jsxs)(`mesh`,{position:[0,0,.1],children:[(0,$.jsx)(`torusGeometry`,{args:[.24,.045,8,20]}),(0,$.jsx)(`meshStandardMaterial`,{color:`#241804`,metalness:.4,roughness:.6})]}),(0,$.jsxs)(`mesh`,{position:[0,0,-.14],children:[(0,$.jsx)(`torusGeometry`,{args:[.22,.04,8,20]}),(0,$.jsx)(`meshStandardMaterial`,{color:`#241804`,metalness:.4,roughness:.6})]}),(0,$.jsx)(`mesh`,{material:h,position:[0,.03,.5],children:(0,$.jsx)(`sphereGeometry`,{args:[.18,12,12]})}),(0,$.jsx)(`mesh`,{material:h,position:[0,0,-.52],rotation:[-Math.PI/2,0,0],children:(0,$.jsx)(`coneGeometry`,{args:[.07,.22,8]})}),(0,$.jsx)(`mesh`,{ref:f,material:g,position:[.26,.24,.05],rotation:[.35,0,.5],scale:[1,.08,.55],children:(0,$.jsx)(`sphereGeometry`,{args:[.3,10,10]})}),(0,$.jsx)(`mesh`,{ref:p,material:g,position:[-.26,.24,.05],rotation:[.35,0,-.5],scale:[1,.08,.55],children:(0,$.jsx)(`sphereGeometry`,{args:[.3,10,10]})})]})})})}),(0,$.jsx)(`pointLight`,{ref:m,color:i,intensity:2.6,distance:8,decay:1.7}),r===`tool_call`&&(0,$.jsx)(er,{toolName:e.currentTool,color:i}),r===`thinking`&&(0,$.jsxs)(`mesh`,{position:[0,.95,0],rotation:[-Math.PI/2,0,0],children:[(0,$.jsx)(`ringGeometry`,{args:[.42,.52,6]}),(0,$.jsx)(`meshBasicMaterial`,{color:i,transparent:!0,opacity:.42,blending:2,depthWrite:!1})]}),r===`stuck`&&(0,$.jsxs)(`mesh`,{position:[0,1.05,0],rotation:[-Math.PI/2,0,0],children:[(0,$.jsx)(`ringGeometry`,{args:[.52,.68,6]}),(0,$.jsx)(`meshBasicMaterial`,{color:`#fb7185`,transparent:!0,opacity:.86,blending:2,depthWrite:!1})]}),e.currentTask&&(0,$.jsx)(nt,{position:[0,1.55,0],center:!0,distanceFactor:17,className:`pointer-events-none select-none`,children:(0,$.jsxs)(`div`,{className:`office3d-task-chip`,style:{"--chip-color":i},children:[(0,$.jsx)(`span`,{className:`office3d-task-chip-prefix`,children:`◈`}),` `,e.currentTask]})}),y&&(0,$.jsx)(nt,{position:[0,e.currentTask?1.05:1.3,0],center:!0,distanceFactor:17,className:`pointer-events-none select-none`,children:(0,$.jsx)(`div`,{className:`office3d-tool-chip`,style:{"--chip-color":i},children:y})}),(0,$.jsx)(nt,{position:[0,-.85,0],center:!0,distanceFactor:16,className:`pointer-events-none select-none`,zIndexRange:[10,0],children:(0,$.jsxs)(`div`,{className:`office3d-name-plate ${a?`is-active`:``}`,style:{"--chip-color":i},children:[(0,$.jsx)(`span`,{className:`office3d-name-dot office3d-name-dot--${r}`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:n.name}),(0,$.jsx)(`small`,{children:n.description||`Agente especialista`})]})]})})]})}var cr=new Set([`failed`,`aborted`,`review_failed`,`blocked`]);function lr(e){return cr.has(e)?4200:e===`completed`?3200:2800}function ur(e){return cr.has(e)}function dr(e,t){return e.some(e=>e.eventId===t.eventId)?e:(ur(t.phase)?[t,...e]:[...e,t]).slice(0,3)}function fr(e){switch(e){case`delegated`:return`Delegando trabajo`;case`review_passed`:return`Revisión aprobada`;case`review_failed`:return`Revisión no aprobada`;case`completed`:return`Entregando resultado`;case`failed`:return`Trabajo fallido`;case`aborted`:return`Trabajo interrumpido`;case`blocked`:return`Agente bloqueado`}}function pr(e){return e===`failed`||e===`aborted`||e===`review_failed`?`alert`:e===`completed`||e===`review_passed`?`done`:`work`}var mr=new W(0,4.4,0),hr=2.25,gr=0;function _r(e,t){let n=pr(e.phase);return n===`alert`?`#fb7185`:n===`done`?`#86efac`:n===`review`?`#67e8f9`:t??`#f59e0b`}function vr({desks:e,events:t,swarmRef:n,coordinatorId:r,coordinatorName:i}){let[a,o]=(0,q.useState)([]),s=(0,q.useRef)(new Set),c=(0,q.useRef)(!1);return(0,q.useEffect)(()=>{if(!c.current){t.forEach(e=>s.current.add(e.eventId)),c.current=!0;return}let n=new Map(e.map(e=>[e.agent.id,e])),a=e=>e===r?i:n.get(e)?.agent.name??`Agente`,l=[];for(let e of t){if(s.current.has(e.eventId))continue;s.current.add(e.eventId);let t=e.targetId||r;t&&l.push({id:++gr,event:e,startId:e.actorId,endId:t,sourceName:a(e.actorId),targetName:a(t),color:_r(e,n.get(t)?.color??n.get(e.actorId)?.color)})}l.length>0&&o(e=>[...e,...l].slice(-8))},[r,i,e,t]),(0,$.jsx)(`group`,{children:a.map(e=>(0,$.jsx)(yr,{transfer:e,swarmRef:n,coordinatorId:r,onDone:()=>o(t=>t.filter(t=>t.id!==e.id))},e.id))})}function yr({transfer:e,swarmRef:t,coordinatorId:n,onDone:r}){let i=(0,q.useRef)(null),a=(0,q.useRef)(null),o=(0,q.useRef)(null),s=(0,q.useRef)(0),c=(0,q.useRef)(!1),l=(0,q.useRef)(new W),u=(0,q.useRef)(new W);U((d,f)=>{if(c.current||!i.current)return;s.current=Math.min(hr,s.current+f);let p=e.startId===n?mr:t.current.get(e.startId)?.pos,m=e.endId===n?mr:t.current.get(e.endId)?.pos;if(!p||!m){i.current.visible=!1,s.current>=hr&&(c.current=!0,r());return}i.current.visible=!0,l.current.copy(p),u.current.copy(m);let h=s.current/hr,g=1-(1-Math.min(1,Math.max(0,(h-.14)/.86)))**3;if(i.current.position.lerpVectors(l.current,u.current,g),i.current.position.y+=Math.sin(g*Math.PI)*2.2,i.current.rotation.x+=f*2.4,i.current.rotation.y+=f*3.2,o.current?.position.copy(i.current.position),a.current){a.current.position.copy(l.current),a.current.visible=h<.46;let e=.8+h*5.2%1*1.35;a.current.scale.setScalar(e),a.current.rotation.y+=f*.8}s.current>=hr&&(c.current=!0,r())});let d=e.event.phase===`delegated`?`${e.sourceName} llama a ${e.targetName}`:e.event.phase===`completed`?`${e.sourceName} entrega a ${e.targetName}`:`${e.sourceName} informa a ${e.targetName}`;return(0,$.jsxs)(`group`,{children:[(0,$.jsx)(`group`,{ref:a,children:[.72,1.08].map((t,n)=>(0,$.jsxs)(`mesh`,{rotation:[Math.PI/2,0,0],children:[(0,$.jsx)(`torusGeometry`,{args:[t,n===0?.055:.035,6,28]}),(0,$.jsx)(`meshBasicMaterial`,{color:e.color,transparent:!0,opacity:n===0?.72:.42,blending:2,depthWrite:!1})]},t))}),(0,$.jsxs)(`mesh`,{ref:i,children:[(0,$.jsx)(`octahedronGeometry`,{args:[.3,0]}),(0,$.jsx)(`meshBasicMaterial`,{color:e.color,transparent:!0,opacity:.98,blending:2,depthWrite:!1})]}),(0,$.jsx)(`group`,{ref:o,children:(0,$.jsx)(nt,{position:[0,.75,0],center:!0,distanceFactor:20,className:`pointer-events-none select-none`,children:(0,$.jsxs)(`div`,{className:`office3d-transfer-label is-compact is-${pr(e.event.phase)}`,style:{"--chip-color":e.color},children:[(0,$.jsx)(`span`,{children:d}),(0,$.jsx)(`strong`,{children:fr(e.event.phase).toUpperCase()})]})})})]})}function br({events:e,desks:t,coordinatorId:n}){let r=J(e=>e.setActiveCue),i=(0,q.useRef)(new Set),a=(0,q.useRef)(!1),o=(0,q.useRef)([]),s=(0,q.useRef)(null),c=(0,q.useRef)(null),l=(0,q.useRef)(new Map),u=(0,q.useRef)(!1),d=(0,q.useCallback)(function e(){if(s.current||o.current.length===0)return;let t=o.current.shift()??null;s.current=t,r(t),t&&(c.current=setTimeout(()=>{s.current=null,r(null),c.current=null,e()},lr(t.phase)))},[r]),f=(0,q.useCallback)(e=>{ur(e.phase)&&s.current&&!ur(s.current.phase)&&(c.current&&clearTimeout(c.current),o.current=dr(o.current,s.current),s.current=null,r(null)),o.current=dr(o.current,e),d()},[d,r]);return(0,q.useEffect)(()=>{if(!a.current){e.forEach(e=>i.current.add(e.eventId)),a.current=!0;return}for(let t of e)i.current.has(t.eventId)||(i.current.add(t.eventId),f(t))},[e,f]),(0,q.useEffect)(()=>{if(!u.current){l.current=new Map(t.map(e=>[e.agent.id,e.state])),u.current=!0;return}for(let e of t){let t=l.current.get(e.agent.id);e.state===`stuck`&&t!==`stuck`&&f({eventId:`blocked:${e.agent.id}:${Date.now()}`,phase:`blocked`,taskRef:e.taskId??`agent:${e.agent.id}`,taskName:e.currentTask??`Ejecución del agente`,actorId:e.agent.id,targetId:n,detail:`El agente necesita atención`,timestamp:Date.now()}),l.current.set(e.agent.id,e.state)}},[n,t,f]),(0,q.useEffect)(()=>()=>{c.current&&clearTimeout(c.current),r(null)},[r]),null}var xr=new W(0,7.6,0),Sr=new W(0,4.4,0),Cr=1.7,wr=6;function Tr(e){let t=(0,K.c)(46),{status:n,decisions:r,swarmRef:i,coordinatorId:a,motion:o}=e,s=(0,q.useRef)(null),c=(0,q.useRef)(null),l=(0,q.useRef)(null),u=(0,q.useRef)(null),d=(0,q.useRef)(0),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=[],t[0]=f):f=t[0];let[p,m]=(0,q.useState)(f),h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=new Set,t[1]=h):h=t[1];let g=(0,q.useRef)(h),_=(0,q.useRef)(!1),v,y;t[2]!==r||t[3]!==o?(v=()=>{if(!_.current){r.forEach(e=>g.current.add(e.eventId)),_.current=!0;return}let e=r.filter(e=>!g.current.has(e.eventId));e.length!==0&&(e.forEach(e=>g.current.add(e.eventId)),d.current=1,o!==`off`&&m(t=>[...t,...e.map(Er)].slice(-wr)))},y=[r,o],t[2]=r,t[3]=o,t[4]=v,t[5]=y):(v=t[4],y=t[5]),(0,q.useEffect)(v,y);let b=n?.state===`fallback`,x=b?De:Ee,S;if(t[6]!==b||t[7]!==o?(S=(e,t)=>{let n=e.clock.elapsedTime;d.current=Math.max(0,d.current-t*1.4);let r=o===`calm`?(b?.12:.35)+d.current*2.2:0;if(s.current&&(s.current.rotation.y=s.current.rotation.y+t*r,s.current.rotation.x=s.current.rotation.x+t*r*.4,s.current.scale.setScalar(1+d.current*.22)),c.current){let e=c.current.material;e.emissiveIntensity=(b?.25+Math.max(0,Math.sin(n*9))*.15:.7+Math.sin(n*1.6)*.12)+d.current*1.6,c.current.rotation.y=c.current.rotation.y-t*r*.6}l.current&&(l.current.rotation.z=l.current.rotation.z+t*(o===`calm`?.5+d.current*3:0)),u.current&&(u.current.intensity=(b?1.2:3)+d.current*9)},t[6]=b,t[7]=o,t[8]=S):S=t[8],U(S),!n||n.state===`off`)return null;let C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(`icosahedronGeometry`,{args:[.95,0]}),t[9]=C):C=t[9];let w;t[10]===x?w=t[11]:(w=(0,$.jsxs)(`mesh`,{ref:s,children:[C,(0,$.jsx)(`meshBasicMaterial`,{color:x,wireframe:!0,transparent:!0,opacity:.55,blending:2,depthWrite:!1})]}),t[10]=x,t[11]=w);let T;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(`octahedronGeometry`,{args:[.45,0]}),t[12]=T):T=t[12];let E;t[13]===x?E=t[14]:(E=(0,$.jsxs)(`mesh`,{ref:c,children:[T,(0,$.jsx)(`meshStandardMaterial`,{color:`#1e1535`,emissive:x,emissiveIntensity:.7,metalness:.4,roughness:.25})]}),t[13]=x,t[14]=E);let D,O;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(D=[Math.PI/2,0,0],O=(0,$.jsx)(`torusGeometry`,{args:[1.45,.025,6,48]}),t[15]=D,t[16]=O):(D=t[15],O=t[16]);let k,A;t[17]===x?(k=t[18],A=t[19]):(k=(0,$.jsx)(`group`,{ref:l,rotation:D,children:(0,$.jsxs)(`mesh`,{children:[O,(0,$.jsx)(`meshBasicMaterial`,{color:x,transparent:!0,opacity:.45,blending:2,depthWrite:!1})]})}),A=(0,$.jsx)(`pointLight`,{ref:u,color:x,intensity:3,distance:12,decay:1.8}),t[17]=x,t[18]=k,t[19]=A);let j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=[0,1.55,0],t[20]=j):j=t[20];let M=`office3d-jev-tag ${b?`is-fallback`:``}`,N;t[21]===n?N=t[22]:(N=Ae(n).toUpperCase(),t[21]=n,t[22]=N);let P;t[23]!==M||t[24]!==N?(P=(0,$.jsx)(nt,{position:j,center:!0,distanceFactor:22,className:`pointer-events-none select-none`,children:(0,$.jsx)(`div`,{className:M,children:N})}),t[23]=M,t[24]=N,t[25]=P):P=t[25];let F;t[26]!==k||t[27]!==A||t[28]!==P||t[29]!==w||t[30]!==E?(F=(0,$.jsxs)(`group`,{position:xr,children:[w,E,k,A,P]}),t[26]=k,t[27]=A,t[28]=P,t[29]=w,t[30]=E,t[31]=F):F=t[31];let I;if(t[32]!==p||t[33]!==x||t[34]!==a||t[35]!==n||t[36]!==i){let e;t[38]!==x||t[39]!==a||t[40]!==n||t[41]!==i?(e=e=>(0,$.jsx)(Dr,{beam:e,swarmRef:i,coordinatorId:a,color:x,name:Ae(n),onDone:()=>m(t=>t.filter(t=>t.decision.eventId!==e.decision.eventId))},e.decision.eventId),t[38]=x,t[39]=a,t[40]=n,t[41]=i,t[42]=e):e=t[42],I=p.map(e),t[32]=p,t[33]=x,t[34]=a,t[35]=n,t[36]=i,t[37]=I}else I=t[37];let L;return t[43]!==F||t[44]!==I?(L=(0,$.jsxs)(`group`,{children:[F,I]}),t[43]=F,t[44]=I,t[45]=L):L=t[45],L}function Er(e){return{decision:e,chip:Ne(e.savedTokens)}}function Dr(e){let t=(0,K.c)(31),{beam:n,swarmRef:r,coordinatorId:i,color:a,name:o,onDone:s}=e,c=(0,q.useRef)(null),l=(0,q.useRef)(null),u=(0,q.useRef)(null),d=(0,q.useRef)(0),f=(0,q.useRef)(!1),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=new W,t[0]=p):p=t[0];let m=(0,q.useRef)(p),h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=new W,t[1]=h):h=t[1];let g=(0,q.useRef)(h),{decision:_,chip:v}=n,y;t[2]!==i||t[3]!==_.agentId||t[4]!==s||t[5]!==r?(y=(e,t)=>{if(f.current)return;d.current+=t;let n=_.agentId===i?Sr:r.current.get(_.agentId)?.pos;n?m.current.copy(n):m.current.copy(Sr),g.current.lerpVectors(xr,m.current,.5),g.current.y=g.current.y+2.4;let a=Math.min(1,d.current/Cr),o=a<.2?a/.2:1-Math.max(0,(a-.55)/.45);if(c.current&&(c.current.setPoints(xr,m.current,g.current),c.current.material.opacity=o*.85),l.current){let e=Math.min(1,a/.45),t=1-e;l.current.position.set(t*t*xr.x+2*t*e*g.current.x+e*e*m.current.x,t*t*xr.y+2*t*e*g.current.y+e*e*m.current.y,t*t*xr.z+2*t*e*g.current.z+e*e*m.current.z),l.current.material.opacity=o}u.current?.position.copy(m.current),a>=1&&(f.current=!0,s())},t[2]=i,t[3]=_.agentId,t[4]=s,t[5]=r,t[6]=y):y=t[6],U(y);let b;t[7]===a?b=t[8]:(b=(0,$.jsx)(Ot,{ref:c,start:xr,end:Sr,color:a,lineWidth:1.6,transparent:!0,opacity:0,depthWrite:!1}),t[7]=a,t[8]=b);let x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`sphereGeometry`,{args:[.16,10,8]}),t[9]=x):x=t[9];let S;t[10]===a?S=t[11]:(S=(0,$.jsxs)(`mesh`,{ref:l,children:[x,(0,$.jsx)(`meshBasicMaterial`,{color:a,transparent:!0,opacity:0,blending:2,depthWrite:!1})]}),t[10]=a,t[11]=S);let C;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(C=[0,1.35,0],t[12]=C):C=t[12];let w;t[13]===_.kind?w=t[14]:(w=ke(_.kind),t[13]=_.kind,t[14]=w);let T;t[15]!==o||t[16]!==w?(T=(0,$.jsxs)(`span`,{children:[o,` · `,w]}),t[15]=o,t[16]=w,t[17]=T):T=t[17];let E;t[18]!==v||t[19]!==_.savedTokens?(E=v&&(0,$.jsx)(`strong`,{className:_.savedTokens<0?`is-cost`:``,children:v}),t[18]=v,t[19]=_.savedTokens,t[20]=E):E=t[20];let D;t[21]===_.latencyMs?D=t[22]:(D=(0,$.jsxs)(`small`,{children:[_.latencyMs,` ms`]}),t[21]=_.latencyMs,t[22]=D);let O;t[23]!==E||t[24]!==D||t[25]!==T?(O=(0,$.jsx)(`group`,{ref:u,children:(0,$.jsx)(nt,{position:C,center:!0,distanceFactor:20,className:`pointer-events-none select-none`,children:(0,$.jsxs)(`div`,{className:`office3d-jev-chip`,children:[T,E,D]})})}),t[23]=E,t[24]=D,t[25]=T,t[26]=O):O=t[26];let k;return t[27]!==O||t[28]!==b||t[29]!==S?(k=(0,$.jsxs)(`group`,{children:[b,S,O]}),t[27]=O,t[28]=b,t[29]=S,t[30]=k):k=t[30],k}function Or(e){let t=(0,K.c)(74),{desks:n,coordinator:r,interactions:i,workEvents:a,jev:o}=e,s=J(Fr),c=J(Pr),l=J(Nr),u=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`off`:l,d=J(Mr),f=J(jr),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=new Map,t[0]=p):p=t[0];let m=(0,q.useRef)(p),h;t[1]===n?h=t[2]:(h=n.some(Ar),t[1]=n,t[2]=h);let g=h,_;t[3]===s?_=t[4]:(_=s===`high`?[1,1.75]:1,t[3]=s,t[4]=_);let v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={antialias:!1,alpha:!1,powerPreference:`high-performance`},t[5]=v):v=t[5];let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y={fov:42,near:.1,far:220,position:[0,46,62]},t[6]=y):y=t[6];let b;t[7]===f?b=t[8]:(b=()=>f(null),t[7]=f,t[8]=b);let x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`color`,{attach:`background`,args:[`#04060c`]}),t[9]=x):x=t[9];let S,C,w;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(`fog`,{attach:`fog`,args:[`#04060c`,34,100]}),w=(0,$.jsx)(`ambientLight`,{intensity:.35}),S=(0,$.jsx)(`directionalLight`,{position:[12,24,8],intensity:.35,color:`#9db8ff`}),t[10]=S,t[11]=C,t[12]=w):(S=t[10],C=t[11],w=t[12]);let T=r?.id??null,E;t[13]!==n||t[14]!==T||t[15]!==a?(E=(0,$.jsx)(br,{events:a,desks:n,coordinatorId:T}),t[13]=n,t[14]=T,t[15]=a,t[16]=E):E=t[16];let D;t[17]!==n||t[18]!==u?(D=(0,$.jsx)(qn,{desks:n,swarmRef:m,motion:u}),t[17]=n,t[18]=u,t[19]=D):D=t[19];let O=r?.id??null,k;t[20]!==u||t[21]!==d||t[22]!==O?(k=(0,$.jsx)(Qt,{coordinatorId:O,selectedAgentId:d,swarmRef:m,motion:u}),t[20]=u,t[21]=d,t[22]=O,t[23]=k):k=t[23];let A;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(cn,{}),t[24]=A):A=t[24];let j;t[25]!==g||t[26]!==r?(j=(0,$.jsx)(bn,{coordinator:r,active:g,swarmRef:m}),t[25]=g,t[26]=r,t[27]=j):j=t[27];let M;t[28]===n?M=t[29]:(M=n.map(e=>(0,$.jsx)(sr,{desk:e,swarmRef:m},e.agent.id)),t[28]=n,t[29]=M);let N=r?.id??null,P;t[30]!==n||t[31]!==i||t[32]!==N?(P=(0,$.jsx)(An,{desks:n,interactions:i,swarmRef:m,coordinatorId:N}),t[30]=n,t[31]=i,t[32]=N,t[33]=P):P=t[33];let F=r?.id??null,I;t[34]!==u||t[35]!==o.decisions||t[36]!==o.status||t[37]!==F?(I=(0,$.jsx)(Tr,{status:o.status,decisions:o.decisions,swarmRef:m,coordinatorId:F,motion:u}),t[34]=u,t[35]=o.decisions,t[36]=o.status,t[37]=F,t[38]=I):I=t[38];let L;t[39]!==r?.id||t[40]!==r?.name||t[41]!==n||t[42]!==u||t[43]!==a?(L=u===`calm`&&(0,$.jsx)(vr,{desks:n,events:a,swarmRef:m,coordinatorId:r?.id??null,coordinatorName:r?.name??`Coordinador`}),t[39]=r?.id,t[40]=r?.name,t[41]=n,t[42]=u,t[43]=a,t[44]=L):L=t[44];let R;t[45]!==n||t[46]!==u||t[47]!==s?(R=u===`calm`&&s===`high`&&(0,$.jsx)(Un,{desks:n,swarmRef:m}),t[45]=n,t[46]=u,t[47]=s,t[48]=R):R=t[48];let z;t[49]!==u||t[50]!==s?(z=u===`calm`&&s===`high`&&(0,$.jsx)(zn,{}),t[49]=u,t[50]=s,t[51]=z):z=t[51];let B;t[52]===s?B=t[53]:(B=(0,$.jsx)(Gn,{quality:s}),t[52]=s,t[53]=B);let V;t[54]!==s||t[55]!==c?(V=(0,$.jsx)(Ht,{bounds:kr,onDecline:()=>{s===`high`&&c(`low`)}}),t[54]=s,t[55]=c,t[56]=V):V=t[56];let H;t[57]!==E||t[58]!==D||t[59]!==k||t[60]!==j||t[61]!==M||t[62]!==P||t[63]!==I||t[64]!==L||t[65]!==R||t[66]!==z||t[67]!==B||t[68]!==V?(H=(0,$.jsxs)(q.Suspense,{fallback:null,children:[E,D,k,A,j,M,P,I,L,R,z,B,V]}),t[57]=E,t[58]=D,t[59]=k,t[60]=j,t[61]=M,t[62]=P,t[63]=I,t[64]=L,t[65]=R,t[66]=z,t[67]=B,t[68]=V,t[69]=H):H=t[69];let ee;return t[70]!==H||t[71]!==_||t[72]!==b?(ee=(0,$.jsxs)(he,{dpr:_,gl:v,camera:y,onPointerMissed:b,children:[x,C,w,S,H]}),t[70]=H,t[71]=_,t[72]=b,t[73]=ee):ee=t[73],ee}function kr(e){return[Math.min(42,e*.68),e*.92]}function Ar(e){return e.state===`thinking`||e.state===`tool_call`||e.state===`stuck`}function jr(e){return e.select}function Mr(e){return e.selectedAgentId}function Nr(e){return e.motion}function Pr(e){return e.setQuality}function Fr(e){return e.quality}function Ir(e){let t=(0,K.c)(8),{events:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`div`,{className:`office3d-ticker-title`,children:`Actividad`}),t[0]=r):r=t[0];let i;t[1]===n.length?i=t[2]:(i=n.length===0&&(0,$.jsx)(`div`,{className:`office3d-ticker-empty`,children:`Sin eventos todavía…`}),t[1]=n.length,t[2]=i);let a;t[3]===n?a=t[4]:(a=n.slice(0,6).map(Lr),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,$.jsxs)(`div`,{className:`office3d-ticker`,children:[r,(0,$.jsxs)(`div`,{className:`office3d-ticker-list`,role:`log`,"aria-live":`polite`,"aria-relevant":`additions`,children:[i,a]})]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function Lr(e){return(0,$.jsxs)(`div`,{className:`office3d-ticker-item office3d-ticker-item--${e.kind}`,children:[(0,$.jsx)(`span`,{className:`office3d-ticker-dot`,style:{background:e.color}}),(0,$.jsx)(`span`,{className:`office3d-ticker-text`,children:e.text}),(0,$.jsx)(`span`,{className:`office3d-ticker-time`,children:e.time})]},e.id)}var Rr=0;function zr(e,t){return t===`tool_call`&&!e.currentTask?{text:`${e.agent.name} · ${Yn(e.currentTool)??`Ejecutando herramienta`}`,color:e.color,kind:`work`}:t===`thinking`&&!e.currentTask?{text:`${e.agent.name} está pensando…`,color:e.color,kind:`info`}:t===`stuck`?{text:`${e.agent.name} necesita ayuda`,color:`#f87171`,kind:`warn`}:null}function Br(e,t,n,r,i=[]){let[a,o]=(0,q.useState)([]),s=(0,q.useRef)(new Map),c=(0,q.useRef)(new Set),l=(0,q.useRef)(new Set),u=(0,q.useRef)(!1);return(0,q.useEffect)(()=>{let a=s.current,d=new Map(e.map(e=>[e.agent.id,e])),f=[],p=new Date().toLocaleTimeString(`es`,{hour12:!1}),m=e=>e===n?.id?n.name:d.get(e)?.agent.name??e;if(u.current){for(let e of r){if(c.current.has(e.eventId))continue;c.current.add(e.eventId);let t=pr(e.phase);f.push({id:++Rr,time:new Date(e.timestamp).toLocaleTimeString(`es`,{hour12:!1}),text:`${fr(e.phase)} · ${m(e.actorId)}${e.targetId?` → ${m(e.targetId)}`:``}: «${e.taskName}»`,color:t===`alert`?`#fb7185`:t===`done`?`#86efac`:d.get(e.targetId??``)?.color??`#f59e0b`,kind:t===`alert`?`warn`:t===`done`?`done`:`work`})}for(let e of i){if(l.current.has(e.eventId)||(l.current.add(e.eventId),e.kind!==`context`))continue;let t=Ne(e.savedTokens);f.push({id:++Rr,time:new Date(e.timestamp).toLocaleTimeString(`es`,{hour12:!1}),text:`Jev → ${m(e.agentId)}: ${e.summary}${t?` (${t})`:``}${e.recommendedAgentId?` · sugiere ${m(e.recommendedAgentId)}`:``}${e.mcpOff?.length?` (encender ${e.mcpOff.join(`, `)})`:``}`,color:Ee,kind:`info`})}}else{r.forEach(e=>c.current.add(e.eventId)),i.forEach(e=>l.current.add(e.eventId));for(let e of t)f.push({id:++Rr,time:p,text:`${m(e.sourceId)} → ${m(e.targetId)}: «${e.taskName??`Flujo activo`}»`,color:d.get(e.targetId)?.color??`#f59e0b`,kind:`work`});u.current=!0}for(let t of e){let e=a.get(t.agent.id);if(e&&e.state!==t.state){let e=zr(t,t.state);e&&f.push({id:++Rr,time:p,...e})}a.set(t.agent.id,{state:t.state})}f.length&&o(e=>[...f.reverse(),...e].slice(0,24))},[e,t,n,r,i]),a}function Vr(e){let t=(0,K.c)(63),{status:n,decisions:r,coordinator:i,desks:a}=e,[o,s]=(0,q.useState)(!1),l=C(Gr);if(!n||n.state===`off`)return null;let u;t[0]!==i||t[1]!==a?(u=e=>e===i?.id?i.name:a.find(t=>t.agent.id===e)?.agent.name??e,t[0]=i,t[1]=a,t[2]=u):u=t[2];let f=u,m;t[3]===n.totals?m=t[4]:(m=n.totals??{decisions:0,savedTokens:0,costUsd:0},t[3]=n.totals,t[4]=m);let h=m,g=r[r.length-1],_;t[5]===r?_=t[6]:(_=r.length?Math.round(r.reduce(Wr,0)/r.length):null,t[5]=r,t[6]=_);let v=_,y;if(t[7]!==v||t[8]!==l||t[9]!==o||t[10]!==g||t[11]!==f||t[12]!==n||t[13]!==h.costUsd||t[14]!==h.decisions||t[15]!==h.savedTokens){let e=Object.entries(l).sort(Ur).slice(0,4),r,i;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`span`,{className:`office3d-jev-icon`,children:(0,$.jsx)(p,{size:14})}),i=(0,$.jsx)(`span`,{className:`office3d-section-kicker`,children:`PLANO DE DECISIÓN`}),t[17]=r,t[18]=i):(r=t[17],i=t[18]);let a;t[19]===n?a=t[20]:(a=Ae(n),t[19]=n,t[20]=a);let u;t[21]===n.state?u=t[22]:(u=je(n.state),t[21]=n.state,t[22]=u);let m;t[23]!==a||t[24]!==u?(m=(0,$.jsxs)(`div`,{children:[i,(0,$.jsxs)(`h2`,{children:[a,` · `,u]})]}),t[23]=a,t[24]=u,t[25]=m):m=t[25];let _;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>s(Hr),t[26]=_):_=t[26];let b=o?`Mostrar detalle de Jev`:`Ocultar detalle de Jev`,x=!o,S;t[27]===o?S=t[28]:(S=o?(0,$.jsx)(c,{size:14}):(0,$.jsx)(d,{size:14}),t[27]=o,t[28]=S);let C;t[29]!==b||t[30]!==x||t[31]!==S?(C=(0,$.jsx)(`button`,{type:`button`,className:`office3d-roster-toggle`,onClick:_,"aria-label":b,"aria-expanded":x,children:S}),t[29]=b,t[30]=x,t[31]=S,t[32]=C):C=t[32];let w;t[33]!==C||t[34]!==m?(w=(0,$.jsxs)(`header`,{className:`office3d-jev-head`,children:[r,m,C]}),t[33]=C,t[34]=m,t[35]=w):w=t[35];let T;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(`dt`,{children:`Decisiones`}),t[36]=T):T=t[36];let E;t[37]===h.decisions?E=t[38]:(E=(0,$.jsxs)(`div`,{children:[T,(0,$.jsx)(`dd`,{children:h.decisions})]}),t[37]=h.decisions,t[38]=E);let D=h.savedTokens>=0?`Tokens ahorrados`:`Tokens añadidos`,O;t[39]===D?O=t[40]:(O=(0,$.jsx)(`dt`,{children:D}),t[39]=D,t[40]=O);let k;t[41]===h.savedTokens?k=t[42]:(k=Me(h.savedTokens),t[41]=h.savedTokens,t[42]=k);let A;t[43]===k?A=t[44]:(A=(0,$.jsxs)(`dd`,{children:[`~`,k]}),t[43]=k,t[44]=A);let j;t[45]!==O||t[46]!==A?(j=(0,$.jsxs)(`div`,{children:[O,A]}),t[45]=O,t[46]=A,t[47]=j):j=t[47];let M;t[48]===n?M=t[49]:(M=Ae(n),t[48]=n,t[49]=M);let N;t[50]===M?N=t[51]:(N=(0,$.jsxs)(`dt`,{children:[`Costo `,M]}),t[50]=M,t[51]=N);let P;t[52]===h.costUsd?P=t[53]:(P=Pe(h.costUsd),t[52]=h.costUsd,t[53]=P);let F;t[54]===P?F=t[55]:(F=(0,$.jsx)(`dd`,{children:P}),t[54]=P,t[55]=F);let I;t[56]!==N||t[57]!==F?(I=(0,$.jsxs)(`div`,{children:[N,F]}),t[56]=N,t[57]=F,t[58]=I):I=t[58];let L;t[59]!==E||t[60]!==j||t[61]!==I?(L=(0,$.jsxs)(`dl`,{className:`office3d-jev-metrics`,children:[E,j,I]}),t[59]=E,t[60]=j,t[61]=I,t[62]=L):L=t[62],y=(0,$.jsxs)(`section`,{className:`office3d-jev office3d-glass ${n.state===`fallback`?`is-fallback`:``} ${o?`is-collapsed`:``}`,"aria-label":`Jev, plano de decisión`,children:[w,L,!o&&(0,$.jsxs)($.Fragment,{children:[n.state===`fallback`&&n.lastError&&(0,$.jsxs)(`p`,{className:`office3d-jev-warn`,children:[`Usando el flujo clásico: `,n.lastError]}),g&&(0,$.jsxs)(`div`,{className:`office3d-jev-latest`,children:[(0,$.jsxs)(`span`,{children:[`Última decisión · `,f(g.agentId),` · `,ke(g.kind)]}),(0,$.jsx)(`p`,{children:g.summary}),g.recommendedAgentId&&(g.mcpOff?.length?(0,$.jsxs)(`p`,{className:`office3d-jev-warn`,children:[f(g.recommendedAgentId),` es el indicado, pero necesita encender `,g.mcpOff.join(`, `)]}):(0,$.jsxs)(`p`,{children:[`Recomendó delegar en `,f(g.recommendedAgentId)]}))]}),e.length>0&&(0,$.jsx)(`ul`,{className:`office3d-jev-agents`,"aria-label":`Ahorro por agente desde que abriste la oficina`,children:e.map(e=>{let[t,n]=e;return(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`span`,{children:f(t)}),(0,$.jsxs)(`b`,{children:[n.savedTokens>=0?`−`:`+`,Me(n.savedTokens)]}),(0,$.jsxs)(`small`,{children:[n.decisions,` dec.`]})]},t)})}),(0,$.jsxs)(`p`,{className:`office3d-jev-note`,children:[`Estimación frente al flujo clásico (caracteres ÷ 4)`,v===null?``:` · ${v} ms de media`]})]})]}),t[7]=v,t[8]=l,t[9]=o,t[10]=g,t[11]=f,t[12]=n,t[13]=h.costUsd,t[14]=h.decisions,t[15]=h.savedTokens,t[16]=y}else y=t[16];return y}function Hr(e){return!e}function Ur(e,t){let[,n]=e,[,r]=t;return r.savedTokens-n.savedTokens}function Wr(e,t){return e+t.latencyMs}function Gr(e){return e.jevByAgent}function Kr(e){let t=(0,K.c)(9),{agentId:n}=e,r;t[0]===n?r=t[1]:(r=e=>e.jevByAgent[n],t[0]=n,t[1]=r);let i=C(r);if(!i)return null;let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(`span`,{className:`office3d-inspector-label`,children:`Jev`}),t[2]=a):a=t[2];let o=i.decisions,s=i.savedTokens>=0?`−`:`+`,c;t[3]===i.savedTokens?c=t[4]:(c=Me(i.savedTokens),t[3]=i.savedTokens,t[4]=c);let l;return t[5]!==i.decisions||t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(`div`,{className:`office3d-inspector-row`,children:[a,(0,$.jsxs)(`span`,{className:`font-mono`,children:[o,` dec. · `,s,c,` tok`]})]}),t[5]=i.decisions,t[6]=s,t[7]=c,t[8]=l):l=t[8],l}var qr={archived:`Archivado manualmente`,disabled:`Desactivado`,idle:`En espera`,thinking:`Pensando`,tool_call:`Ejecutando herramienta`,stuck:`Atascado`};function Jr({desk:e,delegatorName:t}){let n=J(e=>e.select);if(!e)return null;let{agent:r}=e;return(0,$.jsxs)(`aside`,{className:`office3d-inspector`,style:{"--agent-color":e.color},children:[(0,$.jsx)(`button`,{type:`button`,className:`office3d-inspector-close`,onClick:()=>n(null),"aria-label":`Cerrar`,children:(0,$.jsx)(O,{size:14})}),(0,$.jsxs)(`div`,{className:`office3d-inspector-head`,children:[(0,$.jsx)(`span`,{className:`office3d-inspector-orb`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`office3d-inspector-name`,children:r.name}),(0,$.jsx)(`span`,{className:`office3d-inspector-id`,children:r.id})]})]}),(0,$.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,$.jsx)(`span`,{className:`office3d-inspector-label`,children:`Rol`}),(0,$.jsx)(`span`,{children:r.role===`coordinator`?`Coordinador`:`Especialista`})]}),(0,$.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,$.jsx)(`span`,{className:`office3d-inspector-label`,children:`Estado`}),(0,$.jsx)(`span`,{className:`office3d-state-chip office3d-state-chip--${e.state}`,children:qr[e.state]})]}),e.currentTask&&(0,$.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,$.jsx)(`span`,{className:`office3d-inspector-label`,children:`Tarea`}),(0,$.jsx)(`span`,{className:`office3d-inspector-task`,children:e.currentTask})]}),e.delegatedBy&&(0,$.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,$.jsx)(`span`,{className:`office3d-inspector-label`,children:`Delegado por`}),(0,$.jsx)(`span`,{children:t})]}),e.currentTool&&(0,$.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,$.jsx)(`span`,{className:`office3d-inspector-label`,children:`Herramienta`}),(0,$.jsx)(`span`,{className:`office3d-inspector-tool`,children:Yn(e.currentTool)})]}),(0,$.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,$.jsx)(`span`,{className:`office3d-inspector-label`,children:`Workers`}),(0,$.jsx)(`span`,{className:`font-mono`,children:e.workerCount})]}),(0,$.jsx)(Kr,{agentId:r.id}),r.description&&(0,$.jsx)(`p`,{className:`office3d-inspector-desc`,children:r.description})]})}function Yr({coordinator:e}){let t=J(e=>e.select);return e?(0,$.jsxs)(`aside`,{className:`office3d-inspector office3d-inspector--coordinator`,style:{"--agent-color":`#f59e0b`},children:[(0,$.jsx)(`button`,{type:`button`,className:`office3d-inspector-close`,onClick:()=>t(null),"aria-label":`Cerrar`,children:(0,$.jsx)(O,{size:14})}),(0,$.jsxs)(`div`,{className:`office3d-inspector-head`,children:[(0,$.jsx)(`span`,{className:`office3d-inspector-orb`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`office3d-inspector-eyebrow`,children:`Coordinador principal`}),(0,$.jsx)(`h3`,{className:`office3d-inspector-name`,children:e.name})]})]}),(0,$.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,$.jsx)(`span`,{className:`office3d-inspector-label`,children:`Función`}),(0,$.jsx)(`span`,{children:`Asigna y supervisa`})]}),(0,$.jsxs)(`div`,{className:`office3d-inspector-row`,children:[(0,$.jsx)(`span`,{className:`office3d-inspector-label`,children:`Estado`}),(0,$.jsx)(`span`,{className:`office3d-state-chip office3d-state-chip--${e.status}`,children:e.status===`tool_call`?`Ejecutando herramienta`:e.status===`thinking`?`Pensando`:`En espera`})]}),(0,$.jsx)(Kr,{agentId:e.id}),typeof e.description==`string`&&(0,$.jsx)(`p`,{className:`office3d-inspector-desc`,children:e.description})]}):null}var Xr={archived:`Archivado`,disabled:`Desactivado`,idle:`Disponible`,thinking:`Pensando`,tool_call:`Ejecutando`,stuck:`Necesita ayuda`};function Zr(e){let t=e.agent.description?.trim();return t?t.length>62?`${t.slice(0,59)}…`:t:`Agente especialista`}function Qr({coordinator:e,desks:t,interactions:n,workEvents:r}){let[i,a]=(0,q.useState)(!1),o=J(e=>e.selectedAgentId),c=J(e=>e.select),d=new Map(t.map(e=>[e.agent.id,e])),f=t=>t===e?.id?e.name:d.get(t)?.agent.name??t,p=new Map;for(let e of r)p.set(e.taskRef,e);return(0,$.jsxs)(`aside`,{className:`office3d-roster office3d-glass ${i?`is-collapsed`:``}`,"aria-label":`Equipo y flujo de trabajo`,children:[(0,$.jsxs)(`div`,{className:`office3d-roster-heading`,children:[(0,$.jsxs)(`div`,{className:`office3d-roster-title`,children:[(0,$.jsx)(`span`,{className:`office3d-section-kicker`,children:`CENTRO DE OPERACIONES`}),(0,$.jsx)(`h2`,{children:`Quién hace qué`})]}),(0,$.jsx)(`span`,{className:`office3d-roster-live`,"aria-label":`${n.length} flujos activos`,children:(0,$.jsx)(g,{size:15,className:n.length?`is-active`:``})}),(0,$.jsx)(`button`,{type:`button`,className:`office3d-roster-toggle`,onClick:()=>a(e=>!e),"aria-expanded":!i,"aria-label":i?`Abrir centro de operaciones`:`Colapsar centro de operaciones`,title:i?`Abrir centro de operaciones`:`Colapsar centro de operaciones`,children:i?(0,$.jsx)(l,{size:16}):(0,$.jsx)(u,{size:16})})]}),(0,$.jsxs)(`div`,{className:`office3d-roster-content`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`office3d-roster-coordinator ${o===e?.id?`is-selected`:``}`,onClick:()=>e&&c(o===e.id?null:e.id),disabled:!e,children:[(0,$.jsx)(ve,{size:17}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`small`,{children:`ABEJA REINA · COORDINADOR`}),(0,$.jsx)(`strong`,{children:e?.name??`Conectando…`}),(0,$.jsx)(`em`,{children:`Asigna · supervisa · recibe`})]})]}),(0,$.jsxs)(`div`,{className:`office3d-flow`,children:[(0,$.jsxs)(`div`,{className:`office3d-section-title`,children:[`Flujo activo `,(0,$.jsx)(`span`,{children:n.length})]}),n.length===0?(0,$.jsx)(`p`,{className:`office3d-flow-empty`,children:`El equipo está disponible. Las delegaciones aparecerán aquí.`}):n.map(e=>{let t=d.get(e.targetId),n=e.taskId?p.get(e.taskId):null,r=n?.phase===`completed`||n?.phase===`review_passed`?3:e.kind===`reviews`?2:+(t?.state===`thinking`||t?.state===`tool_call`),i=n?.phase===`failed`||n?.phase===`aborted`||n?.phase===`review_failed`||n?.phase===`blocked`;return(0,$.jsxs)(`div`,{className:`office3d-flow-item ${i?`is-failed`:``}`,children:[(0,$.jsx)(`span`,{children:f(e.sourceId)}),(0,$.jsx)(s,{size:12}),(0,$.jsx)(`span`,{children:f(e.targetId)}),(0,$.jsx)(`strong`,{children:e.kind===`reviews`?`Revisión`:`Delegación`}),e.taskName&&(0,$.jsx)(`small`,{children:e.taskName}),(0,$.jsx)(`div`,{className:`office3d-flow-steps`,"aria-label":`Progreso del trabajo`,children:[`Delegado`,`Trabajando`,`Revisando`,i?`Atención`:`Entregado`].map((e,t)=>(0,$.jsx)(`span`,{className:`${t<r?`is-done`:``} ${t===r?`is-current`:``}`,children:e},e))})]},e.id)})]}),(0,$.jsxs)(`div`,{className:`office3d-agents-list`,children:[(0,$.jsxs)(`div`,{className:`office3d-section-title`,children:[`Especialistas `,(0,$.jsx)(`span`,{children:t.length})]}),t.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`office3d-agent-row ${o===e.agent.id?`is-selected`:``}`,onClick:()=>c(o===e.agent.id?null:e.agent.id),style:{"--agent-color":e.color},children:[(0,$.jsx)(`span`,{className:`office3d-agent-status office3d-name-dot--${e.state}`}),(0,$.jsxs)(`span`,{className:`office3d-agent-copy`,children:[(0,$.jsx)(`strong`,{children:e.agent.name}),(0,$.jsx)(`small`,{children:e.currentTask||Zr(e)})]}),(0,$.jsx)(`em`,{children:Xr[e.state]})]},e.agent.id))]})]})]})}function $r(e){let t=(0,K.c)(46),{coordinator:n,desks:r}=e,i=J(ti);if(!i)return null;let a,o,s,c,l,u,d,p,m,h;if(t[0]!==n||t[1]!==i.actorId||t[2]!==i.phase||t[3]!==i.targetId||t[4]!==r){let e=new Map(r.map(ei)),v=t=>t?t===n?.id?n.name:e.get(t)?.agent.name??`Agente`:n?.name??`Coordinador`,y;t[15]===i.phase?y=t[16]:(y=pr(i.phase),t[15]=i.phase,t[16]=y);let b=y,x=b===`alert`?T:b===`done`?f:b===`review`?ye:i.phase===`delegated`?_:g;p=`office3d-now office3d-glass is-${b}`,m=b===`alert`?`assertive`:`polite`,h=`true`,t[17]===x?o=t[18]:(o=(0,$.jsx)(`div`,{className:`office3d-now-icon`,children:(0,$.jsx)(x,{size:17})}),t[17]=x,t[18]=o),l=`office3d-now-copy`,t[19]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(`span`,{children:`AHORA OCURRE`}),t[19]=u):u=t[19];let S;t[20]===i.phase?S=t[21]:(S=fr(i.phase),t[20]=i.phase,t[21]=S),t[22]===S?d=t[23]:(d=(0,$.jsx)(`strong`,{children:S}),t[22]=S,t[23]=d),a=v(i.actorId),t[24]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`b`,{children:`→`}),t[24]=s):s=t[24],c=v(i.targetId),t[0]=n,t[1]=i.actorId,t[2]=i.phase,t[3]=i.targetId,t[4]=r,t[5]=a,t[6]=o,t[7]=s,t[8]=c,t[9]=l,t[10]=u,t[11]=d,t[12]=p,t[13]=m,t[14]=h}else a=t[5],o=t[6],s=t[7],c=t[8],l=t[9],u=t[10],d=t[11],p=t[12],m=t[13],h=t[14];let v;t[25]!==a||t[26]!==s||t[27]!==c?(v=(0,$.jsxs)(`p`,{children:[a,s,c]}),t[25]=a,t[26]=s,t[27]=c,t[28]=v):v=t[28];let y;t[29]===i.taskName?y=t[30]:(y=(0,$.jsx)(`small`,{children:i.taskName}),t[29]=i.taskName,t[30]=y);let b;t[31]===i.detail?b=t[32]:(b=i.detail&&(0,$.jsx)(`em`,{children:i.detail}),t[31]=i.detail,t[32]=b);let x;t[33]!==v||t[34]!==y||t[35]!==b||t[36]!==l||t[37]!==u||t[38]!==d?(x=(0,$.jsxs)(`div`,{className:l,children:[u,d,v,y,b]}),t[33]=v,t[34]=y,t[35]=b,t[36]=l,t[37]=u,t[38]=d,t[39]=x):x=t[39];let S;return t[40]!==o||t[41]!==x||t[42]!==p||t[43]!==m||t[44]!==h?(S=(0,$.jsxs)(`section`,{className:p,"aria-live":m,"aria-atomic":h,children:[o,x]}),t[40]=o,t[41]=x,t[42]=p,t[43]=m,t[44]=h,t[45]=S):S=t[45],S}function ei(e){return[e.agent.id,e]}function ti(e){return e.activeCue}var ni=null;function ri(){if(!(typeof window>`u`))try{ni??=new AudioContext,ni.state===`suspended`&&ni.resume()}catch{ni=null}}var ii={delegated:[520,680],review_passed:[720,960],review_failed:[260,190],completed:[660,880],failed:[220,150],aborted:[280,210],blocked:[240,180]};function ai(e){if(ri(),!ni||ni.state!==`running`)return;let[t,n]=ii[e.phase],r=ni.currentTime,i=ni.createGain();i.gain.setValueAtTime(1e-4,r),i.gain.exponentialRampToValueAtTime(.045,r+.018),i.gain.exponentialRampToValueAtTime(1e-4,r+.34),i.connect(ni.destination);for(let[e,a]of[[t,0],[n,.12]]){let t=ni.createOscillator();t.type=`sine`,t.frequency.setValueAtTime(e,r+a),t.connect(i),t.start(r+a),t.stop(r+a+.2)}}function oi(e){let t=(0,K.c)(89),{desks:n,coordinator:r,interactions:i,workEvents:a,isConnected:s,selectedDesk:c,coordinatorSelected:l,coordinatorName:u,jev:d}=e,f=J(pi),m=J(fi),g=J(di),_=J(ui),S=J(li),C=J(ci),w=Br(n,i,r,a,d.decisions),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=new Set,t[0]=T):T=t[0];let E=(0,q.useRef)(T),O=(0,q.useRef)(!1),k,A;t[1]!==S||t[2]!==a?(k=()=>{if(!O.current){a.forEach(e=>E.current.add(e.eventId)),O.current=!0;return}for(let e of a)E.current.has(e.eventId)||(E.current.add(e.eventId),S&&ai(e))},A=[S,a],t[1]=S,t[2]=a,t[3]=k,t[4]=A):(k=t[3],A=t[4]),(0,q.useEffect)(k,A);let j;t[5]===n?j=t[6]:(j=n.filter(si),t[5]=n,t[6]=j);let M=j.length,N;t[7]!==u||t[8]!==n||t[9]!==c?(N=c?.delegatedBy?n.find(e=>e.agent.id===c.delegatedBy)?.agent.name??u:u,t[7]=u,t[8]=n,t[9]=c,t[10]=N):N=t[10];let P=N,F,I;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(`div`,{className:`office3d-logo`,children:(0,$.jsx)(D,{size:18})}),I=(0,$.jsx)(`h1`,{className:`office3d-title`,children:`HoloHive · Oficina 3D`}),t[11]=F,t[12]=I):(F=t[11],I=t[12]);let L;t[13]!==n.length||t[14]!==M?(L=(0,$.jsxs)(`div`,{className:`office3d-topbar-left`,children:[F,(0,$.jsxs)(`div`,{children:[I,(0,$.jsxs)(`p`,{className:`office3d-subtitle`,children:[n.length,` especialistas · `,M,` trabajando`]})]})]}),t[13]=n.length,t[14]=M,t[15]=L):L=t[15];let R=`office3d-live-badge ${s?`is-live`:`is-off`}`,z;t[16]===s?z=t[17]:(z=s?(0,$.jsx)(x,{size:12}):(0,$.jsx)(b,{size:12}),t[16]=s,t[17]=z);let B=s?`LIVE`:`OFFLINE`,V;t[18]!==z||t[19]!==B||t[20]!==R?(V=(0,$.jsxs)(`span`,{className:R,children:[z,B]}),t[18]=z,t[19]=B,t[20]=R,t[21]=V):V=t[21];let H;t[22]===d.status?H=t[23]:(H=d.status&&d.status.state!==`off`&&(0,$.jsxs)(`span`,{className:`office3d-jev-badge is-${d.status.state}`,title:`${Ae(d.status)} ${je(d.status.state)}`,children:[(0,$.jsx)(p,{size:11}),Ae(d.status).toUpperCase(),d.status.totals&&d.status.totals.savedTokens>0&&(0,$.jsxs)(`b`,{children:[`−`,Me(d.status.totals.savedTokens)]})]}),t[22]=d.status,t[23]=H);let ee;t[24]!==f||t[25]!==m?(ee=()=>m(f===`high`?`low`:`high`),t[24]=f,t[25]=m,t[26]=ee):ee=t[26];let te;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(h,{size:13}),t[27]=te):te=t[27];let ne=f===`high`?`Alta`:`Eco`,U;t[28]!==ee||t[29]!==ne?(U=(0,$.jsxs)(`button`,{type:`button`,className:`office3d-hud-btn`,onClick:ee,title:`Alternar calidad gráfica`,children:[te,ne]}),t[28]=ee,t[29]=ne,t[30]=U):U=t[30];let re=`office3d-hud-btn ${g===`calm`?`is-on`:``}`,ie;t[31]!==g||t[32]!==_?(ie=()=>_(g===`calm`?`off`:`calm`),t[31]=g,t[32]=_,t[33]=ie):ie=t[33];let ae;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(o,{size:13}),t[34]=ae):ae=t[34];let oe=g===`calm`?`Enfoque`:`Fijo`,W;t[35]!==re||t[36]!==ie||t[37]!==oe?(W=(0,$.jsxs)(`button`,{type:`button`,className:re,onClick:ie,title:`Alternar enfoque y movimiento de eventos`,children:[ae,oe]}),t[35]=re,t[36]=ie,t[37]=oe,t[38]=W):W=t[38];let se=`office3d-hud-btn ${S?`is-on`:``}`,ce;t[39]!==C||t[40]!==S?(ce=()=>{S||ri(),C(!S)},t[39]=C,t[40]=S,t[41]=ce):ce=t[41];let le=S?`Desactivar sonido de eventos`:`Activar sonido de eventos`,ue;t[42]===S?ue=t[43]:(ue=S?(0,$.jsx)(v,{size:13}):(0,$.jsx)(y,{size:13}),t[42]=S,t[43]=ue);let de=S?`Audio`:`Silencio`,fe;t[44]!==S||t[45]!==se||t[46]!==ce||t[47]!==le||t[48]!==ue||t[49]!==de?(fe=(0,$.jsxs)(`button`,{type:`button`,className:se,onClick:ce,title:le,"aria-pressed":S,children:[ue,de]}),t[44]=S,t[45]=se,t[46]=ce,t[47]=le,t[48]=ue,t[49]=de,t[50]=fe):fe=t[50];let pe;t[51]!==V||t[52]!==H||t[53]!==U||t[54]!==W||t[55]!==fe?(pe=(0,$.jsxs)(`div`,{className:`office3d-topbar-right`,children:[V,H,U,W,fe]}),t[51]=V,t[52]=H,t[53]=U,t[54]=W,t[55]=fe,t[56]=pe):pe=t[56];let me;t[57]!==pe||t[58]!==L?(me=(0,$.jsxs)(`header`,{className:`office3d-topbar office3d-glass`,children:[L,pe]}),t[57]=pe,t[58]=L,t[59]=me):me=t[59];let he;t[60]!==r||t[61]!==n?(he=(0,$.jsx)($r,{coordinator:r,desks:n}),t[60]=r,t[61]=n,t[62]=he):he=t[62];let ge;t[63]!==r||t[64]!==n||t[65]!==d.decisions||t[66]!==d.status?(ge=(0,$.jsx)(Vr,{status:d.status,decisions:d.decisions,coordinator:r,desks:n}),t[63]=r,t[64]=n,t[65]=d.decisions,t[66]=d.status,t[67]=ge):ge=t[67];let G;t[68]!==r||t[69]!==n||t[70]!==i||t[71]!==a?(G=(0,$.jsx)(Qr,{coordinator:r,desks:n,interactions:i,workEvents:a}),t[68]=r,t[69]=n,t[70]=i,t[71]=a,t[72]=G):G=t[72];let _e;t[73]===w?_e=t[74]:(_e=(0,$.jsx)(`div`,{className:`office3d-bottom-left`,children:(0,$.jsx)(Ir,{events:w})}),t[73]=w,t[74]=_e);let ve;t[75]!==P||t[76]!==c?(ve=(0,$.jsx)(Jr,{desk:c,delegatorName:P}),t[75]=P,t[76]=c,t[77]=ve):ve=t[77];let ye;t[78]!==r||t[79]!==l?(ye=l&&(0,$.jsx)(Yr,{coordinator:r}),t[78]=r,t[79]=l,t[80]=ye):ye=t[80];let be;return t[81]!==me||t[82]!==he||t[83]!==ge||t[84]!==G||t[85]!==_e||t[86]!==ve||t[87]!==ye?(be=(0,$.jsxs)(`div`,{className:`office3d-hud`,children:[me,he,ge,G,_e,ve,ye]}),t[81]=me,t[82]=he,t[83]=ge,t[84]=G,t[85]=_e,t[86]=ve,t[87]=ye,t[88]=be):be=t[88],be}function si(e){return e.state===`thinking`||e.state===`tool_call`}function ci(e){return e.setSoundEnabled}function li(e){return e.soundEnabled}function ui(e){return e.setMotion}function di(e){return e.motion}function fi(e){return e.setQuality}function pi(e){return e.quality}function mi(){let e=(0,K.c)(22),{coordinator:t,desks:n,interactions:r,workEvents:i,isConnected:a}=be(),o=J(hi),s=Fe(),c;e[0]!==n||e[1]!==o?(c=n.find(e=>e.agent.id===o)??null,e[0]=n,e[1]=o,e[2]=c):c=e[2];let l=c,u=!!t&&o===t.id,d=t?.name??`Coordinador`,f=t??null,p;e[3]!==n||e[4]!==r||e[5]!==s||e[6]!==f||e[7]!==i?(p=(0,$.jsx)(Or,{desks:n,coordinator:f,interactions:r,workEvents:i,jev:s}),e[3]=n,e[4]=r,e[5]=s,e[6]=f,e[7]=i,e[8]=p):p=e[8];let m=t??null,h;e[9]!==d||e[10]!==u||e[11]!==n||e[12]!==r||e[13]!==a||e[14]!==s||e[15]!==l||e[16]!==m||e[17]!==i?(h=(0,$.jsx)(oi,{desks:n,coordinator:m,interactions:r,workEvents:i,isConnected:a,selectedDesk:l,coordinatorSelected:u,coordinatorName:d,jev:s}),e[9]=d,e[10]=u,e[11]=n,e[12]=r,e[13]=a,e[14]=s,e[15]=l,e[16]=m,e[17]=i,e[18]=h):h=e[18];let g;return e[19]!==p||e[20]!==h?(g=(0,$.jsxs)(`div`,{className:`office3d-root`,children:[p,h]}),e[19]=p,e[20]=h,e[21]=g):g=e[21],g}function hi(e){return e.selectedAgentId}export{mi as default};