tide-commander 1.199.2 → 1.199.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/assets/{AudioPlayer-XaWiU7f4.js → AudioPlayer-A_DNcPYr.js} +1 -1
- package/dist/assets/{BossLogsModal-1tI-leZQ.js → BossLogsModal-7i0Dfzei.js} +1 -1
- package/dist/assets/{BossSpawnModal-CRoChH0J.js → BossSpawnModal-fBYj1bCx.js} +1 -1
- package/dist/assets/{ControlsModal-Cu7kwhct.js → ControlsModal-CUQiPa2F.js} +1 -1
- package/dist/assets/{DockerLogsModal-DFAiOsWH.js → DockerLogsModal--VKfyjl3.js} +1 -1
- package/dist/assets/{EmbeddedEditor-hnSknX5L.js → EmbeddedEditor-hNl7brYP.js} +1 -1
- package/dist/assets/{FcStdViewer-B_cbRz1w.js → FcStdViewer-B8y6Kf36.js} +1 -1
- package/dist/assets/{GcodeViewer-CFgwEZ6g.js → GcodeViewer-COcNJnpt.js} +1 -1
- package/dist/assets/{GlbViewer-14WSSXX7.js → GlbViewer-C0Xzz1eH.js} +1 -1
- package/dist/assets/{GmailOAuthSetup-waw2142C.js → GmailOAuthSetup-DUIzQ8J7.js} +1 -1
- package/dist/assets/{GoogleOAuthSetup-Bo59grtp.js → GoogleOAuthSetup-BTWZ_aJr.js} +1 -1
- package/dist/assets/{IframeModal-B3M77grB.js → IframeModal-B6PC5QX4.js} +1 -1
- package/dist/assets/{IntegrationsPanel-BLHrC0GX.js → IntegrationsPanel-DgYST-q4.js} +2 -2
- package/dist/assets/{LogViewerModal-CitlmDgQ.js → LogViewerModal-DmH5JCwc.js} +1 -1
- package/dist/assets/{MonitoringModal-BcKOCSRM.js → MonitoringModal-CSB6I7HA.js} +1 -1
- package/dist/assets/{PM2LogsModal-DrHpuMNf.js → PM2LogsModal-jT7I4Nrj.js} +1 -1
- package/dist/assets/{RestoreArchivedAreaModal-DcD3vdUJ.js → RestoreArchivedAreaModal-jp5Xsv_D.js} +1 -1
- package/dist/assets/{Scene2DCanvas-DKUcFYZW.js → Scene2DCanvas-BJf7xjcI.js} +1 -1
- package/dist/assets/{SceneManager-DPojKMM-.js → SceneManager-CjhMmFGP.js} +1 -1
- package/dist/assets/{SkillsPanel-CUW0prbh.js → SkillsPanel-CzLEygqp.js} +1 -1
- package/dist/assets/{SlackMultiInstanceSetup-YFYeZ94t.js → SlackMultiInstanceSetup-kIMTq331.js} +1 -1
- package/dist/assets/{SpawnModal-DPvq-R5b.js → SpawnModal-DeuiK-ft.js} +1 -1
- package/dist/assets/{StatisticsModal-Dt-Hof51.js → StatisticsModal-BbFqat0A.js} +1 -1
- package/dist/assets/{StlViewer-GyyomEax.js → StlViewer-CykV3bDr.js} +1 -1
- package/dist/assets/{SubordinateAssignmentModal-ahzGBjr4.js → SubordinateAssignmentModal-BEhgvADS.js} +1 -1
- package/dist/assets/{ThreeAreaSelector-Bj_mL6NG.js → ThreeAreaSelector-61KRvl6V.js} +1 -1
- package/dist/assets/{ThreeViewShortcuts-CKtE3yZV.js → ThreeViewShortcuts-BsuRkJQ3.js} +1 -1
- package/dist/assets/{TriggerManagerPanel-DtdbOk9B.js → TriggerManagerPanel-BUbAL2Mb.js} +1 -1
- package/dist/assets/{VideoPlayer-Crq-MwPS.js → VideoPlayer-Bow0E8JN.js} +1 -1
- package/dist/assets/{WorkflowEditorPanel-CitR9Em3.js → WorkflowEditorPanel-D5sSWYl7.js} +1 -1
- package/dist/assets/{abnfDiagram-VRR7QNED-QFcuJYPe.js → abnfDiagram-VRR7QNED-C2HvJaIu.js} +1 -1
- package/dist/assets/{arc-CLuSzQ4E.js → arc-DIfPSJnG.js} +1 -1
- package/dist/assets/{architectureDiagram-ZJ3FMSHR-DlhVck93.js → architectureDiagram-ZJ3FMSHR-JwB01V03.js} +1 -1
- package/dist/assets/{area-logos-DYARiYqI.js → area-logos-CzRaMbh2.js} +1 -1
- package/dist/assets/{blockDiagram-677ZJIJ3-CJwOmsfj.js → blockDiagram-677ZJIJ3-Zr1rRoej.js} +1 -1
- package/dist/assets/{c4Diagram-LMCZKHZV-OsgCNPWJ.js → c4Diagram-LMCZKHZV-D1bI4OAN.js} +1 -1
- package/dist/assets/channel-D875PBiW.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-KG-L7vvm.js → chunk-2Q5K7J3B-IBPe4Q7q.js} +1 -1
- package/dist/assets/{chunk-32BRIVSS-BXGbqO9v.js → chunk-32BRIVSS-rQSWhcb_.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-BWXkm8f0.js → chunk-5VM5RSS4-Dmv7dmVy.js} +1 -1
- package/dist/assets/{chunk-EX3LRPZG-7-8ulJ19.js → chunk-EX3LRPZG-TDT_cQou.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-mkwFN5xu.js → chunk-JWPE2WC7-C0GVNe-V.js} +1 -1
- package/dist/assets/{chunk-MOJQB5TN-WEfWznKE.js → chunk-MOJQB5TN-__mP_faY.js} +1 -1
- package/dist/assets/{chunk-RYQCIY6F-ByP5odu4.js → chunk-RYQCIY6F-ecSBBPze.js} +1 -1
- package/dist/assets/{chunk-V7JOEXUC-yWHmp1L1.js → chunk-V7JOEXUC-BC56iR05.js} +1 -1
- package/dist/assets/{chunk-VR4S4FIN-DHbZaHzt.js → chunk-VR4S4FIN-DERvXVps.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-SNa-Wh3U.js → chunk-XXDRQBXY-BVn84nw2.js} +1 -1
- package/dist/assets/classDiagram-OUVF2IWQ-EG57DD_l.js +1 -0
- package/dist/assets/classDiagram-v2-EOCWNBFH-EG57DD_l.js +1 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-CyxHYUhP.js → cose-bilkent-JH36ORCC-mg3hjIh0.js} +1 -1
- package/dist/assets/{cynefin-VYW2F7L2-BvwjSDiQ.js → cynefin-VYW2F7L2-BMZ4knrn.js} +1 -1
- package/dist/assets/{cynefinDiagram-TSTJHNR4-C8doInhn.js → cynefinDiagram-TSTJHNR4-CnOuLqXO.js} +1 -1
- package/dist/assets/{dagre-VKFMJZFB-BNDcupek.js → dagre-VKFMJZFB-BqmESFSV.js} +1 -1
- package/dist/assets/{diagram-FQU43EPY-Bst0bBnQ.js → diagram-FQU43EPY-BO4mTTgt.js} +1 -1
- package/dist/assets/{diagram-G47NLZAW-CfEv0aTY.js → diagram-G47NLZAW-txAn-X18.js} +1 -1
- package/dist/assets/{diagram-NH7WQ7WH-B7MYvWXL.js → diagram-NH7WQ7WH-BpGKYTxX.js} +1 -1
- package/dist/assets/{diagram-OA4YK3LP-BIzII0d2.js → diagram-OA4YK3LP-BWgk4USe.js} +1 -1
- package/dist/assets/{diagram-WEI45ONY-D5yd1HWr.js → diagram-WEI45ONY-CgqpLIRx.js} +1 -1
- package/dist/assets/{ebnfDiagram-CCIWWBDH-gyhVYUos.js → ebnfDiagram-CCIWWBDH-CJXyC9CG.js} +1 -1
- package/dist/assets/{erDiagram-Q63AITRT-Duz-DwfE.js → erDiagram-Q63AITRT-B419ak6F.js} +1 -1
- package/dist/assets/{flowDiagram-23GEKE2U-CrnARkmw.js → flowDiagram-23GEKE2U-CaoVLCFn.js} +1 -1
- package/dist/assets/{ganttDiagram-NO4QXBWP-D6cBteIN.js → ganttDiagram-NO4QXBWP-DzKf09RL.js} +1 -1
- package/dist/assets/{gitGraphDiagram-IHSO6WYX-CMHfr_lR.js → gitGraphDiagram-IHSO6WYX-BcJSGanA.js} +1 -1
- package/dist/assets/{index-D5O_0aq9.js → index-BTxaN45Z.js} +1 -1
- package/dist/assets/{index-DeqoOoo6.js → index-Bf7yerGj.js} +1 -1
- package/dist/assets/{index-fiC5OXgR.js → index-Bhl4oi94.js} +1 -1
- package/dist/assets/{index-2427ATYD.js → index-CNMfqZTR.js} +3 -3
- package/dist/assets/{index-DJKuwqJG.js → index-D-T-XZwp.js} +2 -2
- package/dist/assets/{index-B1vOCcI-.js → index-D4h5z3h7.js} +1 -1
- package/dist/assets/{index-D5pIRxFm.js → index-DGC0uvv8.js} +1 -1
- package/dist/assets/{index-CbMtvQTH.js → index-DKJGKvx6.js} +1 -1
- package/dist/assets/{index-B5wHDczA.js → index-DdXT34nf.js} +1 -1
- package/dist/assets/{infoDiagram-FWYZ7A6U-Mvk2Mpp3.js → infoDiagram-FWYZ7A6U-DmSCjl-a.js} +1 -1
- package/dist/assets/{ishikawaDiagram-FXEZZL3T-DXsaNDYg.js → ishikawaDiagram-FXEZZL3T-C2aoYMOy.js} +1 -1
- package/dist/assets/{journeyDiagram-5HDEW3XC-6QlK8xHN.js → journeyDiagram-5HDEW3XC-C-GVB1KY.js} +1 -1
- package/dist/assets/{kanban-definition-HUTT4EX6-D5EeRs07.js → kanban-definition-HUTT4EX6-IWOTfPcO.js} +1 -1
- package/dist/assets/{linear-D_aP9MD5.js → linear-BjaKb-fM.js} +1 -1
- package/dist/assets/{main-Dk3qq80S.js → main-BTH4eRQ6.js} +97 -97
- package/dist/assets/main-Dzc0Sg9A.css +1 -0
- package/dist/assets/{mermaid.core-CEculPxD.js → mermaid.core-CAEdJZ_w.js} +4 -4
- package/dist/assets/{mindmap-definition-LN4V7U3C-Vjj9vgEN.js → mindmap-definition-LN4V7U3C-BkCFpMNJ.js} +1 -1
- package/dist/assets/{pegDiagram-2B236MQR-B-AwbaoO.js → pegDiagram-2B236MQR-BKiRmui-.js} +1 -1
- package/dist/assets/{pieDiagram-ENE6RG2P-D5o1UYPK.js → pieDiagram-ENE6RG2P-BP8J15I1.js} +1 -1
- package/dist/assets/{quadrantDiagram-ABIIQ3AL-Bl_Rbmz-.js → quadrantDiagram-ABIIQ3AL-BM_bLOrJ.js} +1 -1
- package/dist/assets/{railroadDiagram-RFXS5EU6-CW-qy1dp.js → railroadDiagram-RFXS5EU6-BuzJbVwQ.js} +1 -1
- package/dist/assets/{requirementDiagram-TGXJPOKE-DGUQpy3K.js → requirementDiagram-TGXJPOKE-BFH7PfsI.js} +1 -1
- package/dist/assets/{sankeyDiagram-HTMAVEWB-CUlWZH9G.js → sankeyDiagram-HTMAVEWB-B_LNgbZM.js} +1 -1
- package/dist/assets/{sequenceDiagram-DBY2YBRQ-CeDVJrbJ.js → sequenceDiagram-DBY2YBRQ-Dpx20yKk.js} +1 -1
- package/dist/assets/{sizeCapture-X5ZJPWSS-BGSL3ofq.js → sizeCapture-X5ZJPWSS-DozwVBxi.js} +1 -1
- package/dist/assets/{stateDiagram-2N3HPSRC-9A8tAPIu.js → stateDiagram-2N3HPSRC-Dz7I61Z2.js} +1 -1
- package/dist/assets/stateDiagram-v2-6OUMAXLB-BFOToQX1.js +1 -0
- package/dist/assets/{swimlanes-5IMT3BWC-CipRR1uk.js → swimlanes-5IMT3BWC-IF3gQbtc.js} +2 -2
- package/dist/assets/swimlanesDiagram-G3AALYLV-CF7hL7qo.js +8 -0
- package/dist/assets/{timeline-definition-FHXFAJF6-IgrCsFe-.js → timeline-definition-FHXFAJF6-72sDxnmY.js} +1 -1
- package/dist/assets/{vennDiagram-L72KCM5P-okSGsDy3.js → vennDiagram-L72KCM5P-nfw568sB.js} +1 -1
- package/dist/assets/{wardleyDiagram-EHGQE667-G0RLggUt.js → wardleyDiagram-EHGQE667-DoF1Ii5p.js} +1 -1
- package/dist/assets/{web-BPOqvnJL.js → web-C8qAHcxt.js} +1 -1
- package/dist/assets/{web-B5BfOO5C.js → web-D97lBSvE.js} +1 -1
- package/dist/assets/{web-Q8DwQW0W.js → web-DlKkI5gM.js} +1 -1
- package/dist/assets/{xychartDiagram-FW5EYKEG-DtVJEFyI.js → xychartDiagram-FW5EYKEG-gGwkb3hj.js} +1 -1
- package/dist/build-info.json +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/channel-cpl_NpAy.js +0 -1
- package/dist/assets/classDiagram-OUVF2IWQ-D_lsO4mm.js +0 -1
- package/dist/assets/classDiagram-v2-EOCWNBFH-D_lsO4mm.js +0 -1
- package/dist/assets/main-B2ZLroL1.css +0 -1
- package/dist/assets/stateDiagram-v2-6OUMAXLB-DzVFFq0g.js +0 -1
- package/dist/assets/swimlanesDiagram-G3AALYLV-XDQw-C4e.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as Ze,d as et,z as cs,a0 as us,f as ls,br as hs,bZ as fs,aa as ds,r as h,y as gs,S as _e,b_ as Ye,b$ as ms,c0 as ps,c1 as ys,as as As,c2 as ye,s as U,c3 as xs,j as d,I as V,V as Tt,c4 as Ft,n as Nt,c5 as Es,c6 as Dt,c7 as We,U as qe,m as Ms,ar as Gt,u as Oe,c8 as Rt,aC as Cs,c9 as jt,ca as Is}from"./main-Dk3qq80S.js";import{cb as zn,cc as Kn,cd as On,ce as Un,cf as Gn}from"./main-Dk3qq80S.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";function ce(t){return Array.isArray?Array.isArray(t):Wt(t)==="[object Array]"}function _s(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function Ss(t){return t==null?"":_s(t)}function oe(t){return typeof t=="string"}function Ht(t){return typeof t=="number"}function vs(t){return t===!0||t===!1||ws(t)&&Wt(t)=="[object Boolean]"}function Yt(t){return typeof t=="object"}function ws(t){return Yt(t)&&t!==null}function X(t){return t!=null}function Ve(t){return!t.trim().length}function Wt(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const bs="Incorrect 'index' type",Ls=t=>`Invalid value for key ${t}`,Ts=t=>`Pattern length exceeds max of ${t}.`,Fs=t=>`Missing ${t} property in key`,Ns=t=>`Property 'weight' in key '${t}' must be a positive integer`,kt=Object.prototype.hasOwnProperty;class Ds{constructor(e){this._keys=[],this._keyMap={};let n=0;e.forEach(r=>{let o=qt(r);this._keys.push(o),this._keyMap[o.id]=o,n+=o.weight}),this._keys.forEach(r=>{r.weight/=n})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function qt(t){let e=null,n=null,r=null,o=1,a=null;if(oe(t)||ce(t))r=t,e=$t(t),n=tt(t);else{if(!kt.call(t,"name"))throw new Error(Fs("name"));const c=t.name;if(r=c,kt.call(t,"weight")&&(o=t.weight,o<=0))throw new Error(Ns(c));e=$t(c),n=tt(c),a=t.getFn}return{path:e,id:n,weight:o,src:r,getFn:a}}function $t(t){return ce(t)?t:t.split(".")}function tt(t){return ce(t)?t.join("."):t}function Rs(t,e){let n=[],r=!1;const o=(a,c,u)=>{if(X(a))if(!c[u])n.push(a);else{let f=c[u];const l=a[f];if(!X(l))return;if(u===c.length-1&&(oe(l)||Ht(l)||vs(l)))n.push(Ss(l));else if(ce(l)){r=!0;for(let g=0,x=l.length;g<x;g+=1)o(l[g],c,u+1)}else c.length&&o(l,c,u+1)}};return o(t,oe(e)?e.split("."):e,0),r?n:n[0]}const js={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},ks={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},$s={location:0,threshold:.6,distance:100},Bs={useExtendedSearch:!1,getFn:Rs,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var C={...ks,...js,...$s,...Bs};const Ps=/[^ ]+/g;function Qs(t=1,e=3){const n=new Map,r=Math.pow(10,e);return{get(o){const a=o.match(Ps).length;if(n.has(a))return n.get(a);const c=1/Math.pow(a,.5*t),u=parseFloat(Math.round(c*r)/r);return n.set(a,u),u},clear(){n.clear()}}}class at{constructor({getFn:e=C.getFn,fieldNormWeight:n=C.fieldNormWeight}={}){this.norm=Qs(n,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((n,r)=>{this._keysMap[n.id]=r})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,oe(this.docs[0])?this.docs.forEach((e,n)=>{this._addString(e,n)}):this.docs.forEach((e,n)=>{this._addObject(e,n)}),this.norm.clear())}add(e){const n=this.size();oe(e)?this._addString(e,n):this._addObject(e,n)}removeAt(e){this.records.splice(e,1);for(let n=e,r=this.size();n<r;n+=1)this.records[n].i-=1}getValueForItemAtKeyId(e,n){return e[this._keysMap[n]]}size(){return this.records.length}_addString(e,n){if(!X(e)||Ve(e))return;let r={v:e,i:n,n:this.norm.get(e)};this.records.push(r)}_addObject(e,n){let r={i:n,$:{}};this.keys.forEach((o,a)=>{let c=o.getFn?o.getFn(e):this.getFn(e,o.path);if(X(c)){if(ce(c)){let u=[];const f=[{nestedArrIndex:-1,value:c}];for(;f.length;){const{nestedArrIndex:l,value:g}=f.pop();if(X(g))if(oe(g)&&!Ve(g)){let x={v:g,i:l,n:this.norm.get(g)};u.push(x)}else ce(g)&&g.forEach((x,y)=>{f.push({nestedArrIndex:y,value:x})})}r.$[a]=u}else if(oe(c)&&!Ve(c)){let u={v:c,n:this.norm.get(c)};r.$[a]=u}}}),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function Vt(t,e,{getFn:n=C.getFn,fieldNormWeight:r=C.fieldNormWeight}={}){const o=new at({getFn:n,fieldNormWeight:r});return o.setKeys(t.map(qt)),o.setSources(e),o.create(),o}function zs(t,{getFn:e=C.getFn,fieldNormWeight:n=C.fieldNormWeight}={}){const{keys:r,records:o}=t,a=new at({getFn:e,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(o),a}function Pe(t,{errors:e=0,currentLocation:n=0,expectedLocation:r=0,distance:o=C.distance,ignoreLocation:a=C.ignoreLocation}={}){const c=e/t.length;if(a)return c;const u=Math.abs(r-n);return o?c+u/o:u?1:c}function Ks(t=[],e=C.minMatchCharLength){let n=[],r=-1,o=-1,a=0;for(let c=t.length;a<c;a+=1){let u=t[a];u&&r===-1?r=a:!u&&r!==-1&&(o=a-1,o-r+1>=e&&n.push([r,o]),r=-1)}return t[a-1]&&a-r>=e&&n.push([r,a-1]),n}const me=32;function Os(t,e,n,{location:r=C.location,distance:o=C.distance,threshold:a=C.threshold,findAllMatches:c=C.findAllMatches,minMatchCharLength:u=C.minMatchCharLength,includeMatches:f=C.includeMatches,ignoreLocation:l=C.ignoreLocation}={}){if(e.length>me)throw new Error(Ts(me));const g=e.length,x=t.length,y=Math.max(0,Math.min(r,x));let E=a,A=y;const M=u>1||f,S=M?Array(x):[];let R;for(;(R=t.indexOf(e,A))>-1;){let B=Pe(e,{currentLocation:R,expectedLocation:y,distance:o,ignoreLocation:l});if(E=Math.min(B,E),A=R+g,M){let Y=0;for(;Y<g;)S[R+Y]=1,Y+=1}}A=-1;let w=[],j=1,K=g+x;const le=1<<g-1;for(let B=0;B<g;B+=1){let Y=0,G=K;for(;Y<G;)Pe(e,{errors:B,currentLocation:y+G,expectedLocation:y,distance:o,ignoreLocation:l})<=E?Y=G:K=G,G=Math.floor((K-Y)/2+Y);K=G;let ie=Math.max(1,y-G+1),re=c?x:Math.min(y+G,x)+g,J=Array(re+2);J[re+1]=(1<<B)-1;for(let O=re;O>=ie;O-=1){let W=O-1,N=n[t.charAt(W)];if(M&&(S[W]=+!!N),J[O]=(J[O+1]<<1|1)&N,B&&(J[O]|=(w[O+1]|w[O])<<1|1|w[O+1]),J[O]&le&&(j=Pe(e,{errors:B,currentLocation:W,expectedLocation:y,distance:o,ignoreLocation:l}),j<=E)){if(E=j,A=W,A<=y)break;ie=Math.max(1,2*y-A)}}if(Pe(e,{errors:B+1,currentLocation:y,expectedLocation:y,distance:o,ignoreLocation:l})>E)break;w=J}const he={isMatch:A>=0,score:Math.max(.001,j)};if(M){const B=Ks(S,u);B.length?f&&(he.indices=B):he.isMatch=!1}return he}function Us(t){let e={};for(let n=0,r=t.length;n<r;n+=1){const o=t.charAt(n);e[o]=(e[o]||0)|1<<r-n-1}return e}const ze=String.prototype.normalize?(t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(t=>t);class Xt{constructor(e,{location:n=C.location,threshold:r=C.threshold,distance:o=C.distance,includeMatches:a=C.includeMatches,findAllMatches:c=C.findAllMatches,minMatchCharLength:u=C.minMatchCharLength,isCaseSensitive:f=C.isCaseSensitive,ignoreDiacritics:l=C.ignoreDiacritics,ignoreLocation:g=C.ignoreLocation}={}){if(this.options={location:n,threshold:r,distance:o,includeMatches:a,findAllMatches:c,minMatchCharLength:u,isCaseSensitive:f,ignoreDiacritics:l,ignoreLocation:g},e=f?e:e.toLowerCase(),e=l?ze(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const x=(E,A)=>{this.chunks.push({pattern:E,alphabet:Us(E),startIndex:A})},y=this.pattern.length;if(y>me){let E=0;const A=y%me,M=y-A;for(;E<M;)x(this.pattern.substr(E,me),E),E+=me;if(A){const S=y-me;x(this.pattern.substr(S),S)}}else x(this.pattern,0)}searchIn(e){const{isCaseSensitive:n,ignoreDiacritics:r,includeMatches:o}=this.options;if(e=n?e:e.toLowerCase(),e=r?ze(e):e,this.pattern===e){let M={isMatch:!0,score:0};return o&&(M.indices=[[0,e.length-1]]),M}const{location:a,distance:c,threshold:u,findAllMatches:f,minMatchCharLength:l,ignoreLocation:g}=this.options;let x=[],y=0,E=!1;this.chunks.forEach(({pattern:M,alphabet:S,startIndex:R})=>{const{isMatch:w,score:j,indices:K}=Os(e,M,S,{location:a+R,distance:c,threshold:u,findAllMatches:f,minMatchCharLength:l,includeMatches:o,ignoreLocation:g});w&&(E=!0),y+=j,w&&K&&(x=[...x,...K])});let A={isMatch:E,score:E?y/this.chunks.length:1};return E&&o&&(A.indices=x),A}}class ue{constructor(e){this.pattern=e}static isMultiMatch(e){return Bt(e,this.multiRegex)}static isSingleMatch(e){return Bt(e,this.singleRegex)}search(){}}function Bt(t,e){const n=t.match(e);return n?n[1]:null}class Gs extends ue{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const n=e===this.pattern;return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class Hs extends ue{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const r=e.indexOf(this.pattern)===-1;return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class Ys extends ue{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const n=e.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class Ws extends ue{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const n=!e.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class qs extends ue{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const n=e.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class Vs extends ue{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const n=!e.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class Jt extends ue{constructor(e,{location:n=C.location,threshold:r=C.threshold,distance:o=C.distance,includeMatches:a=C.includeMatches,findAllMatches:c=C.findAllMatches,minMatchCharLength:u=C.minMatchCharLength,isCaseSensitive:f=C.isCaseSensitive,ignoreDiacritics:l=C.ignoreDiacritics,ignoreLocation:g=C.ignoreLocation}={}){super(e),this._bitapSearch=new Xt(e,{location:n,threshold:r,distance:o,includeMatches:a,findAllMatches:c,minMatchCharLength:u,isCaseSensitive:f,ignoreDiacritics:l,ignoreLocation:g})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class Zt extends ue{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let n=0,r;const o=[],a=this.pattern.length;for(;(r=e.indexOf(this.pattern,n))>-1;)n=r+a,o.push([r,n-1]);const c=!!o.length;return{isMatch:c,score:c?0:1,indices:o}}}const st=[Gs,Zt,Ys,Ws,Vs,qs,Hs,Jt],Pt=st.length,Xs=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Js="|";function Zs(t,e={}){return t.split(Js).map(n=>{let r=n.trim().split(Xs).filter(a=>a&&!!a.trim()),o=[];for(let a=0,c=r.length;a<c;a+=1){const u=r[a];let f=!1,l=-1;for(;!f&&++l<Pt;){const g=st[l];let x=g.isMultiMatch(u);x&&(o.push(new g(x,e)),f=!0)}if(!f)for(l=-1;++l<Pt;){const g=st[l];let x=g.isSingleMatch(u);if(x){o.push(new g(x,e));break}}}return o})}const en=new Set([Jt.type,Zt.type]);class tn{constructor(e,{isCaseSensitive:n=C.isCaseSensitive,ignoreDiacritics:r=C.ignoreDiacritics,includeMatches:o=C.includeMatches,minMatchCharLength:a=C.minMatchCharLength,ignoreLocation:c=C.ignoreLocation,findAllMatches:u=C.findAllMatches,location:f=C.location,threshold:l=C.threshold,distance:g=C.distance}={}){this.query=null,this.options={isCaseSensitive:n,ignoreDiacritics:r,includeMatches:o,minMatchCharLength:a,findAllMatches:u,ignoreLocation:c,location:f,threshold:l,distance:g},e=n?e:e.toLowerCase(),e=r?ze(e):e,this.pattern=e,this.query=Zs(this.pattern,this.options)}static condition(e,n){return n.useExtendedSearch}searchIn(e){const n=this.query;if(!n)return{isMatch:!1,score:1};const{includeMatches:r,isCaseSensitive:o,ignoreDiacritics:a}=this.options;e=o?e:e.toLowerCase(),e=a?ze(e):e;let c=0,u=[],f=0;for(let l=0,g=n.length;l<g;l+=1){const x=n[l];u.length=0,c=0;for(let y=0,E=x.length;y<E;y+=1){const A=x[y],{isMatch:M,indices:S,score:R}=A.search(e);if(M){if(c+=1,f+=R,r){const w=A.constructor.type;en.has(w)?u=[...u,...S]:u.push(S)}}else{f=0,c=0,u.length=0;break}}if(c){let y={isMatch:!0,score:f/c};return r&&(y.indices=u),y}}return{isMatch:!1,score:1}}}const nt=[];function sn(...t){nt.push(...t)}function rt(t,e){for(let n=0,r=nt.length;n<r;n+=1){let o=nt[n];if(o.condition(t,e))return new o(t,e)}return new Xt(t,e)}const Ke={AND:"$and",OR:"$or"},ot={PATH:"$path",PATTERN:"$val"},it=t=>!!(t[Ke.AND]||t[Ke.OR]),nn=t=>!!t[ot.PATH],rn=t=>!ce(t)&&Yt(t)&&!it(t),Qt=t=>({[Ke.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function es(t,e,{auto:n=!0}={}){const r=o=>{let a=Object.keys(o);const c=nn(o);if(!c&&a.length>1&&!it(o))return r(Qt(o));if(rn(o)){const f=c?o[ot.PATH]:a[0],l=c?o[ot.PATTERN]:o[f];if(!oe(l))throw new Error(Ls(f));const g={keyId:tt(f),pattern:l};return n&&(g.searcher=rt(l,e)),g}let u={children:[],operator:a[0]};return a.forEach(f=>{const l=o[f];ce(l)&&l.forEach(g=>{u.children.push(r(g))})}),u};return it(t)||(t=Qt(t)),r(t)}function on(t,{ignoreFieldNorm:e=C.ignoreFieldNorm}){t.forEach(n=>{let r=1;n.matches.forEach(({key:o,norm:a,score:c})=>{const u=o?o.weight:null;r*=Math.pow(c===0&&u?Number.EPSILON:c,(u||1)*(e?1:a))}),n.score=r})}function an(t,e){const n=t.matches;e.matches=[],X(n)&&n.forEach(r=>{if(!X(r.indices)||!r.indices.length)return;const{indices:o,value:a}=r;let c={indices:o,value:a};r.key&&(c.key=r.key.src),r.idx>-1&&(c.refIndex=r.idx),e.matches.push(c)})}function cn(t,e){e.score=t.score}function un(t,e,{includeMatches:n=C.includeMatches,includeScore:r=C.includeScore}={}){const o=[];return n&&o.push(an),r&&o.push(cn),t.map(a=>{const{idx:c}=a,u={item:e[c],refIndex:c};return o.length&&o.forEach(f=>{f(a,u)}),u})}class ae{constructor(e,n={},r){this.options={...C,...n},this.options.useExtendedSearch,this._keyStore=new Ds(this.options.keys),this.setCollection(e,r)}setCollection(e,n){if(this._docs=e,n&&!(n instanceof at))throw new Error(bs);this._myIndex=n||Vt(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){X(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const n=[];for(let r=0,o=this._docs.length;r<o;r+=1){const a=this._docs[r];e(a,r)&&(this.removeAt(r),r-=1,o-=1,n.push(a))}return n}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:n=-1}={}){const{includeMatches:r,includeScore:o,shouldSort:a,sortFn:c,ignoreFieldNorm:u}=this.options;let f=oe(e)?oe(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return on(f,{ignoreFieldNorm:u}),a&&f.sort(c),Ht(n)&&n>-1&&(f=f.slice(0,n)),un(f,this._docs,{includeMatches:r,includeScore:o})}_searchStringList(e){const n=rt(e,this.options),{records:r}=this._myIndex,o=[];return r.forEach(({v:a,i:c,n:u})=>{if(!X(a))return;const{isMatch:f,score:l,indices:g}=n.searchIn(a);f&&o.push({item:a,idx:c,matches:[{score:l,value:a,norm:u,indices:g}]})}),o}_searchLogical(e){const n=es(e,this.options),r=(u,f,l)=>{if(!u.children){const{keyId:x,searcher:y}=u,E=this._findMatches({key:this._keyStore.get(x),value:this._myIndex.getValueForItemAtKeyId(f,x),searcher:y});return E&&E.length?[{idx:l,item:f,matches:E}]:[]}const g=[];for(let x=0,y=u.children.length;x<y;x+=1){const E=u.children[x],A=r(E,f,l);if(A.length)g.push(...A);else if(u.operator===Ke.AND)return[]}return g},o=this._myIndex.records,a={},c=[];return o.forEach(({$:u,i:f})=>{if(X(u)){let l=r(n,u,f);l.length&&(a[f]||(a[f]={idx:f,item:u,matches:[]},c.push(a[f])),l.forEach(({matches:g})=>{a[f].matches.push(...g)}))}}),c}_searchObjectList(e){const n=rt(e,this.options),{keys:r,records:o}=this._myIndex,a=[];return o.forEach(({$:c,i:u})=>{if(!X(c))return;let f=[];r.forEach((l,g)=>{f.push(...this._findMatches({key:l,value:c[g],searcher:n}))}),f.length&&a.push({idx:u,item:c,matches:f})}),a}_findMatches({key:e,value:n,searcher:r}){if(!X(n))return[];let o=[];if(ce(n))n.forEach(({v:a,i:c,n:u})=>{if(!X(a))return;const{isMatch:f,score:l,indices:g}=r.searchIn(a);f&&o.push({score:l,key:e,value:a,idx:c,norm:u,indices:g})});else{const{v:a,n:c}=n,{isMatch:u,score:f,indices:l}=r.searchIn(a);u&&o.push({score:f,key:e,value:a,norm:c,indices:l})}return o}}ae.version="7.1.0";ae.createIndex=Vt;ae.parseIndex=zs;ae.config=C;ae.parseQuery=es;sn(tn);function Ie(t){return t.trim().toLowerCase().split(/\s+/).filter(Boolean)}function ln(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qe(t,e){const n=e.trim(),r=Ie(n);if(r.length<=1)return t.search(n);const[o,...a]=r.map(f=>t.search(f)),c=a.map(f=>{const l=new Map;for(const g of f)l.set(g.refIndex,g.score??1);return l}),u=[];for(const f of o){let l=f.score??1,g=!0;for(const x of c){const y=x.get(f.refIndex);if(y===void 0){g=!1;break}l+=y}g&&u.push({item:f.item,score:l/r.length})}return u.sort((f,l)=>(f.score??1)-(l.score??1)),u}function zt(t,e,n){return e===t?6:e.startsWith(t)?5:e.split(/[^a-z0-9]+/i).includes(t)?4:e.includes(t)?3:n.includes(t)?2:1}function hn(t,e,n){const r=Ie(t);if(r.length===0)return 1;const o=e.toLowerCase(),a=n.toLowerCase(),c=zt(r.join(" "),o,a);if(r.length===1)return c;let u=6;for(const f of r)u=Math.min(u,zt(f,o,a));return Math.max(c,u)}const fn=4;function Kt(t){return t.replace(/…|\.\.\./g," ").replace(/\s+/g," ").trim().toLowerCase()}const dn=24;function gn(t,e){const n=Kt(t),r=Kt(e);return n===r?!0:Math.min(n.length,r.length)<dn?!1:n.includes(r)||r.includes(n)}function mn(t,e){const n=[],r=o=>{!o||!o.text.trim()||n.length>=fn||n.some(a=>gn(a.text,o.text))||n.push(o)};t&&r({text:t,kind:"user"});for(const o of e??[])r(o);return n.length>0?n:void 0}async function pn(t){const e=new URLSearchParams({q:t}),n=await Ze(et(`/api/folders/search?${e.toString()}`));if(!n.ok){const o=await n.json().catch(()=>({}));throw new Error(o.error||`Failed to search folders: ${n.statusText}`)}const r=await n.json();return Array.isArray(r.folders)?r.folders:[]}const Ot=["agent","session","building","file","file-content","folder","area"],yn=2,An=2,xn=50,En=10,Mn=3,Cn=30,In=8,_n=3,Sn=15,Xe=5,Je=5;function vn(){const t=Gt(_e.SPOTLIGHT_TAB,"all");return ye.includes(t)?t:"all"}function Ut(){return Ms(_e.SPOTLIGHT_QUERY,"")}function wn(){const t=Gt(_e.AOP_CONFIG,{});return t.sortMode==="name"||t.sortMode==="status"||t.sortMode==="recent"?t.sortMode:"recent"}function bn({isOpen:t,onClose:e,onOpenSpawnModal:n,onOpenCommanderView:r,onOpenToolbox:o,onOpenFileExplorer:a,onOpenPM2LogsModal:c,onOpenBossLogsModal:u,onOpenDatabasePanel:f,onOpenMonitoringModal:l,onOpenSessionFinder:g,onOpenFileDetail:x}){const y=cs(),E=us(),A=ls(),M=hs(),S=fs(),R=ds(),w=h.useRef(e);w.current=e;const j=h.useRef(n);j.current=n;const K=h.useRef(r);K.current=r;const le=h.useRef(o);le.current=o;const he=h.useRef(a);he.current=a;const B=h.useRef(c);B.current=c;const Y=h.useRef(u);Y.current=u;const G=h.useRef(f);G.current=f;const ie=h.useRef(l);ie.current=l;const re=h.useRef(g);re.current=g;const J=h.useRef(x);J.current=x;const[F,O]=h.useState(Ut),[W,N]=h.useState(0),[v,ee]=h.useState(vn),[Ae,te]=h.useState([]),[ct,xe]=h.useState([]),[ut,Ee]=h.useState([]),[lt,Se]=h.useState(!1),[ht,ve]=h.useState(!1),[ft,we]=h.useState(!1),[dt,be]=h.useState(!1),[Le,Me]=h.useState({query:"",rows:[]}),[gt,mt]=h.useState(!1),[pt,yt]=h.useState(!1);h.useEffect(()=>{mt(!1),yt(!1)},[F,t]);const ts=h.useCallback(s=>{O(s),gs(_e.SPOTLIGHT_QUERY,s)},[]);h.useEffect(()=>{t&&(O(Ut()),N(0))},[t]),h.useEffect(()=>{if(!t){te([]),Se(!1);return}const s=F.trim();if(s.length<yn){te([]),Se(!1);return}te([]),Se(!0);let i=!1;const m=setTimeout(()=>{pn(s).then(I=>{i||te(I)}).catch(()=>{i||te([])}).finally(()=>{i||Se(!1)})},250);return()=>{i=!0,clearTimeout(m)}},[t,F]);const At=(M.fileSearchExcludeDirs??Ye).join(",");h.useEffect(()=>{if(!t){xe([]),ve(!1);return}const s=F.trim();if(s.length<An){xe([]),ve(!1);return}xe([]),ve(!0);let i=!1;const m=setTimeout(()=>{ms(s,{exclude:M.fileSearchExcludeDirs??[...Ye],limit:xn}).then(I=>{i||xe(I)}).catch(()=>{i||xe([])}).finally(()=>{i||ve(!1)})},250);return()=>{i=!0,clearTimeout(m)}},[t,F,At,M.fileSearchExcludeDirs]),h.useEffect(()=>{if(!t){Ee([]),we(!1);return}const s=F.trim();if(s.length<Mn){Ee([]),we(!1);return}Ee([]),we(!0);const i=new AbortController,m=setTimeout(()=>{ps(s,{exclude:M.fileSearchExcludeDirs??[...Ye],limit:Cn,signal:i.signal}).then(I=>{i.signal.aborted||Ee(I)}).catch(()=>{i.signal.aborted||Ee([])}).finally(()=>{i.signal.aborted||we(!1)})},300);return()=>{clearTimeout(m),i.abort()}},[t,F,At,M.fileSearchExcludeDirs]),h.useEffect(()=>{if(!t){Me({query:"",rows:[]}),be(!1);return}const s=F.trim();if(s.length<_n){Me({query:"",rows:[]}),be(!1);return}Me({query:"",rows:[]}),be(!0);let i=!1;const m=setTimeout(()=>{ys(s,{limit:Sn}).then(I=>{i||Me({query:s,rows:I})}).catch(()=>{i||Me({query:"",rows:[]})}).finally(()=>{i||be(!1)})},250);return()=>{i=!0,clearTimeout(m)}},[t,F]);const Ue=h.useCallback(s=>{ee(s),As(_e.SPOTLIGHT_TAB,s)},[]),xt=h.useRef(v);xt.current=v;const ss=h.useCallback(s=>{const i=ye.indexOf(xt.current),m=ye[(i+s+ye.length)%ye.length];Ue(m)},[Ue]);h.useEffect(()=>{N(0)},[v]);const Ge=U.getShortcuts(),Te=h.useMemo(()=>t?xs():{},[t]),Fe=h.useMemo(()=>{if(!t)return[];const s=window.matchMedia("(pointer: coarse)").matches,i=Ge.find(I=>I.id==="spawn-agent"),m=Ge.find(I=>I.id==="toggle-commander");return[{id:"cmd-spawn",type:"command",title:"Spawn New Agent",subtitle:s?"":i?Tt(i):"Alt+N",icon:d.jsx(V,{name:"plus",size:16}),action:()=>{w.current(),j.current()}},{id:"cmd-commander",type:"command",title:"Commander View",subtitle:s?"":m!=null&&m.key?Tt(m):"Tab",icon:d.jsx(V,{name:"dashboard",size:16}),action:()=>{w.current(),K.current()}},{id:"cmd-settings",type:"command",title:"Settings & Tools",subtitle:"Configure Tide Commander",icon:d.jsx(V,{name:"gear",size:16}),action:()=>{w.current(),le.current()}},{id:"cmd-monitoring",type:"command",title:"Monitoring & Logs",subtitle:"Triggers, workflows, events",icon:d.jsx(V,{name:"chart-line",size:16}),action:()=>{var I;w.current(),(I=ie.current)==null||I.call(ie)}}]},[t,Ge]),Ne=h.useMemo(()=>{const s=new Map;if(!t)return s;const i=Array.from(E.values());for(const m of y.values())for(const I of i)if(U.isPositionInArea({x:m.position.x,z:m.position.z},I)){s.set(m.id,I);break}return s},[t,y,E]),pe=h.useMemo(()=>t?Array.from(y.values()).map(s=>{const i=[];s.lastAssignedTask&&i.push(s.lastAssignedTask);const m=`${s.class} • ${s.cwd}`,I=Ne.get(s.id),k=(I==null?void 0:I.name)||"";let b=`${s.name} ${s.class} ${s.status} ${s.cwd}`;s.taskLabel&&(b+=` ${s.taskLabel}`),k&&(b+=` ${k}`),i.length>0&&(b+=` ${i.join(" ")}`);const $=Date.now()-s.lastActivity;let D;return s.lastAssignedTask&&(s.lastAssignedTask.length>150?D=s.lastAssignedTask.slice(0,150)+"...":D=s.lastAssignedTask),{id:`agent-${s.id}`,type:"agent",title:s.name,subtitle:m,lastUserInput:D,timeAway:$,icon:d.jsx(Nt,{agent:s,size:20}),_searchText:b,_userQueries:i,_agentId:s.id,_lastActivity:s.lastActivity,_taskLabel:s.taskLabel,_status:s.status,_provider:s.provider??"claude",_piModel:s.piModel,_piModelProvider:s.piModelProvider,_areaName:k||void 0,_areaColor:I==null?void 0:I.color,action:()=>{w.current(),Ft(s.id),U.selectAgent(s.id),U.getState().viewMode!=="flat"&&U.requestTerminalExpand()}}}):[],[t,y,Ne]),De=h.useMemo(()=>t?Array.from(E.values()).map(s=>{var i;return{id:`area-${s.id}`,type:"area",title:s.name,subtitle:`${s.assignedAgentIds.length} agents • ${((i=s.directories)==null?void 0:i.length)||0} folders`,icon:d.jsx(V,{name:"map",size:16}),action:()=>{w.current(),U.selectArea(s.id)}}}):[],[t,E]),Re=h.useMemo(()=>{const s=new Map;for(const i of pe)i._agentId&&s.set(i._agentId,i);return s},[pe]),Et=h.useMemo(()=>{const s=new Map;if(!t)return s;for(const i of y.values()){const m=Ne.get(i.id);if(!m||m.archived)continue;const I=s.get(m.id);I?I.push(i):s.set(m.id,[i])}return s},[t,y,Ne]),Mt=h.useMemo(()=>{const s=new Map;for(const i of S)s.has(i.agentId)||s.set(i.agentId,i.timestamp);return s},[S]),He=h.useMemo(()=>{if(!t)return[];const s=F.trim().toLowerCase(),i=Ie(s),m=Es({sortMode:wn(),agentsWithUnseenOutput:R,getLatestToolTimestamp:b=>Mt.get(b)}),I=Array.from(E.values()).filter(b=>!b.archived).filter(b=>{if(i.length===0)return!0;const $=b.name.toLowerCase();return i.some(D=>$.includes(D))}).sort((b,$)=>b.name.localeCompare($.name,void 0,{sensitivity:"base"})),k=[];for(const b of I){const $=b.name.toLowerCase(),D=i.filter(P=>!$.includes(P));let H=(Et.get(b.id)||[]).slice().sort(m).map(P=>Re.get(P.id)).filter(P=>!!P);D.length>0&&(H=H.filter(P=>{const Z=`${P.title} ${P.subtitle||""} ${P._searchText||""}`.toLowerCase();return D.every(Q=>Z.includes(Q))}),H.length===0)||!s&&H.length===0||k.push({areaId:b.id,areaName:b.name,areaColor:b.color,agents:H})}return k},[t,F,E,Et,Re,R,Mt]),je=h.useMemo(()=>t?Array.from(A.values()).filter(s=>s.type==="server"||s.type==="boss"||s.type==="database"||s.type==="tests").map(s=>{var D,q,H,P,Z;const i=s.status==="running"?"#4ade80":s.status==="stopped"?"#f87171":"#facc15",m=s.type==="boss"?"crown":s.type==="database"?"database":s.type==="tests"?"flask":"desktop",I=s.type==="boss"?"Boss":s.type==="database"?"Database":s.type==="tests"?"Tests":"Server";let k=`${I} • ${s.status}`;if(s.type==="database"&&((q=(D=s.database)==null?void 0:D.connections)!=null&&q.length)){const Q=s.database.connections[0];k+=` • ${Q.engine} @ ${Q.host}`}else s.type==="tests"&&s.folderPath?k=`${I} • ${s.folderPath}`:s.cwd&&(k+=` • ${s.cwd}`);const b=((H=s.pm2Status)==null?void 0:H.ports)||[];let $=`${s.name} ${s.type} ${s.status} ${s.cwd||""} ${((P=s.pm2)==null?void 0:P.name)||""}`;if(s.type==="tests"&&($+=` ${s.folderPath||""} tests junit maven`),b.length>0&&($+=` ${b.join(" ")}`),s.type==="database"&&((Z=s.database)!=null&&Z.connections))for(const Q of s.database.connections)$+=` ${Q.name} ${Q.engine} ${Q.host} ${Q.database||""} mysql postgresql sql`;return{id:`building-${s.id}`,type:"building",title:s.name,subtitle:k,_ports:b,icon:d.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[d.jsx(V,{name:"status-pending",size:10,weight:"fill",color:i}),d.jsx(V,{name:m,size:16})]}),_searchText:$,action:()=>{var Q;w.current(),s.type==="boss"?Y.current(s.id):s.type==="database"?G.current(s.id):s.type==="tests"?U.openTestsBuilding(s.id):s.type==="http"?U.openHttpBuilding(s.id):(Q=s.pm2)!=null&&Q.enabled&&B.current(s.id)}}}):[],[t,A]),Ct=h.useMemo(()=>t?Ae.map(s=>{const i=s.isGitRepo&&s.gitBranch?`${s.path} • ${s.gitBranch}`:s.path;return{id:`folder-${s.path}`,type:"folder",title:s.name,subtitle:i,matchedText:s.path,icon:d.jsx(V,{name:s.isGitRepo?"git-branch":"folder",size:16}),_searchText:`${s.name} ${s.path}`,_isGitRepo:s.isGitRepo,_gitBranch:s.gitBranch,action:()=>{w.current(),U.openFileExplorer(s.path)}}}):[],[t,Ae]),ke=h.useMemo(()=>t?ct.map(s=>{const i=s.areaName&&s.areaName!==s.projectName?`${s.projectName} · ${s.areaName}`:s.projectName;return{id:`file-${s.path}`,type:"file",title:s.name,subtitle:s.relativePath,matchedText:`${s.path} ${i}`,icon:Dt(s.path),_searchText:`${s.name} ${s.relativePath} ${s.path} ${s.projectName} ${s.areaName}`,_projectName:s.projectName,_areaName:s.areaName,action:()=>{w.current(),J.current({filePath:s.path,projectRoot:s.projectRoot,searchQuery:F.trim()})}}}):[],[t,ct,F]),$e=h.useMemo(()=>t?ut.map(s=>{const i=s.matches[0],m=s.areaName&&s.areaName!==s.projectName?`${s.projectName} · ${s.areaName}`:s.projectName;return{id:`file-content-${s.path}`,type:"file-content",title:s.name,subtitle:`${s.relativePath}${i!=null&&i.line?`:${i.line}`:""}`,matchedQuery:i==null?void 0:i.content,matchedText:`${s.path} ${m}`,icon:Dt(s.path),_projectName:s.projectName,_areaName:s.areaName,_lineNumber:i==null?void 0:i.line,action:()=>{w.current(),J.current({filePath:s.path,projectRoot:s.projectRoot,targetLine:i==null?void 0:i.line,searchQuery:F.trim()})}}}):[],[t,ut,F]),fe=h.useMemo(()=>{if(!t)return[];const s=i=>{const m=Date.now()-new Date(i).getTime();return!Number.isFinite(m)||m<0?"":m<36e5?`${Math.max(1,Math.floor(m/6e4))}m`:m<864e5?`${Math.floor(m/36e5)}h`:`${Math.floor(m/864e5)}d`};return Le.rows.map(i=>{const m=Array.from(y.values()).find(D=>D.sessionId===i.sessionId),I=m??(i.agentId?y.get(i.agentId):void 0),k=(i.firstPrompt||i.snippet||i.sessionId).slice(0,90),b=[i.projectPath||i.projectDir];I&&b.push(`→ ${I.name}${m?"":" (past session)"}`);const $=s(i.lastModified);return $&&b.push($),b.push(`${i.totalMatches}×`),{id:`session-${i.sessionId}`,type:"session",title:k,subtitle:b.join(" • "),matchedQuery:i.snippet||void 0,matchedExtracts:i.extracts&&i.extracts.length>0?i.extracts:void 0,_agentId:I==null?void 0:I.id,_sessionMatches:i.totalMatches,_provider:i.provider||"claude",icon:I?d.jsx(Nt,{agent:I,size:20}):d.jsx(V,{name:"history",size:16}),action:()=>{var q;w.current();const D=Array.from(U.getState().agents.values()).find(H=>H.sessionId===i.sessionId);D?(Ft(D.id),U.selectAgent(D.id),U.getState().viewMode!=="flat"&&U.requestTerminalExpand(),U.requestTerminalSearch(D.id,Le.query)):(q=re.current)==null||q.call(re,{initialQuery:Le.query,initialSessionKey:`${i.projectPath}::${i.sessionId}`})}}})},[t,Le,y]),It=h.useMemo(()=>new ae(pe,{keys:["title","subtitle","_searchText","lastUserInput"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[pe]),_t=h.useMemo(()=>new ae(Fe,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[Fe]),St=h.useMemo(()=>new ae(De,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[De]),vt=h.useMemo(()=>new ae(je,{keys:["title","subtitle","_searchText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[je]),Ce=h.useMemo(()=>{if(!F.trim()){const p=[];p.push(...je);const _=[...pe].sort((T,z)=>{const ne=We(T._agentId,T._lastActivity,Te);return We(z._agentId,z._lastActivity,Te)-ne});p.push(..._),p.push(...De.slice(0,2));const L={};return Ot.forEach((T,z)=>{L[T]=z}),p.sort((T,z)=>(L[T.type]??999)-(L[z.type]??999)),p}const s=F.trim().toLowerCase(),i=Ie(s),m=Qe(It,F).slice(0,30),I=Qe(St,F).slice(0,2),k=Ct.slice(0,8),b=ke.slice(0,En),$=Qe(vt,F).filter(p=>{const _=p.score??1,L=`${p.item.title} ${p.item.subtitle||""} ${p.item._searchText||""}`.toLowerCase();return i.every(T=>L.includes(T))||_<=.2}).slice(0,4),D={agent:6,building:5,folder:4,file:4,"file-content":4,command:3,area:2,"modified-file":1,session:0},q=p=>hn(s,p.title,`${p.subtitle||""} ${p._searchText||""} ${p.matchedText||""}`),H=(p,_)=>{const L=(1-Math.min(1,_??1))*4;return q(p)*100+(D[p.type]??0)*5+L},P=new Map,Z=(p,_)=>{const L=P.get(p.type),T={item:p,score:H(p,_)};L?L.push(T):P.set(p.type,[T])},Q=new Map;for(const p of fe)p._agentId&&!Q.has(p._agentId)&&Q.set(p._agentId,p);for(const p of m){const _={...p.item};if(_._userQueries&&_._userQueries.length>0){const T=_._userQueries.find(z=>i.some(ne=>z.toLowerCase().includes(ne)));if(T){const z=T.toLowerCase(),ne=z.includes(s)?s:i.find(ge=>z.includes(ge))??s;if(T.length>200){const ge=z.indexOf(ne),bt=Math.max(0,ge-60),Lt=Math.min(T.length,ge+ne.length+100);_.matchedQuery=(bt>0?"...":"")+T.slice(bt,Lt)+(Lt<T.length?"...":"")}else _.matchedQuery=T}}const L=_._agentId?Q.get(_._agentId):void 0;if(L){_.matchedQuery||(_.matchedQuery=L.matchedQuery);const T=_.matchedQuery,z=(T==null?void 0:T.toLowerCase())??"";_.matchedExtracts=mn(T&&i.every(ne=>z.includes(ne))?T:void 0,L.matchedExtracts),_.action=L.action,_._sessionMatches=L._sessionMatches,_._searchText=`${_._searchText||""} ${L.matchedQuery||""} ${s}`}Z(_,p.score)}for(const[p,_]of Q){if(m.some(T=>T.item._agentId===p))continue;const L=Re.get(p);L&&Z({...L,matchedQuery:_.matchedQuery,matchedExtracts:_.matchedExtracts,action:_.action,_sessionMatches:_._sessionMatches,_searchText:`${L._searchText||""} ${_.matchedQuery||""} ${s}`},void 0)}for(const p of $)Z(p.item,p.score);for(const p of I)Z(p.item,p.score);for(const p of k)Z(p,void 0);for(const p of b)Z(p,void 0);for(const p of $e.slice(0,In))Z(p,void 0);const is=24*36e5,as=Date.now(),wt=p=>{const _=We(p.item._agentId,p.item._lastActivity,Te),L=Math.exp(-Math.LN2*Math.max(0,as-_)/is);return Math.log2(1+(p.item._sessionMatches??0))+4*L};for(const[p,_]of P)p==="agent"?_.sort((L,T)=>{const z=q(L.item),ne=q(T.item);if(ne!==z)return ne-z;const Be=wt(L),ge=wt(T);return ge!==Be?ge-Be:T.score-L.score}):_.sort((L,T)=>T.score-L.score);const de=[];for(const p of Ot){if(p==="session"){!pt&&fe.length>Xe?(de.push(...fe.slice(0,Xe)),de.push({id:"session-show-all",type:"session",title:`Show all conversations (${fe.length})`,subtitle:`${fe.length-Xe} more matches`,icon:d.jsx(V,{name:"arrow-down",size:16}),action:()=>yt(!0)})):de.push(...fe);continue}const _=P.get(p);if(_){if(p==="agent"&&!gt&&_.length>Je){for(const L of _.slice(0,Je))de.push(L.item);de.push({id:"agent-show-all",type:"agent",title:`Show all agents (${_.length})`,subtitle:`${_.length-Je} more matches`,icon:d.jsx(V,{name:"arrow-down",size:16}),action:()=>mt(!0)});continue}for(const L of _)de.push(L.item)}}return de},[F,It,St,vt,pe,Re,De,je,Ct,ke,$e,fe,Te,gt,pt]),se=h.useMemo(()=>{switch(v){case"agents":return Ce.filter(s=>s.type==="agent");case"buildings":return Ce.filter(s=>s.type==="building");case"commands":return F.trim()?Qe(_t,F).slice(0,3).map(s=>s.item):Fe;case"folders":return Ce.filter(s=>s.type==="folder");case"files":return ke;case"contents":return $e;case"areas":return He.flatMap(s=>s.agents);case"all":default:return Ce}},[v,Ce,He,ke,$e,F,_t,Fe]),ns=h.useMemo(()=>{const s=[];if(dt&&s.push("session"),ht&&s.push("file"),ft&&s.push("file-content"),lt&&s.push("folder"),v==="all")return s;const m={buildings:"building",folders:"folder",files:"file",contents:"file-content",agents:"agent",commands:"command"}[v];return m&&s.includes(m)?[m]:[]},[v,dt,ht,ft,lt]);h.useEffect(()=>{W>=se.length&&N(Math.max(0,se.length-1))},[se.length,W]);const rs=h.useCallback(s=>{if(s.altKey&&!s.ctrlKey&&!s.metaKey&&(s.key==="p"||s.key==="n"||s.key==="P"||s.key==="N")){s.preventDefault(),s.stopPropagation(),s.nativeEvent.stopImmediatePropagation();const i=s.key.toLowerCase();N(i==="p"?m=>m>0?m-1:se.length-1:m=>m<se.length-1?m+1:0);return}switch(s.key){case"Escape":s.preventDefault(),w.current();break;case"ArrowUp":s.preventDefault(),N(i=>i>0?i-1:se.length-1);break;case"ArrowDown":s.preventDefault(),N(i=>i<se.length-1?i+1:0);break;case"Enter":s.preventDefault(),se[W]&&se[W].action();break}},[se,W]),os=h.useCallback((s,i)=>{if(!i||!s)return s;const m=Ie(i);if(m.length===0)return s;const I=new RegExp(m.map(ln).sort((q,H)=>H.length-q.length).join("|"),"gi"),k=[];let b=0,$=0,D;for(;(D=I.exec(s))!==null;)D.index>b&&k.push(s.slice(b,D.index)),k.push(qe.createElement("mark",{key:$++,className:"spotlight-highlight"},D[0])),b=D.index+D[0].length;return b<s.length&&k.push(s.slice(b)),k.length>0?qe.createElement(qe.Fragment,null,...k):s},[]);return{query:F,setQuery:ts,selectedIndex:W,setSelectedIndex:N,results:se,loadingTypes:ns,activeTab:v,setActiveTab:Ue,cycleTab:ss,areaSections:He,handleKeyDown:rs,highlightMatch:os}}const Ln=h.forwardRef(function({query:e,onQueryChange:n,onKeyDown:r,onResetSelection:o},a){const{t:c}=Oe(["common"]);return d.jsxs("div",{className:"spotlight-input-wrapper",children:[d.jsx("span",{className:"spotlight-search-icon",children:"⌘"}),d.jsx("input",{ref:a,type:"text",className:"spotlight-input",placeholder:c("common:search.spotlightPlaceholder"),value:e,onChange:u=>{n(u.target.value),o()},onKeyDown:r,autoFocus:!0,spellCheck:!1}),d.jsxs("div",{className:"spotlight-input-hints",children:[d.jsx("span",{className:"spotlight-shortcut-hint",children:"↑↓"}),d.jsx("span",{className:"spotlight-shortcut-hint",children:"Enter"}),d.jsx("span",{className:"spotlight-shortcut-hint",children:"Esc"})]})]})}),Tn=h.memo(function({activeTab:e,onSelect:n}){const{t:r}=Oe(["terminal"]);return d.jsxs("div",{className:"spotlight-tabs",role:"tablist","aria-label":r("terminal:spotlight.tabsLabel"),children:[ye.map(o=>d.jsx("button",{type:"button",role:"tab","aria-selected":o===e,tabIndex:-1,className:`spotlight-tab${o===e?" active":""}`,onClick:()=>n(o),children:r(`terminal:spotlight.tabs.${o}`)},o)),d.jsx("span",{className:"spotlight-tabs-hint",children:d.jsx("kbd",{children:"Tab"})})]})}),Fn=h.forwardRef(function({results:e,loadingTypes:n,selectedIndex:r,query:o,activeTab:a,areaSections:c,highlightMatch:u,onSelectIndex:f},l){const{t:g}=Oe(["terminal"]),x=h.useRef(!1);h.useEffect(()=>{x.current=!1},[e]),h.useEffect(()=>{const A=typeof l=="function"?null:l==null?void 0:l.current;if(!A)return;const M=()=>{x.current=!0};return A.addEventListener("mousemove",M),()=>{A.removeEventListener("mousemove",M)}},[l,e]);const y={command:g("terminal:spotlight.categories.commands"),agent:g("terminal:spotlight.categories.agents"),building:g("terminal:spotlight.categories.infrastructure"),area:g("terminal:spotlight.categories.areas"),folder:g("terminal:spotlight.categories.folders"),file:g("terminal:spotlight.categories.files"),"file-content":g("terminal:spotlight.categories.fileContents"),"modified-file":g("terminal:spotlight.categories.modifiedFiles"),session:g("terminal:spotlight.categories.sessions")},E=h.useMemo(()=>{const A=[];let M=null,S=[];e.forEach((w,j)=>{w.type!==M&&(M!==null&&S.length>0&&A.push([M,S]),M=w.type,S=[]),S.push({result:w,index:j})}),M!==null&&S.length>0&&A.push([M,S]);for(const w of n)A.some(([j])=>j===w)||A.push([w,[]]);const R=["agent","session","building","file","file-content","folder","area","command"];return A.sort(([w],[j])=>R.indexOf(w)-R.indexOf(j)),A},[e,n]);if(h.useEffect(()=>{if(!l||typeof l=="function")return;const A=l.current;if(!A)return;const M=A.querySelector(".spotlight-item.selected");M&&M.scrollIntoView({block:"nearest",behavior:"smooth"})},[r,l]),a==="areas"){if(c.length===0)return d.jsx("div",{className:"spotlight-results",ref:l,children:d.jsx("div",{className:"spotlight-empty",children:g("terminal:spotlight.noResults")})});let A=0;return d.jsx("div",{className:"spotlight-results",ref:l,children:c.map(M=>d.jsxs("div",{children:[d.jsxs("div",{className:"spotlight-category-header spotlight-area-section-header",children:[d.jsx("span",{className:"spotlight-area-dot",style:{background:M.areaColor},"aria-hidden":"true"}),d.jsx("span",{className:"spotlight-area-name",children:M.areaName}),d.jsx("span",{className:"spotlight-area-count",children:M.agents.length})]}),M.agents.length===0?d.jsx("div",{className:"spotlight-area-empty",children:g("terminal:spotlight.noAgentsInArea")}):M.agents.map(S=>{const R=A++;return d.jsx(Rt,{result:S,isSelected:R===r,query:o,highlightMatch:u,onClick:()=>S.action(),onMouseEnter:()=>{x.current&&f(R)}},S.id)})]},M.areaId))})}return e.length===0&&n.length===0?d.jsx("div",{className:"spotlight-results",ref:l,children:d.jsx("div",{className:"spotlight-empty",children:g("terminal:spotlight.noResults")})}):d.jsx("div",{className:"spotlight-results",ref:l,children:E.map(([A,M])=>d.jsxs("div",{children:[(a==="all"||E.length>1)&&d.jsx("div",{className:"spotlight-category-header",children:y[A]||A}),n.includes(A)&&d.jsxs("div",{className:"spotlight-block-loading",role:"status",children:[d.jsx("span",{className:"spotlight-loading-spinner","aria-hidden":"true"}),g("terminal:spotlight.searching")]}),M.map(({result:S,index:R})=>d.jsx(Rt,{result:S,isSelected:R===r,query:o,highlightMatch:u,onClick:()=>S.action(),onMouseEnter:()=>{x.current&&f(R)}},S.id))]},A))})}),Nn=h.memo(function(){const{t:e}=Oe(["terminal"]);return d.jsxs("div",{className:"spotlight-footer",children:[d.jsxs("div",{className:"spotlight-footer-left",children:[d.jsxs("span",{className:"spotlight-footer-hint",children:[d.jsx("kbd",{children:"↑"}),d.jsx("kbd",{children:"↓"})," ",d.jsx("kbd",{children:"Alt+N"}),d.jsx("kbd",{children:"Alt+P"})," ",e("terminal:spotlight.navigate")]}),d.jsxs("span",{className:"spotlight-footer-hint",children:[d.jsx("kbd",{children:"Enter"})," ",e("terminal:spotlight.select")]}),d.jsxs("span",{className:"spotlight-footer-hint",children:[d.jsx("kbd",{children:"Tab"})," ",e("terminal:spotlight.switchTabs")]})]}),d.jsx("div",{className:"spotlight-footer-right",children:d.jsxs("span",{className:"spotlight-footer-hint",children:[d.jsx("kbd",{children:"Esc"})," ",e("common:buttons.close")]})})]})});function Dn({detail:t,onClose:e}){const[n,r]=h.useState(null),[o,a]=h.useState(!0),[c,u]=h.useState(null);Cs("spotlight-file-detail",!0,e),h.useEffect(()=>{const E=new AbortController;return a(!0),u(null),r(null),(async()=>{try{const M=await Ze(et(`/api/files/read?path=${encodeURIComponent(t.filePath)}`),{signal:E.signal}),S=await M.json();if(!M.ok)throw new Error(S.error||"Unable to read file");let R=null;if(!S.binary)try{const w=await Ze(et(`/api/files/git-original?path=${encodeURIComponent(t.filePath)}`),{signal:E.signal}),j=await w.json();w.ok&&!j.binary&&typeof j.content=="string"&&(R=j.content)}catch{}E.signal.aborted||r({filename:S.filename||t.filePath.split("/").pop()||t.filePath,content:typeof S.content=="string"?S.content:"",originalContent:R,binary:S.binary===!0})}catch(M){E.signal.aborted||u(M instanceof Error?M.message:"Unable to load file")}finally{E.signal.aborted||a(!1)}})(),()=>E.abort()},[t.filePath]),h.useEffect(()=>{const E=A=>{A.key==="Escape"&&(A.preventDefault(),A.stopImmediatePropagation(),e())};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[e]);const f=()=>{U.revealFileInExplorer(t.filePath,t.projectRoot,t.targetLine),e()},l=(n==null?void 0:n.filename)||t.filePath,g=l.lastIndexOf(".")>=0?l.slice(l.lastIndexOf(".")):"",x=Is(g),y=(n==null?void 0:n.originalContent)!=null&&n.originalContent!==n.content;return d.jsx("div",{className:"guake-git-diff-modal-overlay",onClick:e,children:d.jsxs("div",{className:"guake-git-diff-modal",onClick:E=>E.stopPropagation(),children:[d.jsxs("div",{className:"guake-git-diff-modal-header",children:[d.jsxs("div",{className:"guake-git-diff-path spotlight-file-detail-path",title:t.filePath,children:[t.filePath,t.targetLine?d.jsxs("span",{className:"spotlight-file-detail-line",children:[":",t.targetLine]}):null]}),d.jsxs("button",{type:"button",className:"spotlight-file-detail-explorer",onClick:f,title:"Open in File Explorer",children:[d.jsx(V,{name:"folder-open",size:14}),"Open in File Explorer"]}),d.jsx("button",{className:"guake-git-close",onClick:e,title:"Close (Esc)",children:d.jsx(V,{name:"close",size:14})})]}),d.jsxs("div",{className:"guake-git-diff-content",children:[o&&d.jsx("div",{className:"guake-git-diff-loading-overlay",children:d.jsx("div",{className:"diff-image-spinner"})}),c&&d.jsx("div",{className:"spotlight-file-detail-message",children:c}),(n==null?void 0:n.binary)&&d.jsx("div",{className:"spotlight-file-detail-message",children:"Binary preview is available in the File Explorer."}),n&&!n.binary&&(y?d.jsx(jt,{originalContent:n.originalContent||"",modifiedContent:n.content,filename:n.filename,filePath:t.filePath,language:x,searchQuery:t.searchQuery,targetLine:t.targetLine}):d.jsx(jt,{originalContent:"",modifiedContent:n.content,filename:n.filename,filePath:t.filePath,language:x,initialModifiedOnly:!0,searchQuery:t.searchQuery,targetLine:t.targetLine,readOnly:!0}))]})]})})}const Rn=768;function Bn({isOpen:t,onClose:e,onOpenSpawnModal:n,onOpenCommanderView:r,onOpenToolbox:o,onOpenFileExplorer:a,onOpenPM2LogsModal:c,onOpenBossLogsModal:u,onOpenDatabasePanel:f,onOpenMonitoringModal:l,onOpenSessionFinder:g}){const x=h.useRef(null),y=h.useRef(null),E=h.useRef(null),A=h.useRef(0),[M,S]=h.useState(null),{query:R,setQuery:w,selectedIndex:j,setSelectedIndex:K,results:le,loadingTypes:he,activeTab:B,setActiveTab:Y,cycleTab:G,areaSections:ie,handleKeyDown:re,highlightMatch:J}=bn({isOpen:t,onClose:e,onOpenSpawnModal:n,onOpenCommanderView:r,onOpenToolbox:o,onOpenFileExplorer:a,onOpenPM2LogsModal:c,onOpenBossLogsModal:u,onOpenDatabasePanel:f,onOpenMonitoringModal:l,onOpenSessionFinder:g,onOpenFileDetail:S});A.current=le.length;const F=h.useRef(G);F.current=G,h.useEffect(()=>{t&&setTimeout(()=>{var N,v;(N=x.current)==null||N.focus(),(v=x.current)==null||v.select()},50)},[t]),h.useEffect(()=>{if(!t)return;const N=window.visualViewport;if(!N||window.innerWidth>Rn)return;const v=()=>{const ee=y.current;ee&&(ee.style.height=`${N.height}px`,ee.style.top=`${N.offsetTop}px`)};return v(),N.addEventListener("resize",v),N.addEventListener("scroll",v),()=>{N.removeEventListener("resize",v),N.removeEventListener("scroll",v);const ee=y.current;ee&&(ee.style.height="",ee.style.top="")}},[t]),h.useEffect(()=>{if(!t)return;const N=v=>{if(v.key==="Escape"){v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation(),e();return}if(v.key==="Tab"){v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation(),F.current(v.shiftKey?-1:1);return}if(v.altKey&&!v.ctrlKey&&!v.metaKey&&(v.key==="n"||v.key==="p"||v.key==="N"||v.key==="P")){v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation();const ee=v.key.toLowerCase(),Ae=A.current;K(ee==="p"?te=>te>0?te-1:Ae-1:te=>te<Ae-1?te+1:0);return}};return window.addEventListener("keydown",N,{capture:!0}),()=>{window.removeEventListener("keydown",N,{capture:!0})}},[t,e]);const O=h.useCallback(N=>{N.target===N.currentTarget&&e()},[e]),W=h.useCallback(()=>{K(0)},[K]);return t?d.jsx("div",{ref:y,className:"spotlight-overlay",onClick:O,children:d.jsxs("div",{className:"spotlight-modal",children:[d.jsx(Ln,{ref:x,query:R,onQueryChange:w,onKeyDown:re,onResetSelection:W}),d.jsx(Tn,{activeTab:B,onSelect:Y}),d.jsx(Fn,{ref:E,results:le,loadingTypes:he,selectedIndex:j,query:R,activeTab:B,areaSections:ie,highlightMatch:J,onSelectIndex:K}),d.jsx(Nn,{})]})}):M?d.jsx(Dn,{detail:M,onClose:()=>S(null)}):null}export{zn as FILE_ICON_NAMES,Bn as Spotlight,Nn as SpotlightFooter,Ln as SpotlightInput,Rt as SpotlightItem,Fn as SpotlightResults,Kn as formatDuration,On as formatRelativeTime,Un as getAgentIcon,Dt as getFileIconFromPath,Gn as getTypeLabel,bn as useSpotlightSearch};
|
|
1
|
+
import{c as Ze,d as et,z as cs,a0 as us,f as ls,br as hs,bZ as fs,aa as ds,r as h,y as gs,S as _e,b_ as Ye,b$ as ms,c0 as ps,c1 as ys,as as As,c2 as ye,s as U,c3 as xs,j as d,I as V,V as Tt,c4 as Ft,n as Nt,c5 as Es,c6 as Dt,c7 as We,U as qe,m as Ms,ar as Gt,u as Oe,c8 as Rt,aC as Cs,c9 as jt,ca as Is}from"./main-BTH4eRQ6.js";import{cb as zn,cc as Kn,cd as On,ce as Un,cf as Gn}from"./main-BTH4eRQ6.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";function ce(t){return Array.isArray?Array.isArray(t):Wt(t)==="[object Array]"}function _s(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function Ss(t){return t==null?"":_s(t)}function oe(t){return typeof t=="string"}function Ht(t){return typeof t=="number"}function vs(t){return t===!0||t===!1||ws(t)&&Wt(t)=="[object Boolean]"}function Yt(t){return typeof t=="object"}function ws(t){return Yt(t)&&t!==null}function X(t){return t!=null}function Ve(t){return!t.trim().length}function Wt(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const bs="Incorrect 'index' type",Ls=t=>`Invalid value for key ${t}`,Ts=t=>`Pattern length exceeds max of ${t}.`,Fs=t=>`Missing ${t} property in key`,Ns=t=>`Property 'weight' in key '${t}' must be a positive integer`,kt=Object.prototype.hasOwnProperty;class Ds{constructor(e){this._keys=[],this._keyMap={};let n=0;e.forEach(r=>{let o=qt(r);this._keys.push(o),this._keyMap[o.id]=o,n+=o.weight}),this._keys.forEach(r=>{r.weight/=n})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function qt(t){let e=null,n=null,r=null,o=1,a=null;if(oe(t)||ce(t))r=t,e=$t(t),n=tt(t);else{if(!kt.call(t,"name"))throw new Error(Fs("name"));const c=t.name;if(r=c,kt.call(t,"weight")&&(o=t.weight,o<=0))throw new Error(Ns(c));e=$t(c),n=tt(c),a=t.getFn}return{path:e,id:n,weight:o,src:r,getFn:a}}function $t(t){return ce(t)?t:t.split(".")}function tt(t){return ce(t)?t.join("."):t}function Rs(t,e){let n=[],r=!1;const o=(a,c,u)=>{if(X(a))if(!c[u])n.push(a);else{let f=c[u];const l=a[f];if(!X(l))return;if(u===c.length-1&&(oe(l)||Ht(l)||vs(l)))n.push(Ss(l));else if(ce(l)){r=!0;for(let g=0,x=l.length;g<x;g+=1)o(l[g],c,u+1)}else c.length&&o(l,c,u+1)}};return o(t,oe(e)?e.split("."):e,0),r?n:n[0]}const js={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},ks={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},$s={location:0,threshold:.6,distance:100},Bs={useExtendedSearch:!1,getFn:Rs,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var C={...ks,...js,...$s,...Bs};const Ps=/[^ ]+/g;function Qs(t=1,e=3){const n=new Map,r=Math.pow(10,e);return{get(o){const a=o.match(Ps).length;if(n.has(a))return n.get(a);const c=1/Math.pow(a,.5*t),u=parseFloat(Math.round(c*r)/r);return n.set(a,u),u},clear(){n.clear()}}}class at{constructor({getFn:e=C.getFn,fieldNormWeight:n=C.fieldNormWeight}={}){this.norm=Qs(n,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((n,r)=>{this._keysMap[n.id]=r})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,oe(this.docs[0])?this.docs.forEach((e,n)=>{this._addString(e,n)}):this.docs.forEach((e,n)=>{this._addObject(e,n)}),this.norm.clear())}add(e){const n=this.size();oe(e)?this._addString(e,n):this._addObject(e,n)}removeAt(e){this.records.splice(e,1);for(let n=e,r=this.size();n<r;n+=1)this.records[n].i-=1}getValueForItemAtKeyId(e,n){return e[this._keysMap[n]]}size(){return this.records.length}_addString(e,n){if(!X(e)||Ve(e))return;let r={v:e,i:n,n:this.norm.get(e)};this.records.push(r)}_addObject(e,n){let r={i:n,$:{}};this.keys.forEach((o,a)=>{let c=o.getFn?o.getFn(e):this.getFn(e,o.path);if(X(c)){if(ce(c)){let u=[];const f=[{nestedArrIndex:-1,value:c}];for(;f.length;){const{nestedArrIndex:l,value:g}=f.pop();if(X(g))if(oe(g)&&!Ve(g)){let x={v:g,i:l,n:this.norm.get(g)};u.push(x)}else ce(g)&&g.forEach((x,y)=>{f.push({nestedArrIndex:y,value:x})})}r.$[a]=u}else if(oe(c)&&!Ve(c)){let u={v:c,n:this.norm.get(c)};r.$[a]=u}}}),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function Vt(t,e,{getFn:n=C.getFn,fieldNormWeight:r=C.fieldNormWeight}={}){const o=new at({getFn:n,fieldNormWeight:r});return o.setKeys(t.map(qt)),o.setSources(e),o.create(),o}function zs(t,{getFn:e=C.getFn,fieldNormWeight:n=C.fieldNormWeight}={}){const{keys:r,records:o}=t,a=new at({getFn:e,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(o),a}function Pe(t,{errors:e=0,currentLocation:n=0,expectedLocation:r=0,distance:o=C.distance,ignoreLocation:a=C.ignoreLocation}={}){const c=e/t.length;if(a)return c;const u=Math.abs(r-n);return o?c+u/o:u?1:c}function Ks(t=[],e=C.minMatchCharLength){let n=[],r=-1,o=-1,a=0;for(let c=t.length;a<c;a+=1){let u=t[a];u&&r===-1?r=a:!u&&r!==-1&&(o=a-1,o-r+1>=e&&n.push([r,o]),r=-1)}return t[a-1]&&a-r>=e&&n.push([r,a-1]),n}const me=32;function Os(t,e,n,{location:r=C.location,distance:o=C.distance,threshold:a=C.threshold,findAllMatches:c=C.findAllMatches,minMatchCharLength:u=C.minMatchCharLength,includeMatches:f=C.includeMatches,ignoreLocation:l=C.ignoreLocation}={}){if(e.length>me)throw new Error(Ts(me));const g=e.length,x=t.length,y=Math.max(0,Math.min(r,x));let E=a,A=y;const M=u>1||f,S=M?Array(x):[];let R;for(;(R=t.indexOf(e,A))>-1;){let B=Pe(e,{currentLocation:R,expectedLocation:y,distance:o,ignoreLocation:l});if(E=Math.min(B,E),A=R+g,M){let Y=0;for(;Y<g;)S[R+Y]=1,Y+=1}}A=-1;let w=[],j=1,K=g+x;const le=1<<g-1;for(let B=0;B<g;B+=1){let Y=0,G=K;for(;Y<G;)Pe(e,{errors:B,currentLocation:y+G,expectedLocation:y,distance:o,ignoreLocation:l})<=E?Y=G:K=G,G=Math.floor((K-Y)/2+Y);K=G;let ie=Math.max(1,y-G+1),re=c?x:Math.min(y+G,x)+g,J=Array(re+2);J[re+1]=(1<<B)-1;for(let O=re;O>=ie;O-=1){let W=O-1,N=n[t.charAt(W)];if(M&&(S[W]=+!!N),J[O]=(J[O+1]<<1|1)&N,B&&(J[O]|=(w[O+1]|w[O])<<1|1|w[O+1]),J[O]&le&&(j=Pe(e,{errors:B,currentLocation:W,expectedLocation:y,distance:o,ignoreLocation:l}),j<=E)){if(E=j,A=W,A<=y)break;ie=Math.max(1,2*y-A)}}if(Pe(e,{errors:B+1,currentLocation:y,expectedLocation:y,distance:o,ignoreLocation:l})>E)break;w=J}const he={isMatch:A>=0,score:Math.max(.001,j)};if(M){const B=Ks(S,u);B.length?f&&(he.indices=B):he.isMatch=!1}return he}function Us(t){let e={};for(let n=0,r=t.length;n<r;n+=1){const o=t.charAt(n);e[o]=(e[o]||0)|1<<r-n-1}return e}const ze=String.prototype.normalize?(t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(t=>t);class Xt{constructor(e,{location:n=C.location,threshold:r=C.threshold,distance:o=C.distance,includeMatches:a=C.includeMatches,findAllMatches:c=C.findAllMatches,minMatchCharLength:u=C.minMatchCharLength,isCaseSensitive:f=C.isCaseSensitive,ignoreDiacritics:l=C.ignoreDiacritics,ignoreLocation:g=C.ignoreLocation}={}){if(this.options={location:n,threshold:r,distance:o,includeMatches:a,findAllMatches:c,minMatchCharLength:u,isCaseSensitive:f,ignoreDiacritics:l,ignoreLocation:g},e=f?e:e.toLowerCase(),e=l?ze(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const x=(E,A)=>{this.chunks.push({pattern:E,alphabet:Us(E),startIndex:A})},y=this.pattern.length;if(y>me){let E=0;const A=y%me,M=y-A;for(;E<M;)x(this.pattern.substr(E,me),E),E+=me;if(A){const S=y-me;x(this.pattern.substr(S),S)}}else x(this.pattern,0)}searchIn(e){const{isCaseSensitive:n,ignoreDiacritics:r,includeMatches:o}=this.options;if(e=n?e:e.toLowerCase(),e=r?ze(e):e,this.pattern===e){let M={isMatch:!0,score:0};return o&&(M.indices=[[0,e.length-1]]),M}const{location:a,distance:c,threshold:u,findAllMatches:f,minMatchCharLength:l,ignoreLocation:g}=this.options;let x=[],y=0,E=!1;this.chunks.forEach(({pattern:M,alphabet:S,startIndex:R})=>{const{isMatch:w,score:j,indices:K}=Os(e,M,S,{location:a+R,distance:c,threshold:u,findAllMatches:f,minMatchCharLength:l,includeMatches:o,ignoreLocation:g});w&&(E=!0),y+=j,w&&K&&(x=[...x,...K])});let A={isMatch:E,score:E?y/this.chunks.length:1};return E&&o&&(A.indices=x),A}}class ue{constructor(e){this.pattern=e}static isMultiMatch(e){return Bt(e,this.multiRegex)}static isSingleMatch(e){return Bt(e,this.singleRegex)}search(){}}function Bt(t,e){const n=t.match(e);return n?n[1]:null}class Gs extends ue{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const n=e===this.pattern;return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class Hs extends ue{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const r=e.indexOf(this.pattern)===-1;return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class Ys extends ue{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const n=e.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class Ws extends ue{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const n=!e.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class qs extends ue{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const n=e.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class Vs extends ue{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const n=!e.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class Jt extends ue{constructor(e,{location:n=C.location,threshold:r=C.threshold,distance:o=C.distance,includeMatches:a=C.includeMatches,findAllMatches:c=C.findAllMatches,minMatchCharLength:u=C.minMatchCharLength,isCaseSensitive:f=C.isCaseSensitive,ignoreDiacritics:l=C.ignoreDiacritics,ignoreLocation:g=C.ignoreLocation}={}){super(e),this._bitapSearch=new Xt(e,{location:n,threshold:r,distance:o,includeMatches:a,findAllMatches:c,minMatchCharLength:u,isCaseSensitive:f,ignoreDiacritics:l,ignoreLocation:g})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class Zt extends ue{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let n=0,r;const o=[],a=this.pattern.length;for(;(r=e.indexOf(this.pattern,n))>-1;)n=r+a,o.push([r,n-1]);const c=!!o.length;return{isMatch:c,score:c?0:1,indices:o}}}const st=[Gs,Zt,Ys,Ws,Vs,qs,Hs,Jt],Pt=st.length,Xs=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Js="|";function Zs(t,e={}){return t.split(Js).map(n=>{let r=n.trim().split(Xs).filter(a=>a&&!!a.trim()),o=[];for(let a=0,c=r.length;a<c;a+=1){const u=r[a];let f=!1,l=-1;for(;!f&&++l<Pt;){const g=st[l];let x=g.isMultiMatch(u);x&&(o.push(new g(x,e)),f=!0)}if(!f)for(l=-1;++l<Pt;){const g=st[l];let x=g.isSingleMatch(u);if(x){o.push(new g(x,e));break}}}return o})}const en=new Set([Jt.type,Zt.type]);class tn{constructor(e,{isCaseSensitive:n=C.isCaseSensitive,ignoreDiacritics:r=C.ignoreDiacritics,includeMatches:o=C.includeMatches,minMatchCharLength:a=C.minMatchCharLength,ignoreLocation:c=C.ignoreLocation,findAllMatches:u=C.findAllMatches,location:f=C.location,threshold:l=C.threshold,distance:g=C.distance}={}){this.query=null,this.options={isCaseSensitive:n,ignoreDiacritics:r,includeMatches:o,minMatchCharLength:a,findAllMatches:u,ignoreLocation:c,location:f,threshold:l,distance:g},e=n?e:e.toLowerCase(),e=r?ze(e):e,this.pattern=e,this.query=Zs(this.pattern,this.options)}static condition(e,n){return n.useExtendedSearch}searchIn(e){const n=this.query;if(!n)return{isMatch:!1,score:1};const{includeMatches:r,isCaseSensitive:o,ignoreDiacritics:a}=this.options;e=o?e:e.toLowerCase(),e=a?ze(e):e;let c=0,u=[],f=0;for(let l=0,g=n.length;l<g;l+=1){const x=n[l];u.length=0,c=0;for(let y=0,E=x.length;y<E;y+=1){const A=x[y],{isMatch:M,indices:S,score:R}=A.search(e);if(M){if(c+=1,f+=R,r){const w=A.constructor.type;en.has(w)?u=[...u,...S]:u.push(S)}}else{f=0,c=0,u.length=0;break}}if(c){let y={isMatch:!0,score:f/c};return r&&(y.indices=u),y}}return{isMatch:!1,score:1}}}const nt=[];function sn(...t){nt.push(...t)}function rt(t,e){for(let n=0,r=nt.length;n<r;n+=1){let o=nt[n];if(o.condition(t,e))return new o(t,e)}return new Xt(t,e)}const Ke={AND:"$and",OR:"$or"},ot={PATH:"$path",PATTERN:"$val"},it=t=>!!(t[Ke.AND]||t[Ke.OR]),nn=t=>!!t[ot.PATH],rn=t=>!ce(t)&&Yt(t)&&!it(t),Qt=t=>({[Ke.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function es(t,e,{auto:n=!0}={}){const r=o=>{let a=Object.keys(o);const c=nn(o);if(!c&&a.length>1&&!it(o))return r(Qt(o));if(rn(o)){const f=c?o[ot.PATH]:a[0],l=c?o[ot.PATTERN]:o[f];if(!oe(l))throw new Error(Ls(f));const g={keyId:tt(f),pattern:l};return n&&(g.searcher=rt(l,e)),g}let u={children:[],operator:a[0]};return a.forEach(f=>{const l=o[f];ce(l)&&l.forEach(g=>{u.children.push(r(g))})}),u};return it(t)||(t=Qt(t)),r(t)}function on(t,{ignoreFieldNorm:e=C.ignoreFieldNorm}){t.forEach(n=>{let r=1;n.matches.forEach(({key:o,norm:a,score:c})=>{const u=o?o.weight:null;r*=Math.pow(c===0&&u?Number.EPSILON:c,(u||1)*(e?1:a))}),n.score=r})}function an(t,e){const n=t.matches;e.matches=[],X(n)&&n.forEach(r=>{if(!X(r.indices)||!r.indices.length)return;const{indices:o,value:a}=r;let c={indices:o,value:a};r.key&&(c.key=r.key.src),r.idx>-1&&(c.refIndex=r.idx),e.matches.push(c)})}function cn(t,e){e.score=t.score}function un(t,e,{includeMatches:n=C.includeMatches,includeScore:r=C.includeScore}={}){const o=[];return n&&o.push(an),r&&o.push(cn),t.map(a=>{const{idx:c}=a,u={item:e[c],refIndex:c};return o.length&&o.forEach(f=>{f(a,u)}),u})}class ae{constructor(e,n={},r){this.options={...C,...n},this.options.useExtendedSearch,this._keyStore=new Ds(this.options.keys),this.setCollection(e,r)}setCollection(e,n){if(this._docs=e,n&&!(n instanceof at))throw new Error(bs);this._myIndex=n||Vt(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){X(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const n=[];for(let r=0,o=this._docs.length;r<o;r+=1){const a=this._docs[r];e(a,r)&&(this.removeAt(r),r-=1,o-=1,n.push(a))}return n}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:n=-1}={}){const{includeMatches:r,includeScore:o,shouldSort:a,sortFn:c,ignoreFieldNorm:u}=this.options;let f=oe(e)?oe(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return on(f,{ignoreFieldNorm:u}),a&&f.sort(c),Ht(n)&&n>-1&&(f=f.slice(0,n)),un(f,this._docs,{includeMatches:r,includeScore:o})}_searchStringList(e){const n=rt(e,this.options),{records:r}=this._myIndex,o=[];return r.forEach(({v:a,i:c,n:u})=>{if(!X(a))return;const{isMatch:f,score:l,indices:g}=n.searchIn(a);f&&o.push({item:a,idx:c,matches:[{score:l,value:a,norm:u,indices:g}]})}),o}_searchLogical(e){const n=es(e,this.options),r=(u,f,l)=>{if(!u.children){const{keyId:x,searcher:y}=u,E=this._findMatches({key:this._keyStore.get(x),value:this._myIndex.getValueForItemAtKeyId(f,x),searcher:y});return E&&E.length?[{idx:l,item:f,matches:E}]:[]}const g=[];for(let x=0,y=u.children.length;x<y;x+=1){const E=u.children[x],A=r(E,f,l);if(A.length)g.push(...A);else if(u.operator===Ke.AND)return[]}return g},o=this._myIndex.records,a={},c=[];return o.forEach(({$:u,i:f})=>{if(X(u)){let l=r(n,u,f);l.length&&(a[f]||(a[f]={idx:f,item:u,matches:[]},c.push(a[f])),l.forEach(({matches:g})=>{a[f].matches.push(...g)}))}}),c}_searchObjectList(e){const n=rt(e,this.options),{keys:r,records:o}=this._myIndex,a=[];return o.forEach(({$:c,i:u})=>{if(!X(c))return;let f=[];r.forEach((l,g)=>{f.push(...this._findMatches({key:l,value:c[g],searcher:n}))}),f.length&&a.push({idx:u,item:c,matches:f})}),a}_findMatches({key:e,value:n,searcher:r}){if(!X(n))return[];let o=[];if(ce(n))n.forEach(({v:a,i:c,n:u})=>{if(!X(a))return;const{isMatch:f,score:l,indices:g}=r.searchIn(a);f&&o.push({score:l,key:e,value:a,idx:c,norm:u,indices:g})});else{const{v:a,n:c}=n,{isMatch:u,score:f,indices:l}=r.searchIn(a);u&&o.push({score:f,key:e,value:a,norm:c,indices:l})}return o}}ae.version="7.1.0";ae.createIndex=Vt;ae.parseIndex=zs;ae.config=C;ae.parseQuery=es;sn(tn);function Ie(t){return t.trim().toLowerCase().split(/\s+/).filter(Boolean)}function ln(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qe(t,e){const n=e.trim(),r=Ie(n);if(r.length<=1)return t.search(n);const[o,...a]=r.map(f=>t.search(f)),c=a.map(f=>{const l=new Map;for(const g of f)l.set(g.refIndex,g.score??1);return l}),u=[];for(const f of o){let l=f.score??1,g=!0;for(const x of c){const y=x.get(f.refIndex);if(y===void 0){g=!1;break}l+=y}g&&u.push({item:f.item,score:l/r.length})}return u.sort((f,l)=>(f.score??1)-(l.score??1)),u}function zt(t,e,n){return e===t?6:e.startsWith(t)?5:e.split(/[^a-z0-9]+/i).includes(t)?4:e.includes(t)?3:n.includes(t)?2:1}function hn(t,e,n){const r=Ie(t);if(r.length===0)return 1;const o=e.toLowerCase(),a=n.toLowerCase(),c=zt(r.join(" "),o,a);if(r.length===1)return c;let u=6;for(const f of r)u=Math.min(u,zt(f,o,a));return Math.max(c,u)}const fn=4;function Kt(t){return t.replace(/…|\.\.\./g," ").replace(/\s+/g," ").trim().toLowerCase()}const dn=24;function gn(t,e){const n=Kt(t),r=Kt(e);return n===r?!0:Math.min(n.length,r.length)<dn?!1:n.includes(r)||r.includes(n)}function mn(t,e){const n=[],r=o=>{!o||!o.text.trim()||n.length>=fn||n.some(a=>gn(a.text,o.text))||n.push(o)};t&&r({text:t,kind:"user"});for(const o of e??[])r(o);return n.length>0?n:void 0}async function pn(t){const e=new URLSearchParams({q:t}),n=await Ze(et(`/api/folders/search?${e.toString()}`));if(!n.ok){const o=await n.json().catch(()=>({}));throw new Error(o.error||`Failed to search folders: ${n.statusText}`)}const r=await n.json();return Array.isArray(r.folders)?r.folders:[]}const Ot=["agent","session","building","file","file-content","folder","area"],yn=2,An=2,xn=50,En=10,Mn=3,Cn=30,In=8,_n=3,Sn=15,Xe=5,Je=5;function vn(){const t=Gt(_e.SPOTLIGHT_TAB,"all");return ye.includes(t)?t:"all"}function Ut(){return Ms(_e.SPOTLIGHT_QUERY,"")}function wn(){const t=Gt(_e.AOP_CONFIG,{});return t.sortMode==="name"||t.sortMode==="status"||t.sortMode==="recent"?t.sortMode:"recent"}function bn({isOpen:t,onClose:e,onOpenSpawnModal:n,onOpenCommanderView:r,onOpenToolbox:o,onOpenFileExplorer:a,onOpenPM2LogsModal:c,onOpenBossLogsModal:u,onOpenDatabasePanel:f,onOpenMonitoringModal:l,onOpenSessionFinder:g,onOpenFileDetail:x}){const y=cs(),E=us(),A=ls(),M=hs(),S=fs(),R=ds(),w=h.useRef(e);w.current=e;const j=h.useRef(n);j.current=n;const K=h.useRef(r);K.current=r;const le=h.useRef(o);le.current=o;const he=h.useRef(a);he.current=a;const B=h.useRef(c);B.current=c;const Y=h.useRef(u);Y.current=u;const G=h.useRef(f);G.current=f;const ie=h.useRef(l);ie.current=l;const re=h.useRef(g);re.current=g;const J=h.useRef(x);J.current=x;const[F,O]=h.useState(Ut),[W,N]=h.useState(0),[v,ee]=h.useState(vn),[Ae,te]=h.useState([]),[ct,xe]=h.useState([]),[ut,Ee]=h.useState([]),[lt,Se]=h.useState(!1),[ht,ve]=h.useState(!1),[ft,we]=h.useState(!1),[dt,be]=h.useState(!1),[Le,Me]=h.useState({query:"",rows:[]}),[gt,mt]=h.useState(!1),[pt,yt]=h.useState(!1);h.useEffect(()=>{mt(!1),yt(!1)},[F,t]);const ts=h.useCallback(s=>{O(s),gs(_e.SPOTLIGHT_QUERY,s)},[]);h.useEffect(()=>{t&&(O(Ut()),N(0))},[t]),h.useEffect(()=>{if(!t){te([]),Se(!1);return}const s=F.trim();if(s.length<yn){te([]),Se(!1);return}te([]),Se(!0);let i=!1;const m=setTimeout(()=>{pn(s).then(I=>{i||te(I)}).catch(()=>{i||te([])}).finally(()=>{i||Se(!1)})},250);return()=>{i=!0,clearTimeout(m)}},[t,F]);const At=(M.fileSearchExcludeDirs??Ye).join(",");h.useEffect(()=>{if(!t){xe([]),ve(!1);return}const s=F.trim();if(s.length<An){xe([]),ve(!1);return}xe([]),ve(!0);let i=!1;const m=setTimeout(()=>{ms(s,{exclude:M.fileSearchExcludeDirs??[...Ye],limit:xn}).then(I=>{i||xe(I)}).catch(()=>{i||xe([])}).finally(()=>{i||ve(!1)})},250);return()=>{i=!0,clearTimeout(m)}},[t,F,At,M.fileSearchExcludeDirs]),h.useEffect(()=>{if(!t){Ee([]),we(!1);return}const s=F.trim();if(s.length<Mn){Ee([]),we(!1);return}Ee([]),we(!0);const i=new AbortController,m=setTimeout(()=>{ps(s,{exclude:M.fileSearchExcludeDirs??[...Ye],limit:Cn,signal:i.signal}).then(I=>{i.signal.aborted||Ee(I)}).catch(()=>{i.signal.aborted||Ee([])}).finally(()=>{i.signal.aborted||we(!1)})},300);return()=>{clearTimeout(m),i.abort()}},[t,F,At,M.fileSearchExcludeDirs]),h.useEffect(()=>{if(!t){Me({query:"",rows:[]}),be(!1);return}const s=F.trim();if(s.length<_n){Me({query:"",rows:[]}),be(!1);return}Me({query:"",rows:[]}),be(!0);let i=!1;const m=setTimeout(()=>{ys(s,{limit:Sn}).then(I=>{i||Me({query:s,rows:I})}).catch(()=>{i||Me({query:"",rows:[]})}).finally(()=>{i||be(!1)})},250);return()=>{i=!0,clearTimeout(m)}},[t,F]);const Ue=h.useCallback(s=>{ee(s),As(_e.SPOTLIGHT_TAB,s)},[]),xt=h.useRef(v);xt.current=v;const ss=h.useCallback(s=>{const i=ye.indexOf(xt.current),m=ye[(i+s+ye.length)%ye.length];Ue(m)},[Ue]);h.useEffect(()=>{N(0)},[v]);const Ge=U.getShortcuts(),Te=h.useMemo(()=>t?xs():{},[t]),Fe=h.useMemo(()=>{if(!t)return[];const s=window.matchMedia("(pointer: coarse)").matches,i=Ge.find(I=>I.id==="spawn-agent"),m=Ge.find(I=>I.id==="toggle-commander");return[{id:"cmd-spawn",type:"command",title:"Spawn New Agent",subtitle:s?"":i?Tt(i):"Alt+N",icon:d.jsx(V,{name:"plus",size:16}),action:()=>{w.current(),j.current()}},{id:"cmd-commander",type:"command",title:"Commander View",subtitle:s?"":m!=null&&m.key?Tt(m):"Tab",icon:d.jsx(V,{name:"dashboard",size:16}),action:()=>{w.current(),K.current()}},{id:"cmd-settings",type:"command",title:"Settings & Tools",subtitle:"Configure Tide Commander",icon:d.jsx(V,{name:"gear",size:16}),action:()=>{w.current(),le.current()}},{id:"cmd-monitoring",type:"command",title:"Monitoring & Logs",subtitle:"Triggers, workflows, events",icon:d.jsx(V,{name:"chart-line",size:16}),action:()=>{var I;w.current(),(I=ie.current)==null||I.call(ie)}}]},[t,Ge]),Ne=h.useMemo(()=>{const s=new Map;if(!t)return s;const i=Array.from(E.values());for(const m of y.values())for(const I of i)if(U.isPositionInArea({x:m.position.x,z:m.position.z},I)){s.set(m.id,I);break}return s},[t,y,E]),pe=h.useMemo(()=>t?Array.from(y.values()).map(s=>{const i=[];s.lastAssignedTask&&i.push(s.lastAssignedTask);const m=`${s.class} • ${s.cwd}`,I=Ne.get(s.id),k=(I==null?void 0:I.name)||"";let b=`${s.name} ${s.class} ${s.status} ${s.cwd}`;s.taskLabel&&(b+=` ${s.taskLabel}`),k&&(b+=` ${k}`),i.length>0&&(b+=` ${i.join(" ")}`);const $=Date.now()-s.lastActivity;let D;return s.lastAssignedTask&&(s.lastAssignedTask.length>150?D=s.lastAssignedTask.slice(0,150)+"...":D=s.lastAssignedTask),{id:`agent-${s.id}`,type:"agent",title:s.name,subtitle:m,lastUserInput:D,timeAway:$,icon:d.jsx(Nt,{agent:s,size:20}),_searchText:b,_userQueries:i,_agentId:s.id,_lastActivity:s.lastActivity,_taskLabel:s.taskLabel,_status:s.status,_provider:s.provider??"claude",_piModel:s.piModel,_piModelProvider:s.piModelProvider,_areaName:k||void 0,_areaColor:I==null?void 0:I.color,action:()=>{w.current(),Ft(s.id),U.selectAgent(s.id),U.getState().viewMode!=="flat"&&U.requestTerminalExpand()}}}):[],[t,y,Ne]),De=h.useMemo(()=>t?Array.from(E.values()).map(s=>{var i;return{id:`area-${s.id}`,type:"area",title:s.name,subtitle:`${s.assignedAgentIds.length} agents • ${((i=s.directories)==null?void 0:i.length)||0} folders`,icon:d.jsx(V,{name:"map",size:16}),action:()=>{w.current(),U.selectArea(s.id)}}}):[],[t,E]),Re=h.useMemo(()=>{const s=new Map;for(const i of pe)i._agentId&&s.set(i._agentId,i);return s},[pe]),Et=h.useMemo(()=>{const s=new Map;if(!t)return s;for(const i of y.values()){const m=Ne.get(i.id);if(!m||m.archived)continue;const I=s.get(m.id);I?I.push(i):s.set(m.id,[i])}return s},[t,y,Ne]),Mt=h.useMemo(()=>{const s=new Map;for(const i of S)s.has(i.agentId)||s.set(i.agentId,i.timestamp);return s},[S]),He=h.useMemo(()=>{if(!t)return[];const s=F.trim().toLowerCase(),i=Ie(s),m=Es({sortMode:wn(),agentsWithUnseenOutput:R,getLatestToolTimestamp:b=>Mt.get(b)}),I=Array.from(E.values()).filter(b=>!b.archived).filter(b=>{if(i.length===0)return!0;const $=b.name.toLowerCase();return i.some(D=>$.includes(D))}).sort((b,$)=>b.name.localeCompare($.name,void 0,{sensitivity:"base"})),k=[];for(const b of I){const $=b.name.toLowerCase(),D=i.filter(P=>!$.includes(P));let H=(Et.get(b.id)||[]).slice().sort(m).map(P=>Re.get(P.id)).filter(P=>!!P);D.length>0&&(H=H.filter(P=>{const Z=`${P.title} ${P.subtitle||""} ${P._searchText||""}`.toLowerCase();return D.every(Q=>Z.includes(Q))}),H.length===0)||!s&&H.length===0||k.push({areaId:b.id,areaName:b.name,areaColor:b.color,agents:H})}return k},[t,F,E,Et,Re,R,Mt]),je=h.useMemo(()=>t?Array.from(A.values()).filter(s=>s.type==="server"||s.type==="boss"||s.type==="database"||s.type==="tests").map(s=>{var D,q,H,P,Z;const i=s.status==="running"?"#4ade80":s.status==="stopped"?"#f87171":"#facc15",m=s.type==="boss"?"crown":s.type==="database"?"database":s.type==="tests"?"flask":"desktop",I=s.type==="boss"?"Boss":s.type==="database"?"Database":s.type==="tests"?"Tests":"Server";let k=`${I} • ${s.status}`;if(s.type==="database"&&((q=(D=s.database)==null?void 0:D.connections)!=null&&q.length)){const Q=s.database.connections[0];k+=` • ${Q.engine} @ ${Q.host}`}else s.type==="tests"&&s.folderPath?k=`${I} • ${s.folderPath}`:s.cwd&&(k+=` • ${s.cwd}`);const b=((H=s.pm2Status)==null?void 0:H.ports)||[];let $=`${s.name} ${s.type} ${s.status} ${s.cwd||""} ${((P=s.pm2)==null?void 0:P.name)||""}`;if(s.type==="tests"&&($+=` ${s.folderPath||""} tests junit maven`),b.length>0&&($+=` ${b.join(" ")}`),s.type==="database"&&((Z=s.database)!=null&&Z.connections))for(const Q of s.database.connections)$+=` ${Q.name} ${Q.engine} ${Q.host} ${Q.database||""} mysql postgresql sql`;return{id:`building-${s.id}`,type:"building",title:s.name,subtitle:k,_ports:b,icon:d.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[d.jsx(V,{name:"status-pending",size:10,weight:"fill",color:i}),d.jsx(V,{name:m,size:16})]}),_searchText:$,action:()=>{var Q;w.current(),s.type==="boss"?Y.current(s.id):s.type==="database"?G.current(s.id):s.type==="tests"?U.openTestsBuilding(s.id):s.type==="http"?U.openHttpBuilding(s.id):(Q=s.pm2)!=null&&Q.enabled&&B.current(s.id)}}}):[],[t,A]),Ct=h.useMemo(()=>t?Ae.map(s=>{const i=s.isGitRepo&&s.gitBranch?`${s.path} • ${s.gitBranch}`:s.path;return{id:`folder-${s.path}`,type:"folder",title:s.name,subtitle:i,matchedText:s.path,icon:d.jsx(V,{name:s.isGitRepo?"git-branch":"folder",size:16}),_searchText:`${s.name} ${s.path}`,_isGitRepo:s.isGitRepo,_gitBranch:s.gitBranch,action:()=>{w.current(),U.openFileExplorer(s.path)}}}):[],[t,Ae]),ke=h.useMemo(()=>t?ct.map(s=>{const i=s.areaName&&s.areaName!==s.projectName?`${s.projectName} · ${s.areaName}`:s.projectName;return{id:`file-${s.path}`,type:"file",title:s.name,subtitle:s.relativePath,matchedText:`${s.path} ${i}`,icon:Dt(s.path),_searchText:`${s.name} ${s.relativePath} ${s.path} ${s.projectName} ${s.areaName}`,_projectName:s.projectName,_areaName:s.areaName,action:()=>{w.current(),J.current({filePath:s.path,projectRoot:s.projectRoot,searchQuery:F.trim()})}}}):[],[t,ct,F]),$e=h.useMemo(()=>t?ut.map(s=>{const i=s.matches[0],m=s.areaName&&s.areaName!==s.projectName?`${s.projectName} · ${s.areaName}`:s.projectName;return{id:`file-content-${s.path}`,type:"file-content",title:s.name,subtitle:`${s.relativePath}${i!=null&&i.line?`:${i.line}`:""}`,matchedQuery:i==null?void 0:i.content,matchedText:`${s.path} ${m}`,icon:Dt(s.path),_projectName:s.projectName,_areaName:s.areaName,_lineNumber:i==null?void 0:i.line,action:()=>{w.current(),J.current({filePath:s.path,projectRoot:s.projectRoot,targetLine:i==null?void 0:i.line,searchQuery:F.trim()})}}}):[],[t,ut,F]),fe=h.useMemo(()=>{if(!t)return[];const s=i=>{const m=Date.now()-new Date(i).getTime();return!Number.isFinite(m)||m<0?"":m<36e5?`${Math.max(1,Math.floor(m/6e4))}m`:m<864e5?`${Math.floor(m/36e5)}h`:`${Math.floor(m/864e5)}d`};return Le.rows.map(i=>{const m=Array.from(y.values()).find(D=>D.sessionId===i.sessionId),I=m??(i.agentId?y.get(i.agentId):void 0),k=(i.firstPrompt||i.snippet||i.sessionId).slice(0,90),b=[i.projectPath||i.projectDir];I&&b.push(`→ ${I.name}${m?"":" (past session)"}`);const $=s(i.lastModified);return $&&b.push($),b.push(`${i.totalMatches}×`),{id:`session-${i.sessionId}`,type:"session",title:k,subtitle:b.join(" • "),matchedQuery:i.snippet||void 0,matchedExtracts:i.extracts&&i.extracts.length>0?i.extracts:void 0,_agentId:I==null?void 0:I.id,_sessionMatches:i.totalMatches,_provider:i.provider||"claude",icon:I?d.jsx(Nt,{agent:I,size:20}):d.jsx(V,{name:"history",size:16}),action:()=>{var q;w.current();const D=Array.from(U.getState().agents.values()).find(H=>H.sessionId===i.sessionId);D?(Ft(D.id),U.selectAgent(D.id),U.getState().viewMode!=="flat"&&U.requestTerminalExpand(),U.requestTerminalSearch(D.id,Le.query)):(q=re.current)==null||q.call(re,{initialQuery:Le.query,initialSessionKey:`${i.projectPath}::${i.sessionId}`})}}})},[t,Le,y]),It=h.useMemo(()=>new ae(pe,{keys:["title","subtitle","_searchText","lastUserInput"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[pe]),_t=h.useMemo(()=>new ae(Fe,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[Fe]),St=h.useMemo(()=>new ae(De,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[De]),vt=h.useMemo(()=>new ae(je,{keys:["title","subtitle","_searchText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[je]),Ce=h.useMemo(()=>{if(!F.trim()){const p=[];p.push(...je);const _=[...pe].sort((T,z)=>{const ne=We(T._agentId,T._lastActivity,Te);return We(z._agentId,z._lastActivity,Te)-ne});p.push(..._),p.push(...De.slice(0,2));const L={};return Ot.forEach((T,z)=>{L[T]=z}),p.sort((T,z)=>(L[T.type]??999)-(L[z.type]??999)),p}const s=F.trim().toLowerCase(),i=Ie(s),m=Qe(It,F).slice(0,30),I=Qe(St,F).slice(0,2),k=Ct.slice(0,8),b=ke.slice(0,En),$=Qe(vt,F).filter(p=>{const _=p.score??1,L=`${p.item.title} ${p.item.subtitle||""} ${p.item._searchText||""}`.toLowerCase();return i.every(T=>L.includes(T))||_<=.2}).slice(0,4),D={agent:6,building:5,folder:4,file:4,"file-content":4,command:3,area:2,"modified-file":1,session:0},q=p=>hn(s,p.title,`${p.subtitle||""} ${p._searchText||""} ${p.matchedText||""}`),H=(p,_)=>{const L=(1-Math.min(1,_??1))*4;return q(p)*100+(D[p.type]??0)*5+L},P=new Map,Z=(p,_)=>{const L=P.get(p.type),T={item:p,score:H(p,_)};L?L.push(T):P.set(p.type,[T])},Q=new Map;for(const p of fe)p._agentId&&!Q.has(p._agentId)&&Q.set(p._agentId,p);for(const p of m){const _={...p.item};if(_._userQueries&&_._userQueries.length>0){const T=_._userQueries.find(z=>i.some(ne=>z.toLowerCase().includes(ne)));if(T){const z=T.toLowerCase(),ne=z.includes(s)?s:i.find(ge=>z.includes(ge))??s;if(T.length>200){const ge=z.indexOf(ne),bt=Math.max(0,ge-60),Lt=Math.min(T.length,ge+ne.length+100);_.matchedQuery=(bt>0?"...":"")+T.slice(bt,Lt)+(Lt<T.length?"...":"")}else _.matchedQuery=T}}const L=_._agentId?Q.get(_._agentId):void 0;if(L){_.matchedQuery||(_.matchedQuery=L.matchedQuery);const T=_.matchedQuery,z=(T==null?void 0:T.toLowerCase())??"";_.matchedExtracts=mn(T&&i.every(ne=>z.includes(ne))?T:void 0,L.matchedExtracts),_.action=L.action,_._sessionMatches=L._sessionMatches,_._searchText=`${_._searchText||""} ${L.matchedQuery||""} ${s}`}Z(_,p.score)}for(const[p,_]of Q){if(m.some(T=>T.item._agentId===p))continue;const L=Re.get(p);L&&Z({...L,matchedQuery:_.matchedQuery,matchedExtracts:_.matchedExtracts,action:_.action,_sessionMatches:_._sessionMatches,_searchText:`${L._searchText||""} ${_.matchedQuery||""} ${s}`},void 0)}for(const p of $)Z(p.item,p.score);for(const p of I)Z(p.item,p.score);for(const p of k)Z(p,void 0);for(const p of b)Z(p,void 0);for(const p of $e.slice(0,In))Z(p,void 0);const is=24*36e5,as=Date.now(),wt=p=>{const _=We(p.item._agentId,p.item._lastActivity,Te),L=Math.exp(-Math.LN2*Math.max(0,as-_)/is);return Math.log2(1+(p.item._sessionMatches??0))+4*L};for(const[p,_]of P)p==="agent"?_.sort((L,T)=>{const z=q(L.item),ne=q(T.item);if(ne!==z)return ne-z;const Be=wt(L),ge=wt(T);return ge!==Be?ge-Be:T.score-L.score}):_.sort((L,T)=>T.score-L.score);const de=[];for(const p of Ot){if(p==="session"){!pt&&fe.length>Xe?(de.push(...fe.slice(0,Xe)),de.push({id:"session-show-all",type:"session",title:`Show all conversations (${fe.length})`,subtitle:`${fe.length-Xe} more matches`,icon:d.jsx(V,{name:"arrow-down",size:16}),action:()=>yt(!0)})):de.push(...fe);continue}const _=P.get(p);if(_){if(p==="agent"&&!gt&&_.length>Je){for(const L of _.slice(0,Je))de.push(L.item);de.push({id:"agent-show-all",type:"agent",title:`Show all agents (${_.length})`,subtitle:`${_.length-Je} more matches`,icon:d.jsx(V,{name:"arrow-down",size:16}),action:()=>mt(!0)});continue}for(const L of _)de.push(L.item)}}return de},[F,It,St,vt,pe,Re,De,je,Ct,ke,$e,fe,Te,gt,pt]),se=h.useMemo(()=>{switch(v){case"agents":return Ce.filter(s=>s.type==="agent");case"buildings":return Ce.filter(s=>s.type==="building");case"commands":return F.trim()?Qe(_t,F).slice(0,3).map(s=>s.item):Fe;case"folders":return Ce.filter(s=>s.type==="folder");case"files":return ke;case"contents":return $e;case"areas":return He.flatMap(s=>s.agents);case"all":default:return Ce}},[v,Ce,He,ke,$e,F,_t,Fe]),ns=h.useMemo(()=>{const s=[];if(dt&&s.push("session"),ht&&s.push("file"),ft&&s.push("file-content"),lt&&s.push("folder"),v==="all")return s;const m={buildings:"building",folders:"folder",files:"file",contents:"file-content",agents:"agent",commands:"command"}[v];return m&&s.includes(m)?[m]:[]},[v,dt,ht,ft,lt]);h.useEffect(()=>{W>=se.length&&N(Math.max(0,se.length-1))},[se.length,W]);const rs=h.useCallback(s=>{if(s.altKey&&!s.ctrlKey&&!s.metaKey&&(s.key==="p"||s.key==="n"||s.key==="P"||s.key==="N")){s.preventDefault(),s.stopPropagation(),s.nativeEvent.stopImmediatePropagation();const i=s.key.toLowerCase();N(i==="p"?m=>m>0?m-1:se.length-1:m=>m<se.length-1?m+1:0);return}switch(s.key){case"Escape":s.preventDefault(),w.current();break;case"ArrowUp":s.preventDefault(),N(i=>i>0?i-1:se.length-1);break;case"ArrowDown":s.preventDefault(),N(i=>i<se.length-1?i+1:0);break;case"Enter":s.preventDefault(),se[W]&&se[W].action();break}},[se,W]),os=h.useCallback((s,i)=>{if(!i||!s)return s;const m=Ie(i);if(m.length===0)return s;const I=new RegExp(m.map(ln).sort((q,H)=>H.length-q.length).join("|"),"gi"),k=[];let b=0,$=0,D;for(;(D=I.exec(s))!==null;)D.index>b&&k.push(s.slice(b,D.index)),k.push(qe.createElement("mark",{key:$++,className:"spotlight-highlight"},D[0])),b=D.index+D[0].length;return b<s.length&&k.push(s.slice(b)),k.length>0?qe.createElement(qe.Fragment,null,...k):s},[]);return{query:F,setQuery:ts,selectedIndex:W,setSelectedIndex:N,results:se,loadingTypes:ns,activeTab:v,setActiveTab:Ue,cycleTab:ss,areaSections:He,handleKeyDown:rs,highlightMatch:os}}const Ln=h.forwardRef(function({query:e,onQueryChange:n,onKeyDown:r,onResetSelection:o},a){const{t:c}=Oe(["common"]);return d.jsxs("div",{className:"spotlight-input-wrapper",children:[d.jsx("span",{className:"spotlight-search-icon",children:"⌘"}),d.jsx("input",{ref:a,type:"text",className:"spotlight-input",placeholder:c("common:search.spotlightPlaceholder"),value:e,onChange:u=>{n(u.target.value),o()},onKeyDown:r,autoFocus:!0,spellCheck:!1}),d.jsxs("div",{className:"spotlight-input-hints",children:[d.jsx("span",{className:"spotlight-shortcut-hint",children:"↑↓"}),d.jsx("span",{className:"spotlight-shortcut-hint",children:"Enter"}),d.jsx("span",{className:"spotlight-shortcut-hint",children:"Esc"})]})]})}),Tn=h.memo(function({activeTab:e,onSelect:n}){const{t:r}=Oe(["terminal"]);return d.jsxs("div",{className:"spotlight-tabs",role:"tablist","aria-label":r("terminal:spotlight.tabsLabel"),children:[ye.map(o=>d.jsx("button",{type:"button",role:"tab","aria-selected":o===e,tabIndex:-1,className:`spotlight-tab${o===e?" active":""}`,onClick:()=>n(o),children:r(`terminal:spotlight.tabs.${o}`)},o)),d.jsx("span",{className:"spotlight-tabs-hint",children:d.jsx("kbd",{children:"Tab"})})]})}),Fn=h.forwardRef(function({results:e,loadingTypes:n,selectedIndex:r,query:o,activeTab:a,areaSections:c,highlightMatch:u,onSelectIndex:f},l){const{t:g}=Oe(["terminal"]),x=h.useRef(!1);h.useEffect(()=>{x.current=!1},[e]),h.useEffect(()=>{const A=typeof l=="function"?null:l==null?void 0:l.current;if(!A)return;const M=()=>{x.current=!0};return A.addEventListener("mousemove",M),()=>{A.removeEventListener("mousemove",M)}},[l,e]);const y={command:g("terminal:spotlight.categories.commands"),agent:g("terminal:spotlight.categories.agents"),building:g("terminal:spotlight.categories.infrastructure"),area:g("terminal:spotlight.categories.areas"),folder:g("terminal:spotlight.categories.folders"),file:g("terminal:spotlight.categories.files"),"file-content":g("terminal:spotlight.categories.fileContents"),"modified-file":g("terminal:spotlight.categories.modifiedFiles"),session:g("terminal:spotlight.categories.sessions")},E=h.useMemo(()=>{const A=[];let M=null,S=[];e.forEach((w,j)=>{w.type!==M&&(M!==null&&S.length>0&&A.push([M,S]),M=w.type,S=[]),S.push({result:w,index:j})}),M!==null&&S.length>0&&A.push([M,S]);for(const w of n)A.some(([j])=>j===w)||A.push([w,[]]);const R=["agent","session","building","file","file-content","folder","area","command"];return A.sort(([w],[j])=>R.indexOf(w)-R.indexOf(j)),A},[e,n]);if(h.useEffect(()=>{if(!l||typeof l=="function")return;const A=l.current;if(!A)return;const M=A.querySelector(".spotlight-item.selected");M&&M.scrollIntoView({block:"nearest",behavior:"smooth"})},[r,l]),a==="areas"){if(c.length===0)return d.jsx("div",{className:"spotlight-results",ref:l,children:d.jsx("div",{className:"spotlight-empty",children:g("terminal:spotlight.noResults")})});let A=0;return d.jsx("div",{className:"spotlight-results",ref:l,children:c.map(M=>d.jsxs("div",{children:[d.jsxs("div",{className:"spotlight-category-header spotlight-area-section-header",children:[d.jsx("span",{className:"spotlight-area-dot",style:{background:M.areaColor},"aria-hidden":"true"}),d.jsx("span",{className:"spotlight-area-name",children:M.areaName}),d.jsx("span",{className:"spotlight-area-count",children:M.agents.length})]}),M.agents.length===0?d.jsx("div",{className:"spotlight-area-empty",children:g("terminal:spotlight.noAgentsInArea")}):M.agents.map(S=>{const R=A++;return d.jsx(Rt,{result:S,isSelected:R===r,query:o,highlightMatch:u,onClick:()=>S.action(),onMouseEnter:()=>{x.current&&f(R)}},S.id)})]},M.areaId))})}return e.length===0&&n.length===0?d.jsx("div",{className:"spotlight-results",ref:l,children:d.jsx("div",{className:"spotlight-empty",children:g("terminal:spotlight.noResults")})}):d.jsx("div",{className:"spotlight-results",ref:l,children:E.map(([A,M])=>d.jsxs("div",{children:[(a==="all"||E.length>1)&&d.jsx("div",{className:"spotlight-category-header",children:y[A]||A}),n.includes(A)&&d.jsxs("div",{className:"spotlight-block-loading",role:"status",children:[d.jsx("span",{className:"spotlight-loading-spinner","aria-hidden":"true"}),g("terminal:spotlight.searching")]}),M.map(({result:S,index:R})=>d.jsx(Rt,{result:S,isSelected:R===r,query:o,highlightMatch:u,onClick:()=>S.action(),onMouseEnter:()=>{x.current&&f(R)}},S.id))]},A))})}),Nn=h.memo(function(){const{t:e}=Oe(["terminal"]);return d.jsxs("div",{className:"spotlight-footer",children:[d.jsxs("div",{className:"spotlight-footer-left",children:[d.jsxs("span",{className:"spotlight-footer-hint",children:[d.jsx("kbd",{children:"↑"}),d.jsx("kbd",{children:"↓"})," ",d.jsx("kbd",{children:"Alt+N"}),d.jsx("kbd",{children:"Alt+P"})," ",e("terminal:spotlight.navigate")]}),d.jsxs("span",{className:"spotlight-footer-hint",children:[d.jsx("kbd",{children:"Enter"})," ",e("terminal:spotlight.select")]}),d.jsxs("span",{className:"spotlight-footer-hint",children:[d.jsx("kbd",{children:"Tab"})," ",e("terminal:spotlight.switchTabs")]})]}),d.jsx("div",{className:"spotlight-footer-right",children:d.jsxs("span",{className:"spotlight-footer-hint",children:[d.jsx("kbd",{children:"Esc"})," ",e("common:buttons.close")]})})]})});function Dn({detail:t,onClose:e}){const[n,r]=h.useState(null),[o,a]=h.useState(!0),[c,u]=h.useState(null);Cs("spotlight-file-detail",!0,e),h.useEffect(()=>{const E=new AbortController;return a(!0),u(null),r(null),(async()=>{try{const M=await Ze(et(`/api/files/read?path=${encodeURIComponent(t.filePath)}`),{signal:E.signal}),S=await M.json();if(!M.ok)throw new Error(S.error||"Unable to read file");let R=null;if(!S.binary)try{const w=await Ze(et(`/api/files/git-original?path=${encodeURIComponent(t.filePath)}`),{signal:E.signal}),j=await w.json();w.ok&&!j.binary&&typeof j.content=="string"&&(R=j.content)}catch{}E.signal.aborted||r({filename:S.filename||t.filePath.split("/").pop()||t.filePath,content:typeof S.content=="string"?S.content:"",originalContent:R,binary:S.binary===!0})}catch(M){E.signal.aborted||u(M instanceof Error?M.message:"Unable to load file")}finally{E.signal.aborted||a(!1)}})(),()=>E.abort()},[t.filePath]),h.useEffect(()=>{const E=A=>{A.key==="Escape"&&(A.preventDefault(),A.stopImmediatePropagation(),e())};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[e]);const f=()=>{U.revealFileInExplorer(t.filePath,t.projectRoot,t.targetLine),e()},l=(n==null?void 0:n.filename)||t.filePath,g=l.lastIndexOf(".")>=0?l.slice(l.lastIndexOf(".")):"",x=Is(g),y=(n==null?void 0:n.originalContent)!=null&&n.originalContent!==n.content;return d.jsx("div",{className:"guake-git-diff-modal-overlay",onClick:e,children:d.jsxs("div",{className:"guake-git-diff-modal",onClick:E=>E.stopPropagation(),children:[d.jsxs("div",{className:"guake-git-diff-modal-header",children:[d.jsxs("div",{className:"guake-git-diff-path spotlight-file-detail-path",title:t.filePath,children:[t.filePath,t.targetLine?d.jsxs("span",{className:"spotlight-file-detail-line",children:[":",t.targetLine]}):null]}),d.jsxs("button",{type:"button",className:"spotlight-file-detail-explorer",onClick:f,title:"Open in File Explorer",children:[d.jsx(V,{name:"folder-open",size:14}),"Open in File Explorer"]}),d.jsx("button",{className:"guake-git-close",onClick:e,title:"Close (Esc)",children:d.jsx(V,{name:"close",size:14})})]}),d.jsxs("div",{className:"guake-git-diff-content",children:[o&&d.jsx("div",{className:"guake-git-diff-loading-overlay",children:d.jsx("div",{className:"diff-image-spinner"})}),c&&d.jsx("div",{className:"spotlight-file-detail-message",children:c}),(n==null?void 0:n.binary)&&d.jsx("div",{className:"spotlight-file-detail-message",children:"Binary preview is available in the File Explorer."}),n&&!n.binary&&(y?d.jsx(jt,{originalContent:n.originalContent||"",modifiedContent:n.content,filename:n.filename,filePath:t.filePath,language:x,searchQuery:t.searchQuery,targetLine:t.targetLine}):d.jsx(jt,{originalContent:"",modifiedContent:n.content,filename:n.filename,filePath:t.filePath,language:x,initialModifiedOnly:!0,searchQuery:t.searchQuery,targetLine:t.targetLine,readOnly:!0}))]})]})})}const Rn=768;function Bn({isOpen:t,onClose:e,onOpenSpawnModal:n,onOpenCommanderView:r,onOpenToolbox:o,onOpenFileExplorer:a,onOpenPM2LogsModal:c,onOpenBossLogsModal:u,onOpenDatabasePanel:f,onOpenMonitoringModal:l,onOpenSessionFinder:g}){const x=h.useRef(null),y=h.useRef(null),E=h.useRef(null),A=h.useRef(0),[M,S]=h.useState(null),{query:R,setQuery:w,selectedIndex:j,setSelectedIndex:K,results:le,loadingTypes:he,activeTab:B,setActiveTab:Y,cycleTab:G,areaSections:ie,handleKeyDown:re,highlightMatch:J}=bn({isOpen:t,onClose:e,onOpenSpawnModal:n,onOpenCommanderView:r,onOpenToolbox:o,onOpenFileExplorer:a,onOpenPM2LogsModal:c,onOpenBossLogsModal:u,onOpenDatabasePanel:f,onOpenMonitoringModal:l,onOpenSessionFinder:g,onOpenFileDetail:S});A.current=le.length;const F=h.useRef(G);F.current=G,h.useEffect(()=>{t&&setTimeout(()=>{var N,v;(N=x.current)==null||N.focus(),(v=x.current)==null||v.select()},50)},[t]),h.useEffect(()=>{if(!t)return;const N=window.visualViewport;if(!N||window.innerWidth>Rn)return;const v=()=>{const ee=y.current;ee&&(ee.style.height=`${N.height}px`,ee.style.top=`${N.offsetTop}px`)};return v(),N.addEventListener("resize",v),N.addEventListener("scroll",v),()=>{N.removeEventListener("resize",v),N.removeEventListener("scroll",v);const ee=y.current;ee&&(ee.style.height="",ee.style.top="")}},[t]),h.useEffect(()=>{if(!t)return;const N=v=>{if(v.key==="Escape"){v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation(),e();return}if(v.key==="Tab"){v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation(),F.current(v.shiftKey?-1:1);return}if(v.altKey&&!v.ctrlKey&&!v.metaKey&&(v.key==="n"||v.key==="p"||v.key==="N"||v.key==="P")){v.preventDefault(),v.stopPropagation(),v.stopImmediatePropagation();const ee=v.key.toLowerCase(),Ae=A.current;K(ee==="p"?te=>te>0?te-1:Ae-1:te=>te<Ae-1?te+1:0);return}};return window.addEventListener("keydown",N,{capture:!0}),()=>{window.removeEventListener("keydown",N,{capture:!0})}},[t,e]);const O=h.useCallback(N=>{N.target===N.currentTarget&&e()},[e]),W=h.useCallback(()=>{K(0)},[K]);return t?d.jsx("div",{ref:y,className:"spotlight-overlay",onClick:O,children:d.jsxs("div",{className:"spotlight-modal",children:[d.jsx(Ln,{ref:x,query:R,onQueryChange:w,onKeyDown:re,onResetSelection:W}),d.jsx(Tn,{activeTab:B,onSelect:Y}),d.jsx(Fn,{ref:E,results:le,loadingTypes:he,selectedIndex:j,query:R,activeTab:B,areaSections:ie,highlightMatch:J,onSelectIndex:K}),d.jsx(Nn,{})]})}):M?d.jsx(Dn,{detail:M,onClose:()=>S(null)}):null}export{zn as FILE_ICON_NAMES,Bn as Spotlight,Nn as SpotlightFooter,Ln as SpotlightInput,Rt as SpotlightItem,Fn as SpotlightResults,Kn as formatDuration,On as formatRelativeTime,Un as getAgentIcon,Dt as getFileIconFromPath,Gn as getTypeLabel,bn as useSpotlightSearch};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{U as ts,u as rs,aa as _s,ab as bs,ac as Is,j as s,I as B,n as Es,ad as $s,ae as Ds,af as Ms,ag as Ls,ah as Ps,r as o,ai as Ss,z as Xs,f as Ys,a0 as Rs,aj as Gs,ak as Us,al as Fs,am as Hs,an as Zs,ao as Bs,s as M,ap as Ks,aq as G}from"./main-Dk3qq80S.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";const vs=ts.memo(({agent:a,isSelected:z,isKeyboardFocused:U=!1,onSelect:L,onDoubleClick:r,onChat:p,onFocus:h,onKill:w,onDragStart:P})=>{const{t:x}=rs(["dashboard","common"]),S=_s().has(a.id),N=bs(a.status),F=Is(a),j=Ps(F),I=a.taskLabel?s.jsxs(s.Fragment,{children:[s.jsx(B,{name:"task",size:12})," ",a.taskLabel]}):a.currentTask||a.lastAssignedTask,m=a.status==="idle"&&a.lastActivity>0,[,H]=ts.useState(0);return ts.useEffect(()=>{if(!m)return;const v=window.setInterval(()=>H(q=>q+1),15e3);return()=>window.clearInterval(v)},[m]),s.jsxs("div",{className:`dash-card dash-card--${N} ${z?"dash-card--selected":""} ${U?"dash-card--keyboard-focused":""}`,"data-agent-id":a.id,onClick:()=>L(a.id),onDoubleClick:v=>{v.stopPropagation(),r(a.id)},onDragStart:v=>{P==null||P(a),v.dataTransfer.effectAllowed="move"},draggable:!0,title:x("cards.doubleClickHint"),children:[s.jsxs("div",{className:"dash-card__row1",children:[s.jsx("span",{className:`dash-card__status-dot dash-card__status-dot--${N}`}),s.jsx("span",{className:"dash-card__name",children:a.name}),s.jsxs("span",{className:"dash-card__class",children:[s.jsx(Es,{agent:a,size:14})," ",a.class]}),s.jsxs("span",{className:`dash-card__provider dash-card__provider--${a.provider}`,children:[s.jsx($s,{agent:a,alt:"",className:"dash-card__provider-icon"})," ",a.provider]}),S&&s.jsx("span",{className:"dash-card__unseen-badge",title:"New output available - click to view",children:"!"})]}),s.jsxs("div",{className:"dash-card__row2",children:[s.jsx("span",{className:`dash-card__status dash-card__status--${N}`,children:S?"Unseen":a.status}),s.jsxs("div",{className:"dash-card__context",children:[s.jsx("div",{className:"dash-card__context-bar",children:s.jsx("div",{className:`dash-card__context-fill dash-card__context-fill--${j}`,style:{width:`${F}%`}})}),s.jsxs("span",{className:`dash-card__context-pct dash-card__context-pct--${j}`,children:[F,"%"]})]})]}),s.jsxs("div",{className:"dash-card__row3",children:[s.jsxs("span",{className:"dash-card__workdir",title:a.cwd,children:[s.jsx(B,{name:"folder",size:11})," ",a.cwd.split("/").pop()||a.cwd]}),m&&s.jsxs("span",{className:"dash-card__idle-time",style:{color:Ls(a.lastActivity)},title:Ms(a.lastActivity),children:[s.jsx(B,{name:"status-waiting-input",size:10})," ",Ds(a.lastActivity)]})]}),I&&s.jsx("div",{className:"dash-card__row4",children:s.jsx("span",{className:"dash-card__task",children:I})}),s.jsxs("div",{className:"dash-card__actions",children:[p&&s.jsx("button",{className:"dash-card__action-btn dash-card__action-btn--chat",onClick:v=>{v.stopPropagation(),p(a.id)},title:x("cards.openTerminal"),children:x("cards.chat")}),w&&s.jsx("button",{className:"dash-card__action-btn dash-card__action-btn--danger",onClick:v=>{v.stopPropagation(),w(a.id)},title:x("cards.killAgent"),children:x("cards.stop")})]})]})});vs.displayName="AgentCard";const fs=({buildings:a,onSelectBuilding:z})=>{const{t:U}=rs(["dashboard"]),L=o.useMemo(()=>Array.from(a.values()).sort((r,p)=>r.name.localeCompare(p.name)),[a]);return s.jsxs("div",{className:"dashboard-view__buildings",children:[s.jsxs("div",{className:"dashboard-view__buildings-header",children:[s.jsx("span",{className:"dashboard-view__buildings-title",children:U("buildings.title")}),s.jsx("span",{className:"dashboard-view__buildings-count",children:L.length})]}),s.jsx("div",{className:"dashboard-view__buildings-row",children:L.map(r=>{const p=bs(r.status),h=Ss(r.type);return s.jsxs("button",{className:`dash-pill dash-pill--${p}`,onClick:()=>z==null?void 0:z(r.id),title:`${r.name} (${r.type}) - ${r.status}`,children:[s.jsx("span",{className:"dash-pill__icon",children:s.jsx(B,{name:h,size:14})}),s.jsx("span",{className:"dash-pill__name",children:r.name}),s.jsx("span",{className:`dash-pill__dot dash-pill__dot--${p}`})]},r.id)})})]})};fs.displayName="BuildingPills";function Js({onSelectAgent:a,onFocusAgent:z,onKillAgent:U,onSelectBuilding:L,onOpenTerminal:r,onFocusZone:p}){const{t:h}=rs(["dashboard","common"]),w=Xs(),P=Ys(),x=Rs(),ns=Gs(),S=_s(),[N,F]=o.useState(""),[j,I]=o.useState("all"),[m,H]=o.useState("zone"),[v,q]=o.useState(new Set),[k,J]=o.useState(null),[ws,K]=o.useState(null),[X,Q]=o.useState(!1),[g,Z]=o.useState(null),W=o.useMemo(()=>{const e=Array.from(w.values());return{total:e.length,working:e.filter(d=>d.status==="working"||d.status==="waiting"||d.status==="waiting_permission").length,idle:e.filter(d=>d.status==="idle").length,error:e.filter(d=>d.status==="error"||d.status==="offline"||d.status==="orphaned").length}},[w]),is=o.useMemo(()=>m==="zone"?Us(w,x):m==="status"?Fs(w,S):Hs(w),[w,x,m,S]),T=o.useMemo(()=>{const e=N.toLowerCase().trim(),d=is.map(l=>({...l,agents:l.agents.filter(_=>{if(j==="working"){if(_.status!=="working"&&_.status!=="waiting"&&_.status!=="waiting_permission")return!1}else if(j==="error"&&_.status!=="error"&&_.status!=="offline"&&_.status!=="orphaned")return!1;return!(e&&!_.name.toLowerCase().includes(e)&&!_.class.toLowerCase().includes(e))})}));return m==="zone"?d:d.filter(l=>l.agents.length>0)},[is,j,N,m]),O=o.useCallback(e=>e.area?`area:${e.area.id}`:`${m}:${e.label}`,[m]),ss=o.useMemo(()=>T.map(e=>({...e,sortedAgents:m==="status"?Zs(e.agents,{prioritizeRecentlyIdle:!0}):Bs(e.agents)})),[T,m]),C=o.useMemo(()=>{const e=[];return ss.forEach(d=>{const l=O(d);v.has(l)||e.push(...d.sortedAgents)}),e},[ss,v,O]),gs=o.useCallback(e=>{q(d=>{const l=new Set(d);return l.has(e)?l.delete(e):l.add(e),l})},[]),ps=o.useCallback(e=>{r==null||r(e)},[r]),xs=o.useCallback(e=>{a==null||a(e),Q(!0),Z(e)},[a]),js=o.useCallback(e=>{r==null||r(e)},[r]),Ns=o.useCallback(e=>{J(e)},[]),ks=o.useCallback((e,d)=>{e.preventDefault(),e.dataTransfer.dropEffect="move",K(d)},[]),Cs=o.useCallback(()=>{K(null)},[]),ys=o.useCallback(e=>{if(!k)return;if(e===null){const E=M.getState(),t=Array.from(E.areas.values()).find(n=>n.assignedAgentIds.includes(k.id));t&&M.unassignAgentFromArea(k.id,t.id),J(null),K(null);return}const d=x.get(e);if(!d)return;const l=Array.from(w.values()),_=Ks(d,l,k.position);M.updateAgent({...k,position:{...k.position,x:_.x,z:_.z}}),M.assignAgentToArea(k.id,e),J(null),K(null)},[k,x,w]);return o.useEffect(()=>{if(C.length===0){Q(!1),Z(null);return}X&&(!g||!C.some(e=>e.id===g))&&(Z(C[0].id),a==null||a(C[0].id))},[C,X,g,a]),o.useEffect(()=>{const e=t=>t instanceof HTMLElement?t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT"||t.isContentEditable:!1,d=t=>t instanceof HTMLElement?!!t.closest(".guake-terminal")||t.classList.contains("guake-input")||t.classList.contains("agent-panel-input"):!1,l=t=>{const n=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).find(A=>A.dataset.agentId===t);n==null||n.scrollIntoView({block:"nearest",inline:"nearest"})},_=(t,n)=>{var os,cs,ls,us,hs,ms;const A=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).map(i=>{const u=i.dataset.agentId;if(!u)return null;const y=i.getBoundingClientRect();return{id:u,centerX:y.left+y.width/2,centerY:y.top+y.height/2,height:y.height}}).filter(i=>i!==null).sort((i,u)=>i.centerY-u.centerY||i.centerX-u.centerX);if(A.length===0)return t;const es=A.reduce((i,u)=>i+u.height,0)/A.length,as=Math.max(18,es*.6),f=[];for(const i of A){const u=f[f.length-1];if(!u){f.push([{id:i.id,centerX:i.centerX,centerY:i.centerY}]);continue}const y=u.reduce((As,zs)=>As+zs.centerY,0)/u.length;Math.abs(i.centerY-y)<=as?u.push({id:i.id,centerX:i.centerX,centerY:i.centerY}):f.push([{id:i.id,centerX:i.centerX,centerY:i.centerY}])}f.forEach(i=>i.sort((u,y)=>u.centerX-y.centerX));const Y=f.findIndex(i=>i.some(u=>u.id===t));if(Y===-1)return((cs=(os=f[0])==null?void 0:os[0])==null?void 0:cs.id)??t;const $=f[Y],b=$.findIndex(i=>i.id===t);if(b===-1)return((us=(ls=f[0])==null?void 0:ls[0])==null?void 0:us.id)??t;if(n==="left")return((hs=$[Math.max(0,b-1)])==null?void 0:hs.id)??t;if(n==="right")return((ms=$[Math.min($.length-1,b+1)])==null?void 0:ms.id)??t;const V=n==="up"?Math.max(0,Y-1):Math.min(f.length-1,Y+1),c=f[V],R=$[b].centerX;let D=c[0],ds=Math.abs(D.centerX-R);for(const i of c){const u=Math.abs(i.centerX-R);u<ds&&(D=i,ds=u)}return(D==null?void 0:D.id)??t},E=t=>{const n=M.getShortcuts(),A=n.find(c=>c.id==="dashboard-selector-toggle"),es=n.find(c=>c.id==="dashboard-vim-left"),as=n.find(c=>c.id==="dashboard-vim-down"),f=n.find(c=>c.id==="dashboard-vim-up"),Y=n.find(c=>c.id==="dashboard-vim-right"),$=n.find(c=>c.id==="open-terminal"),b=M.getState();if(e(t.target))if(!b.terminalOpen&&d(t.target)&&document.activeElement instanceof HTMLElement)document.activeElement.blur();else return;if(G(t,A)){if(C.length===0)return;t.preventDefault(),t.stopPropagation(),Q(!0),Z(c=>{const R=c&&C.some(D=>D.id===c)?c:C[0].id;return a==null||a(R),window.setTimeout(()=>l(R),0),R});return}const V=G(t,es)||t.key==="ArrowLeft"?"left":G(t,as)||t.key==="ArrowDown"?"down":G(t,f)||t.key==="ArrowUp"?"up":G(t,Y)||t.key==="ArrowRight"?"right":null;if(V&&X&&g){t.preventDefault(),t.stopPropagation();const c=_(g,V);c!==g&&(Z(c),a==null||a(c),window.setTimeout(()=>l(c),0));return}if(G(t,$)){if(b.terminalOpen)return;if(X&&g&&b.agents.has(g)){t.preventDefault(),r==null||r(g);return}if(b.selectedAgentIds.size===1){t.preventDefault();const c=Array.from(b.selectedAgentIds)[0];r==null||r(c);return}if(b.lastSelectedAgentId&&b.agents.has(b.lastSelectedAgentId)){t.preventDefault(),r==null||r(b.lastSelectedAgentId);return}}};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[C,X,g,r,a]),o.useEffect(()=>{const e=document.activeElement;e instanceof HTMLElement&&e.closest(".guake-terminal")&&!M.getState().terminalOpen&&e.blur()},[]),s.jsxs("div",{className:"dashboard-view",children:[s.jsxs("div",{className:"dashboard-view__topbar",children:[s.jsxs("div",{className:"dashboard-view__metrics",children:[s.jsxs("button",{className:`dashboard-view__metric-btn ${j==="all"?"dashboard-view__metric-btn--active":""}`,onClick:()=>I("all"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:W.total}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:labels.agents")})]}),s.jsxs("button",{className:`dashboard-view__metric-btn dashboard-view__metric-btn--working ${j==="working"?"dashboard-view__metric-btn--active":""}`,onClick:()=>I("working"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:W.working}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:status.working")})]}),s.jsxs("button",{className:"dashboard-view__metric-btn dashboard-view__metric-btn--idle ",onClick:()=>I("all"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:W.idle}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:status.idle")})]}),s.jsxs("button",{className:`dashboard-view__metric-btn dashboard-view__metric-btn--error ${j==="error"?"dashboard-view__metric-btn--active":""}`,onClick:()=>I("error"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:W.error}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:status.error")})]})]}),s.jsx("input",{className:"dashboard-view__search",type:"text",placeholder:h("searchPlaceholder"),value:N,onChange:e=>F(e.target.value)})]}),s.jsxs("div",{className:"dashboard-view__grouping",children:[s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="zone"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>H("zone"),children:h("grouping.byZone")}),s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="status"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>H("status"),children:h("grouping.byStatus")}),s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="activity"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>H("activity"),children:h("grouping.byActivity")})]}),s.jsxs("div",{className:"dashboard-view__content",children:[ss.map(e=>{const d=O(e),l=v.has(d),_=e.sortedAgents,E=e.agents.filter(n=>n.status==="working"||n.status==="waiting"||n.status==="waiting_permission").length,t=e.agents.filter(n=>S.has(n.id)).length;return s.jsxs("div",{className:`dashboard-view__zone ${ws===(e.area?e.area.id:null)&&k?"dashboard-view__zone--drag-over":""}`,onDragOver:n=>ks(n,e.area?e.area.id:null),onDragLeave:Cs,onDrop:()=>ys(e.area?e.area.id:null),children:[s.jsxs("div",{className:"dashboard-view__zone-header",onClick:()=>gs(d),children:[s.jsxs("div",{className:"dashboard-view__zone-left",children:[s.jsx("span",{className:`dashboard-view__zone-chevron ${l?"dashboard-view__zone-chevron--collapsed":""}`,children:s.jsx(B,{name:"caret-down",size:12})}),s.jsx("span",{className:"dashboard-view__zone-dot",style:{backgroundColor:e.color}}),s.jsx("span",{className:"dashboard-view__zone-name",children:e.label}),s.jsxs("span",{className:"dashboard-view__zone-count",children:[h("agentCount",{count:e.agents.length}),E>0&&s.jsxs("span",{className:"dashboard-view__zone-working",children:[" · ",E," ",h("working")]}),t>0&&s.jsxs("span",{className:"dashboard-view__zone-unseen",children:[" · ",t," Unseen"]})]})]}),e.area&&p&&s.jsx("button",{className:"dashboard-view__zone-focus",onClick:n=>{n.stopPropagation(),p(e.area.id)},title:h("focusZone"),children:h("focusZone")})]}),!l&&s.jsx("div",{className:"dashboard-view__zone-grid",children:_.map(n=>s.jsx(vs,{agent:n,isSelected:ns.has(n.id),isKeyboardFocused:X&&g===n.id,onSelect:xs,onDoubleClick:ps,onChat:js,onFocus:z,onKill:U,onDragStart:Ns},n.id))})]},d)}),T.length===0&&s.jsx("div",{className:"dashboard-view__empty",children:N?h("noAgentsMatching",{search:N}):h("noAgentsSpawned")}),P.size>0&&s.jsx(fs,{buildings:P,onSelectBuilding:L})]})]})}export{Js as DashboardView};
|
|
1
|
+
import{U as ts,u as rs,aa as _s,ab as bs,ac as Is,j as s,I as B,n as Es,ad as $s,ae as Ds,af as Ms,ag as Ls,ah as Ps,r as o,ai as Ss,z as Xs,f as Ys,a0 as Rs,aj as Gs,ak as Us,al as Fs,am as Hs,an as Zs,ao as Bs,s as M,ap as Ks,aq as G}from"./main-BTH4eRQ6.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";const vs=ts.memo(({agent:a,isSelected:z,isKeyboardFocused:U=!1,onSelect:L,onDoubleClick:r,onChat:p,onFocus:h,onKill:w,onDragStart:P})=>{const{t:x}=rs(["dashboard","common"]),S=_s().has(a.id),N=bs(a.status),F=Is(a),j=Ps(F),I=a.taskLabel?s.jsxs(s.Fragment,{children:[s.jsx(B,{name:"task",size:12})," ",a.taskLabel]}):a.currentTask||a.lastAssignedTask,m=a.status==="idle"&&a.lastActivity>0,[,H]=ts.useState(0);return ts.useEffect(()=>{if(!m)return;const v=window.setInterval(()=>H(q=>q+1),15e3);return()=>window.clearInterval(v)},[m]),s.jsxs("div",{className:`dash-card dash-card--${N} ${z?"dash-card--selected":""} ${U?"dash-card--keyboard-focused":""}`,"data-agent-id":a.id,onClick:()=>L(a.id),onDoubleClick:v=>{v.stopPropagation(),r(a.id)},onDragStart:v=>{P==null||P(a),v.dataTransfer.effectAllowed="move"},draggable:!0,title:x("cards.doubleClickHint"),children:[s.jsxs("div",{className:"dash-card__row1",children:[s.jsx("span",{className:`dash-card__status-dot dash-card__status-dot--${N}`}),s.jsx("span",{className:"dash-card__name",children:a.name}),s.jsxs("span",{className:"dash-card__class",children:[s.jsx(Es,{agent:a,size:14})," ",a.class]}),s.jsxs("span",{className:`dash-card__provider dash-card__provider--${a.provider}`,children:[s.jsx($s,{agent:a,alt:"",className:"dash-card__provider-icon"})," ",a.provider]}),S&&s.jsx("span",{className:"dash-card__unseen-badge",title:"New output available - click to view",children:"!"})]}),s.jsxs("div",{className:"dash-card__row2",children:[s.jsx("span",{className:`dash-card__status dash-card__status--${N}`,children:S?"Unseen":a.status}),s.jsxs("div",{className:"dash-card__context",children:[s.jsx("div",{className:"dash-card__context-bar",children:s.jsx("div",{className:`dash-card__context-fill dash-card__context-fill--${j}`,style:{width:`${F}%`}})}),s.jsxs("span",{className:`dash-card__context-pct dash-card__context-pct--${j}`,children:[F,"%"]})]})]}),s.jsxs("div",{className:"dash-card__row3",children:[s.jsxs("span",{className:"dash-card__workdir",title:a.cwd,children:[s.jsx(B,{name:"folder",size:11})," ",a.cwd.split("/").pop()||a.cwd]}),m&&s.jsxs("span",{className:"dash-card__idle-time",style:{color:Ls(a.lastActivity)},title:Ms(a.lastActivity),children:[s.jsx(B,{name:"status-waiting-input",size:10})," ",Ds(a.lastActivity)]})]}),I&&s.jsx("div",{className:"dash-card__row4",children:s.jsx("span",{className:"dash-card__task",children:I})}),s.jsxs("div",{className:"dash-card__actions",children:[p&&s.jsx("button",{className:"dash-card__action-btn dash-card__action-btn--chat",onClick:v=>{v.stopPropagation(),p(a.id)},title:x("cards.openTerminal"),children:x("cards.chat")}),w&&s.jsx("button",{className:"dash-card__action-btn dash-card__action-btn--danger",onClick:v=>{v.stopPropagation(),w(a.id)},title:x("cards.killAgent"),children:x("cards.stop")})]})]})});vs.displayName="AgentCard";const fs=({buildings:a,onSelectBuilding:z})=>{const{t:U}=rs(["dashboard"]),L=o.useMemo(()=>Array.from(a.values()).sort((r,p)=>r.name.localeCompare(p.name)),[a]);return s.jsxs("div",{className:"dashboard-view__buildings",children:[s.jsxs("div",{className:"dashboard-view__buildings-header",children:[s.jsx("span",{className:"dashboard-view__buildings-title",children:U("buildings.title")}),s.jsx("span",{className:"dashboard-view__buildings-count",children:L.length})]}),s.jsx("div",{className:"dashboard-view__buildings-row",children:L.map(r=>{const p=bs(r.status),h=Ss(r.type);return s.jsxs("button",{className:`dash-pill dash-pill--${p}`,onClick:()=>z==null?void 0:z(r.id),title:`${r.name} (${r.type}) - ${r.status}`,children:[s.jsx("span",{className:"dash-pill__icon",children:s.jsx(B,{name:h,size:14})}),s.jsx("span",{className:"dash-pill__name",children:r.name}),s.jsx("span",{className:`dash-pill__dot dash-pill__dot--${p}`})]},r.id)})})]})};fs.displayName="BuildingPills";function Js({onSelectAgent:a,onFocusAgent:z,onKillAgent:U,onSelectBuilding:L,onOpenTerminal:r,onFocusZone:p}){const{t:h}=rs(["dashboard","common"]),w=Xs(),P=Ys(),x=Rs(),ns=Gs(),S=_s(),[N,F]=o.useState(""),[j,I]=o.useState("all"),[m,H]=o.useState("zone"),[v,q]=o.useState(new Set),[k,J]=o.useState(null),[ws,K]=o.useState(null),[X,Q]=o.useState(!1),[g,Z]=o.useState(null),W=o.useMemo(()=>{const e=Array.from(w.values());return{total:e.length,working:e.filter(d=>d.status==="working"||d.status==="waiting"||d.status==="waiting_permission").length,idle:e.filter(d=>d.status==="idle").length,error:e.filter(d=>d.status==="error"||d.status==="offline"||d.status==="orphaned").length}},[w]),is=o.useMemo(()=>m==="zone"?Us(w,x):m==="status"?Fs(w,S):Hs(w),[w,x,m,S]),T=o.useMemo(()=>{const e=N.toLowerCase().trim(),d=is.map(l=>({...l,agents:l.agents.filter(_=>{if(j==="working"){if(_.status!=="working"&&_.status!=="waiting"&&_.status!=="waiting_permission")return!1}else if(j==="error"&&_.status!=="error"&&_.status!=="offline"&&_.status!=="orphaned")return!1;return!(e&&!_.name.toLowerCase().includes(e)&&!_.class.toLowerCase().includes(e))})}));return m==="zone"?d:d.filter(l=>l.agents.length>0)},[is,j,N,m]),O=o.useCallback(e=>e.area?`area:${e.area.id}`:`${m}:${e.label}`,[m]),ss=o.useMemo(()=>T.map(e=>({...e,sortedAgents:m==="status"?Zs(e.agents,{prioritizeRecentlyIdle:!0}):Bs(e.agents)})),[T,m]),C=o.useMemo(()=>{const e=[];return ss.forEach(d=>{const l=O(d);v.has(l)||e.push(...d.sortedAgents)}),e},[ss,v,O]),gs=o.useCallback(e=>{q(d=>{const l=new Set(d);return l.has(e)?l.delete(e):l.add(e),l})},[]),ps=o.useCallback(e=>{r==null||r(e)},[r]),xs=o.useCallback(e=>{a==null||a(e),Q(!0),Z(e)},[a]),js=o.useCallback(e=>{r==null||r(e)},[r]),Ns=o.useCallback(e=>{J(e)},[]),ks=o.useCallback((e,d)=>{e.preventDefault(),e.dataTransfer.dropEffect="move",K(d)},[]),Cs=o.useCallback(()=>{K(null)},[]),ys=o.useCallback(e=>{if(!k)return;if(e===null){const E=M.getState(),t=Array.from(E.areas.values()).find(n=>n.assignedAgentIds.includes(k.id));t&&M.unassignAgentFromArea(k.id,t.id),J(null),K(null);return}const d=x.get(e);if(!d)return;const l=Array.from(w.values()),_=Ks(d,l,k.position);M.updateAgent({...k,position:{...k.position,x:_.x,z:_.z}}),M.assignAgentToArea(k.id,e),J(null),K(null)},[k,x,w]);return o.useEffect(()=>{if(C.length===0){Q(!1),Z(null);return}X&&(!g||!C.some(e=>e.id===g))&&(Z(C[0].id),a==null||a(C[0].id))},[C,X,g,a]),o.useEffect(()=>{const e=t=>t instanceof HTMLElement?t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT"||t.isContentEditable:!1,d=t=>t instanceof HTMLElement?!!t.closest(".guake-terminal")||t.classList.contains("guake-input")||t.classList.contains("agent-panel-input"):!1,l=t=>{const n=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).find(A=>A.dataset.agentId===t);n==null||n.scrollIntoView({block:"nearest",inline:"nearest"})},_=(t,n)=>{var os,cs,ls,us,hs,ms;const A=Array.from(document.querySelectorAll(".dash-card[data-agent-id]")).map(i=>{const u=i.dataset.agentId;if(!u)return null;const y=i.getBoundingClientRect();return{id:u,centerX:y.left+y.width/2,centerY:y.top+y.height/2,height:y.height}}).filter(i=>i!==null).sort((i,u)=>i.centerY-u.centerY||i.centerX-u.centerX);if(A.length===0)return t;const es=A.reduce((i,u)=>i+u.height,0)/A.length,as=Math.max(18,es*.6),f=[];for(const i of A){const u=f[f.length-1];if(!u){f.push([{id:i.id,centerX:i.centerX,centerY:i.centerY}]);continue}const y=u.reduce((As,zs)=>As+zs.centerY,0)/u.length;Math.abs(i.centerY-y)<=as?u.push({id:i.id,centerX:i.centerX,centerY:i.centerY}):f.push([{id:i.id,centerX:i.centerX,centerY:i.centerY}])}f.forEach(i=>i.sort((u,y)=>u.centerX-y.centerX));const Y=f.findIndex(i=>i.some(u=>u.id===t));if(Y===-1)return((cs=(os=f[0])==null?void 0:os[0])==null?void 0:cs.id)??t;const $=f[Y],b=$.findIndex(i=>i.id===t);if(b===-1)return((us=(ls=f[0])==null?void 0:ls[0])==null?void 0:us.id)??t;if(n==="left")return((hs=$[Math.max(0,b-1)])==null?void 0:hs.id)??t;if(n==="right")return((ms=$[Math.min($.length-1,b+1)])==null?void 0:ms.id)??t;const V=n==="up"?Math.max(0,Y-1):Math.min(f.length-1,Y+1),c=f[V],R=$[b].centerX;let D=c[0],ds=Math.abs(D.centerX-R);for(const i of c){const u=Math.abs(i.centerX-R);u<ds&&(D=i,ds=u)}return(D==null?void 0:D.id)??t},E=t=>{const n=M.getShortcuts(),A=n.find(c=>c.id==="dashboard-selector-toggle"),es=n.find(c=>c.id==="dashboard-vim-left"),as=n.find(c=>c.id==="dashboard-vim-down"),f=n.find(c=>c.id==="dashboard-vim-up"),Y=n.find(c=>c.id==="dashboard-vim-right"),$=n.find(c=>c.id==="open-terminal"),b=M.getState();if(e(t.target))if(!b.terminalOpen&&d(t.target)&&document.activeElement instanceof HTMLElement)document.activeElement.blur();else return;if(G(t,A)){if(C.length===0)return;t.preventDefault(),t.stopPropagation(),Q(!0),Z(c=>{const R=c&&C.some(D=>D.id===c)?c:C[0].id;return a==null||a(R),window.setTimeout(()=>l(R),0),R});return}const V=G(t,es)||t.key==="ArrowLeft"?"left":G(t,as)||t.key==="ArrowDown"?"down":G(t,f)||t.key==="ArrowUp"?"up":G(t,Y)||t.key==="ArrowRight"?"right":null;if(V&&X&&g){t.preventDefault(),t.stopPropagation();const c=_(g,V);c!==g&&(Z(c),a==null||a(c),window.setTimeout(()=>l(c),0));return}if(G(t,$)){if(b.terminalOpen)return;if(X&&g&&b.agents.has(g)){t.preventDefault(),r==null||r(g);return}if(b.selectedAgentIds.size===1){t.preventDefault();const c=Array.from(b.selectedAgentIds)[0];r==null||r(c);return}if(b.lastSelectedAgentId&&b.agents.has(b.lastSelectedAgentId)){t.preventDefault(),r==null||r(b.lastSelectedAgentId);return}}};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[C,X,g,r,a]),o.useEffect(()=>{const e=document.activeElement;e instanceof HTMLElement&&e.closest(".guake-terminal")&&!M.getState().terminalOpen&&e.blur()},[]),s.jsxs("div",{className:"dashboard-view",children:[s.jsxs("div",{className:"dashboard-view__topbar",children:[s.jsxs("div",{className:"dashboard-view__metrics",children:[s.jsxs("button",{className:`dashboard-view__metric-btn ${j==="all"?"dashboard-view__metric-btn--active":""}`,onClick:()=>I("all"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:W.total}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:labels.agents")})]}),s.jsxs("button",{className:`dashboard-view__metric-btn dashboard-view__metric-btn--working ${j==="working"?"dashboard-view__metric-btn--active":""}`,onClick:()=>I("working"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:W.working}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:status.working")})]}),s.jsxs("button",{className:"dashboard-view__metric-btn dashboard-view__metric-btn--idle ",onClick:()=>I("all"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:W.idle}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:status.idle")})]}),s.jsxs("button",{className:`dashboard-view__metric-btn dashboard-view__metric-btn--error ${j==="error"?"dashboard-view__metric-btn--active":""}`,onClick:()=>I("error"),children:[s.jsx("span",{className:"dashboard-view__metric-value",children:W.error}),s.jsx("span",{className:"dashboard-view__metric-label",children:h("common:status.error")})]})]}),s.jsx("input",{className:"dashboard-view__search",type:"text",placeholder:h("searchPlaceholder"),value:N,onChange:e=>F(e.target.value)})]}),s.jsxs("div",{className:"dashboard-view__grouping",children:[s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="zone"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>H("zone"),children:h("grouping.byZone")}),s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="status"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>H("status"),children:h("grouping.byStatus")}),s.jsx("button",{className:`dashboard-view__grouping-btn ${m==="activity"?"dashboard-view__grouping-btn--active":""}`,onClick:()=>H("activity"),children:h("grouping.byActivity")})]}),s.jsxs("div",{className:"dashboard-view__content",children:[ss.map(e=>{const d=O(e),l=v.has(d),_=e.sortedAgents,E=e.agents.filter(n=>n.status==="working"||n.status==="waiting"||n.status==="waiting_permission").length,t=e.agents.filter(n=>S.has(n.id)).length;return s.jsxs("div",{className:`dashboard-view__zone ${ws===(e.area?e.area.id:null)&&k?"dashboard-view__zone--drag-over":""}`,onDragOver:n=>ks(n,e.area?e.area.id:null),onDragLeave:Cs,onDrop:()=>ys(e.area?e.area.id:null),children:[s.jsxs("div",{className:"dashboard-view__zone-header",onClick:()=>gs(d),children:[s.jsxs("div",{className:"dashboard-view__zone-left",children:[s.jsx("span",{className:`dashboard-view__zone-chevron ${l?"dashboard-view__zone-chevron--collapsed":""}`,children:s.jsx(B,{name:"caret-down",size:12})}),s.jsx("span",{className:"dashboard-view__zone-dot",style:{backgroundColor:e.color}}),s.jsx("span",{className:"dashboard-view__zone-name",children:e.label}),s.jsxs("span",{className:"dashboard-view__zone-count",children:[h("agentCount",{count:e.agents.length}),E>0&&s.jsxs("span",{className:"dashboard-view__zone-working",children:[" · ",E," ",h("working")]}),t>0&&s.jsxs("span",{className:"dashboard-view__zone-unseen",children:[" · ",t," Unseen"]})]})]}),e.area&&p&&s.jsx("button",{className:"dashboard-view__zone-focus",onClick:n=>{n.stopPropagation(),p(e.area.id)},title:h("focusZone"),children:h("focusZone")})]}),!l&&s.jsx("div",{className:"dashboard-view__zone-grid",children:_.map(n=>s.jsx(vs,{agent:n,isSelected:ns.has(n.id),isKeyboardFocused:X&&g===n.id,onSelect:xs,onDoubleClick:ps,onChat:js,onFocus:z,onKill:U,onDragStart:Ns},n.id))})]},d)}),T.length===0&&s.jsx("div",{className:"dashboard-view__empty",children:N?h("noAgentsMatching",{search:N}):h("noAgentsSpawned")}),P.size>0&&s.jsx(fs,{buildings:P,onSelectBuilding:L})]})]})}export{Js as DashboardView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{az as He,r as t,s as I,d as ye,aA as Ee,c as Oe,j as e,I as O,u as fe,aB as _e,aC as Te,aD as Be,aE as Ue,aF as Ke,aG as We,ad as Ve,a5 as De,aH as Ge,aI as qe,aJ as Je,aK as Ye,J as Xe,m as Me,S as le,F as Qe,C as Ze,n as et,y as Ie,z as tt,a0 as st,aL as nt,aq as X,aM as at}from"./main-
|
|
1
|
+
import{az as He,r as t,s as I,d as ye,aA as Ee,c as Oe,j as e,I as O,u as fe,aB as _e,aC as Te,aD as Be,aE as Ue,aF as Ke,aG as We,ad as Ve,a5 as De,aH as Ge,aI as qe,aJ as Je,aK as Ye,J as Xe,m as Me,S as le,F as Qe,C as Ze,n as et,y as Ie,z as tt,a0 as st,aL as nt,aq as X,aM as at}from"./main-BTH4eRQ6.js";import{FileExplorerPanel as ct}from"./index-CNMfqZTR.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-DYBBrXTx.js";const Se={status:"all",activity:"all",sort:"activity"},lt={"1h":3600*1e3,"6h":360*60*1e3,"24h":1440*60*1e3},Ae=20,me=3,ot={idle:"#4aff9e",working:"#4a9eff",waiting:"#ff9e4a",waiting_permission:"#ffcc00",error:"#ff4a4a",offline:"#888888",orphaned:"#ff9e4a"},rt=12e4;function it(s){return s.trim().replace(/\r\n/g,`
|
|
2
2
|
`)}function $e(s,a){return`${s}:${it(a)}`}function dt(s,a,c,f){if(s.uuid&&a.has(s.uuid))return!1;if(s.uuid)return!0;const p=s.isUserPrompt?"user":"assistant",d=$e(p,s.text),M=s.timestamp||0,A=c.get(d);return A!==void 0&&Math.abs(M-A)<=rt?!1:M>f}function ut({isOpen:s,agents:a}){const c=He(),[f,p]=t.useState(new Map),d=t.useRef(new Set);t.useRef(a);const M=t.useMemo(()=>Array.from(a.keys()).sort().join(","),[a]),A=t.useMemo(()=>Array.from(a.values()).map(j=>`${j.id}:${j.sessionId||""}`).sort().join(","),[a]);t.useEffect(()=>{s||(d.current.clear(),p(new Map))},[s]),t.useEffect(()=>{if(!s)return;const j=new Set(Array.from(a.keys()));for(const i of d.current)j.has(i)||d.current.delete(i);let h=null;c>0&&(h=I.preserveOutputs(),d.current.clear());const v=async(i,b,$=0)=>{if(d.current.add(i.id),$>0&&await new Promise(x=>setTimeout(x,$)),p(x=>{const N=new Map(x);return N.set(i.id,{agentId:i.id,messages:[],loading:!0,hasMore:!1,totalCount:0}),N}),!i.sessionId){b&&b.length>0&&I.mergeOutputsWithHistory(i.id,[],b),p(x=>{const N=new Map(x);return N.set(i.id,{agentId:i.id,messages:[],loading:!1,hasMore:!1,totalCount:0}),N});return}try{const N=await(await Oe(ye(`/api/agents/${i.id}/history?limit=${Ee}&offset=0`))).json(),P=N.messages||[],W=P.length>0?Math.max(...P.map(C=>C.timestamp?new Date(C.timestamp).getTime():0)):0,J=new Set(P.map(C=>C.uuid).filter(C=>!!C)),V=new Map;for(const C of P){if(C.type!=="user"&&C.type!=="assistant")continue;const o=$e(C.type,C.content),L=C.timestamp?new Date(C.timestamp).getTime():0,K=V.get(o)??0;L>K&&V.set(o,L)}const G=I.getOutputs(i.id),U=(b&&b.length>0?[...b,...G]:G).filter(C=>dt(C,J,V,W));I.clearOutputs(i.id);for(const C of U)I.addOutput(i.id,C);p(C=>{const o=new Map(C);return o.set(i.id,{agentId:i.id,messages:P,loading:!1,hasMore:N.hasMore||!1,totalCount:N.totalCount||0}),o})}catch(x){if(console.error(`Failed to load history for ${i.name}:`,x),b&&b.length>0){I.clearOutputs(i.id);for(const N of b)I.addOutput(i.id,N)}p(N=>{const P=new Map(N);return P.set(i.id,{agentId:i.id,messages:[],loading:!1,hasMore:!1,totalCount:0}),P})}},u=c>0?500:0,D=Array.from(a.values());for(const i of D)if(!d.current.has(i.id)){const b=h==null?void 0:h.get(i.id);v(i,b,u)}},[s,M,A,c]);const R=t.useRef(a),k=t.useRef(f);R.current=a,k.current=f;const w=t.useCallback(async j=>{const h=R.current.get(j),v=k.current.get(j);if(!(h!=null&&h.sessionId)||!v||!v.hasMore)return;const u=v.messages.length;try{const i=await(await fetch(ye(`/api/agents/${j}/history?limit=${Ee}&offset=${u}`))).json();i.messages&&i.messages.length>0&&p(b=>{const $=new Map(b),x=b.get(j);return x&&$.set(j,{...x,messages:[...i.messages,...x.messages],hasMore:i.hasMore||!1}),$})}catch(D){console.error(`Failed to load more history for agent ${j}:`,D)}},[]),E=t.useCallback(j=>{d.current.delete(j),p(h=>{const v=new Map(h),u=h.get(j);return u&&v.set(j,{...u,messages:[],hasMore:!1,totalCount:0,loading:!1}),v})},[]);return{histories:f,loadMoreHistory:w,clearAgentHistory:E}}function mt({command:s,onCommandChange:a,useTextarea:c,forceTextarea:f,onForceTextarea:p,onSend:d,canSend:M,attachedFiles:A,onAddFile:R,onRemoveFile:k,uploadFile:w,onAddPastedText:E,placeholder:j="Message...",className:h="",compact:v=!1,inputRef:u}){const D=t.useRef(null),i=t.useRef(null),b=t.useRef(c);t.useEffect(()=>{if(c&&!b.current&&i.current){const o=i.current;o.focus(),o.selectionStart=o.selectionEnd=o.value.length}b.current=c},[c]),t.useEffect(()=>{const o=i.current;if(!o||!c)return;o.style.height="auto";const L=v?120:180,K=Math.min(o.scrollHeight,L);o.style.height=`${K}px`},[s,c,v]);const $=t.useCallback(async o=>{const L=o.clipboardData.items;for(const _ of L)if(_.type.startsWith("image/")){o.preventDefault();const F=_.getAsFile();if(F){const z=await w(F);z&&R(z)}return}const K=o.clipboardData.files;if(K.length>0){o.preventDefault();for(const _ of K){const F=await w(_);F&&R(F)}return}const B=o.clipboardData.getData("text"),te=(B.match(/\n/g)||[]).length+1;if(te>5){o.preventDefault();const F=`[Pasted text #${E(B)} +${te} lines]`,z=o.target,se=z.selectionStart||0,ae=z.selectionEnd||0,ne=s.slice(0,se)+F+s.slice(ae);a(ne),c||p(!0)}},[s,a,c,p,w,R,E]),x=t.useCallback(async o=>{const L=o.target.files;if(L){for(const K of L){const B=await w(K);B&&R(B)}D.current&&(D.current.value="")}},[w,R]),N=t.useCallback(o=>{if(o.key==="Enter"&&o.shiftKey){c||(o.preventDefault(),p(!0));return}o.key==="Enter"&&(o.preventDefault(),d())},[c,p,d]),P=t.useCallback(o=>{},[]),W=t.useCallback(o=>{o.button===1&&(o.preventDefault(),o.stopPropagation())},[]),J=t.useCallback(o=>{i.current=o,u==null||u(o)},[u]),V=v?"agent-panel-input":"guake-input",G=v?"agent-panel-input-container":"guake-input-container",Q=v?"agent-panel-attach-btn":"guake-attach-btn",U=v?"agent-panel-send-btn":"",C=c?v?"agent-panel-input-expanded":"guake-input-expanded":"";return e.jsxs(e.Fragment,{children:[A.length>0&&e.jsx("div",{className:v?"agent-panel-attachments":"guake-attachments",children:A.map(o=>e.jsxs("div",{className:`${v?"agent-panel-attachment":"guake-attachment"} ${o.isImage?"is-image":""}`,children:[e.jsx("span",{className:v?"agent-panel-attachment-icon":"guake-attachment-icon",children:e.jsx(O,{name:o.isImage?"file":"paperclip",size:12})}),e.jsx("span",{className:v?"agent-panel-attachment-name":"guake-attachment-name",title:o.path,children:o.name}),!v&&e.jsxs("span",{className:"guake-attachment-size",children:["(",Math.round(o.size/1024),"KB)"]}),e.jsx("button",{className:v?"agent-panel-attachment-remove":"guake-attachment-remove",onClick:()=>k(o.id),title:"Remove",children:"×"})]},o.id))}),e.jsxs("div",{className:`${V} ${C} ${h}`,children:[e.jsx("input",{ref:D,type:"file",multiple:!0,onChange:x,style:{display:"none"},accept:"*"}),e.jsxs("div",{className:G,onAuxClick:W,children:[e.jsx("button",{className:Q,onClick:()=>{var o;return(o=D.current)==null?void 0:o.click()},title:"Attach file (or paste image)",children:e.jsx(O,{name:"paperclip",size:14})}),c?e.jsx("textarea",{ref:J,placeholder:j,value:s,onChange:o=>a(o.target.value),onKeyDown:N,onPaste:$,onMouseDown:P}):e.jsx("input",{ref:u,type:"text",placeholder:j,value:s,onChange:o=>a(o.target.value),onKeyDown:N,onPaste:$,onMouseDown:P}),e.jsx("button",{className:U,onClick:d,disabled:!M,title:"Send",children:e.jsx(O,{name:"send",size:14})})]})]})]})}function ft(s){const a=Math.floor(s/1e3),c=Math.floor(a/60),f=a%60;return`${c}:${f.toString().padStart(2,"0")}`}const pt=t.memo(function({agentId:a,isWorking:c,timestamp:f}){const{t:p}=fe(["terminal"]),[d,M]=t.useState(0);return t.useEffect(()=>{if(!c||!f){M(0);return}M(Date.now()-f);const A=setInterval(()=>{M(Date.now()-f)},1e3);return()=>clearInterval(A)},[c,f]),c?e.jsxs("div",{className:"guake-stop-bar",children:[e.jsx("span",{className:"guake-elapsed-timer",children:ft(d)}),e.jsxs("button",{className:"guake-stop-btn",onClick:()=>I.stopAgent(a),title:p("terminal:input.stopOperation"),children:[e.jsx("span",{className:"stop-icon",children:e.jsx(O,{name:"stop",size:12,weight:"fill"})}),e.jsx("span",{className:"stop-label",children:p("terminal:input.stop")})]})]}):null});function ht({agent:s,history:a,outputs:c,isExpanded:f,isFocused:p,advancedView:d,onExpand:M,onFocus:A,inputRef:R,onLoadMore:k,onClearHistory:w}){const{t:E}=fe(["terminal","common"]),j=_e(s.id),h=t.useRef(null),[v,u]=t.useState(!1),D=t.useRef(0),i=t.useRef(!1),[b,$]=t.useState(!0),[x,N]=t.useState(!1),[P,W]=t.useState(null),[J,V]=t.useState(null),[G,Q]=t.useState(null);Te(`commander-image-modal-${s.id}`,P!==null,()=>W(null));const{command:U,setCommand:C,forceTextarea:o,setForceTextarea:L,useTextarea:K,setPastedTexts:B,incrementPastedCount:te,resetPastedCount:_,attachedFiles:F,setAttachedFiles:z,removeAttachedFile:se,uploadFile:ae,expandPastedTexts:ne}=Be({selectedAgentId:s.id}),ce=U.trim().length>0||F.length>0,n=Ue({outputs:c,viewMode:d?"advanced":"simple"}),l=t.useMemo(()=>{const S=Ke(s);return{usedPercent:S.usedPercent,freePercent:S.freePercent,hasData:!!s.contextStats,totalTokens:S.totalTokens,contextWindow:S.contextWindow}},[s.contextStats,s.contextUsed,s.contextLimit]),g=t.useCallback(()=>{!v&&(a!=null&&a.hasMore)&&k&&(u(!0),D.current=h.current?h.current.scrollHeight-h.current.scrollTop:0,k())},[v,a==null?void 0:a.hasMore,k]);t.useEffect(()=>{v&&a&&!a.loading&&u(!1)},[a,v]);const m=t.useCallback(()=>{i.current=!0,$(!1)},[]),T=t.useRef(f),Z=t.useRef(p);t.useEffect(()=>{(f&&!T.current||p&&!Z.current)&&(i.current=!1,$(!0),N(!0)),T.current=f,Z.current=p},[f,p]);const ee=t.useRef(a==null?void 0:a.loading);t.useEffect(()=>{ee.current&&!(a!=null&&a.loading)&&(i.current=!1,$(!0),N(!0)),ee.current=a==null?void 0:a.loading},[a==null?void 0:a.loading]),t.useEffect(()=>{if(!x)return;const S=h.current;if(!S)return;const y=performance.now();let H=0,ue=-1,be;const Re=()=>{const{scrollTop:Fe,scrollHeight:Ne,clientHeight:Le}=S,ze=Ne-Fe-Le<=2;if(Math.abs(Ne-ue)<=1&&ze?H+=1:H=0,ue=Ne,H>=3){N(!1);return}if(performance.now()-y>5e3){N(!1);return}be=requestAnimationFrame(Re)};return be=requestAnimationFrame(Re),()=>cancelAnimationFrame(be)},[x]),t.useEffect(()=>{i.current||$(!0)},[n.length]);const q=t.useCallback(()=>!1,[]),ie=t.useCallback(S=>{const y=te();return B(H=>new Map(H).set(y,S)),y},[te,B]),he=t.useCallback(S=>{z(y=>[...y,S])},[z]),xe=t.useCallback(()=>{if(!ce)return;if(U.trim()==="/clear"&&F.length===0){I.clearContext(s.id),w(),C(""),L(!1),B(new Map),z([]),_();return}let S=ne(U.trim());if(F.length>0){const y=F.map(H=>H.isImage?`[Image: ${H.path}]`:`[File: ${H.path}]`).join(`
|
|
3
3
|
`);S=S?`${S}
|
|
4
4
|
|