tide-commander 1.153.0 → 1.155.0
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 +20 -0
- package/dist/assets/{BossLogsModal-Dgz-N5gw.js → BossLogsModal-OFobifVq.js} +1 -1
- package/dist/assets/{BossSpawnModal-BK_rYu8s.js → BossSpawnModal-Dho-x6rm.js} +1 -1
- package/dist/assets/{ControlsModal-hC_AiCpk.js → ControlsModal-DJBDhvNO.js} +1 -1
- package/dist/assets/{DockerLogsModal-D7ogyaZr.js → DockerLogsModal-C9TRTcsO.js} +1 -1
- package/dist/assets/{EmbeddedEditor-BFzUOmwz.js → EmbeddedEditor-GDE_Khwz.js} +1 -1
- package/dist/assets/{GmailOAuthSetup-C_Yc5Ypv.js → GmailOAuthSetup-D9m5zMWC.js} +1 -1
- package/dist/assets/{GoogleOAuthSetup-CefQSOYm.js → GoogleOAuthSetup-BxkN7LjY.js} +1 -1
- package/dist/assets/{IframeModal-BbeuiE04.js → IframeModal-Do_I_wI7.js} +1 -1
- package/dist/assets/{IntegrationsPanel-xh3TgJLH.js → IntegrationsPanel-jRrwC2-G.js} +2 -2
- package/dist/assets/{LogViewerModal-CE2L8nWJ.js → LogViewerModal-BtcUe5i2.js} +1 -1
- package/dist/assets/{MonitoringModal-A2SN3uAJ.js → MonitoringModal-BTmSXrzv.js} +1 -1
- package/dist/assets/{PM2LogsModal-DdlhCa8u.js → PM2LogsModal-CUf7NGHz.js} +1 -1
- package/dist/assets/{RestoreArchivedAreaModal-BvHo-OxE.js → RestoreArchivedAreaModal-B72UKeRP.js} +1 -1
- package/dist/assets/{Scene2DCanvas-t6RuUegr.js → Scene2DCanvas-BCfxX7JU.js} +1 -1
- package/dist/assets/{SceneManager-TQ2_AvFn.js → SceneManager-BQubdlgd.js} +4 -4
- package/dist/assets/{SkillsPanel-PjzjcaoG.js → SkillsPanel-3qreMiJs.js} +1 -1
- package/dist/assets/{SlackMultiInstanceSetup-ms4r32Z8.js → SlackMultiInstanceSetup-BSCT5nAB.js} +1 -1
- package/dist/assets/{SpawnModal-B1FS8m9h.js → SpawnModal-DaWjnugM.js} +1 -1
- package/dist/assets/{StatisticsModal-mmz8hnD5.js → StatisticsModal-DCjCAU2o.js} +1 -1
- package/dist/assets/{SubordinateAssignmentModal-BXoG-Xgd.js → SubordinateAssignmentModal-9iPXraIi.js} +1 -1
- package/dist/assets/{TriggerManagerPanel-ODJyjvY-.js → TriggerManagerPanel-B4dCLEi_.js} +1 -1
- package/dist/assets/{WorkflowEditorPanel-9wtY0Tn3.js → WorkflowEditorPanel-BaYXKfYH.js} +1 -1
- package/dist/assets/{area-logos-BLyzmh47.js → area-logos-CgVT13bp.js} +1 -1
- package/dist/assets/{index-CN2p2fxH.js → index-0y0WY2XK.js} +1 -1
- package/dist/assets/index-BPjQZacc.css +1 -0
- package/dist/assets/{index-CdbLxNJr.js → index-C-tbJxGb.js} +1 -1
- package/dist/assets/{index-1hwiSf7o.js → index-C3Yb-3TP.js} +1 -1
- package/dist/assets/index-C3jAbuv2.js +1 -0
- package/dist/assets/{index-Ci2ZKu0n.js → index-C7t_6aP3.js} +2 -2
- package/dist/assets/{index-CBkh8xcE.js → index-CetQ5OX1.js} +1 -1
- package/dist/assets/{index-Cf-PINah.js → index-D8dlRudN.js} +3 -3
- package/dist/assets/index-DNjdlOwh.js +1 -0
- package/dist/assets/{index-D8vFfLs4.js → index-DiZy3nuB.js} +1 -1
- package/dist/assets/main-BHBs2E1L.css +1 -0
- package/dist/assets/{main-9TcmAtcq.js → main-DDwa0x9e.js} +113 -113
- package/dist/assets/{web-BVIPIXA1.js → web-Dj2DYQG1.js} +1 -1
- package/dist/assets/{web-Cz3TYK-R.js → web-EBdZk56y.js} +1 -1
- package/dist/assets/{web-BAkfcL4w.js → web-PXjd4vZ8.js} +1 -1
- package/dist/build-info.json +1 -1
- package/dist/index.html +2 -2
- package/dist/locales/de/config.json +1 -0
- package/dist/locales/en/config.json +6 -1
- package/dist/locales/en/terminal.json +7 -1
- package/dist/locales/es/config.json +4 -1
- package/dist/locales/es/terminal.json +8 -0
- package/dist/locales/fr/config.json +1 -0
- package/dist/locales/hi/config.json +1 -0
- package/dist/locales/it/config.json +1 -0
- package/dist/locales/ja/config.json +1 -0
- package/dist/locales/pt/config.json +1 -0
- package/dist/locales/ru/config.json +1 -0
- package/dist/locales/zh-CN/config.json +1 -0
- package/dist/src/packages/server/codex/app-server/app-server-event-adapter.js +222 -0
- package/dist/src/packages/server/codex/app-server/app-server-process.js +304 -0
- package/dist/src/packages/server/codex/app-server/app-server-recovery-store.js +76 -0
- package/dist/src/packages/server/codex/app-server/codex-app-server-runner.js +453 -0
- package/dist/src/packages/server/opencode/json-event-parser.js +3 -1
- package/dist/src/packages/server/opencode/server/opencode-server-event-adapter.js +127 -0
- package/dist/src/packages/server/opencode/server/opencode-server-process.js +285 -0
- package/dist/src/packages/server/opencode/server/opencode-server-recovery-store.js +73 -0
- package/dist/src/packages/server/opencode/server/opencode-server-runner.js +384 -0
- package/dist/src/packages/server/routes/agents.js +57 -1
- package/dist/src/packages/server/routes/system.js +110 -1
- package/dist/src/packages/server/runtime/codex-runner-router.js +99 -0
- package/dist/src/packages/server/runtime/codex-runtime-provider.js +5 -3
- package/dist/src/packages/server/runtime/opencode-runner-router.js +93 -0
- package/dist/src/packages/server/runtime/opencode-runtime-provider.js +5 -3
- package/dist/src/packages/server/services/claude-credentials-service.js +208 -1
- package/dist/src/packages/server/services/claude-usage-service.js +35 -28
- package/dist/src/packages/server/services/provider-credentials-service.js +338 -0
- package/dist/src/packages/server/services/system-prompt-service.js +94 -0
- package/package.json +1 -1
- package/dist/assets/index-CbfoJ_Vc.js +0 -1
- package/dist/assets/index-E5IMeM80.js +0 -1
- package/dist/assets/index-XI0_ICy6.css +0 -1
- package/dist/assets/main-DP0iv8Le.css +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l,j as e,I,u as J,bl as Xe,ag as Qe,bm as rs,bn as ds,s as A,bo as us,bd as ps,bp as hs,C as he,K as se,L as X,i as ye,k as ke,bq as ms,br as gs,bs as fs,bt as xs,bu as bs,bv as js,bw as vs,bx as es,by as Ns,bz as ws,bA as ys,J as ks,X as Ss,bB as Se,a9 as Cs,bC as ss,bD as As,bE as Me,bF as Ts,bG as Es,bH as _s,bI as Ps,bJ as Is,bK as Ls,bL as $s,as as Ds,b6 as Os,_ as Fs,S as we,bM as Rs,bN as Bs,b8 as zs,bO as Be,$ as Pe,bi as Us,bP as ze,bQ as Ms,bR as Vs,a5 as Ks,m as Hs,bS as qs,bT as Ws,bU as Gs}from"./main-9TcmAtcq.js";import{g as Ys,d as Js,u as Zs}from"./area-logos-BLyzmh47.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const ts="tide-toolbox-collapse";function Xs(s,a){try{const t=localStorage.getItem(`${ts}-${s}`);if(t!==null)return t==="true"}catch{}return a}function Qs(s,a){try{localStorage.setItem(`${ts}-${s}`,String(a))}catch{}}function W({title:s,storageKey:a,defaultOpen:t=!1,forceOpen:o=!1,children:d,headerExtra:c}){const[r,f]=l.useState(()=>a?Xs(a,t):t),n=()=>{const v=!r;f(v),a&&Qs(a,v)},g=o||r;return e.jsxs("div",{className:`collapsible-section ${g?"open":"collapsed"}`,children:[e.jsxs("button",{className:"collapsible-header",onClick:n,children:[e.jsx("span",{className:"collapsible-title",children:s}),e.jsxs("span",{className:"collapsible-header-right",children:[c,e.jsx("span",{className:"collapsible-arrow",children:e.jsx(I,{name:g?"caret-down":"caret-right",size:10})})]})]}),g&&e.jsx("div",{className:"collapsible-content",children:d})]})}function et({area:s,isSelected:a,onClick:t,onDelete:o}){const{t:d}=J(["config","common"]),c=s.assignedAgentIds.length,r=s.type==="rectangle"?d("config:areas.rect"):d("config:areas.circle");return e.jsxs("div",{className:`area-item ${a?"selected":""}`,onClick:t,children:[e.jsx("div",{className:"area-color-dot",style:{backgroundColor:s.color}}),e.jsxs("div",{className:"area-info",children:[e.jsx("div",{className:"area-name",children:s.name}),e.jsxs("div",{className:"area-meta",children:[r," ",c>0&&`• ${c} ${c>1?d("common:labels.agents").toLowerCase():d("common:labels.agent").toLowerCase()}`]})]}),e.jsx("button",{className:"area-delete-btn",onClick:o,title:d("config:areas.deleteArea"),children:"×"})]})}function st({building:s,isSelected:a,onClick:t,onEdit:o}){var f;const{t:d}=J(["config"]),c=((f=s.pm2Status)==null?void 0:f.ports)||[],r=(n,g)=>{n.stopPropagation(),window.open(`http://${window.location.hostname}:${g}`,"_blank")};return e.jsxs("div",{className:`building-item ${a?"selected":""}`,onClick:t,children:[e.jsx("div",{className:"building-status-dot",style:{backgroundColor:Xe[s.status]},title:s.status}),e.jsx("div",{className:"building-icon",children:e.jsx(I,{name:Qe(s.type),size:16})}),e.jsxs("div",{className:"building-info",children:[e.jsx("div",{className:"building-name",children:s.name}),e.jsxs("div",{className:"building-meta",children:[s.type,c.length>0&&e.jsx("span",{className:"building-ports",children:c.map(n=>e.jsxs("a",{href:`http://${window.location.hostname}:${n}`,className:"building-port-link",onClick:g=>r(g,n),title:`Open :${n}`,children:[":",n]},n))})]})]}),e.jsx("button",{className:"building-edit-btn",onClick:n=>{n.stopPropagation(),o()},title:d("config:buildings.editBuilding"),children:e.jsx(I,{name:"gear",size:14})})]})}function tt({building:s,onClose:a,onOpenModal:t}){var g,v,k,h,E,b,S,x;const{t:o}=J(["config","common"]),c=rs().get(s.id)||[],r=ds[s.style||"server-rack"],f=u=>{A.sendBuildingCommand(s.id,u)},n=u=>{window.open(u,"_blank")};return e.jsxs("div",{className:"building-editor",children:[e.jsxs("div",{className:"building-editor-header",children:[e.jsxs("div",{className:"building-editor-title-row",children:[e.jsx("span",{className:"building-editor-icon",children:e.jsx(I,{name:Qe(s.type),size:18})}),e.jsx("span",{className:"building-editor-title",children:s.name}),e.jsx("span",{className:"building-editor-status",style:{backgroundColor:Xe[s.status]},children:s.status})]}),e.jsx("button",{className:"building-editor-close",onClick:a,children:"×"})]}),e.jsx("div",{className:"building-editor-section",children:e.jsxs("div",{className:"building-editor-info-grid",children:[e.jsxs("div",{className:"building-editor-info-item",children:[e.jsx("span",{className:"building-editor-info-label",children:o("common:labels.type")}),e.jsx("span",{className:"building-editor-info-value",children:s.type})]}),e.jsxs("div",{className:"building-editor-info-item",children:[e.jsx("span",{className:"building-editor-info-label",children:o("config:buildings.style")}),e.jsx("span",{className:"building-editor-info-value",children:r.label})]}),s.cwd&&e.jsxs("div",{className:"building-editor-info-item building-editor-info-wide",children:[e.jsx("span",{className:"building-editor-info-label",children:o("config:buildings.directory")}),e.jsx("span",{className:"building-editor-info-value building-editor-cwd",title:s.cwd,children:s.cwd.split("/").pop()||s.cwd})]})]})}),s.type==="server"&&e.jsxs("div",{className:"building-editor-section",children:[e.jsx("div",{className:"building-editor-section-title",children:o("config:buildings.actions")}),e.jsxs("div",{className:"building-editor-actions",children:[e.jsxs("button",{className:"building-editor-action-btn start",onClick:()=>f("start"),disabled:!((g=s.commands)!=null&&g.start)||s.status==="running",title:((v=s.commands)==null?void 0:v.start)||o("config:buildings.noStartCommand"),children:[e.jsx(I,{name:"play",size:12})," ",o("common:buttons.start")]}),e.jsxs("button",{className:"building-editor-action-btn stop",onClick:()=>f("stop"),disabled:!((k=s.commands)!=null&&k.stop)||s.status==="stopped",title:((h=s.commands)==null?void 0:h.stop)||o("config:buildings.noStopCommand"),children:[e.jsx(I,{name:"stop",size:12,weight:"fill"})," ",o("common:buttons.stop")]}),e.jsxs("button",{className:"building-editor-action-btn restart",onClick:()=>f("restart"),disabled:!((E=s.commands)!=null&&E.restart),title:((b=s.commands)==null?void 0:b.restart)||o("config:buildings.noRestartCommand"),children:[e.jsx(I,{name:"refresh",size:12})," ",o("common:buttons.retry")]}),e.jsxs("button",{className:"building-editor-action-btn health",onClick:()=>f("healthCheck"),disabled:!((S=s.commands)!=null&&S.healthCheck),title:((x=s.commands)==null?void 0:x.healthCheck)||o("config:buildings.noHealthCheck"),children:[e.jsx(I,{name:"heart",size:12})," Health"]})]})]}),s.urls&&s.urls.length>0&&e.jsxs("div",{className:"building-editor-section",children:[e.jsx("div",{className:"building-editor-section-title",children:o("config:buildings.links")}),e.jsx("div",{className:"building-editor-links",children:s.urls.map((u,w)=>e.jsxs("button",{className:"building-editor-link",onClick:()=>n(u.url),title:u.url,children:[e.jsx(I,{name:"link",size:12})," ",u.label||u.url]},w))})]}),c.length>0&&e.jsxs("div",{className:"building-editor-section",children:[e.jsxs("div",{className:"building-editor-section-title",children:[o("config:buildings.recentLogs"),e.jsx("button",{className:"building-editor-clear-logs",onClick:()=>A.clearBuildingLogs(s.id),title:o("common:buttons.clear"),children:o("common:buttons.clear")})]}),e.jsx("div",{className:"building-editor-logs",children:c.slice(-5).map((u,w)=>e.jsx("div",{className:"building-editor-log-entry",children:u},w))})]}),e.jsx("div",{className:"building-editor-footer",children:e.jsxs("button",{className:"building-editor-edit-btn",onClick:t,children:[e.jsx(I,{name:"gear",size:12})," ",o("config:buildings.fullSettings")]})})]})}const at=[{key:"center",labelKey:"posCenter"},{key:"top-left",labelKey:"posTopLeft"},{key:"top-right",labelKey:"posTopRight"},{key:"bottom-left",labelKey:"posBottomLeft"},{key:"bottom-right",labelKey:"posBottomRight"}];function nt({area:s,onClose:a,onOpenFolder:t}){var te;const{t:o}=J(["config","common"]),[d,c]=l.useState(s.name),[r,f]=l.useState(s.prompt||""),[n,g]=l.useState(!1),[v,k]=l.useState(""),[h,E]=l.useState(!1),b=l.useRef(null);l.useEffect(()=>{c(s.name)},[s.id,s.name]),l.useEffect(()=>{f(s.prompt||"")},[s.id,s.prompt]);const S=N=>{const $=N.target.value;c($),A.updateArea(s.id,{name:$})},x=N=>{A.updateArea(s.id,{color:N})},u=N=>{const $=N.target.value;f($),A.updateArea(s.id,{prompt:$})},w=()=>{v.trim()&&(A.addDirectoryToArea(s.id,v.trim()),k(""),g(!1))},B=(N,$)=>{$.stopPropagation(),A.removeDirectoryFromArea(s.id,N)},F=()=>{A.bringAreaToFront(s.id)},G=()=>{A.sendAreaToBack(s.id)},K=l.useCallback(()=>{let N=2,$=2;s.type==="rectangle"&&s.width&&s.height?(N=s.width,$=s.height):s.type==="circle"&&s.radius&&(N=s.radius*1.414,$=s.radius*1.414);const M=Math.min(N,$)*.4;return{width:Math.round(M*10)/10,height:Math.round(M*10)/10}},[s.type,s.width,s.height,s.radius]),H=async N=>{var M;const $=(M=N.target.files)==null?void 0:M[0];if($){E(!0);try{const j=await Zs(s.id,$),L=K();A.updateArea(s.id,{logo:{filename:j.filename,position:"center",width:L.width,height:L.height,keepAspectRatio:!0,opacity:.8}})}catch(j){console.error("Failed to upload logo:",j)}finally{E(!1),b.current&&(b.current.value="")}}},z=async()=>{try{await Js(s.id),A.updateArea(s.id,{logo:void 0})}catch(N){console.error("Failed to remove logo:",N)}},V=N=>{s.logo&&A.updateArea(s.id,{logo:{...s.logo,position:N}})},p=N=>{if(!s.logo)return;const $=parseFloat(N.target.value)||.1;if(s.logo.keepAspectRatio&&s.logo.width>0){const M=s.logo.height/s.logo.width;A.updateArea(s.id,{logo:{...s.logo,width:$,height:Math.round($*M*10)/10}})}else A.updateArea(s.id,{logo:{...s.logo,width:$}})},P=N=>{if(!s.logo)return;const $=parseFloat(N.target.value)||.1;if(s.logo.keepAspectRatio&&s.logo.height>0){const M=s.logo.width/s.logo.height;A.updateArea(s.id,{logo:{...s.logo,height:$,width:Math.round($*M*10)/10}})}else A.updateArea(s.id,{logo:{...s.logo,height:$}})},U=()=>{s.logo&&A.updateArea(s.id,{logo:{...s.logo,keepAspectRatio:!s.logo.keepAspectRatio}})},q=N=>{s.logo&&A.updateArea(s.id,{logo:{...s.logo,opacity:parseFloat(N.target.value)}})};return e.jsxs("div",{className:"area-editor",children:[e.jsxs("div",{className:"area-editor-header",children:[e.jsx("span",{className:"area-editor-title",children:o("config:areas.editArea")}),e.jsx("button",{className:"area-editor-close",onClick:a,children:"×"})]}),e.jsxs("div",{className:"area-editor-row",children:[e.jsx("div",{className:"area-editor-label",children:o("common:labels.name")}),e.jsx("input",{type:"text",className:"area-editor-input",value:d,onChange:S,placeholder:o("config:areas.areaName")})]}),e.jsxs("div",{className:"area-editor-row",children:[e.jsx("div",{className:"area-editor-label",children:o("config:areas.color")}),e.jsx("div",{className:"color-picker-row",children:us.map(N=>e.jsx("button",{type:"button",className:`color-swatch ${s.color===N?"selected":""}`,style:{backgroundColor:N},onClick:()=>x(N),"aria-label":`Set area color ${N}`,"aria-pressed":s.color===N,title:N},N))})]}),e.jsxs("div",{className:"area-editor-row",children:[e.jsx("div",{className:"area-editor-label",children:o("config:areas.layer")}),e.jsxs("div",{className:"area-layer-buttons",children:[e.jsxs("button",{className:"area-layer-btn",onClick:F,title:o("config:areas.bringToFront"),children:[e.jsx(I,{name:"arrow-up",size:12})," ",o("config:areas.front")]}),e.jsxs("button",{className:"area-layer-btn",onClick:G,title:o("config:areas.sendToBack"),children:[e.jsx(I,{name:"arrow-down",size:12})," ",o("config:areas.back")]})]})]}),e.jsxs("div",{className:"area-editor-row",style:{flexDirection:"column",alignItems:"stretch"},children:[e.jsx("div",{className:"area-editor-label",style:{marginBottom:6},children:o("config:areas.logo")}),e.jsxs("div",{className:"area-logo-section",children:[(te=s.logo)!=null&&te.filename?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"area-logo-preview",children:[e.jsx("img",{src:Ys(s.logo.filename),alt:"Logo",className:"area-logo-thumbnail"}),e.jsx("button",{className:"area-logo-remove-btn",onClick:z,children:o("config:areas.removeLogo")}),e.jsx("button",{className:"area-logo-replace-btn",onClick:()=>{var N;return(N=b.current)==null?void 0:N.click()},disabled:h,children:h?"...":e.jsx(I,{name:"refresh",size:12})})]}),e.jsxs("div",{className:"area-logo-config-row",children:[e.jsx("span",{className:"area-logo-config-label",children:o("config:areas.logoPosition")}),e.jsx("div",{className:"area-logo-position-row",children:at.map(({key:N,labelKey:$})=>{var M;return e.jsx("button",{className:`area-logo-pos-btn ${((M=s.logo)==null?void 0:M.position)===N?"active":""}`,onClick:()=>V(N),children:o(`config:areas.${$}`)},N)})})]}),e.jsxs("div",{className:"area-logo-config-row",children:[e.jsx("span",{className:"area-logo-config-label",children:o("config:areas.logoSize")}),e.jsxs("div",{className:"area-logo-size-row",children:[e.jsxs("label",{className:"area-logo-size-field",children:[e.jsx("span",{children:o("config:areas.logoWidth")}),e.jsx("input",{type:"number",className:"area-logo-size-input",value:s.logo.width,onChange:p,min:.1,step:.1})]}),e.jsxs("label",{className:"area-logo-size-field",children:[e.jsx("span",{children:o("config:areas.logoHeight")}),e.jsx("input",{type:"number",className:"area-logo-size-input",value:s.logo.height,onChange:P,min:.1,step:.1})]}),e.jsxs("label",{className:"area-logo-aspect-label",title:o("config:areas.keepAspectRatio"),children:[e.jsx("input",{type:"checkbox",checked:s.logo.keepAspectRatio,onChange:U}),o("config:areas.keepAspectRatio")]})]})]}),e.jsxs("div",{className:"area-logo-config-row",children:[e.jsx("span",{className:"area-logo-config-label",children:o("config:areas.logoOpacity")}),e.jsxs("div",{className:"area-logo-opacity-row",children:[e.jsx("input",{type:"range",min:0,max:1,step:.05,value:s.logo.opacity??.8,onChange:q,className:"area-logo-opacity-slider"}),e.jsxs("span",{className:"area-logo-opacity-value",children:[Math.round((s.logo.opacity??.8)*100),"%"]})]})]})]}):e.jsx("button",{className:"area-logo-upload-btn",onClick:()=>{var N;return(N=b.current)==null?void 0:N.click()},disabled:h,children:h?"...":o("config:areas.uploadLogo")}),e.jsx("input",{ref:b,type:"file",accept:"image/*",style:{display:"none"},onChange:H})]})]}),e.jsxs("div",{className:"area-editor-row",style:{flexDirection:"column",alignItems:"stretch"},children:[e.jsx("div",{className:"area-editor-label",style:{marginBottom:6},children:o("config:areas.folders",{count:s.directories.length})}),e.jsxs("div",{className:"area-folders-list",children:[s.directories.map(N=>e.jsxs("div",{className:"area-folder-item",title:N,children:[e.jsx("span",{className:"area-folder-icon clickable",onClick:()=>t==null?void 0:t(s.id),title:o("config:areas.openFolder"),children:e.jsx(I,{name:"folder",size:14})}),e.jsx("span",{className:"area-folder-path",children:N.split("/").pop()||N}),e.jsx("button",{className:"area-folder-remove",onClick:$=>B(N,$),title:o("config:areas.removeFolder"),children:"×"})]},N)),n?e.jsxs("div",{className:"area-add-folder-inline",children:[e.jsx(ps,{value:v,onChange:k,onSubmit:w,placeholder:o("config:areas.folderPlaceholder"),className:"area-add-folder-input",directoriesOnly:!0,autoFocus:!0}),e.jsx("button",{className:"area-add-folder-confirm",onClick:w,children:"+"})]}):e.jsx("button",{className:"area-add-folder-btn",onClick:()=>g(!0),children:o("config:areas.addFolder")})]})]}),e.jsxs("div",{className:"area-editor-row",style:{flexDirection:"column",alignItems:"stretch"},children:[e.jsx("div",{className:"area-editor-label",style:{marginBottom:6},children:o("config:areas.prompt","Prompt")}),e.jsx("textarea",{className:"area-editor-input",value:r,onChange:u,placeholder:o("config:areas.promptPlaceholder","System prompt for agents in this area..."),rows:4,style:{resize:"vertical",fontFamily:"monospace",fontSize:12}}),e.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:4},children:o("config:areas.promptHint","This prompt is injected into agents assigned to this area. Takes effect on next context refresh.")})]}),s.assignedAgentIds.length>0&&e.jsxs("div",{className:"area-editor-row",children:[e.jsx("div",{className:"area-editor-label",children:o("config:areas.assignedAgents",{count:s.assignedAgentIds.length})}),e.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:o("config:areas.rightClickUnassign")})]})]})}function it(){const{t:s}=J(["config","common"]),a=hs(),[t,o]=l.useState(!1),[d,c]=l.useState(null),[r,f]=l.useState({name:"",key:"",value:"",description:""}),[n,g]=l.useState(null),v=()=>{o(!0),c(null),f({name:"",key:"",value:"",description:""})},k=u=>{c(u.id),o(!1),f({name:u.name,key:u.key,value:u.value,description:u.description||""})},h=()=>{o(!1),c(null),f({name:"",key:"",value:"",description:""})},E=()=>{!r.name.trim()||!r.key.trim()||(d?A.updateSecret(d,{name:r.name.trim(),key:r.key.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_"),value:r.value,description:r.description.trim()||void 0}):A.createSecret({name:r.name.trim(),key:r.key.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_"),value:r.value,description:r.description.trim()||void 0}),h())},b=u=>{g(u)},S=()=>{n&&(A.deleteSecret(n),d===n&&h())},x=u=>{navigator.clipboard.writeText(`{{${u}}}`)};return e.jsxs("div",{className:"secrets-section",children:[e.jsx("div",{className:"secrets-description",children:s("config:secrets.description",{placeholder:"{{KEY}}"})}),e.jsx("div",{className:"secrets-list",children:a.length===0&&!t?e.jsx("div",{className:"secrets-empty",children:s("config:secrets.noSecrets")}):a.map(u=>e.jsxs("div",{className:`secret-item ${d===u.id?"editing":""}`,children:[e.jsxs("div",{className:"secret-item-header",children:[e.jsxs("div",{className:"secret-item-info",children:[e.jsx("span",{className:"secret-item-name",children:u.name}),e.jsx("code",{className:"secret-item-key",onClick:()=>x(u.key),title:s("config:secrets.copyPlaceholder"),children:`{{${u.key}}}`})]}),e.jsxs("div",{className:"secret-item-actions",children:[e.jsx("button",{className:"secret-item-btn edit",onClick:()=>k(u),title:s("common:buttons.edit"),children:e.jsx(I,{name:"edit",size:12})}),e.jsx("button",{className:"secret-item-btn delete",onClick:()=>b(u.id),title:s("common:buttons.delete"),children:"×"})]})]}),u.description&&e.jsx("div",{className:"secret-item-description",children:u.description})]},u.id))}),(t||d)&&e.jsxs("div",{className:"secret-form",children:[e.jsxs("div",{className:"secret-form-row",children:[e.jsx("label",{className:"secret-form-label",children:s("common:labels.name")}),e.jsx("input",{type:"text",className:"secret-form-input",placeholder:s("config:secrets.namePlaceholder"),value:r.name,onChange:u=>f({...r,name:u.target.value}),autoFocus:!0})]}),e.jsxs("div",{className:"secret-form-row",children:[e.jsx("label",{className:"secret-form-label",children:"Key"}),e.jsx("input",{type:"text",className:"secret-form-input",placeholder:s("config:secrets.keyPlaceholder"),value:r.key,onChange:u=>f({...r,key:u.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"")})}),e.jsx("span",{className:"secret-form-hint",children:s("config:secrets.usedAs",{placeholder:`{{${r.key||"KEY"}}}`})})]}),e.jsxs("div",{className:"secret-form-row",children:[e.jsx("label",{className:"secret-form-label",children:s("config:secrets.secretValue")}),e.jsx("input",{type:"password",className:"secret-form-input",placeholder:s("config:secrets.valuePlaceholder"),value:r.value,onChange:u=>f({...r,value:u.target.value})})]}),e.jsxs("div",{className:"secret-form-row",children:[e.jsx("label",{className:"secret-form-label",children:s("common:labels.description")}),e.jsx("input",{type:"text",className:"secret-form-input",placeholder:s("config:secrets.descriptionPlaceholder"),value:r.description,onChange:u=>f({...r,description:u.target.value})})]}),e.jsxs("div",{className:"secret-form-actions",children:[e.jsx("button",{className:"secret-form-btn cancel",onClick:h,children:s("common:buttons.cancel")}),e.jsx("button",{className:"secret-form-btn save",onClick:E,disabled:!r.name.trim()||!r.key.trim(),children:s(d?"config:secrets.update":"common:buttons.add")})]})]}),!t&&!d&&e.jsx("button",{className:"secrets-add-btn",onClick:v,children:s("config:secrets.addSecret")}),e.jsx(he,{isOpen:n!==null,title:s("common:buttons.delete"),message:s("config:secrets.deleteConfirm"),confirmLabel:s("common:buttons.delete"),cancelLabel:s("common:buttons.cancel"),variant:"danger",onConfirm:S,onClose:()=>g(null)})]})}async function ot(){const s=se(),a=await fetch(`${X()}/api/agents/system-settings/prompt`,{headers:{Authorization:`Bearer ${s}`}});if(!a.ok)throw new Error(`Failed to fetch system prompt: ${a.statusText}`);return(await a.json()).prompt||""}async function lt(s){const a=se(),t=await fetch(`${X()}/api/agents/system-settings/prompt`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({prompt:s})});if(!t.ok)throw new Error(`Failed to update system prompt: ${t.statusText}`)}async function ct(){const s=se(),a=await fetch(`${X()}/api/agents/system-settings/prompt`,{method:"DELETE",headers:{Authorization:`Bearer ${s}`}});if(!a.ok)throw new Error(`Failed to clear system prompt: ${a.statusText}`)}async function rt(){const s=se(),a=await fetch(`${X()}/api/agents/system-settings/echo-prompt`,{headers:{Authorization:`Bearer ${s}`}});if(!a.ok)throw new Error(`Failed to fetch echo prompt setting: ${a.statusText}`);return(await a.json()).enabled||!1}async function dt(s){const a=se(),t=await fetch(`${X()}/api/agents/system-settings/echo-prompt`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({enabled:s})});if(!t.ok)throw new Error(`Failed to update echo prompt setting: ${t.statusText}`)}async function ut(){const s=se(),a=await fetch(`${X()}/api/agents/system-settings/codex-binary`,{headers:{Authorization:`Bearer ${s}`}});if(!a.ok)throw new Error(`Failed to fetch codex binary path: ${a.statusText}`);return(await a.json()).path||""}async function pt(s){const a=se(),t=await fetch(`${X()}/api/agents/system-settings/codex-binary`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({path:s})});if(!t.ok)throw new Error(`Failed to update codex binary path: ${t.statusText}`)}async function ht(){const s=se(),a=await fetch(`${X()}/api/agents/system-settings/tmux-mode`,{headers:{Authorization:`Bearer ${s}`}});if(!a.ok)throw new Error(`Failed to fetch tmux mode setting: ${a.statusText}`);return(await a.json()).enabled||!1}async function mt(s){const a=se(),t=await fetch(`${X()}/api/agents/system-settings/tmux-mode`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({enabled:s})});if(!t.ok)throw new Error(`Failed to update tmux mode setting: ${t.statusText}`)}async function gt(){const s=se(),a=await fetch(`${X()}/api/agents/system-settings/interactive-mode`,{headers:{Authorization:`Bearer ${s}`}});if(!a.ok)throw new Error(`Failed to fetch interactive mode setting: ${a.statusText}`);return(await a.json()).enabled||!1}async function ft(s){const a=se(),t=await fetch(`${X()}/api/agents/system-settings/interactive-mode`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({enabled:s})});if(!t.ok)throw new Error(`Failed to update interactive mode setting: ${t.statusText}`)}async function xt(){const s=se(),a=await fetch(`${X()}/api/agents/system-settings/backup`,{headers:{Authorization:`Bearer ${s}`}});if(!a.ok)throw new Error(`Failed to fetch backup status: ${a.statusText}`);return a.json()}async function bt(s){const a=se(),t=await fetch(`${X()}/api/agents/system-settings/backup`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({enabled:s})});if(!t.ok){const o=await t.json().catch(()=>({}));throw new Error(o.error||`Failed to update backup setting: ${t.statusText}`)}return t.json()}function jt({checked:s,onChange:a,disabled:t}){return e.jsxs("label",{className:"config-toggle",children:[e.jsx("input",{type:"checkbox",className:"config-toggle-input",checked:s,disabled:t,onChange:o=>a(o.target.checked)}),e.jsx("span",{className:"config-toggle-track",children:e.jsx("span",{className:"config-toggle-thumb"})})]})}function vt(){const{t:s}=J(["config","common"]),[a,t]=l.useState([]),[o,d]=l.useState(new Set),[c,r]=l.useState(new Set),[f,n]=l.useState(!1),[g,v]=l.useState(!1),[k,h]=l.useState(null),[E,b]=l.useState(null),[S,x]=l.useState(null),[u,w]=l.useState(null),[B,F]=l.useState(!1),[G,K]=l.useState(null);l.useEffect(()=>{ye(ke("/api/config/categories")).then(j=>j.json()).then(j=>{const L=Array.isArray(j)?j:[];t(L),d(new Set(L.map(D=>D.id)))}).catch(j=>console.error("Failed to fetch config categories:",j))},[]),l.useEffect(()=>{xt().then(w).catch(j=>{console.error("Failed to fetch backup status:",j),K(j.message||"Failed to fetch backup status")})},[]);const H=async j=>{if(!B){F(!0),K(null);try{const L=await bt(j);w(L)}catch(L){K(L.message||"Failed to update backup setting")}finally{F(!1)}}},z=j=>{d(L=>{const D=new Set(L);return D.has(j)?D.delete(j):D.add(j),D})},V=j=>{r(L=>{const D=new Set(L);return D.has(j)?D.delete(j):D.add(j),D})},p=()=>d(new Set(a.map(j=>j.id))),P=()=>d(new Set),U=()=>{E&&r(new Set(E.categories.map(j=>j.id)))},q=()=>r(new Set),te=async()=>{var j;if(o.size!==0){n(!0),x(null);try{const L=Array.from(o).join(","),D=await ye(ke(`/api/config/export?categories=${L}`));if(!D.ok)throw new Error("Export failed");const Q=await D.blob(),ee=window.URL.createObjectURL(Q),C=document.createElement("a");C.href=ee;const y=D.headers.get("Content-Disposition"),Z=((j=y==null?void 0:y.match(/filename="(.+)"/))==null?void 0:j[1])||"tide-commander-config.zip";C.download=Z,document.body.appendChild(C),C.click(),document.body.removeChild(C),window.URL.revokeObjectURL(ee),x({type:"success",text:s("config:data.exportSuccess")})}catch(L){x({type:"error",text:L.message||"Export failed"})}finally{n(!1)}}},N=async j=>{var D;const L=(D=j.target.files)==null?void 0:D[0];if(L){h(L),x(null),b(null),r(new Set);try{const Q=await ye(ke("/api/config/preview"),{method:"POST",headers:{"Content-Type":"application/zip"},body:await L.arrayBuffer()});if(!Q.ok){const y=await Q.json();throw new Error(y.error||"Failed to preview config file")}const ee=await Q.json(),C=Array.isArray(ee.categories)?ee.categories:[];b({...ee,categories:C}),r(new Set(C.map(y=>y.id)))}catch(Q){x({type:"error",text:Q.message||"Failed to read config file"}),h(null)}}},$=async()=>{if(!(!k||c.size===0)){v(!0),x(null);try{const j=Array.from(c).join(","),L=await ye(ke(`/api/config/import?categories=${j}`),{method:"POST",headers:{"Content-Type":"application/zip"},body:await k.arrayBuffer()}),D=await L.json();if(!L.ok)throw new Error(D.error||"Import failed");x({type:"success",text:D.message||s("config:data.importSuccess")}),h(null),b(null),r(new Set)}catch(j){x({type:"error",text:j.message||"Import failed"})}finally{v(!1)}}},M=()=>{h(null),b(null),r(new Set),x(null)};return e.jsxs("div",{className:"data-section",children:[S&&e.jsx("div",{className:`data-message data-message-${S.type}`,children:S.text}),e.jsxs("div",{className:"data-subsection",children:[e.jsxs("div",{className:"data-subsection-header",children:[e.jsx("span",{className:"data-subsection-title",children:"Hourly Backups"}),e.jsx(jt,{checked:!!(u!=null&&u.enabled),disabled:B||!u,onChange:H})]}),e.jsxs("div",{className:"data-backup-info",children:[u?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:["Saves a compressed snapshot of your data every hour to"," ",e.jsx("code",{children:u.backupDir}),". Identical snapshots are skipped. Keeps the 8 newest plus one from each of the 2 most recent prior days."]}),!u.scriptExists&&e.jsxs("div",{style:{marginTop:6,color:"var(--dracula-red, #ff5555)"},children:["Backup script not found at ",e.jsx("code",{children:u.scriptPath})]}),u.lastRunAt&&e.jsxs("div",{style:{marginTop:6},children:["Last run: ",new Date(u.lastRunAt).toLocaleString(),u.lastRunOk===!0&&" — ok",u.lastRunOk===!1&&u.lastRunError&&e.jsxs("span",{style:{color:"var(--dracula-red, #ff5555)"},children:[" — ",u.lastRunError]})]})]}):e.jsx("div",{children:"Loading backup status…"}),G&&e.jsx("div",{className:"data-message data-message-error",style:{marginTop:6},children:G})]})]}),e.jsxs("div",{className:"data-subsection",children:[e.jsxs("div",{className:"data-subsection-header",children:[e.jsx("span",{className:"data-subsection-title",children:s("config:data.exportData")}),e.jsxs("div",{className:"data-select-controls",children:[e.jsx("button",{className:"data-select-btn",onClick:p,children:s("common:labels.all")}),e.jsx("button",{className:"data-select-btn",onClick:P,children:s("common:labels.none")})]})]}),e.jsx("div",{className:"data-category-list",children:a.map(j=>e.jsxs("label",{className:"data-category-item",children:[e.jsx("input",{type:"checkbox",checked:o.has(j.id),onChange:()=>z(j.id)}),e.jsx("span",{className:"data-category-name",children:j.name})]},j.id))}),e.jsx("button",{className:"data-action-btn export",onClick:te,disabled:f||o.size===0,children:f?s("config:data.exporting"):s("config:data.exportCount",{count:o.size})})]}),e.jsxs("div",{className:"data-subsection",children:[e.jsx("div",{className:"data-subsection-header",children:e.jsx("span",{className:"data-subsection-title",children:s("config:data.importData")})}),k?E?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"data-import-info",children:[e.jsx("div",{className:"data-import-file",children:k.name}),e.jsxs("div",{className:"data-import-date",children:[s("config:data.exported"),": ",new Date(E.exportedAt).toLocaleDateString()]})]}),e.jsxs("div",{className:"data-subsection-header",children:[e.jsx("span",{className:"data-subsection-subtitle",children:s("config:data.selectToImport")}),e.jsxs("div",{className:"data-select-controls",children:[e.jsx("button",{className:"data-select-btn",onClick:U,children:s("common:labels.all")}),e.jsx("button",{className:"data-select-btn",onClick:q,children:s("common:labels.none")})]})]}),e.jsx("div",{className:"data-category-list",children:E.categories.map(j=>e.jsxs("label",{className:"data-category-item",children:[e.jsx("input",{type:"checkbox",checked:c.has(j.id),onChange:()=>V(j.id)}),e.jsx("span",{className:"data-category-name",children:j.name}),j.fileCount&&e.jsxs("span",{className:"data-category-count",children:["(",j.fileCount," ",s("config:data.files"),")"]})]},j.id))}),e.jsxs("div",{className:"data-import-actions",children:[e.jsx("button",{className:"data-action-btn cancel",onClick:M,children:s("common:buttons.cancel")}),e.jsx("button",{className:"data-action-btn import",onClick:$,disabled:g||c.size===0,children:g?s("config:data.importing"):s("config:data.importCount",{count:c.size})})]})]}):e.jsx("div",{className:"data-loading",children:s("config:data.readingFile")}):e.jsxs("label",{className:"data-file-input",children:[e.jsx("input",{type:"file",accept:".zip",onChange:N,style:{display:"none"}}),e.jsx("span",{className:"data-file-input-label",children:s("config:data.selectFile")})]})]})]})}function Nt(){const[s,a]=l.useState(()=>ms()),t=o=>{a(o);const d=bs(o);js(d)};return e.jsx("div",{className:"theme-selector",children:e.jsx("div",{className:"theme-selector-grid",children:gs.map(o=>e.jsxs("button",{className:`theme-option ${s===o.id?"active":""}`,onClick:()=>t(o.id),title:o.description,children:[e.jsx("div",{className:"theme-preview",children:e.jsxs("div",{className:"theme-preview-bg",style:{backgroundColor:o.colors.bgPrimary},children:[e.jsx("div",{className:"theme-preview-accent",style:{backgroundColor:o.colors.accentBlue}}),e.jsx("div",{className:"theme-preview-claude",style:{backgroundColor:o.colors.accentClaude}})]})}),e.jsx("span",{className:"theme-name",children:o.name})]},o.id))})})}function wt(){const{t:s}=J(["config"]),{installInfo:a,phase:t,output:o,error:d,newVersion:c,autoRestart:r,refreshInstallInfo:f,runUpdate:n,reset:g}=vs(),[v,k]=l.useState(!1),h=l.useRef(null);l.useEffect(()=>{f()},[f]),l.useEffect(()=>{h.current&&(h.current.scrollTop=h.current.scrollHeight)},[o]);const E=l.useCallback(()=>{k(!0)},[]),b=l.useCallback(()=>{k(!1)},[]),S=l.useCallback(()=>{k(!1),n()},[n]),x=l.useCallback(()=>{g(),k(!1),f()},[g,f]),u=es.isNativePlatform(),w=s(u?"config:about.autoUpdateServerTitle":"config:about.autoUpdateTitle");return a?a.isGlobalInstall?a.autoUpdateSupported?!a.updateAvailable&&t==="idle"?null:e.jsxs("div",{className:"about-autoupdate",children:[e.jsx("div",{className:"about-autoupdate-title",children:w}),t==="idle"&&!v&&a.updateAvailable&&e.jsxs("div",{className:"about-autoupdate-row",children:[e.jsxs("span",{className:"about-autoupdate-versions",children:[e.jsx("span",{className:"about-autoupdate-current",children:a.currentVersion}),e.jsx("span",{className:"about-autoupdate-arrow",children:"→"}),e.jsx("span",{className:"about-autoupdate-latest",children:a.latestVersion})]}),e.jsx("button",{className:"about-update-btn download",onClick:E,children:s("config:about.autoUpdateButton")})]}),t==="idle"&&v&&e.jsxs("div",{className:"about-autoupdate-confirm",children:[e.jsx("div",{className:"about-autoupdate-confirm-title",children:s("config:about.autoUpdateConfirmTitle")}),e.jsx("div",{className:"about-autoupdate-confirm-body",children:s("config:about.autoUpdateConfirmBody")}),e.jsxs("div",{className:"about-autoupdate-confirm-actions",children:[e.jsx("button",{className:"about-update-btn changelog",onClick:b,children:s("config:about.autoUpdateCancel")}),e.jsx("button",{className:"about-update-btn download",onClick:S,children:s("config:about.autoUpdateConfirm")})]})]}),(t==="running"||t==="success"||t==="failed")&&e.jsxs("div",{className:"about-autoupdate-stream",children:[e.jsxs("div",{className:"about-autoupdate-stream-title",children:[t==="running"&&s("config:about.autoUpdateRunning"),t==="success"&&s("config:about.autoUpdateSuccess"),t==="failed"&&s("config:about.autoUpdateFailed")]}),e.jsx("pre",{ref:h,className:"about-autoupdate-output",children:o||"..."}),t==="success"&&e.jsxs("div",{className:"about-autoupdate-success-hint",children:[c&&e.jsxs("div",{className:"about-autoupdate-newversion",children:["v",c]}),e.jsx("div",{children:s(r?"config:about.autoUpdateReconnectHint":"config:about.autoUpdateRestartHint")})]}),t==="failed"&&d&&e.jsx("div",{className:"about-update-error",children:d}),(t==="success"||t==="failed")&&e.jsx("div",{className:"about-autoupdate-stream-actions",children:e.jsx("button",{className:"about-update-btn changelog",onClick:x,children:s("config:about.autoUpdateClose")})})]})]}):u?null:e.jsxs("div",{className:"about-autoupdate",children:[e.jsx("div",{className:"about-autoupdate-title",children:w}),e.jsx("div",{className:"about-autoupdate-devnote",children:s("config:about.autoUpdatePackageManagerNotice",{pm:a.packageManager})}),a.suggestedManualCommand&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"about-autoupdate-manualhint",children:s("config:about.autoUpdateManualCommand")}),e.jsx("pre",{className:"about-autoupdate-manualcmd",children:a.suggestedManualCommand})]})]}):u?null:e.jsxs("div",{className:"about-autoupdate",children:[e.jsx("div",{className:"about-autoupdate-title",children:w}),e.jsx("div",{className:"about-autoupdate-devnote",children:s("config:about.autoUpdateDevMode")})]}):null}function yt(){const{t:s}=J(["config"]),[a,t]=l.useState(null),[o,d]=l.useState(!1),[c,r]=l.useState(null);l.useEffect(()=>{Ns().then(t).catch(v=>r(v.message))},[]);const f=l.useCallback(async v=>{if(!o){d(!0),r(null);try{t(await ws(v))}catch(k){r(k.message)}finally{d(!1)}}},[o]),n=es.isNativePlatform(),g=s(n?"config:about.unattendedServerTitle":"config:about.unattendedTitle");return!a&&!c?null:a?n&&!a.supported?null:e.jsxs("div",{className:"about-autoupdate",children:[e.jsx("div",{className:"about-autoupdate-title",children:g}),e.jsxs("div",{className:"about-autoupdate-row",children:[e.jsx("span",{className:"about-autoupdate-devnote",children:s("config:about.unattendedDesc")}),e.jsxs("label",{className:"config-toggle",style:a.supported?void 0:{opacity:.5},children:[e.jsx("input",{type:"checkbox",className:"config-toggle-input",checked:a.enabled,disabled:o||!a.supported,onChange:v=>void f(v.target.checked)}),e.jsx("span",{className:"config-toggle-track",children:e.jsx("span",{className:"config-toggle-thumb"})})]})]}),!a.supported&&e.jsx("div",{className:"about-autoupdate-devnote",children:s("config:about.unattendedUnsupported")}),a.supported&&a.enabled&&a.pendingRestartVersion&&e.jsx("div",{className:"about-autoupdate-devnote",children:s("config:about.unattendedPendingRestart",{version:a.pendingRestartVersion})}),a.supported&&a.enabled&&!a.pendingRestartVersion&&a.lastResult&&e.jsx("div",{className:"about-autoupdate-devnote",children:a.lastResult}),c&&e.jsx("div",{className:"about-update-error",children:c})]}):n?null:e.jsxs("div",{className:"about-autoupdate",children:[e.jsx("div",{className:"about-autoupdate-title",children:g}),e.jsx("div",{className:"about-update-error",children:c})]})}function kt(){var B;const{t:s}=J(["config"]),{isAndroid:a,supported:t,otaActive:o,bundleState:d,serverInfo:c,infoError:r,updateAvailable:f,phase:n,progress:g,error:v,autoSync:k,checkNow:h,syncNow:E,resetToBundled:b,setAutoSync:S}=ys(),[x,u]=l.useState(null),w=l.useRef(h);return w.current=h,l.useEffect(()=>{a&&(w.current(!1),ks.getInfo().then(F=>u(F.version)).catch(()=>{}))},[a]),!a||t===!1?null:e.jsxs("div",{className:"about-autoupdate",children:[e.jsx("div",{className:"about-autoupdate-title",children:s("config:webBundle.title")}),e.jsxs("div",{className:"about-autoupdate-devnote",children:[o?s("config:webBundle.sourceOta",{hash:((B=d==null?void 0:d.hash)==null?void 0:B.slice(0,8))??"?"}):s("config:webBundle.sourceBundled"),x&&` · ${s("config:webBundle.apkVersion",{version:x})}`]}),c?e.jsxs("div",{className:"about-autoupdate-devnote",children:[s("config:webBundle.serverBundle",{version:c.version,hash:c.hash.slice(0,8)})," — ",s(f?"config:webBundle.updateAvailable":"config:webBundle.upToDate")]}):r&&e.jsx("div",{className:"about-autoupdate-devnote",children:s("config:webBundle.serverUnavailable")}),v&&e.jsx("div",{className:"about-update-error",children:v}),e.jsxs("div",{className:"about-autoupdate-row",children:[e.jsx("span",{className:"about-autoupdate-devnote",children:s("config:webBundle.autoSync")}),e.jsxs("label",{className:"config-toggle",children:[e.jsx("input",{type:"checkbox",className:"config-toggle-input",checked:k,onChange:F=>S(F.target.checked)}),e.jsx("span",{className:"config-toggle-track",children:e.jsx("span",{className:"config-toggle-thumb"})})]})]}),e.jsxs("div",{className:"about-update-actions",children:[e.jsx("button",{className:"about-update-btn download",onClick:()=>void E(),disabled:n!=="idle"||!c,children:n==="syncing"?s("config:webBundle.syncingPct",{percent:g??0}):s("config:webBundle.syncNow")}),o&&e.jsx("button",{className:"about-update-btn changelog",onClick:()=>void b(),children:s("config:webBundle.reset")})]})]})}function St(){const{t:s}=J(["config"]),{updateAvailable:a,updateInfo:t,recentReleases:o,isChecking:d,error:c,currentVersion:r,isAndroid:f,downloadPhase:n,downloadProgress:g,checkForUpdate:v,downloadAndInstall:k,openReleasePage:h}=fs(),[E,b]=l.useState(!1),S=u=>u?`${(u/(1024*1024)).toFixed(1)} MB`:"",x=u=>new Date(u).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"});return e.jsxs("div",{className:"about-section",children:[e.jsxs("div",{className:"about-logo",children:[e.jsx("span",{className:"about-logo-icon",children:e.jsx(I,{name:"waves",size:24})}),e.jsx("span",{className:"about-logo-text",children:"Tide Commander"})]}),e.jsxs("div",{className:"about-version",children:[e.jsx("span",{className:"about-version-label",children:s("config:about.version")}),e.jsxs("div",{className:"about-version-info",children:[e.jsx("span",{className:"about-version-value",children:r}),a&&t?e.jsx("span",{className:"about-version-update-badge",onClick:h,title:`Update available: ${t.version}`,children:t.version}):e.jsxs("a",{href:"https://github.com/deivid11/tide-commander/releases",target:"_blank",rel:"noopener noreferrer",className:"about-version-status",children:["(",s("config:about.updated"),")"]})]})]}),e.jsx(wt,{}),e.jsx(yt,{}),e.jsx(kt,{}),e.jsx("div",{className:"about-changelog-row",children:e.jsx("button",{className:"about-update-btn changelog",onClick:()=>b(!0),children:s("config:about.changelog")})}),e.jsxs("div",{className:"about-update",children:[a&&t?e.jsxs("div",{className:"about-update-available",children:[e.jsxs("div",{className:"about-update-header",children:[e.jsx("span",{className:"about-update-badge",children:s("config:about.updateAvailable")}),e.jsx("span",{className:"about-update-version",children:t.version})]}),t.apkSize&&e.jsxs("div",{className:"about-update-size",children:[s("config:about.sizeLabel"),": ",S(t.apkSize)]}),c&&e.jsx("div",{className:"about-update-error",children:c}),e.jsxs("div",{className:"about-update-actions",children:[e.jsx("button",{className:"about-update-btn changelog",onClick:h,children:s("config:about.changelog")}),f&&t.apkUrl?e.jsx("button",{className:"about-update-btn download",onClick:()=>void k(),disabled:n!=="idle",children:n==="downloading"?s("config:appUpdateBanner.downloadingPct",{percent:g??0}):s(n==="installing"?"config:appUpdateBanner.installHint":"config:about.downloadAPK")}):e.jsx("button",{className:"about-update-btn download",onClick:h,children:s("config:about.viewRelease")})]})]}):e.jsxs("div",{className:"about-update-check",children:[e.jsx("span",{className:"about-update-status",children:s(d?"config:about.checkingUpdates":"config:about.upToDate")}),e.jsx("button",{className:"about-update-btn check",onClick:()=>v(!0),disabled:d,children:d?"...":s("config:about.check")})]}),o.length>0&&e.jsxs("div",{className:"about-releases",children:[e.jsx("div",{className:"about-releases-title",children:s("config:about.recentReleases")}),e.jsx("div",{className:"about-releases-list",children:o.map(u=>e.jsxs("a",{href:u.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:`about-release-item ${u.version===`v${r}`||u.version===r?"current":""}`,children:[e.jsx("span",{className:"about-release-version",children:u.version}),e.jsx("span",{className:"about-release-date",children:x(u.publishedAt)})]},u.version))})]})]}),e.jsx("div",{className:"about-description",children:s("config:about.tagline")}),e.jsxs("div",{className:"about-principles",children:[e.jsx("div",{className:"about-principles-title",children:s("config:about.corePrinciples")}),e.jsxs("ul",{className:"about-principles-list",children:[e.jsx("li",{children:s("config:about.principle1")}),e.jsx("li",{children:s("config:about.principle2")}),e.jsx("li",{children:s("config:about.principle3")}),e.jsx("li",{children:s("config:about.principle4")})]})]}),e.jsx("div",{className:"about-links",children:e.jsxs("a",{href:"https://github.com/deivid11/tide-commander",target:"_blank",rel:"noopener noreferrer",className:"about-link",children:[e.jsx("span",{className:"about-link-icon",children:e.jsx(I,{name:"package",size:14})}),e.jsx("span",{children:s("config:about.repository")})]})}),e.jsxs("div",{className:"about-credits",children:[e.jsx("div",{className:"about-credits-title",children:s("config:about.specialThanks")}),e.jsxs("div",{className:"about-credit-item",children:[e.jsx("a",{href:"https://kenney.nl",target:"_blank",rel:"noopener noreferrer",className:"about-credit-link",children:"Kenney.nl"}),e.jsx("span",{className:"about-credit-desc",children:s("config:about.kenneyCredit")})]}),e.jsxs("div",{className:"about-credit-item",children:[e.jsx("a",{href:"https://claude.ai/code",target:"_blank",rel:"noopener noreferrer",className:"about-credit-link",children:"Claude Code"}),e.jsx("span",{className:"about-credit-desc",children:s("config:about.claudeCodeCredit")})]})]}),E&&e.jsx(xs,{onClose:()=>b(!1)})]})}const Ct={gmail:"✉️",slack:"💬",jira:"📋","google-calendar":"📅",docx:"📄",whatsapp:"📱"};function At({onOpenModal:s}){const[a,t]=l.useState([]),[o,d]=l.useState(!0),c=l.useCallback(async()=>{try{const r=await ye(ke("/api/integrations"));if(!r.ok)return;const f=await r.json();t(f)}catch{}finally{d(!1)}},[]);return l.useEffect(()=>{c()},[c]),o?e.jsx("div",{style:{color:"var(--text-secondary, #a6adc8)",fontSize:12,padding:"4px 0"},children:"Loading..."}):a.length===0?e.jsx("div",{style:{color:"var(--text-secondary, #a6adc8)",fontSize:12,padding:"4px 0"},children:"No integrations available."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[a.map(r=>{const f=Ct[r.id]||"🔌",n=!!r.status.error,g=r.status.connected,v=n?"#f38ba8":g?"#a6e3a1":"#fab387",k=n?"Error":g?"Connected":"Setup Required",h=n?"✗":g?"✓":"⚠";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",borderRadius:4,background:"var(--surface-1, #181825)",border:"1px solid var(--border, #313244)",fontSize:12,minHeight:26},children:[e.jsx("span",{style:{fontSize:13,flexShrink:0},children:f}),e.jsx("span",{style:{flex:1,minWidth:0,color:"var(--text-primary, #cdd6f4)",fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:r.name}),e.jsx("span",{style:{color:v,fontSize:10,fontWeight:500,whiteSpace:"nowrap"},title:k,children:h}),e.jsx("button",{onClick:()=>s(r.id),title:`Configure ${r.name}`,style:{background:"none",border:"none",cursor:"pointer",padding:"1px 3px",fontSize:12,color:"var(--text-secondary, #a6adc8)",borderRadius:3,flexShrink:0,lineHeight:1},onMouseEnter:E=>{E.target.style.color="var(--text-primary, #cdd6f4)"},onMouseLeave:E=>{E.target.style.color="var(--text-secondary, #a6adc8)"},children:"⚙️"})]},r.id)}),e.jsx("button",{onClick:()=>s(),style:{background:"none",border:"1px dashed var(--border, #313244)",borderRadius:4,padding:"3px 8px",cursor:"pointer",color:"var(--text-secondary, #a6adc8)",fontSize:11,textAlign:"center",marginTop:2},onMouseEnter:r=>{r.target.style.borderColor="var(--accent, #89b4fa)",r.target.style.color="var(--accent, #89b4fa)"},onMouseLeave:r=>{r.target.style.borderColor="var(--border, #313244)",r.target.style.color="var(--text-secondary, #a6adc8)"},children:"Manage All Integrations"})]})}const Ie="__global__";function Tt({isOpen:s,onClose:a,initialAgentId:t}){const{t:o}=J(["config"]),d=Ss(),[c,r]=l.useState(""),[f,n]=l.useState(""),[g,v]=l.useState(!1),[k,h]=l.useState(""),[E,b]=l.useState(""),[S,x]=l.useState(null),[u,w]=l.useState(null),[B,F]=l.useState(!1),[G,K]=l.useState(!1),[H,z]=l.useState(!1),[V,p]=l.useState(null),P=l.useMemo(()=>[...d].sort((C,y)=>C.name.localeCompare(y.name)),[d]),U=l.useMemo(()=>d.find(C=>C.id===c),[d,c]),q=c===Ie;l.useEffect(()=>{if(!s)return;const C=t&&d.some(y=>y.id===t)?t:Ie;r(C),v(!1),ot().then(y=>n(y)).catch(()=>n("")).finally(()=>v(!0))},[s]),l.useEffect(()=>{const C=c===Ie?f:(U==null?void 0:U.customPrompt)??"";h(C),b(C),F(!1),x(null),w(null)},[c,g]);const te=C=>{const y=C.target.value;h(y),F(y!==E),x(null),w(null)},N=async()=>{if(c)try{x(null),w(null),q?(await lt(k),n(k),w(o("config:systemPrompt.savedGlobal"))):(A.updateAgentProperties(c,{customPrompt:k}),w(o("config:systemPrompt.saved"))),b(k),F(!1)}catch(C){x(C instanceof Error?C.message:"Failed to save system prompt")}},$=()=>{K(!0)},M=async()=>{if(c)try{x(null),w(null),q?(await ct(),n(""),w(o("config:systemPrompt.clearedGlobal"))):(A.updateAgentProperties(c,{customPrompt:""}),w(o("config:systemPrompt.cleared"))),h(""),b(""),F(!1)}catch(C){x(C instanceof Error?C.message:"Failed to clear system prompt")}},j=()=>{h(E),F(!1),x(null),w(null)},L=C=>{if(C!==c){if(B){p(C),z(!0);return}r(C)}},D=()=>{if(B){p(null),z(!0);return}a()},Q=()=>{if(z(!1),V){const C=V;p(null),r(C)}else a()},ee=C=>{C.key==="Escape"&&(C.preventDefault(),D())};return s?e.jsxs(Se,{children:[e.jsx("div",{className:`modal-overlay ${s?"visible":""}`,onClick:D,children:e.jsxs("div",{className:"system-prompt-modal",onClick:C=>C.stopPropagation(),onKeyDown:ee,children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h2",{children:o("config:systemPrompt.title")}),e.jsx("button",{className:"modal-close",onClick:D,"aria-label":"Close",children:e.jsx(I,{name:"close",size:16})})]}),e.jsxs("div",{className:"modal-body",children:[e.jsx("p",{className:"modal-description",children:o("config:systemPrompt.description")}),e.jsxs("div",{className:"agent-picker",children:[e.jsx("label",{htmlFor:"system-prompt-agent",className:"editor-label",children:o("config:systemPrompt.agentLabel")}),e.jsxs("div",{className:"agent-picker-row",children:[q?e.jsx(I,{name:"globe",size:20,className:"agent-picker-icon"}):U&&e.jsx(Cs,{classId:U.class,size:20,className:"agent-picker-icon"}),e.jsxs("select",{id:"system-prompt-agent",className:"agent-picker-select",value:c,onChange:C=>L(C.target.value),children:[e.jsxs("option",{value:Ie,children:[o("config:systemPrompt.globalOption"),f?" • ✦":""]}),P.map(C=>e.jsxs("option",{value:C.id,children:[C.name,C.customPrompt?" • ✦":""]},C.id))]})]})]}),S&&e.jsxs("div",{className:"alert alert-error",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(I,{name:"warn",size:14})}),S]}),u&&e.jsxs("div",{className:"alert alert-success",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(I,{name:"check",size:14})}),u]}),e.jsxs("div",{className:"editor-wrapper",children:[e.jsxs("div",{className:"editor-header",children:[e.jsx("label",{htmlFor:"prompt-input",className:"editor-label",children:o("config:systemPrompt.editPrompt")}),e.jsxs("span",{className:"char-count",children:[k.length," ",o("config:systemPrompt.characters")]})]}),e.jsx("textarea",{id:"prompt-input",className:"prompt-editor",value:k,onChange:te,placeholder:o("config:systemPrompt.placeholder"),rows:18,disabled:q&&!g,autoFocus:!0}),e.jsx("div",{className:"editor-hint",children:o(q?"config:systemPrompt.hintGlobal":"config:systemPrompt.hint")})]})]}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("div",{className:"footer-buttons-left",children:e.jsx("button",{className:"btn btn-danger",onClick:$,disabled:!k||!c,children:o("config:systemPrompt.clear")})}),e.jsxs("div",{className:"footer-buttons-right",children:[e.jsx("button",{className:"btn btn-secondary",onClick:D,children:"Close"}),e.jsx("button",{className:"btn btn-secondary",onClick:j,disabled:!B,children:o("config:systemPrompt.reset")}),e.jsx("button",{className:"btn btn-primary",onClick:N,disabled:!B||!c,children:o("config:systemPrompt.save")})]})]})]})}),e.jsx(he,{isOpen:G,title:o("config:systemPrompt.clear"),message:o(q?"config:systemPrompt.confirmClearGlobal":"config:systemPrompt.confirmClear"),confirmLabel:o("config:systemPrompt.clear"),cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{M()},onClose:()=>K(!1)}),e.jsx(he,{isOpen:H,title:"Unsaved Changes",message:"You have unsaved changes for this agent. Discard them?",confirmLabel:"Discard",cancelLabel:"Keep editing",variant:"danger",onConfirm:Q,onClose:()=>{z(!1),p(null)}})]}):null}const We={enabled:!1,baseUrl:"",defaultSessionId:"",webhookVerifyToken:"",showIncomingToasts:!0},Et=2500,_t=12e4;function Ge(s){return{enabled:s.enabled??!1,baseUrl:s.baseUrl??"",defaultSessionId:s.defaultSessionId??"",webhookVerifyToken:s.webhookVerifyToken??"",showIncomingToasts:s.showIncomingToasts??!0}}function Pt(s,a){return s.enabled===a.enabled&&s.baseUrl===a.baseUrl&&s.defaultSessionId===a.defaultSessionId&&s.webhookVerifyToken===a.webhookVerifyToken&&s.showIncomingToasts===a.showIncomingToasts}function It({isOpen:s,onClose:a}){const{t}=J(["config"]),[o,d]=l.useState(We),[c,r]=l.useState(We),[f,n]=l.useState(!1),[g,v]=l.useState([]),[k,h]=l.useState(!0),[E,b]=l.useState(null),[S,x]=l.useState(null),[u,w]=l.useState(""),[B,F]=l.useState(!1),[G,K]=l.useState(""),[H,z]=l.useState(null),[V,p]=l.useState(null),[P,U]=l.useState(null),q=l.useRef(null),te=l.useRef(0),[N,$]=l.useState(""),[M,j]=l.useState(""),[L,D]=l.useState(null),[Q,ee]=l.useState(!1),[C,y]=l.useState(!1),[Z,ae]=l.useState(!1),[le,ie]=l.useState(!1),[ue,je]=l.useState(null),ve=!Pt(o,c),re=l.useCallback(()=>{q.current&&(clearTimeout(q.current),q.current=null)},[]),me=l.useCallback(async()=>{try{h(!0),b(null),x(null);const[m,O]=await Promise.all([ss(),As()]),oe=Ge(m);if(d(oe),r(oe),n(!!O.configured),O.configured)try{const fe=await Me();v(Array.isArray(fe)?fe:[])}catch{v([])}else v([])}catch(m){b(m instanceof Error?m.message:t("config:whatsapp.errors.loadFailed"))}finally{h(!1)}},[t]),_=l.useCallback(async()=>{try{const m=await Me();v(Array.isArray(m)?m:[])}catch{}},[]);l.useEffect(()=>(s?me():(re(),z(null),p(null),U(null),w(""),F(!1),D(null)),()=>{re()}),[s,me,re]);const pe=(m,O)=>{d(oe=>({...oe,[m]:O})),b(null),x(null)},ce=async()=>{try{b(null),x(null);const m=await Is({enabled:o.enabled,baseUrl:o.baseUrl.trim(),defaultSessionId:o.defaultSessionId.trim(),webhookVerifyToken:o.webhookVerifyToken,showIncomingToasts:o.showIncomingToasts});window.dispatchEvent(new CustomEvent("tide:whatsapp-config-updated"));const O=Ge(m);d(O),r(O),x(t("config:whatsapp.saved"))}catch(m){b(m instanceof Error?m.message:t("config:whatsapp.errors.saveFailed"))}},$e=()=>{d(c),b(null),x(null)},ge=()=>{if(ve){y(!0);return}a()},De=m=>{m.key==="Escape"&&(m.preventDefault(),ge())},Oe=async()=>{const m=u.trim();if(m)try{b(null),x(null),await Es(m),w(""),F(!1),n(!0),x(t("config:whatsapp.apiKeySaved"))}catch(O){b(O instanceof Error?O.message:t("config:whatsapp.errors.apiKeySaveFailed"))}},Ce=()=>{ae(!0)},Fe=async()=>{try{b(null),x(null),await Ls(),n(!1),x(t("config:whatsapp.apiKeyCleared"))}catch(m){b(m instanceof Error?m.message:t("config:whatsapp.errors.apiKeyClearFailed"))}},Ne=l.useCallback(async m=>{if(Date.now()>te.current){U(t("config:whatsapp.pairingTimeout")),z(null),p(null),re(),_();return}try{const O=await Ts(m);if(O.status&&["connected","paired","open","ready"].includes(O.status.toLowerCase())){U(t("config:whatsapp.pairingSuccess")),z(null),p(null),re(),_();return}const fe=O.qrUrl??O.qr??null;fe&&p(fe)}catch(O){U(O instanceof Error?O.message:t("config:whatsapp.errors.qrFetchFailed"))}q.current=setTimeout(()=>{Ne(m)},Et)},[_,re,t]),Ae=async()=>{const m=G.trim();if(m)try{b(null),x(null),U(null),p(null),re(),await _s(m),K(""),z(m),te.current=Date.now()+_t,Ne(m),_()}catch(O){b(O instanceof Error?O.message:t("config:whatsapp.errors.sessionCreateFailed"))}},Te=()=>{re(),z(null),p(null),U(null)},Ee=m=>{je(m),ie(!0)},Re=async()=>{if(ue)try{b(null),x(null),await $s(ue),H===ue&&Te(),_(),x(t("config:whatsapp.sessionDeleted"))}catch(m){b(m instanceof Error?m.message:t("config:whatsapp.errors.sessionDeleteFailed"))}finally{je(null)}},_e=async()=>{const m=N.trim(),O=M.trim();if(!(!m||!O))try{ee(!0),D(null);const oe=o.defaultSessionId.trim()||void 0;await Ps(m,O,oe),D({kind:"success",text:t("config:whatsapp.testSent")})}catch(oe){D({kind:"error",text:oe instanceof Error?oe.message:t("config:whatsapp.errors.testSendFailed")})}finally{ee(!1)}};return s?e.jsxs(Se,{children:[e.jsx("div",{className:`modal-overlay ${s?"visible":""}`,onClick:ge,children:e.jsxs("div",{className:"whatsapp-config-modal",onClick:m=>m.stopPropagation(),onKeyDown:De,children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h2",{children:t("config:whatsapp.title")}),e.jsx("button",{className:"modal-close",onClick:ge,"aria-label":"Close",children:e.jsx(I,{name:"close",size:16})})]}),e.jsx("div",{className:"modal-body",children:k?e.jsxs("div",{className:"loading-state",children:[e.jsx("div",{className:"spinner"}),e.jsx("p",{children:t("config:whatsapp.loading")})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"modal-description",children:t("config:whatsapp.description")}),E&&e.jsxs("div",{className:"alert alert-error",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(I,{name:"warn",size:14})}),E]}),S&&e.jsxs("div",{className:"alert alert-success",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(I,{name:"check",size:14})}),S]}),e.jsxs("section",{className:"wa-section",children:[e.jsx("h3",{className:"wa-section-title",children:t("config:whatsapp.sections.general")}),e.jsxs("div",{className:"wa-field wa-field-row",children:[e.jsx("label",{htmlFor:"wa-enabled",className:"wa-label",children:t("config:whatsapp.enabled")}),e.jsxs("label",{className:"wa-toggle",children:[e.jsx("input",{id:"wa-enabled",type:"checkbox",checked:o.enabled,onChange:m=>pe("enabled",m.target.checked)}),e.jsx("span",{className:"wa-toggle-track",children:e.jsx("span",{className:"wa-toggle-thumb"})})]})]}),e.jsxs("div",{className:"wa-field wa-field-row",children:[e.jsx("label",{htmlFor:"wa-show-toasts",className:"wa-label",children:t("config:whatsapp.showIncomingToasts")}),e.jsxs("label",{className:"wa-toggle",children:[e.jsx("input",{id:"wa-show-toasts",type:"checkbox",checked:o.showIncomingToasts,onChange:m=>pe("showIncomingToasts",m.target.checked)}),e.jsx("span",{className:"wa-toggle-track",children:e.jsx("span",{className:"wa-toggle-thumb"})})]})]}),e.jsx("span",{className:"wa-hint",children:t("config:whatsapp.showIncomingToastsHelp")}),e.jsxs("div",{className:"wa-field",children:[e.jsx("label",{htmlFor:"wa-base-url",className:"wa-label",children:t("config:whatsapp.baseUrl")}),e.jsx("input",{id:"wa-base-url",type:"text",className:"wa-input",placeholder:"http://localhost:3007",value:o.baseUrl,onChange:m=>pe("baseUrl",m.target.value)})]}),e.jsxs("div",{className:"wa-field",children:[e.jsx("label",{htmlFor:"wa-default-session",className:"wa-label",children:t("config:whatsapp.defaultSessionId")}),e.jsx("input",{id:"wa-default-session",type:"text",className:"wa-input",placeholder:t("config:whatsapp.defaultSessionIdPlaceholder"),value:o.defaultSessionId,onChange:m=>pe("defaultSessionId",m.target.value)})]}),e.jsxs("div",{className:"wa-field",children:[e.jsx("label",{htmlFor:"wa-webhook-token",className:"wa-label",children:t("config:whatsapp.webhookVerifyToken")}),e.jsx("input",{id:"wa-webhook-token",type:"text",className:"wa-input",placeholder:t("config:whatsapp.webhookVerifyTokenPlaceholder"),value:o.webhookVerifyToken,onChange:m=>pe("webhookVerifyToken",m.target.value)})]})]}),e.jsxs("section",{className:"wa-section",children:[e.jsx("h3",{className:"wa-section-title",children:t("config:whatsapp.sections.apiKey")}),e.jsx("div",{className:"wa-key-status",children:f?e.jsxs("span",{className:"wa-status wa-status-ok",children:[e.jsx(I,{name:"check",size:12})," ",t("config:whatsapp.configured")]}):e.jsxs("span",{className:"wa-status wa-status-warn",children:[e.jsx(I,{name:"warn",size:12})," ",t("config:whatsapp.notConfigured")]})}),e.jsxs("div",{className:"wa-field wa-field-inline",children:[e.jsx("input",{type:B?"text":"password",className:"wa-input",placeholder:t("config:whatsapp.apiKeyPlaceholder"),value:u,onChange:m=>w(m.target.value)}),e.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>F(m=>!m),title:t(B?"config:whatsapp.hideKey":"config:whatsapp.showKey"),children:e.jsx(I,{name:B?"eye-closed":"eye",size:14})}),e.jsx("button",{type:"button",className:"btn btn-primary",onClick:Oe,disabled:!u.trim(),children:t("config:whatsapp.saveKey")}),e.jsx("button",{type:"button",className:"btn btn-danger",onClick:Ce,disabled:!f,children:t("config:whatsapp.clearKey")})]}),e.jsx("span",{className:"wa-hint",children:t("config:whatsapp.apiKeyHint")})]}),e.jsxs("section",{className:"wa-section",children:[e.jsx("h3",{className:"wa-section-title",children:t("config:whatsapp.sections.sessions")}),e.jsx("div",{className:"wa-sessions-list",children:!Array.isArray(g)||g.length===0?e.jsx("div",{className:"wa-empty",children:t("config:whatsapp.noSessions")}):g.map(m=>e.jsxs("div",{className:"wa-session-row",children:[e.jsxs("div",{className:"wa-session-info",children:[e.jsx("span",{className:"wa-session-id",children:m.id}),e.jsx("span",{className:`wa-session-status status-${(m.status??"unknown").toLowerCase()}`,children:m.status||"—"}),m.pairedNumber&&e.jsx("span",{className:"wa-session-paired",children:m.pairedNumber})]}),e.jsx("button",{type:"button",className:"btn btn-danger btn-sm",onClick:()=>Ee(m.id),children:t("config:whatsapp.deleteSession")})]},m.id))}),e.jsxs("div",{className:"wa-field wa-field-inline",children:[e.jsx("input",{type:"text",className:"wa-input",placeholder:t("config:whatsapp.addSessionPlaceholder"),value:G,onChange:m=>K(m.target.value),onKeyDown:m=>{m.key==="Enter"&&Ae()}}),e.jsx("button",{type:"button",className:"btn btn-primary",onClick:Ae,disabled:!G.trim()||H!==null,children:t("config:whatsapp.addSession")})]}),H&&e.jsxs("div",{className:"wa-qr-panel",children:[e.jsxs("div",{className:"wa-qr-header",children:[e.jsx("span",{children:t("config:whatsapp.qrPrompt",{id:H})}),e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:Te,children:t("config:whatsapp.cancelPairing")})]}),V?e.jsx("div",{className:"wa-qr-image",children:e.jsx("img",{src:V,alt:"WhatsApp pairing QR code"})}):e.jsxs("div",{className:"wa-qr-loading",children:[e.jsx("div",{className:"spinner"}),e.jsx("p",{children:t("config:whatsapp.waitingForQr")})]})]}),P&&!H&&e.jsx("div",{className:"wa-pairing-message",children:P})]}),e.jsxs("section",{className:"wa-section",children:[e.jsx("h3",{className:"wa-section-title",children:t("config:whatsapp.sections.testMessage")}),e.jsxs("div",{className:"wa-field",children:[e.jsx("label",{htmlFor:"wa-test-to",className:"wa-label",children:t("config:whatsapp.testTo")}),e.jsx("input",{id:"wa-test-to",type:"text",className:"wa-input",placeholder:t("config:whatsapp.testToPlaceholder"),value:N,onChange:m=>$(m.target.value)})]}),e.jsxs("div",{className:"wa-field",children:[e.jsx("label",{htmlFor:"wa-test-message",className:"wa-label",children:t("config:whatsapp.testMessageBody")}),e.jsx("textarea",{id:"wa-test-message",className:"wa-textarea",rows:4,placeholder:t("config:whatsapp.testMessageBodyPlaceholder"),value:M,onChange:m=>j(m.target.value)})]}),e.jsx("div",{className:"wa-field-inline wa-field-end",children:e.jsx("button",{type:"button",className:"btn btn-primary",onClick:_e,disabled:!N.trim()||!M.trim()||Q,children:t(Q?"config:whatsapp.sending":"config:whatsapp.sendTest")})}),L&&e.jsxs("div",{className:`alert ${L.kind==="success"?"alert-success":"alert-error"}`,children:[e.jsx("span",{className:"alert-icon",children:e.jsx(I,{name:L.kind==="success"?"check":"warn",size:14})}),L.text]})]})]})}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("div",{className:"footer-buttons-left"}),e.jsxs("div",{className:"footer-buttons-right",children:[e.jsx("button",{className:"btn btn-secondary",onClick:ge,children:t("config:whatsapp.close")}),e.jsx("button",{className:"btn btn-secondary",onClick:$e,disabled:!ve||k,children:t("config:whatsapp.reset")}),e.jsx("button",{className:"btn btn-primary",onClick:ce,disabled:!ve||k,children:t("config:whatsapp.save")})]})]})]})}),e.jsx(he,{isOpen:C,title:t("config:whatsapp.unsavedTitle"),message:t("config:whatsapp.unsavedMessage"),confirmLabel:t("config:whatsapp.closeAnyway"),cancelLabel:t("config:whatsapp.keepEditing"),variant:"danger",onConfirm:()=>{y(!1),a()},onClose:()=>y(!1)}),e.jsx(he,{isOpen:Z,title:t("config:whatsapp.clearKey"),message:t("config:whatsapp.confirmClearKey"),confirmLabel:t("config:whatsapp.clearKey"),cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{Fe()},onClose:()=>ae(!1)}),e.jsx(he,{isOpen:le,title:t("config:whatsapp.deleteSession"),message:t("config:whatsapp.confirmDeleteSession",{id:ue??""}),confirmLabel:t("config:whatsapp.deleteSession"),cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{Re()},onClose:()=>{ie(!1),je(null)}})]}):null}const as=["messages","statusChanges","taskComplete","errors","planReady","agentSpawned","agentStopped"];function Ve(s=!1){const a=se(),t={};return a&&(t.Authorization=`Bearer ${a}`),s&&(t["Content-Type"]="application/json"),t}async function Ke(s,a){try{const t=await s.json();if(t&&typeof t.error=="string")return t.error;if(t&&typeof t.message=="string")return t.message}catch{}return`${a}: ${s.statusText}`}async function Lt(){const s=await fetch(`${X()}/api/whatsapp/notification-config`,{headers:Ve()});if(!s.ok)throw new Error(await Ke(s,"Failed to fetch WhatsApp notification config"));return s.json()}async function $t(s){const a=await fetch(`${X()}/api/whatsapp/notification-config`,{method:"PATCH",headers:Ve(!0),body:JSON.stringify(s)});if(!a.ok)throw new Error(await Ke(a,"Failed to update WhatsApp notification config"));return a.json()}async function Dt(){const s=await fetch(`${X()}/api/whatsapp/notification-config`,{method:"DELETE",headers:Ve()});if(!s.ok)throw new Error(await Ke(s,"Failed to reset WhatsApp notification config"));return s.json()}const Le={messages:!0,statusChanges:!0,taskComplete:!0,errors:!0,planReady:!0,agentSpawned:!0,agentStopped:!0},Ye={filter:{...Le},recipient:""};function Ot(s,a){if(s.recipient!==a.recipient)return!1;for(const t of as)if(s.filter[t]!==a.filter[t])return!1;return!0}function Ft({isOpen:s,onClose:a}){const{t}=J(["config"]),[o,d]=l.useState(Ye),[c,r]=l.useState(Ye),[f,n]=l.useState(!0),[g,v]=l.useState(null),[k,h]=l.useState(null),[E,b]=l.useState(!1),[S,x]=l.useState(!1),u=!Ot(o,c),w=l.useCallback(async()=>{try{n(!0),v(null),h(null);const p=await Lt(),P={filter:{...Le,...p.filter},recipient:p.recipient??""};d(P),r(P)}catch(p){v(p instanceof Error?p.message:t("config:whatsappNotifications.errors.loadFailed"))}finally{n(!1)}},[t]);l.useEffect(()=>{s&&w()},[s,w]);const B=(p,P)=>{d(U=>({...U,filter:{...U.filter,[p]:P}})),v(null),h(null)},F=p=>{d(P=>({...P,recipient:p})),v(null),h(null)},G=async()=>{try{v(null),h(null);const p=await $t({filter:o.filter,recipient:o.recipient.trim()}),P={filter:{...Le,...p.filter},recipient:p.recipient??""};d(P),r(P),h(t("config:whatsappNotifications.saved"))}catch(p){v(p instanceof Error?p.message:t("config:whatsappNotifications.errors.saveFailed"))}},K=()=>{d(c),v(null),h(null)},H=async()=>{try{v(null),h(null);const p=await Dt(),P={filter:{...Le,...p.filter},recipient:p.recipient??""};d(P),r(P),h(t("config:whatsappNotifications.resetDone"))}catch(p){v(p instanceof Error?p.message:t("config:whatsappNotifications.errors.resetFailed"))}},z=()=>{if(u){b(!0);return}a()},V=p=>{p.key==="Escape"&&(p.preventDefault(),z())};return s?e.jsxs(Se,{children:[e.jsx("div",{className:`modal-overlay ${s?"visible":""}`,onClick:z,children:e.jsxs("div",{className:"whatsapp-notifications-modal",onClick:p=>p.stopPropagation(),onKeyDown:V,children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h2",{children:t("config:whatsappNotifications.title")}),e.jsx("button",{className:"modal-close",onClick:z,"aria-label":"Close",children:e.jsx(I,{name:"close",size:16})})]}),e.jsx("div",{className:"modal-body",children:f?e.jsxs("div",{className:"loading-state",children:[e.jsx("div",{className:"spinner"}),e.jsx("p",{children:t("config:whatsappNotifications.loading")})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"modal-description",children:t("config:whatsappNotifications.description")}),g&&e.jsxs("div",{className:"alert alert-error",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(I,{name:"warn",size:14})}),g]}),k&&e.jsxs("div",{className:"alert alert-success",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(I,{name:"check",size:14})}),k]}),e.jsxs("section",{className:"wan-section",children:[e.jsx("h3",{className:"wan-section-title",children:t("config:whatsappNotifications.sections.recipient")}),e.jsxs("div",{className:"wan-field",children:[e.jsx("label",{htmlFor:"wan-recipient",className:"wan-label",children:t("config:whatsappNotifications.recipientLabel")}),e.jsx("input",{id:"wan-recipient",type:"text",className:"wan-input",placeholder:t("config:whatsappNotifications.recipientPlaceholder"),value:o.recipient,onChange:p=>F(p.target.value)}),e.jsx("span",{className:"wan-hint",children:t("config:whatsappNotifications.recipientHint")})]})]}),e.jsxs("section",{className:"wan-section",children:[e.jsx("h3",{className:"wan-section-title",children:t("config:whatsappNotifications.sections.events")}),e.jsx("p",{className:"wan-section-hint",children:t("config:whatsappNotifications.eventsHint")}),as.map(p=>e.jsxs("div",{className:"wan-toggle-row",children:[e.jsxs("div",{className:"wan-toggle-info",children:[e.jsx("span",{className:"wan-toggle-title",children:t(`config:whatsappNotifications.events.${p}.title`)}),e.jsx("span",{className:"wan-toggle-help",children:t(`config:whatsappNotifications.events.${p}.help`)})]}),e.jsxs("label",{className:"wan-toggle",children:[e.jsx("input",{type:"checkbox",checked:o.filter[p],onChange:P=>B(p,P.target.checked)}),e.jsx("span",{className:"wan-toggle-track",children:e.jsx("span",{className:"wan-toggle-thumb"})})]})]},p))]})]})}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("div",{className:"footer-buttons-left",children:e.jsx("button",{className:"btn btn-danger",onClick:()=>x(!0),disabled:f,children:t("config:whatsappNotifications.resetToDefaults")})}),e.jsxs("div",{className:"footer-buttons-right",children:[e.jsx("button",{className:"btn btn-secondary",onClick:z,children:t("config:whatsappNotifications.close")}),e.jsx("button",{className:"btn btn-secondary",onClick:K,disabled:!u||f,children:t("config:whatsappNotifications.reset")}),e.jsx("button",{className:"btn btn-primary",onClick:G,disabled:!u||f,children:t("config:whatsappNotifications.save")})]})]})]})}),e.jsx(he,{isOpen:E,title:t("config:whatsappNotifications.unsavedTitle"),message:t("config:whatsappNotifications.unsavedMessage"),confirmLabel:t("config:whatsappNotifications.closeAnyway"),cancelLabel:t("config:whatsappNotifications.keepEditing"),variant:"danger",onConfirm:()=>{b(!1),a()},onClose:()=>b(!1)}),e.jsx(he,{isOpen:S,title:t("config:whatsappNotifications.resetToDefaults"),message:t("config:whatsappNotifications.confirmReset"),confirmLabel:t("config:whatsappNotifications.resetToDefaults"),cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{H(),x(!1)},onClose:()=>x(!1)})]}):null}function ns(s){const a=s.replace(/@.*$/,"");return/^\d{10,15}$/.test(a)?a.startsWith("521")&&a.length===13?`+52 1 ${a.slice(3,5)} ${a.slice(5,9)} ${a.slice(9)}`:a.startsWith("52")&&a.length===12?`+52 ${a.slice(2,4)} ${a.slice(4,8)} ${a.slice(8)}`:a.startsWith("1")&&a.length===11?`+1 ${a.slice(1,4)} ${a.slice(4,7)} ${a.slice(7)}`:`+${a}`:s}function Rt(s,a=Date.now()){const t=s*1e3,o=a-t;if(o<0)return Je(t);const d=Math.floor(o/6e4);if(d<1)return"now";if(d<60)return`${d}m`;const c=Math.floor(d/60);if(c<24)return`${c}h`;const r=Math.floor(c/24);return r===1?"yesterday":r<7?`${r}d`:Je(t)}function Je(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function Bt(s){const a=s*1e3;return new Date(a).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function is(s){switch(s){case"image":return"📷";case"audio":return"🎤";case"video":return"📹";case"document":return"📎";case"location":return"📍";case"contact":return"👤";case"sticker":return"🌟";case"reaction":return"👍";case"unknown":return"❓";case"text":default:return null}}function zt(s,a){return s.length<=a?s:s.slice(0,Math.max(0,a-1)).trimEnd()+"…"}function Ut({chats:s,selectedChatId:a,loading:t,error:o,onSelect:d,onRefresh:c,now:r}){const{t:f}=J(["config","common"]);return e.jsxs("div",{className:"whatsapp-history-chatlist",children:[e.jsxs("div",{className:"whatsapp-history-chatlist__header",children:[e.jsx("span",{className:"whatsapp-history-chatlist__title",children:f("config:whatsappHistory.chats")}),e.jsx("button",{type:"button",className:"whatsapp-history-chatlist__refresh",onClick:c,disabled:t,"aria-label":f("config:whatsappHistory.refresh"),title:f("config:whatsappHistory.refresh"),children:"⟳"})]}),o&&e.jsx("div",{className:"whatsapp-history-chatlist__error",children:o}),t&&s.length===0&&e.jsxs("div",{className:"whatsapp-history-chatlist__loading",children:[e.jsx("span",{className:"spinner"}),e.jsx("span",{children:f("config:whatsappHistory.loadingChats")})]}),!t&&!o&&s.length===0&&e.jsx("div",{className:"whatsapp-history-chatlist__empty",children:f("config:whatsappHistory.emptyChats")}),e.jsx("ul",{className:"whatsapp-history-chatlist__items",children:s.map(n=>{const g=is(n.lastMessageType),v=n.lastMessagePreview||`[${n.lastMessageType}]`,k=n.chatId===a,h=ns(n.chatId),E=n.isGroup?n.groupName:n.fromName,b=E||h,S=!!E&&E!==h;return e.jsx("li",{className:`whatsapp-history-chatlist__item ${k?"is-selected":""}`,children:e.jsxs("button",{type:"button",className:"whatsapp-history-chatlist__button",onClick:()=>d(n.chatId),children:[e.jsxs("div",{className:"whatsapp-history-chatlist__row",children:[e.jsx("span",{className:"whatsapp-history-chatlist__name",title:n.chatId,children:b}),e.jsx("span",{className:"whatsapp-history-chatlist__time",children:Rt(n.lastTimestamp,r)})]}),S&&e.jsx("div",{className:"whatsapp-history-chatlist__row whatsapp-history-chatlist__row--jid",children:e.jsx("span",{className:"whatsapp-history-chatlist__jid",children:h})}),e.jsxs("div",{className:"whatsapp-history-chatlist__row whatsapp-history-chatlist__row--secondary",children:[e.jsxs("span",{className:"whatsapp-history-chatlist__preview",children:[n.lastDirection==="outbound"&&e.jsx("span",{className:"whatsapp-history-chatlist__direction",children:"↗ "}),g&&e.jsxs("span",{className:"whatsapp-history-chatlist__preview-icon",children:[g," "]}),zt(v,40)]}),n.unreadCount>0&&e.jsx("span",{className:"whatsapp-history-chatlist__unread",children:n.unreadCount})]})]})},n.chatId)})})]})}function Mt({message:s}){const a=s.direction==="outbound"?"outbound":"inbound",t=is(s.messageType),o=(s.body??"").trim(),d=o.length>0,c=d?null:`[${s.messageType}]`;return e.jsx("div",{className:`whatsapp-history-bubble whatsapp-history-bubble--${a}`,children:e.jsxs("div",{className:"whatsapp-history-bubble__inner",children:[t&&e.jsx("span",{className:"whatsapp-history-bubble__type-icon",title:s.messageType,children:t}),d?e.jsx("span",{className:"whatsapp-history-bubble__body",children:o}):e.jsx("span",{className:"whatsapp-history-bubble__placeholder",children:c}),s.audioTranscription&&e.jsxs("span",{className:"whatsapp-history-bubble__transcription",children:["“",s.audioTranscription,"”"]}),s.mediaPath&&e.jsx("a",{className:"whatsapp-history-bubble__media-link",href:s.mediaPath,target:"_blank",rel:"noopener noreferrer",children:s.mediaFilename||"open media"}),e.jsx("span",{className:"whatsapp-history-bubble__time",children:Bt(s.timestamp)})]})})}const Vt=["all","inbound","outbound"],Kt=["all","text","image","audio","video","document","sticker","location","contact","reaction","unknown"];function Ht({direction:s,type:a,onDirectionChange:t,onTypeChange:o,disabled:d}){const{t:c}=J(["config"]);return e.jsxs("div",{className:"whatsapp-history-filters",children:[e.jsxs("label",{className:"whatsapp-history-filters__field",children:[e.jsx("span",{children:c("config:whatsappHistory.direction")}),e.jsx("select",{value:s,onChange:r=>t(r.target.value),disabled:d,children:Vt.map(r=>e.jsx("option",{value:r,children:c(`config:whatsappHistory.directionValues.${r}`)},r))})]}),e.jsxs("label",{className:"whatsapp-history-filters__field",children:[e.jsx("span",{children:c("config:whatsappHistory.type")}),e.jsx("select",{value:a,onChange:r=>o(r.target.value),disabled:d,children:Kt.map(r=>e.jsx("option",{value:r,children:c(`config:whatsappHistory.typeValues.${r}`)},r))})]})]})}const qt=80;function Wt({chatId:s,messages:a,loading:t,loadingMore:o,error:d,hasMore:c,direction:r,type:f,onDirectionChange:n,onTypeChange:g,onLoadMore:v}){const{t:k}=J(["config"]),h=l.useRef(null),E=l.useRef(null),b=l.useRef(!1),S=l.useRef(null);l.useEffect(()=>{E.current!==s&&(E.current=s,b.current=!1)},[s]),l.useLayoutEffect(()=>{h.current&&(b.current||a.length!==0&&(h.current.scrollTop=h.current.scrollHeight,b.current=!0))},[s,a.length]),l.useLayoutEffect(()=>{if(!h.current||S.current===null)return;const w=h.current.scrollHeight-S.current;S.current=null,w>0&&(h.current.scrollTop+=w)},[a.length]);const x=l.useCallback(()=>{!c||o||t||(h.current&&(S.current=h.current.scrollHeight),v())},[c,o,t,v]),u=l.useCallback(w=>{if(!b.current)return;w.currentTarget.scrollTop<=qt&&x()},[x]);return s?e.jsxs("div",{className:"whatsapp-history-messages",children:[e.jsxs("div",{className:"whatsapp-history-messages__header",children:[e.jsx("div",{className:"whatsapp-history-messages__title",children:ns(s)}),e.jsx(Ht,{direction:r,type:f,onDirectionChange:n,onTypeChange:g,disabled:t})]}),e.jsxs("div",{className:"whatsapp-history-messages__scroll",ref:h,onScroll:u,children:[c&&e.jsx("div",{className:"whatsapp-history-messages__load-more-row",children:e.jsx("button",{type:"button",className:"whatsapp-history-messages__load-more",onClick:x,disabled:o||t,children:k(o?"config:whatsappHistory.loadingOlder":"config:whatsappHistory.loadOlder")})}),d&&e.jsx("div",{className:"whatsapp-history-messages__error",children:d}),t&&a.length===0&&e.jsxs("div",{className:"whatsapp-history-messages__loading",children:[e.jsx("span",{className:"spinner"}),e.jsx("span",{children:k("config:whatsappHistory.loadingMessages")})]}),!t&&!d&&a.length===0&&e.jsx("div",{className:"whatsapp-history-messages__empty",children:k("config:whatsappHistory.emptyMessages")}),a.map(w=>e.jsx(Mt,{message:w},Gt(w)))]})]}):e.jsx("div",{className:"whatsapp-history-messages whatsapp-history-messages--empty",children:e.jsx("div",{className:"whatsapp-history-messages__placeholder",children:k("config:whatsappHistory.selectChat")})})}function Gt(s){return typeof s.id=="number"?`id:${s.id}`:s.messageId?`mid:${s.messageId}`:`t:${s.timestamp}:${s.fromJid}:${(s.body??"").slice(0,16)}`}function os(){const s=se(),a={};return s&&(a.Authorization=`Bearer ${s}`),a}async function ls(s,a){try{const t=await s.json();if(t&&typeof t.error=="string")return t.error;if(t&&typeof t.message=="string")return t.message}catch{}return`${a}: ${s.statusText}`}async function Yt(s){const a=`${X()}/api/whatsapp/chats/${encodeURIComponent(s)}`,t=await fetch(a,{headers:os()});if(!t.ok)throw new Error(await ls(t,"Failed to fetch WhatsApp chats"));return t.json()}async function Ze(s,a,t={}){const o=new URLSearchParams;t.cursor&&o.set("cursor",t.cursor),typeof t.limit=="number"&&o.set("limit",String(t.limit)),t.direction&&o.set("direction",t.direction),t.type&&o.set("type",t.type);const d=o.toString(),c=`${X()}/api/whatsapp/chats/${encodeURIComponent(s)}/${encodeURIComponent(a)}/messages${d?`?${d}`:""}`,r=await fetch(c,{headers:os()});if(!r.ok)throw new Error(await ls(r,"Failed to fetch WhatsApp messages"));return r.json()}const Jt=50;function Zt({isOpen:s,onClose:a}){const{t}=J(["config"]),[o,d]=l.useState([]),[c,r]=l.useState(null),[f,n]=l.useState(null),[g,v]=l.useState([]),[k,h]=l.useState(!1),[E,b]=l.useState(null),[S,x]=l.useState(null),[u,w]=l.useState([]),[B,F]=l.useState(!1),[G,K]=l.useState(!1),[H,z]=l.useState(null),[V,p]=l.useState(null),[P,U]=l.useState("all"),[q,te]=l.useState("all"),[N,$]=l.useState(()=>Date.now()),M=l.useRef(0);l.useEffect(()=>{if(!s)return;const y=window.setInterval(()=>$(Date.now()),6e4);return()=>window.clearInterval(y)},[s]),l.useEffect(()=>{if(!s)return;let y=!1;return(async()=>{var Z;try{n(null);const[ae,le]=await Promise.all([Me().catch(()=>[]),ss().catch(()=>null)]);if(y)return;d(ae);const ie=(le==null?void 0:le.defaultSessionId)||((Z=ae[0])==null?void 0:Z.id)||null;r(ue=>ue??ie)}catch(ae){if(y)return;n(ae instanceof Error?ae.message:String(ae))}})(),()=>{y=!0}},[s]);const j=l.useCallback(async y=>{h(!0),b(null);try{const Z=await Yt(y);v(Z.chats)}catch(Z){b(Z instanceof Error?Z.message:String(Z))}finally{h(!1)}},[]);l.useEffect(()=>{!s||!c||(x(null),w([]),p(null),j(c))},[s,c,j]);const L=l.useMemo(()=>{const y={limit:Jt};return P!=="all"&&(y.direction=P),q!=="all"&&(y.type=q),y},[P,q]),D=l.useCallback(async(y,Z,ae)=>{const le=++M.current;F(!0),z(null),w([]),p(null);try{const ie=await Ze(y,Z,ae);if(le!==M.current)return;w([...ie.messages].reverse()),p(ie.nextCursor)}catch(ie){if(le!==M.current)return;z(ie instanceof Error?ie.message:String(ie))}finally{le===M.current&&F(!1)}},[]);l.useEffect(()=>{!s||!c||!S||D(c,S,L)},[s,c,S,L,D]);const Q=l.useCallback(async()=>{if(!(!c||!S||!V)){K(!0),z(null);try{const y=await Ze(c,S,{...L,cursor:V});w(Z=>[...[...y.messages].reverse(),...Z]),p(y.nextCursor)}catch(y){z(y instanceof Error?y.message:String(y))}finally{K(!1)}}},[c,S,V,L]),ee=l.useCallback(()=>{c&&j(c)},[c,j]),C=l.useCallback(y=>{y.key==="Escape"&&(y.preventDefault(),a())},[a]);return s?e.jsx(Se,{children:e.jsx("div",{className:"modal-overlay visible",onClick:a,children:e.jsxs("div",{className:"whatsapp-history-modal",onClick:y=>y.stopPropagation(),onKeyDown:C,children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h2",{children:t("config:whatsappHistory.title")}),e.jsx("div",{className:"whatsapp-history-modal__session",children:e.jsxs("label",{children:[e.jsx("span",{children:t("config:whatsappHistory.session")}),e.jsxs("select",{value:c??"",onChange:y=>r(y.target.value||null),disabled:o.length===0,children:[o.length===0&&e.jsx("option",{value:"",children:t("config:whatsappHistory.noSessions")}),o.map(y=>e.jsxs("option",{value:y.id,children:[y.id,y.pairedNumber?` (${y.pairedNumber})`:""]},y.id))]})]})}),e.jsx("button",{className:"modal-close",onClick:a,"aria-label":"Close",children:e.jsx(I,{name:"close",size:16})})]}),f&&e.jsx("div",{className:"whatsapp-history-modal__alert",children:f}),e.jsxs("div",{className:"whatsapp-history-modal__body",children:[e.jsx(Ut,{chats:g,selectedChatId:S,loading:k,error:E,onSelect:x,onRefresh:ee,now:N}),e.jsx(Wt,{chatId:S,messages:u,loading:B,loadingMore:G,error:H,hasMore:V!==null,direction:P,type:q,onDirectionChange:U,onTypeChange:te,onLoadMore:Q})]})]})})}):null}function Xt({isOpen:s,onClose:a,onOpenConfig:t,onOpenNotifications:o,onOpenHistory:d}){const{t:c}=J(["config"]);if(l.useEffect(()=>{if(!s)return;const f=n=>{n.key==="Escape"&&(n.preventDefault(),a())};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[s,a]),!s)return null;const r=f=>{a(),f()};return e.jsx(Se,{children:e.jsx("div",{className:"modal-overlay visible",onClick:a,children:e.jsxs("div",{className:"whatsapp-hub-modal",onClick:f=>f.stopPropagation(),children:[e.jsxs("div",{className:"modal-header",children:[e.jsxs("h2",{children:[e.jsx("span",{className:"whatsapp-hub-modal__icon",children:"📱"}),c("config:whatsappHub.title",{defaultValue:"WhatsApp"})]}),e.jsx("button",{className:"modal-close",onClick:a,"aria-label":"Close",children:e.jsx(I,{name:"close",size:16})})]}),e.jsxs("div",{className:"modal-body",children:[e.jsx("p",{className:"whatsapp-hub-modal__intro",children:c("config:whatsappHub.intro",{defaultValue:"Pick what you want to manage for the WhatsApp integration."})}),e.jsxs("div",{className:"whatsapp-hub-modal__options",children:[e.jsxs("button",{type:"button",className:"whatsapp-hub-modal__option",onClick:()=>r(t),children:[e.jsx("span",{className:"whatsapp-hub-modal__option-icon",children:e.jsx(I,{name:"gear",size:18})}),e.jsxs("span",{className:"whatsapp-hub-modal__option-text",children:[e.jsx("span",{className:"whatsapp-hub-modal__option-title",children:c("config:whatsappHub.config",{defaultValue:"Integration config"})}),e.jsx("span",{className:"whatsapp-hub-modal__option-desc",children:c("config:whatsappHub.configDesc",{defaultValue:"Server URL, API key, sessions and pairing."})})]})]}),e.jsxs("button",{type:"button",className:"whatsapp-hub-modal__option",onClick:()=>r(o),children:[e.jsx("span",{className:"whatsapp-hub-modal__option-icon",children:e.jsx(I,{name:"bell",size:18})}),e.jsxs("span",{className:"whatsapp-hub-modal__option-text",children:[e.jsx("span",{className:"whatsapp-hub-modal__option-title",children:c("config:whatsappHub.notifications",{defaultValue:"Notifications"})}),e.jsx("span",{className:"whatsapp-hub-modal__option-desc",children:c("config:whatsappHub.notificationsDesc",{defaultValue:"Which agent events get forwarded and to whom."})})]})]}),e.jsxs("button",{type:"button",className:"whatsapp-hub-modal__option",onClick:()=>r(d),children:[e.jsx("span",{className:"whatsapp-hub-modal__option-icon",children:e.jsx(I,{name:"hourglass",size:18})}),e.jsxs("span",{className:"whatsapp-hub-modal__option-text",children:[e.jsx("span",{className:"whatsapp-hub-modal__option-title",children:c("config:whatsappHub.history",{defaultValue:"History"})}),e.jsx("span",{className:"whatsapp-hub-modal__option-desc",children:c("config:whatsappHub.historyDesc",{defaultValue:"Browse persisted chats and messages."})})]})]})]})]})]})})})}const Qt=[{value:"auto",label:"Auto",icon:"🕐"},{value:"dawn",label:"Dawn",icon:"🌅"},{value:"day",label:"Day",icon:"☀️"},{value:"dusk",label:"Dusk",icon:"🌇"},{value:"night",label:"Night",icon:"🌙"}],ea=[{value:"none",label:"Grass",icon:"🌱"},{value:"concrete",label:"Concrete",icon:"🏗️"},{value:"galactic",label:"Galactic",icon:"🌌"},{value:"metal",label:"Metal",icon:"⚙️"},{value:"hex",label:"Hex",icon:"⬡"},{value:"circuit",label:"Circuit",icon:"🔌"},{value:"pokemon-stadium",label:"Pokemon",icon:"🔴"}],sa=[{value:"static",label:"Static",icon:"🧍"},{value:"idle",label:"Idle",icon:"🚶"},{value:"walk",label:"Walk",icon:"🚶♂️"},{value:"sprint",label:"Sprint",icon:"🏃"},{value:"jump",label:"Jump",icon:"⬆️"},{value:"fall",label:"Fall",icon:"⬇️"},{value:"crouch",label:"Crouch",icon:"🧎"},{value:"sit",label:"Sit",icon:"🪑"},{value:"die",label:"Die",icon:"💀"},{value:"emote-yes",label:"Yes",icon:"👍"},{value:"emote-no",label:"No",icon:"👎"}],ta=[{value:"normal",label:"Normal",icon:"🎨"},{value:"bw",label:"B&W",icon:"⬛"},{value:"sepia",label:"Sepia",icon:"🟤"},{value:"cool",label:"Cool",icon:"❄️"},{value:"warm",label:"Warm",icon:"🔥"},{value:"neon",label:"Neon",icon:"💜"}],aa=[{key:"showTrees",icon:"🌳",label:"Trees"},{key:"showBushes",icon:"🌿",label:"Bushes"},{key:"showHouse",icon:"🏠",label:"House"},{key:"showLamps",icon:"💡",label:"Lamps"},{key:"showGrass",icon:"🟩",label:"Grass"},{key:"showClouds",icon:"☁️",label:"Clouds"}],na=[{value:null,label:"Auto",color:"linear-gradient(135deg, #4a90d9 0%, #0a1a2a 100%)"},{value:"#4a90d9",label:"Day Blue",color:"#4a90d9"},{value:"#0a1a2a",label:"Night",color:"#0a1a2a"},{value:"#ff6b35",label:"Sunset",color:"#ff6b35"},{value:"#1a0a2e",label:"Purple",color:"#1a0a2e"},{value:"#2d5a27",label:"Matrix",color:"#2d5a27"},{value:"#8b0000",label:"Blood",color:"#8b0000"},{value:"#000000",label:"Void",color:"#000000"}],ia={showTrees:"trees",showBushes:"bushes",showHouse:"house",showLamps:"lamps",showGrass:"grass",showClouds:"clouds"},oa={none:"grass","pokemon-stadium":"pokemon"},la={"emote-yes":"yes","emote-no":"no"},ca={"":"auto","#4a90d9":"dayBlue","#0a1a2a":"night","#ff6b35":"sunset","#1a0a2e":"purple","#2d5a27":"matrix","#8b0000":"blood","#000000":"void"};function ne({checked:s,onChange:a}){return e.jsxs("label",{className:"config-toggle",children:[e.jsx("input",{type:"checkbox",className:"config-toggle-input",checked:s,onChange:t=>a(t.target.checked)}),e.jsx("span",{className:"config-toggle-track",children:e.jsx("span",{className:"config-toggle-thumb"})})]})}function be({options:s,value:a,onChange:t,iconOnly:o=!1}){return e.jsx("div",{className:"chip-selector",children:s.map(d=>e.jsxs("button",{className:`chip ${a===d.value?"active":""}`,onClick:()=>t(d.value),title:d.label,children:[e.jsx("span",{className:"chip-icon",children:d.icon}),!o&&e.jsx("span",{className:"chip-label",children:d.label})]},d.value))})}function T({text:s,query:a}){if(!a.trim())return e.jsx(e.Fragment,{children:s});const t=s.toLowerCase(),o=a.toLowerCase(),d=t.indexOf(o);if(d===-1)return e.jsx(e.Fragment,{children:s});const c=s.slice(0,d),r=s.slice(d,d+a.length),f=s.slice(d+a.length);return e.jsxs(e.Fragment,{children:[c,e.jsx("mark",{className:"search-highlight",children:r}),f]})}const ra=[{id:"general",title:"General",keywords:["history","hide costs","grid","fps","power saving","performance","limit","editor","external editor","language","idioma","语言","vibration","haptic","intensity","tab title","tmux","process persistence","interactive","tui","terminal","experimental","claude","stream","streaming","word by word","live text","grok"]},{id:"agentNames",title:"Agent Names",keywords:["agent","names","custom","characters","rename"]},{id:"defaultClass",title:"Default Spawn Class",keywords:["default","class","spawn","agent","scout","builder","random"]},{id:"appearance",title:"Appearance",keywords:["theme","appearance","color","dark","light","style","look"]},{id:"connection",title:"Connection",keywords:["backend","url","auth","token","reconnect","server","api","connect","codex","opencode","binary","path"]},{id:"scene",title:"Scene",keywords:["character","size","indicator","scale","time","dawn","day","dusk","night","auto"]},{id:"terrain",title:"Terrain",keywords:["trees","bushes","house","lamps","grass","clouds","fog","brightness","floor","sky","color","environment","battlefield","size","grid","simple","minimal","dark","clean"]},{id:"modelStyle",title:"Agent Model Style",keywords:["saturation","roughness","metalness","glow","emissive","reflections","wireframe","color mode","material","shader"]},{id:"animations",title:"Animations",keywords:["idle","working","animation","walk","run","sprint","jump","sit","crouch"]},{id:"secrets",title:"Secrets",keywords:["secrets","api","key","password","credentials","env","environment"]},{id:"claudeAccounts",title:"Claude Accounts",keywords:["claude","accounts","credentials","oauth","rate limit","session","david","profile","switch account","subscription"]},{id:"systemPrompt",title:"System Prompt",keywords:["system","prompt","global","instructions","ai","agent","rules","guidelines"]},{id:"data",title:"Data",keywords:["export","import","backup","restore","save","load","json"]},{id:"integrations",title:"Integrations",keywords:["integrations","integraciones","plugins","gmail","slack","jira","calendar","docx","email","whatsapp","notifications","notification","baileys","history","historial","chat","messages","inbox","config","setup"]},{id:"workflows",title:"Workflows",keywords:["workflow","automation","state machine","editor","actions","transitions","pipeline"]},{id:"triggers",title:"Triggers",keywords:["trigger","event","webhook","cron","slack","email","jira","matching","fire"]},{id:"monitoring",title:"Monitoring",keywords:["monitoring","logs","triggers","events","history","workflow","traces","audit","timeline"]},{id:"statistics",title:"Statistics",keywords:["statistics","stats","usage","tokens","token","claude","chart","graph","pie","cost"]},{id:"experimental",title:"Experimental",keywords:["experimental","2d","view","voice","assistant","speech","tts","text to speech","echo","prompt","duplicate"]},{id:"about",title:"About",keywords:["about","version","update","credits","github","releases"]}],Ue=[{value:"auto",label:"Auto",icon:"🌐"},{value:"en",label:"English",icon:"🇺🇸"},{value:"zh-CN",label:"中文",icon:"🇨🇳"},{value:"es",label:"Español",icon:"🇪🇸"},{value:"hi",label:"हिन्दी",icon:"🇮🇳"},{value:"pt",label:"Português",icon:"🇧🇷"},{value:"ru",label:"Русский",icon:"🇷🇺"},{value:"ja",label:"日本語",icon:"🇯🇵"},{value:"de",label:"Deutsch",icon:"🇩🇪"},{value:"fr",label:"Français",icon:"🇫🇷"},{value:"it",label:"Italiano",icon:"🇮🇹"}];function da({config:s,onChange:a,searchQuery:t="",onOpenIntegrationsModal:o,onOpenMonitoringModal:d,onOpenStatisticsModal:c,onOpenWorkflowEditor:r,onOpenTriggerManager:f}){var He;const{t:n}=J(["config","common"]),g=Ds(),v=Os(),[k,h]=l.useState(()=>Fs(we.DEFAULT_AGENT_CLASS)||"scout"),[E,b]=l.useState(g.historyLimit),[S,x]=l.useState(()=>Rs()),[u,w]=l.useState(!1),[B,F]=l.useState(""),[G,K]=l.useState(()=>se()),[H,z]=l.useState(!1),[V,p]=l.useState(!1),[P,U]=l.useState(""),[q,te]=l.useState(!1),[N,$]=l.useState(!1),[M,j]=l.useState(!1),[L,D]=l.useState(!1),[Q,ee]=l.useState(!1),[C,y]=l.useState(""),[Z,ae]=l.useState(!1);l.useEffect(()=>{ut().then(y).catch(()=>{})},[]),l.useEffect(()=>{rt().then(i=>{i!==g.experimentalEchoPrompt&&A.updateSettings({experimentalEchoPrompt:i})}).catch(()=>{})},[]),l.useEffect(()=>{ht().then(i=>{i!==g.tmuxMode&&A.updateSettings({tmuxMode:i})}).catch(()=>{})},[]),l.useEffect(()=>{gt().then(i=>{i!==g.interactiveMode&&A.updateSettings({interactiveMode:i})}).catch(()=>{})},[]),l.useEffect(()=>Bs(i=>{x(i),w(!1)}),[]);const le=Qt.map(i=>({...i,label:n(`config:time.${i.value}`)})),ie=ea.map(i=>({...i,label:n(`config:floor.${oa[i.value]||i.value}`)})),ue=sa.map(i=>({...i,label:n(`config:animation.${la[i.value]||i.value}`)})),je=ta.map(i=>({...i,label:n(`config:colorMode.${i.value}`)})),ve=aa.map(i=>({...i,label:n(`config:terrain.${ia[i.key]}`)})),re=na.map(i=>({...i,label:n(`config:sky.${ca[i.value??""]}`)})),me=t.trim()?ra.filter(i=>{const R=t.toLowerCase();return i.title.toLowerCase().includes(R)||i.keywords.some(de=>de.toLowerCase().includes(R))}).map(i=>i.id):null,_=i=>me?me.includes(i):!0,pe=_("integrations"),ce=g.customAgentNames||[],$e=ce.length>0?ce:zs,ge=()=>{const i=P.trim();i&&!ce.includes(i)&&(A.updateSettings({customAgentNames:[...ce,i]}),U(""))},De=i=>{A.updateSettings({customAgentNames:ce.filter(R=>R!==i)})},Oe=()=>{A.updateSettings({customAgentNames:[]})},Ce=()=>{const i=B.trim();if(i){if(S.includes(i)){F("");return}x([...S,i]),w(!0),F("")}},Fe=i=>{x(S.filter((R,de)=>de!==i)),w(!0)},Ne=(i,R)=>{const de=i+R;if(de<0||de>=S.length)return;const xe=S.slice();[xe[i],xe[de]]=[xe[de],xe[i]],x(xe),w(!0)},Ae=()=>{Vs(S),w(!1),ze()},Te=i=>{K(i),z(!0)},Ee=()=>{Pe(we.AUTH_TOKEN,G),z(!1),ze()},Re=i=>{y(i),ae(!0)},_e=()=>{pt(C).catch(()=>{}),ae(!1)},m=i=>{a({...s,terrain:{...s.terrain,...i}})},O=i=>{a({...s,modelStyle:{...s.modelStyle,...i}})},oe=i=>{a({...s,animations:{...s.animations,...i}})},fe=i=>{b(i),A.updateSettings({historyLimit:i})},cs=i=>{const R=s.terrain[i];typeof R=="boolean"&&m({[i]:!R})},Y=t.trim().length>0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"config-section",children:[me&&me.length===0&&e.jsx("div",{className:"config-no-results",children:n("config:noResults",{query:t})}),_("general")&&e.jsxs(W,{title:n("config:sections.general"),storageKey:"general",defaultOpen:!0,forceOpen:Y&&_("general"),children:[e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:general.history"),query:t})}),e.jsx("input",{type:"number",className:"config-input config-input-sm",value:E,onChange:i=>fe(parseInt(i.target.value)||100),min:50,max:2e3,step:50})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:general.hideCosts"),query:t})}),e.jsx(ne,{checked:g.hideCost,onChange:i=>A.updateSettings({hideCost:i})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",title:n("config:general.streamTextLiveTitle"),children:e.jsx(T,{text:n("config:general.streamTextLive"),query:t})}),e.jsx(ne,{checked:g.streamTextLive!==!1,onChange:i=>A.updateSettings({streamTextLive:i})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:general.grid"),query:t})}),e.jsx(ne,{checked:s.gridVisible,onChange:i=>a({...s,gridVisible:i})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:general.showFPS"),query:t})}),e.jsx(ne,{checked:g.showFPS,onChange:i=>A.updateSettings({showFPS:i})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:general.fpsLimit"),query:t})}),e.jsx("input",{type:"range",className:"config-slider",min:"0",max:"120",step:"10",value:s.fpsLimit,onChange:i=>a({...s,fpsLimit:parseInt(i.target.value)})}),e.jsx("span",{className:"config-value",children:s.fpsLimit===0?"∞":s.fpsLimit})]}),e.jsxs("div",{className:"config-row",children:[e.jsxs("span",{className:"config-label",title:"Experimental: Reduce FPS when idle to save power",children:[e.jsx(T,{text:n("config:general.powerSaving"),query:t})," ",e.jsx(I,{name:"bolt",size:12})]}),e.jsx(ne,{checked:g.powerSaving,onChange:i=>A.updateSettings({powerSaving:i})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",title:"Wrap agent processes in tmux sessions so they survive server restarts (requires tmux installed)",children:e.jsx(T,{text:n("config:general.tmuxMode"),query:t})}),e.jsx(ne,{checked:g.tmuxMode,onChange:async i=>{A.updateSettings({tmuxMode:i});try{await mt(i)}catch(R){console.error("Failed to sync tmux mode setting to server:",R)}}})]}),e.jsxs("div",{className:"config-row",children:[e.jsxs("span",{className:"config-label",title:"Experimental: run Claude agents as the real interactive `claude` TUI inside tmux, reconstructing the conversation from the session transcript (requires tmux). Takes effect on server restart.",children:[e.jsx(T,{text:n("config:general.interactiveMode"),query:t})," ",e.jsx(I,{name:"bolt",size:12})]}),e.jsx(ne,{checked:g.interactiveMode,onChange:async i=>{A.updateSettings({interactiveMode:i});try{await ft(i)}catch(R){console.error("Failed to sync interactive mode setting to server:",R)}}})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:general.vibrationIntensity"),query:t})}),e.jsx("input",{type:"range",className:"config-slider",min:"0",max:"5",step:"1",value:g.vibrationIntensity,onChange:i=>A.updateSettings({vibrationIntensity:parseInt(i.target.value)})}),e.jsx("span",{className:"config-value",children:g.vibrationIntensity===0?n("config:vibrationValues.off"):g.vibrationIntensity===1?n("config:vibrationValues.ultraLight"):g.vibrationIntensity===2?n("config:vibrationValues.veryLight"):g.vibrationIntensity===3?n("config:vibrationValues.light"):g.vibrationIntensity===4?n("config:vibrationValues.medium"):n("config:vibrationValues.heavy")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:general.externalEditor"),query:t})}),e.jsx("input",{type:"text",className:"config-input",placeholder:n("config:general.externalEditorPlaceholder"),value:g.externalEditorCommand||"",onChange:i=>A.updateSettings({externalEditorCommand:i.target.value})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:general.tabTitle"),query:t})}),e.jsx("input",{type:"text",className:"config-input",placeholder:n("config:general.tabTitlePlaceholder"),value:g.tabTitle||"",onChange:i=>A.updateSettings({tabTitle:i.target.value})})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:general.language"),query:t})}),e.jsx(be,{options:Ue,value:localStorage.getItem("tide-commander-language-mode")==="manual"?((He=Ue.find(i=>i.value!=="auto"&&Be.language.startsWith(i.value.split("-")[0])))==null?void 0:He.value)||"en":"auto",onChange:i=>{var R;if(i==="auto"){localStorage.setItem("tide-commander-language-mode","auto");const de=navigator.language,xe=((R=Ue.find(qe=>qe.value!=="auto"&&de.startsWith(qe.value.split("-")[0])))==null?void 0:R.value)||"en";Be.changeLanguage(xe)}else localStorage.setItem("tide-commander-language-mode","manual"),Be.changeLanguage(i)}})]})]}),_("agentNames")&&e.jsx(W,{title:n("config:sections.agentNames"),storageKey:"agentNames",defaultOpen:!1,forceOpen:Y&&_("agentNames"),children:e.jsxs("div",{className:"agent-names-section",children:[e.jsx("span",{className:"config-hint",children:ce.length>0?n("config:agentNames.customConfigured",{count:ce.length}):n("config:agentNames.usingDefaults")}),e.jsxs("div",{className:"agent-names-input-row",children:[e.jsx("input",{type:"text",className:"config-input config-input-full",placeholder:n("config:agentNames.addPlaceholder"),value:P,onChange:i=>U(i.target.value),onKeyDown:i=>{i.key==="Enter"&&ge()}}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:ge,disabled:!P.trim(),title:n("config:agentNames.addName"),children:"+"})]}),e.jsx("div",{className:"agent-names-list",children:$e.map((i,R)=>e.jsxs("div",{className:"agent-name-chip",children:[e.jsx("span",{className:"agent-name-text",children:i}),ce.length>0&&e.jsx("button",{className:"agent-name-remove",onClick:()=>De(i),title:n("common:buttons.remove"),children:"x"})]},`${i}-${R}`))}),ce.length>0&&e.jsx("button",{className:"config-btn config-btn-link",onClick:Oe,children:n("common:buttons.resetToDefaults")})]})}),_("defaultClass")&&e.jsx(W,{title:"Default Spawn Class",storageKey:"defaultClass",defaultOpen:!1,forceOpen:Y&&_("defaultClass"),children:e.jsxs("div",{className:"config-row config-row-stacked",children:[e.jsx("span",{className:"config-hint",children:'Class pre-selected when the spawn modal opens. "Random" picks a different class each time.'}),e.jsxs("div",{className:"agent-names-list",style:{flexWrap:"wrap",gap:"6px",marginTop:"8px"},children:[e.jsx("div",{className:`agent-name-chip${k==="random"?" agent-name-chip--selected":""}`,style:{cursor:"pointer",userSelect:"none"},onClick:()=>{h("random"),Pe(we.DEFAULT_AGENT_CLASS,"random")},children:e.jsx("span",{className:"agent-name-text",children:"🎲 Random"})}),Object.entries(Us).map(([i,R])=>e.jsx("div",{className:`agent-name-chip${k===i?" agent-name-chip--selected":""}`,style:{cursor:"pointer",userSelect:"none"},onClick:()=>{h(i),Pe(we.DEFAULT_AGENT_CLASS,i)},children:e.jsxs("span",{className:"agent-name-text",children:[R.icon," ",i.charAt(0).toUpperCase()+i.slice(1)]})},i)),v.map(i=>e.jsx("div",{className:`agent-name-chip${k===i.id?" agent-name-chip--selected":""}`,style:{cursor:"pointer",userSelect:"none"},onClick:()=>{h(i.id),Pe(we.DEFAULT_AGENT_CLASS,i.id)},children:e.jsxs("span",{className:"agent-name-text",children:[i.icon," ",i.name]})},i.id))]})]})}),_("appearance")&&e.jsx(W,{title:n("config:sections.appearance"),storageKey:"appearance",defaultOpen:!1,forceOpen:Y&&_("appearance"),children:e.jsx(Nt,{})}),_("connection")&&e.jsxs(W,{title:n("config:sections.connection"),storageKey:"connection",defaultOpen:!1,forceOpen:Y&&_("connection"),children:[e.jsxs("div",{className:"config-row config-row-stacked",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:connection.backendUrl"),query:t})}),e.jsx("div",{className:"backend-urls-list",children:S.map((i,R)=>e.jsxs("div",{className:"backend-url-row",children:[e.jsx("span",{className:"backend-url-priority",title:n("config:connection.priorityLabel",{defaultValue:"Priority"}),children:R+1}),e.jsx("span",{className:"backend-url-text",title:i,children:i}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:()=>Ne(R,-1),disabled:R===0,title:n("config:connection.moveUp",{defaultValue:"Move up"}),children:"↑"}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:()=>Ne(R,1),disabled:R===S.length-1,title:n("config:connection.moveDown",{defaultValue:"Move down"}),children:"↓"}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:()=>Fe(R),title:n("common:buttons.remove"),children:"x"})]},`${i}-${R}`))}),e.jsxs("div",{className:"config-input-group",children:[e.jsx("input",{type:"text",className:"config-input config-input-full",value:B,onChange:i=>F(i.target.value),placeholder:n("config:connection.addUrlPlaceholder",{defaultValue:"http://host:port"}),onKeyDown:i=>{i.key==="Enter"&&Ce()}}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:Ce,disabled:!B.trim(),title:n("config:connection.addUrl",{defaultValue:"Add URL"}),children:"+"}),u&&e.jsx("button",{className:"config-btn config-btn-sm",onClick:Ae,title:n("config:connection.saveAndReconnect"),children:n("common:buttons.apply")})]}),e.jsx("span",{className:"config-hint",children:n("config:connection.urlsHint",{defaultValue:"Tried in order on connect; the first reachable host wins. Leave empty for auto-detect."})})]}),e.jsxs("div",{className:"config-row config-row-stacked",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:connection.authToken"),query:t})}),e.jsxs("div",{className:"config-input-group",children:[e.jsx("input",{type:V?"text":"password",className:"config-input config-input-full",value:G,onChange:i=>Te(i.target.value),placeholder:n("config:connection.tokenPlaceholder"),onKeyDown:i=>{i.key==="Enter"&&H&&Ee()}}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:()=>p(!V),title:n(V?"config:connection.hideToken":"config:connection.showToken"),children:e.jsx(I,{name:V?"eye-closed":"eye",size:14})}),H&&e.jsx("button",{className:"config-btn config-btn-sm",onClick:Ee,title:n("config:connection.saveAndReconnect"),children:n("common:buttons.apply")})]}),e.jsx("span",{className:"config-hint",children:n("config:connection.tokenRequired")})]}),e.jsxs("div",{className:"config-row config-row-stacked",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:connection.codexBinaryPath"),query:t})}),e.jsxs("div",{className:"config-input-group",children:[e.jsx("input",{type:"text",className:"config-input config-input-full",value:C,onChange:i=>Re(i.target.value),placeholder:n("config:connection.codexBinaryPathPlaceholder"),onKeyDown:i=>{i.key==="Enter"&&Z&&_e()}}),Z&&e.jsx("button",{className:"config-btn config-btn-sm",onClick:_e,children:n("common:buttons.apply")})]}),e.jsx("span",{className:"config-hint",children:n("config:connection.codexBinaryPathHint")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("common:buttons.reconnect"),query:t})}),e.jsx("button",{className:"config-btn",onClick:()=>ze(),title:"Force reconnect to server",children:n("common:buttons.reconnect")})]})]}),_("scene")&&e.jsxs(W,{title:n("config:sections.scene"),storageKey:"scene",defaultOpen:!1,forceOpen:Y&&_("scene"),children:[e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:scene.characterSize"),query:t})}),e.jsx("input",{type:"range",className:"config-slider",min:"0.3",max:"3.0",step:"0.1",value:s.characterScale,onChange:i=>a({...s,characterScale:parseFloat(i.target.value)})}),e.jsxs("span",{className:"config-value",children:[s.characterScale.toFixed(1),"x"]})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:scene.scale2d",{defaultValue:"2D Scale"}),query:t})}),e.jsx("input",{type:"range",className:"config-slider",min:"0.3",max:"2.0",step:"0.1",value:s.scale2d,onChange:i=>a({...s,scale2d:parseFloat(i.target.value)})}),e.jsxs("span",{className:"config-value",children:[s.scale2d.toFixed(1),"x"]})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:scene.scale3d",{defaultValue:"3D Scale"}),query:t})}),e.jsx("input",{type:"range",className:"config-slider",min:"0.3",max:"2.0",step:"0.1",value:s.scale3d,onChange:i=>a({...s,scale3d:parseFloat(i.target.value)})}),e.jsxs("span",{className:"config-value",children:[s.scale3d.toFixed(1),"x"]})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:scene.show2DTaskLabels",{defaultValue:"Show 2D task labels"}),query:t})}),e.jsx(ne,{checked:s.show2DTaskLabels,onChange:i=>a({...s,show2DTaskLabels:i})})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:scene.time"),query:t})}),e.jsx(be,{options:le,value:s.timeMode,onChange:i=>a({...s,timeMode:i}),iconOnly:!0})]})]}),_("terrain")&&e.jsxs(W,{title:n("config:sections.terrain"),storageKey:"terrain",defaultOpen:!1,forceOpen:Y&&_("terrain"),children:[e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:terrainSettings.simpleMode",{defaultValue:"Simple Mode"}),query:t})}),e.jsx(ne,{checked:s.terrain.simpleMode??!1,onChange:i=>m({simpleMode:i})})]}),e.jsx("div",{className:"terrain-icons",style:{opacity:s.terrain.simpleMode?.4:1,pointerEvents:s.terrain.simpleMode?"none":"auto"},children:ve.map(i=>e.jsx("button",{className:`terrain-icon-btn ${s.terrain[i.key]?"active":""}`,onClick:()=>cs(i.key),title:i.label,children:i.icon},i.key))}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:terrainSettings.fog"),query:t})}),e.jsx("input",{type:"range",className:"config-slider",min:"0",max:"2",step:"0.1",value:s.terrain.fogDensity,onChange:i=>m({fogDensity:parseFloat(i.target.value)})}),e.jsx("span",{className:"config-value",children:s.terrain.fogDensity===0?n("config:fogValues.off"):s.terrain.fogDensity<=1?n("config:fogValues.low"):n("config:fogValues.high")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:terrainSettings.brightness"),query:t})}),e.jsx("input",{type:"range",className:"config-slider",min:"0.2",max:"2",step:"0.1",value:s.terrain.brightness,onChange:i=>m({brightness:parseFloat(i.target.value)})}),e.jsx("span",{className:"config-value",children:s.terrain.brightness<=.5?n("config:brightnessValues.dark"):s.terrain.brightness<=1.2?n("config:brightnessValues.normal"):n("config:brightnessValues.bright")})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:terrainSettings.floor"),query:t})}),e.jsx(be,{options:ie,value:s.terrain.floorStyle,onChange:i=>m({floorStyle:i}),iconOnly:!0})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:terrainSettings.sky"),query:t})}),e.jsx("div",{className:"sky-color-selector",children:re.map(i=>e.jsx("button",{className:`sky-color-btn ${s.terrain.skyColor===i.value?"active":""}`,onClick:()=>m({skyColor:i.value}),title:i.label,style:{background:i.color}},i.value??"auto"))})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:terrainSettings.battlefieldSize"),query:t})}),e.jsx("input",{type:"range",className:"config-slider",min:"30",max:"200",step:"10",value:s.terrain.battlefieldSize,onChange:i=>m({battlefieldSize:parseInt(i.target.value)})}),e.jsx("span",{className:"config-value",children:s.terrain.battlefieldSize})]})]}),_("modelStyle")&&e.jsxs(W,{title:n("config:sections.modelStyle"),storageKey:"modelStyle",defaultOpen:!1,forceOpen:Y&&_("modelStyle"),children:[e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:modelStyleSettings.saturation"),query:t})}),e.jsx("input",{type:"range",className:"config-slider",min:"0",max:"2",step:"0.1",value:s.modelStyle.saturation,onChange:i=>O({saturation:parseFloat(i.target.value)})}),e.jsx("span",{className:"config-value",children:s.modelStyle.saturation<=.3?n("config:saturationValues.gray"):s.modelStyle.saturation<=1.2?n("config:saturationValues.normal"):n("config:saturationValues.vivid")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:modelStyleSettings.roughness"),query:t})}),e.jsx("input",{type:"range",className:"config-slider",min:"-1",max:"1",step:"0.1",value:s.modelStyle.roughness,onChange:i=>O({roughness:parseFloat(i.target.value)})}),e.jsx("span",{className:"config-value",children:s.modelStyle.roughness<0?n("config:roughnessValues.auto"):s.modelStyle.roughness<=.3?n("config:roughnessValues.glossy"):s.modelStyle.roughness<=.7?n("config:roughnessValues.normal"):n("config:roughnessValues.matte")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:modelStyleSettings.metalness"),query:t})}),e.jsx("input",{type:"range",className:"config-slider",min:"-1",max:"1",step:"0.1",value:s.modelStyle.metalness,onChange:i=>O({metalness:parseFloat(i.target.value)})}),e.jsx("span",{className:"config-value",children:s.modelStyle.metalness<0?n("config:metalnessValues.auto"):s.modelStyle.metalness<=.3?n("config:metalnessValues.plastic"):s.modelStyle.metalness<=.7?n("config:metalnessValues.mixed"):n("config:metalnessValues.metal")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:modelStyleSettings.glow"),query:t})}),e.jsx("input",{type:"range",className:"config-slider",min:"0",max:"1",step:"0.05",value:s.modelStyle.emissiveBoost,onChange:i=>O({emissiveBoost:parseFloat(i.target.value)})}),e.jsx("span",{className:"config-value",children:s.modelStyle.emissiveBoost<=.1?n("config:glowValues.off"):s.modelStyle.emissiveBoost<=.4?n("config:glowValues.low"):s.modelStyle.emissiveBoost<=.7?n("config:glowValues.med"):n("config:glowValues.high")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:modelStyleSettings.reflections"),query:t})}),e.jsx("input",{type:"range",className:"config-slider",min:"-1",max:"2",step:"0.1",value:s.modelStyle.envMapIntensity,onChange:i=>O({envMapIntensity:parseFloat(i.target.value)})}),e.jsx("span",{className:"config-value",children:s.modelStyle.envMapIntensity<0?n("config:reflectionValues.auto"):s.modelStyle.envMapIntensity<=.3?n("config:reflectionValues.low"):s.modelStyle.envMapIntensity<=1?n("config:reflectionValues.normal"):n("config:reflectionValues.high")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:modelStyleSettings.wireframe"),query:t})}),e.jsx(ne,{checked:s.modelStyle.wireframe,onChange:i=>O({wireframe:i})})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:modelStyleSettings.colorMode"),query:t})}),e.jsx(be,{options:je,value:s.modelStyle.colorMode,onChange:i=>O({colorMode:i}),iconOnly:!0})]})]}),_("animations")&&e.jsxs(W,{title:n("config:sections.animations"),storageKey:"animations",defaultOpen:!1,forceOpen:Y&&_("animations"),children:[e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:animationSettings.idle"),query:t})}),e.jsx(be,{options:ue,value:s.animations.idleAnimation,onChange:i=>oe({idleAnimation:i}),iconOnly:!0})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:animationSettings.working"),query:t})}),e.jsx(be,{options:ue,value:s.animations.workingAnimation,onChange:i=>oe({workingAnimation:i}),iconOnly:!0})]})]}),_("secrets")&&e.jsx(W,{title:n("config:sections.secrets"),storageKey:"secrets",defaultOpen:!1,forceOpen:Y&&_("secrets"),children:e.jsx(it,{})}),_("claudeAccounts")&&e.jsx(W,{title:n("config:sections.claudeAccounts",{defaultValue:"Claude Accounts"}),storageKey:"claudeAccounts",defaultOpen:!1,forceOpen:Y&&_("claudeAccounts"),children:e.jsx(Ms,{})}),_("systemPrompt")&&e.jsx(W,{title:n("config:sections.systemPrompt"),storageKey:"systemPrompt",defaultOpen:!1,forceOpen:Y&&_("systemPrompt"),children:e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(T,{text:n("config:systemPrompt.title"),query:t})}),e.jsx("button",{className:"config-button",onClick:()=>te(!0),children:n("config:systemPrompt.editPrompt")})]})}),_("data")&&e.jsx(W,{title:n("config:sections.data"),storageKey:"data",defaultOpen:!1,forceOpen:Y&&_("data"),children:e.jsx(vt,{})}),pe&&e.jsx(W,{title:n("config:sections.integrations"),storageKey:"integrations",defaultOpen:!1,forceOpen:Y&&pe,children:e.jsx(At,{onOpenModal:i=>{i==="whatsapp"?ee(!0):o==null||o(i)}})}),_("workflows")&&e.jsxs(W,{title:"Workflows",storageKey:"workflows",defaultOpen:!1,forceOpen:Y&&_("workflows"),children:[e.jsx("div",{className:"config-row",children:e.jsx("span",{className:"config-label",children:e.jsx(T,{text:"Create and manage automated workflow pipelines with visual state machine editor",query:t})})}),e.jsx("div",{className:"config-row",children:e.jsx("button",{className:"config-button",onClick:()=>r==null?void 0:r(),children:"Open Workflow Editor"})})]}),_("triggers")&&e.jsxs(W,{title:"Triggers",storageKey:"triggers",defaultOpen:!1,forceOpen:Y&&_("triggers"),children:[e.jsx("div",{className:"config-row",children:e.jsx("span",{className:"config-label",children:e.jsx(T,{text:"Create and manage event-driven triggers that fire agents with templates",query:t})})}),e.jsx("div",{className:"config-row",children:e.jsx("button",{className:"config-button",onClick:()=>f==null?void 0:f(),children:"Open Trigger Manager"})})]}),_("monitoring")&&e.jsxs(W,{title:"Monitoring",storageKey:"monitoring",defaultOpen:!1,forceOpen:Y&&_("monitoring"),children:[e.jsx("div",{className:"config-row",children:e.jsx("span",{className:"config-label",children:e.jsx(T,{text:"View event logs, trigger history, workflow traces, and system stats",query:t})})}),e.jsx("div",{className:"config-row",children:e.jsx("button",{className:"config-button",onClick:()=>d==null?void 0:d(),children:"Open Monitoring & Logs"})})]}),_("statistics")&&e.jsxs(W,{title:"Statistics",storageKey:"statistics",defaultOpen:!1,forceOpen:Y&&_("statistics"),children:[e.jsx("div",{className:"config-row",children:e.jsx("span",{className:"config-label",children:e.jsx(T,{text:"View token usage charts and system-wide agent statistics",query:t})})}),e.jsx("div",{className:"config-row",children:e.jsx("button",{className:"config-button",onClick:()=>c==null?void 0:c(),children:"Open Statistics"})})]}),_("experimental")&&e.jsxs(W,{title:n("config:sections.experimental"),storageKey:"experimental",defaultOpen:!1,forceOpen:Y&&_("experimental"),children:[e.jsxs("div",{className:"config-row",children:[e.jsxs("span",{className:"config-label",title:"Lightweight 2D top-down view for better performance",children:[e.jsx(T,{text:n("config:experimental.2dView"),query:t})," ",e.jsx(I,{name:"map",size:12})]}),e.jsx(ne,{checked:g.experimental2DView,onChange:i=>A.updateSettings({experimental2DView:i})})]}),e.jsxs("div",{className:"config-row",children:[e.jsxs("span",{className:"config-label",title:"Voice assistant for hands-free agent control",children:[e.jsx(T,{text:n("config:experimental.voiceAssistant"),query:t})," ",e.jsx(I,{name:"microphone",size:12})]}),e.jsx(ne,{checked:g.experimentalVoiceAssistant,onChange:i=>A.updateSettings({experimentalVoiceAssistant:i})})]}),e.jsxs("div",{className:"config-row",children:[e.jsxs("span",{className:"config-label",title:"Text-to-speech for reading agent responses",children:[e.jsx(T,{text:n("config:experimental.tts"),query:t})," ",e.jsx(I,{name:"speaker-on",size:12})]}),e.jsx(ne,{checked:g.experimentalTTS,onChange:i=>A.updateSettings({experimentalTTS:i})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",title:"Duplicate system prompt for improved LLM attention coverage. Increases input token usage.",children:e.jsx(T,{text:n("config:experimental.echoPrompt"),query:t})}),e.jsx(ne,{checked:g.experimentalEchoPrompt,onChange:async i=>{A.updateSettings({experimentalEchoPrompt:i});try{await dt(i)}catch(R){console.error("Failed to sync echo prompt setting to server:",R)}}})]}),e.jsx("span",{className:"config-hint",children:n("config:experimental.hint")})]}),_("about")&&e.jsx(W,{title:n("config:sections.about"),storageKey:"about",defaultOpen:!1,forceOpen:Y&&_("about"),children:e.jsx(St,{})})]}),e.jsx(Tt,{isOpen:q,onClose:()=>te(!1)}),e.jsx(It,{isOpen:N,onClose:()=>$(!1)}),e.jsx(Ft,{isOpen:M,onClose:()=>j(!1)}),e.jsx(Zt,{isOpen:L,onClose:()=>D(!1)}),e.jsx(Xt,{isOpen:Q,onClose:()=>ee(!1),onOpenConfig:()=>$(!0),onOpenNotifications:()=>j(!0),onOpenHistory:()=>D(!0)})]})}function ga({onConfigChange:s,onToolChange:a,config:t,isOpen:o,onClose:d,onOpenBuildingModal:c,onOpenAreaExplorer:r,onOpenIntegrationsModal:f,onOpenMonitoringModal:n,onOpenStatisticsModal:g,onOpenWorkflowEditor:v,onOpenTriggerManager:k}){const{t:h}=J(["config","common"]),E=Ks(),b=Hs(),S=qs(),x=Ws(),u=Gs(),w=Array.from(E.values()),B=Array.from(b.values()),[F,G]=l.useState(""),K=l.useRef(null);if(l.useEffect(()=>{const p=P=>{P.key==="Escape"&&o&&d()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[o,d]),l.useEffect(()=>{if(o&&K.current){if(typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches)return;const P=setTimeout(()=>{var U;(U=K.current)==null||U.focus()},50);return()=>clearTimeout(P)}},[o]),!o)return null;const H=p=>{a(u===p?null:p)},z=p=>{A.selectArea(x===p?null:p),a("select")},V=(p,P)=>{p.stopPropagation(),A.deleteArea(P)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbox-backdrop",onClick:d}),e.jsxs("aside",{className:"toolbox",children:[e.jsxs("div",{className:"toolbox-header",children:[e.jsx("span",{children:h("config:title")}),e.jsx("button",{className:"toolbox-close-btn",onClick:d,title:h("common:buttons.close"),children:"×"})]}),e.jsxs("div",{className:"toolbox-search",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]}),e.jsx("input",{ref:K,type:"text",placeholder:h("config:searchPlaceholder"),value:F,onChange:p=>G(p.target.value),className:"toolbox-search-input"}),F&&e.jsx("button",{className:"toolbox-search-clear",onClick:()=>G(""),children:"×"})]}),e.jsxs("div",{className:"toolbox-content",children:[e.jsx("div",{className:"toolbox-section toolbox-section-collapsible",children:e.jsxs(W,{title:h("config:areas.title",{count:w.length}),storageKey:"areas",children:[e.jsxs("div",{className:"tool-buttons",children:[e.jsx("button",{className:`tool-btn ${u==="select"?"active":""}`,onClick:()=>H("select"),title:h("config:tools.select"),children:e.jsx("span",{children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z"})})})}),e.jsx("button",{className:`tool-btn ${u==="rectangle"?"active":""}`,onClick:()=>H("rectangle"),title:h("config:tools.rectangle"),children:e.jsx("span",{children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"})})})}),e.jsx("button",{className:`tool-btn ${u==="circle"?"active":""}`,onClick:()=>H("circle"),title:h("config:tools.circle"),children:e.jsx("span",{children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("circle",{cx:"12",cy:"12",r:"9"})})})})]}),e.jsx("div",{className:"areas-list",children:w.length===0?e.jsx("div",{className:"areas-empty",children:h("config:areas.drawToCreate")}):w.map(p=>e.jsx(et,{area:p,isSelected:x===p.id,onClick:()=>z(p.id),onDelete:P=>V(P,p.id)},p.id))})]})}),x&&e.jsx(nt,{area:E.get(x),onClose:()=>A.selectArea(null),onOpenFolder:r}),e.jsx("div",{className:"toolbox-section toolbox-section-collapsible",children:e.jsx(W,{title:h("config:buildings.title",{count:B.length}),storageKey:"buildings",headerExtra:e.jsx("button",{className:"add-building-btn",onClick:p=>{p.stopPropagation(),c==null||c()},title:h("config:buildings.addBuilding"),children:"+"}),children:e.jsx("div",{className:"buildings-list",children:B.length===0?e.jsx("div",{className:"buildings-empty",children:h("config:buildings.clickToAdd")}):B.map(p=>e.jsx(st,{building:p,isSelected:S.has(p.id),onClick:()=>{A.selectBuilding(S.has(p.id)?null:p.id)},onEdit:()=>c==null?void 0:c(p.id)},p.id))})})}),S.size===1&&(()=>{const p=Array.from(S)[0],P=b.get(p);return P?e.jsx(tt,{building:P,onClose:()=>A.selectBuilding(null),onOpenModal:()=>c==null?void 0:c(p)}):null})(),e.jsx(da,{config:t,onChange:s,searchQuery:F,onOpenIntegrationsModal:f,onOpenMonitoringModal:n,onOpenStatisticsModal:g,onOpenWorkflowEditor:v,onOpenTriggerManager:k})]})]})]})}export{ga as Toolbox};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as At,k as yt,aC as Et,a5 as xt,m as Ct,cB as Mt,cC as Ft,aU as wt,r as d,$ as St,S as pe,cD as Bt,cE as fe,s as V,cF as vt,j as f,I as ne,cG as Ve,cH as It,a9 as _t,cI as Dt,cJ as kt,cK as Ee,aq as ve,_ as Rt,v as nt,u as Fe,cL as Je}from"./main-9TcmAtcq.js";import{cM as Ls,cN as $s,cO as js,cP as Ns,cQ as Ps}from"./main-9TcmAtcq.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function re(t){return Array.isArray?Array.isArray(t):ct(t)==="[object Array]"}function bt(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function Tt(t){return t==null?"":bt(t)}function Z(t){return typeof t=="string"}function rt(t){return typeof t=="number"}function Lt(t){return t===!0||t===!1||$t(t)&&ct(t)=="[object Boolean]"}function it(t){return typeof t=="object"}function $t(t){return it(t)&&t!==null}function G(t){return t!=null}function Ie(t){return!t.trim().length}function ct(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const jt="Incorrect 'index' type",Nt=t=>`Invalid value for key ${t}`,Pt=t=>`Pattern length exceeds max of ${t}.`,Kt=t=>`Missing ${t} property in key`,Ot=t=>`Property 'weight' in key '${t}' must be a positive integer`,Xe=Object.prototype.hasOwnProperty;class zt{constructor(e){this._keys=[],this._keyMap={};let n=0;e.forEach(r=>{let i=ot(r);this._keys.push(i),this._keyMap[i.id]=i,n+=i.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 ot(t){let e=null,n=null,r=null,i=1,c=null;if(Z(t)||re(t))r=t,e=qe(t),n=_e(t);else{if(!Xe.call(t,"name"))throw new Error(Kt("name"));const o=t.name;if(r=o,Xe.call(t,"weight")&&(i=t.weight,i<=0))throw new Error(Ot(o));e=qe(o),n=_e(o),c=t.getFn}return{path:e,id:n,weight:i,src:r,getFn:c}}function qe(t){return re(t)?t:t.split(".")}function _e(t){return re(t)?t.join("."):t}function Gt(t,e){let n=[],r=!1;const i=(c,o,a)=>{if(G(c))if(!o[a])n.push(c);else{let u=o[a];const l=c[u];if(!G(l))return;if(a===o.length-1&&(Z(l)||rt(l)||Lt(l)))n.push(Tt(l));else if(re(l)){r=!0;for(let h=0,E=l.length;h<E;h+=1)i(l[h],o,a+1)}else o.length&&i(l,o,a+1)}};return i(t,Z(e)?e.split("."):e,0),r?n:n[0]}const Qt={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Wt={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},Ht={location:0,threshold:.6,distance:100},Ut={useExtendedSearch:!1,getFn:Gt,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var y={...Wt,...Qt,...Ht,...Ut};const Yt=/[^ ]+/g;function Vt(t=1,e=3){const n=new Map,r=Math.pow(10,e);return{get(i){const c=i.match(Yt).length;if(n.has(c))return n.get(c);const o=1/Math.pow(c,.5*t),a=parseFloat(Math.round(o*r)/r);return n.set(c,a),a},clear(){n.clear()}}}class Le{constructor({getFn:e=y.getFn,fieldNormWeight:n=y.fieldNormWeight}={}){this.norm=Vt(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,Z(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();Z(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(!G(e)||Ie(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((i,c)=>{let o=i.getFn?i.getFn(e):this.getFn(e,i.path);if(G(o)){if(re(o)){let a=[];const u=[{nestedArrIndex:-1,value:o}];for(;u.length;){const{nestedArrIndex:l,value:h}=u.pop();if(G(h))if(Z(h)&&!Ie(h)){let E={v:h,i:l,n:this.norm.get(h)};a.push(E)}else re(h)&&h.forEach((E,x)=>{u.push({nestedArrIndex:x,value:E})})}r.$[c]=a}else if(Z(o)&&!Ie(o)){let a={v:o,n:this.norm.get(o)};r.$[c]=a}}}),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function at(t,e,{getFn:n=y.getFn,fieldNormWeight:r=y.fieldNormWeight}={}){const i=new Le({getFn:n,fieldNormWeight:r});return i.setKeys(t.map(ot)),i.setSources(e),i.create(),i}function Jt(t,{getFn:e=y.getFn,fieldNormWeight:n=y.fieldNormWeight}={}){const{keys:r,records:i}=t,c=new Le({getFn:e,fieldNormWeight:n});return c.setKeys(r),c.setIndexRecords(i),c}function xe(t,{errors:e=0,currentLocation:n=0,expectedLocation:r=0,distance:i=y.distance,ignoreLocation:c=y.ignoreLocation}={}){const o=e/t.length;if(c)return o;const a=Math.abs(r-n);return i?o+a/i:a?1:o}function Xt(t=[],e=y.minMatchCharLength){let n=[],r=-1,i=-1,c=0;for(let o=t.length;c<o;c+=1){let a=t[c];a&&r===-1?r=c:!a&&r!==-1&&(i=c-1,i-r+1>=e&&n.push([r,i]),r=-1)}return t[c-1]&&c-r>=e&&n.push([r,c-1]),n}const le=32;function qt(t,e,n,{location:r=y.location,distance:i=y.distance,threshold:c=y.threshold,findAllMatches:o=y.findAllMatches,minMatchCharLength:a=y.minMatchCharLength,includeMatches:u=y.includeMatches,ignoreLocation:l=y.ignoreLocation}={}){if(e.length>le)throw new Error(Pt(le));const h=e.length,E=t.length,x=Math.max(0,Math.min(r,E));let g=c,m=x;const S=a>1||u,w=S?Array(E):[];let T;for(;(T=t.indexOf(e,m))>-1;){let $=xe(e,{currentLocation:T,expectedLocation:x,distance:i,ignoreLocation:l});if(g=Math.min($,g),m=T+h,S){let N=0;for(;N<h;)w[T+N]=1,N+=1}}m=-1;let j=[],Q=1,W=h+E;const oe=1<<h-1;for(let $=0;$<h;$+=1){let N=0,D=W;for(;N<D;)xe(e,{errors:$,currentLocation:x+D,expectedLocation:x,distance:i,ignoreLocation:l})<=g?N=D:W=D,D=Math.floor((W-N)/2+N);W=D;let ae=Math.max(1,x-D+1),H=o?E:Math.min(x+D,E)+h,B=Array(H+2);B[H+1]=(1<<$)-1;for(let R=H;R>=ae;R-=1){let X=R-1,O=n[t.charAt(X)];if(S&&(w[X]=+!!O),B[R]=(B[R+1]<<1|1)&O,$&&(B[R]|=(j[R+1]|j[R])<<1|1|j[R+1]),B[R]&oe&&(Q=xe(e,{errors:$,currentLocation:X,expectedLocation:x,distance:i,ignoreLocation:l}),Q<=g)){if(g=Q,m=X,m<=x)break;ae=Math.max(1,2*x-m)}}if(xe(e,{errors:$+1,currentLocation:x,expectedLocation:x,distance:i,ignoreLocation:l})>g)break;j=B}const ie={isMatch:m>=0,score:Math.max(.001,Q)};if(S){const $=Xt(w,a);$.length?u&&(ie.indices=$):ie.isMatch=!1}return ie}function Zt(t){let e={};for(let n=0,r=t.length;n<r;n+=1){const i=t.charAt(n);e[i]=(e[i]||0)|1<<r-n-1}return e}const Ce=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 ut{constructor(e,{location:n=y.location,threshold:r=y.threshold,distance:i=y.distance,includeMatches:c=y.includeMatches,findAllMatches:o=y.findAllMatches,minMatchCharLength:a=y.minMatchCharLength,isCaseSensitive:u=y.isCaseSensitive,ignoreDiacritics:l=y.ignoreDiacritics,ignoreLocation:h=y.ignoreLocation}={}){if(this.options={location:n,threshold:r,distance:i,includeMatches:c,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:h},e=u?e:e.toLowerCase(),e=l?Ce(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const E=(g,m)=>{this.chunks.push({pattern:g,alphabet:Zt(g),startIndex:m})},x=this.pattern.length;if(x>le){let g=0;const m=x%le,S=x-m;for(;g<S;)E(this.pattern.substr(g,le),g),g+=le;if(m){const w=x-le;E(this.pattern.substr(w),w)}}else E(this.pattern,0)}searchIn(e){const{isCaseSensitive:n,ignoreDiacritics:r,includeMatches:i}=this.options;if(e=n?e:e.toLowerCase(),e=r?Ce(e):e,this.pattern===e){let S={isMatch:!0,score:0};return i&&(S.indices=[[0,e.length-1]]),S}const{location:c,distance:o,threshold:a,findAllMatches:u,minMatchCharLength:l,ignoreLocation:h}=this.options;let E=[],x=0,g=!1;this.chunks.forEach(({pattern:S,alphabet:w,startIndex:T})=>{const{isMatch:j,score:Q,indices:W}=qt(e,S,w,{location:c+T,distance:o,threshold:a,findAllMatches:u,minMatchCharLength:l,includeMatches:i,ignoreLocation:h});j&&(g=!0),x+=Q,j&&W&&(E=[...E,...W])});let m={isMatch:g,score:g?x/this.chunks.length:1};return g&&i&&(m.indices=E),m}}class ce{constructor(e){this.pattern=e}static isMultiMatch(e){return Ze(e,this.multiRegex)}static isSingleMatch(e){return Ze(e,this.singleRegex)}search(){}}function Ze(t,e){const n=t.match(e);return n?n[1]:null}class es extends ce{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 ts extends ce{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 ss extends ce{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 ns extends ce{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 rs extends ce{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 is extends ce{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 lt extends ce{constructor(e,{location:n=y.location,threshold:r=y.threshold,distance:i=y.distance,includeMatches:c=y.includeMatches,findAllMatches:o=y.findAllMatches,minMatchCharLength:a=y.minMatchCharLength,isCaseSensitive:u=y.isCaseSensitive,ignoreDiacritics:l=y.ignoreDiacritics,ignoreLocation:h=y.ignoreLocation}={}){super(e),this._bitapSearch=new ut(e,{location:n,threshold:r,distance:i,includeMatches:c,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:u,ignoreDiacritics:l,ignoreLocation:h})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class ht extends ce{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let n=0,r;const i=[],c=this.pattern.length;for(;(r=e.indexOf(this.pattern,n))>-1;)n=r+c,i.push([r,n-1]);const o=!!i.length;return{isMatch:o,score:o?0:1,indices:i}}}const De=[es,ht,ss,ns,is,rs,ts,lt],et=De.length,cs=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,os="|";function as(t,e={}){return t.split(os).map(n=>{let r=n.trim().split(cs).filter(c=>c&&!!c.trim()),i=[];for(let c=0,o=r.length;c<o;c+=1){const a=r[c];let u=!1,l=-1;for(;!u&&++l<et;){const h=De[l];let E=h.isMultiMatch(a);E&&(i.push(new h(E,e)),u=!0)}if(!u)for(l=-1;++l<et;){const h=De[l];let E=h.isSingleMatch(a);if(E){i.push(new h(E,e));break}}}return i})}const us=new Set([lt.type,ht.type]);class ls{constructor(e,{isCaseSensitive:n=y.isCaseSensitive,ignoreDiacritics:r=y.ignoreDiacritics,includeMatches:i=y.includeMatches,minMatchCharLength:c=y.minMatchCharLength,ignoreLocation:o=y.ignoreLocation,findAllMatches:a=y.findAllMatches,location:u=y.location,threshold:l=y.threshold,distance:h=y.distance}={}){this.query=null,this.options={isCaseSensitive:n,ignoreDiacritics:r,includeMatches:i,minMatchCharLength:c,findAllMatches:a,ignoreLocation:o,location:u,threshold:l,distance:h},e=n?e:e.toLowerCase(),e=r?Ce(e):e,this.pattern=e,this.query=as(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:i,ignoreDiacritics:c}=this.options;e=i?e:e.toLowerCase(),e=c?Ce(e):e;let o=0,a=[],u=0;for(let l=0,h=n.length;l<h;l+=1){const E=n[l];a.length=0,o=0;for(let x=0,g=E.length;x<g;x+=1){const m=E[x],{isMatch:S,indices:w,score:T}=m.search(e);if(S){if(o+=1,u+=T,r){const j=m.constructor.type;us.has(j)?a=[...a,...w]:a.push(w)}}else{u=0,o=0,a.length=0;break}}if(o){let x={isMatch:!0,score:u/o};return r&&(x.indices=a),x}}return{isMatch:!1,score:1}}}const ke=[];function hs(...t){ke.push(...t)}function Re(t,e){for(let n=0,r=ke.length;n<r;n+=1){let i=ke[n];if(i.condition(t,e))return new i(t,e)}return new ut(t,e)}const Me={AND:"$and",OR:"$or"},be={PATH:"$path",PATTERN:"$val"},Te=t=>!!(t[Me.AND]||t[Me.OR]),ds=t=>!!t[be.PATH],fs=t=>!re(t)&&it(t)&&!Te(t),tt=t=>({[Me.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function dt(t,e,{auto:n=!0}={}){const r=i=>{let c=Object.keys(i);const o=ds(i);if(!o&&c.length>1&&!Te(i))return r(tt(i));if(fs(i)){const u=o?i[be.PATH]:c[0],l=o?i[be.PATTERN]:i[u];if(!Z(l))throw new Error(Nt(u));const h={keyId:_e(u),pattern:l};return n&&(h.searcher=Re(l,e)),h}let a={children:[],operator:c[0]};return c.forEach(u=>{const l=i[u];re(l)&&l.forEach(h=>{a.children.push(r(h))})}),a};return Te(t)||(t=tt(t)),r(t)}function gs(t,{ignoreFieldNorm:e=y.ignoreFieldNorm}){t.forEach(n=>{let r=1;n.matches.forEach(({key:i,norm:c,score:o})=>{const a=i?i.weight:null;r*=Math.pow(o===0&&a?Number.EPSILON:o,(a||1)*(e?1:c))}),n.score=r})}function ps(t,e){const n=t.matches;e.matches=[],G(n)&&n.forEach(r=>{if(!G(r.indices)||!r.indices.length)return;const{indices:i,value:c}=r;let o={indices:i,value:c};r.key&&(o.key=r.key.src),r.idx>-1&&(o.refIndex=r.idx),e.matches.push(o)})}function ms(t,e){e.score=t.score}function As(t,e,{includeMatches:n=y.includeMatches,includeScore:r=y.includeScore}={}){const i=[];return n&&i.push(ps),r&&i.push(ms),t.map(c=>{const{idx:o}=c,a={item:e[o],refIndex:o};return i.length&&i.forEach(u=>{u(c,a)}),a})}class q{constructor(e,n={},r){this.options={...y,...n},this.options.useExtendedSearch,this._keyStore=new zt(this.options.keys),this.setCollection(e,r)}setCollection(e,n){if(this._docs=e,n&&!(n instanceof Le))throw new Error(jt);this._myIndex=n||at(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){G(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const n=[];for(let r=0,i=this._docs.length;r<i;r+=1){const c=this._docs[r];e(c,r)&&(this.removeAt(r),r-=1,i-=1,n.push(c))}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:i,shouldSort:c,sortFn:o,ignoreFieldNorm:a}=this.options;let u=Z(e)?Z(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return gs(u,{ignoreFieldNorm:a}),c&&u.sort(o),rt(n)&&n>-1&&(u=u.slice(0,n)),As(u,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e){const n=Re(e,this.options),{records:r}=this._myIndex,i=[];return r.forEach(({v:c,i:o,n:a})=>{if(!G(c))return;const{isMatch:u,score:l,indices:h}=n.searchIn(c);u&&i.push({item:c,idx:o,matches:[{score:l,value:c,norm:a,indices:h}]})}),i}_searchLogical(e){const n=dt(e,this.options),r=(a,u,l)=>{if(!a.children){const{keyId:E,searcher:x}=a,g=this._findMatches({key:this._keyStore.get(E),value:this._myIndex.getValueForItemAtKeyId(u,E),searcher:x});return g&&g.length?[{idx:l,item:u,matches:g}]:[]}const h=[];for(let E=0,x=a.children.length;E<x;E+=1){const g=a.children[E],m=r(g,u,l);if(m.length)h.push(...m);else if(a.operator===Me.AND)return[]}return h},i=this._myIndex.records,c={},o=[];return i.forEach(({$:a,i:u})=>{if(G(a)){let l=r(n,a,u);l.length&&(c[u]||(c[u]={idx:u,item:a,matches:[]},o.push(c[u])),l.forEach(({matches:h})=>{c[u].matches.push(...h)}))}}),o}_searchObjectList(e){const n=Re(e,this.options),{keys:r,records:i}=this._myIndex,c=[];return i.forEach(({$:o,i:a})=>{if(!G(o))return;let u=[];r.forEach((l,h)=>{u.push(...this._findMatches({key:l,value:o[h],searcher:n}))}),u.length&&c.push({idx:a,item:o,matches:u})}),c}_findMatches({key:e,value:n,searcher:r}){if(!G(n))return[];let i=[];if(re(n))n.forEach(({v:c,i:o,n:a})=>{if(!G(c))return;const{isMatch:u,score:l,indices:h}=r.searchIn(c);u&&i.push({score:l,key:e,value:c,idx:o,norm:a,indices:h})});else{const{v:c,n:o}=n,{isMatch:a,score:u,indices:l}=r.searchIn(c);a&&i.push({score:u,key:e,value:c,norm:o,indices:l})}return i}}q.version="7.1.0";q.createIndex=at;q.parseIndex=Jt;q.config=y;q.parseQuery=dt;hs(ls);async function ys(t){const e=new URLSearchParams({q:t}),n=await At(yt(`/api/folders/search?${e.toString()}`));if(!n.ok){const i=await n.json().catch(()=>({}));throw new Error(i.error||`Failed to search folders: ${n.statusText}`)}const r=await n.json();return Array.isArray(r.folders)?r.folders:[]}const Es=["command","agent","building","area","folder","modified-file"],xs=2;function Cs(){const t=nt(pe.SPOTLIGHT_TAB,"all");return fe.includes(t)?t:"all"}function st(){return Rt(pe.SPOTLIGHT_QUERY,"")}function Ms(){const t=nt(pe.AOP_CONFIG,{});return t.sortMode==="name"||t.sortMode==="status"||t.sortMode==="recent"?t.sortMode:"recent"}function Fs({isOpen:t,onClose:e,onOpenSpawnModal:n,onOpenCommanderView:r,onOpenToolbox:i,onOpenFileExplorer:c,onOpenPM2LogsModal:o,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l}){const h=Et(),E=xt(),x=Ct(),g=Mt(),m=Ft(),S=wt(),w=d.useRef(e);w.current=e;const T=d.useRef(n);T.current=n;const j=d.useRef(r);j.current=r;const Q=d.useRef(i);Q.current=i;const W=d.useRef(c);W.current=c;const oe=d.useRef(o);oe.current=o;const ie=d.useRef(a);ie.current=a;const $=d.useRef(u);$.current=u;const N=d.useRef(l);N.current=l;const[D,ae]=d.useState(st),[H,B]=d.useState(0),[M,R]=d.useState(Cs),[X,O]=d.useState([]),ft=d.useCallback(s=>{ae(s),St(pe.SPOTLIGHT_QUERY,s)},[]);d.useEffect(()=>{t&&(ae(st()),B(0))},[t]),d.useEffect(()=>{if(!t){O([]);return}const s=D.trim();if(s.length<xs){O([]);return}let p=!1;const C=setTimeout(()=>{ys(s).then(F=>{p||O(F)}).catch(()=>{p||O([])})},250);return()=>{p=!0,clearTimeout(C)}},[t,D]);const we=d.useCallback(s=>{R(s),Bt(pe.SPOTLIGHT_TAB,s)},[]),$e=d.useRef(M);$e.current=M;const gt=d.useCallback(s=>{const p=fe.indexOf($e.current),C=fe[(p+s+fe.length)%fe.length];we(C)},[we]);d.useEffect(()=>{B(0)},[M]);const Se=V.getShortcuts(),ge=d.useMemo(()=>t?vt():{},[t]),me=d.useMemo(()=>{if(!t)return[];const s=Se.find(C=>C.id==="spawn-agent"),p=Se.find(C=>C.id==="toggle-commander");return[{id:"cmd-spawn",type:"command",title:"Spawn New Agent",subtitle:s?Ve(s):"Alt+N",icon:f.jsx(ne,{name:"plus",size:16}),action:()=>{w.current(),T.current()}},{id:"cmd-commander",type:"command",title:"Commander View",subtitle:p!=null&&p.key?Ve(p):"Tab",icon:f.jsx(ne,{name:"dashboard",size:16}),action:()=>{w.current(),j.current()}},{id:"cmd-settings",type:"command",title:"Settings & Tools",subtitle:"Configure Tide Commander",icon:f.jsx(ne,{name:"gear",size:16}),action:()=>{w.current(),Q.current()}},{id:"cmd-monitoring",type:"command",title:"Monitoring & Logs",subtitle:"Triggers, workflows, events",icon:f.jsx(ne,{name:"chart-line",size:16}),action:()=>{var C;w.current(),(C=N.current)==null||C.call(N)}}]},[t,Se]),he=d.useMemo(()=>t?Array.from(h.values()).map(s=>{const p=(g||[]).filter(Y=>Y.agentId===s.id).map(Y=>Y.filePath),C=[...new Set(p)],F=C.map(Y=>Y.split("/").pop()||Y),v=[];s.lastAssignedTask&&v.push(s.lastAssignedTask);const L=`${s.class} • ${s.cwd}`;let k=`${s.name} ${s.class} ${s.status} ${s.cwd}`;s.taskLabel&&(k+=` ${s.taskLabel}`),F.length>0&&(k+=` ${F.join(" ")} ${C.join(" ")}`),v.length>0&&(k+=` ${v.join(" ")}`);const P=Date.now()-s.lastActivity;let U;return s.lastAssignedTask&&(s.lastAssignedTask.length>150?U=s.lastAssignedTask.slice(0,150)+"...":U=s.lastAssignedTask),{id:`agent-${s.id}`,type:"agent",title:s.name,subtitle:L,lastUserInput:U,timeAway:P,icon:f.jsx(_t,{agent:s,size:20}),_searchText:k,_modifiedFiles:C,_userQueries:v,_agentId:s.id,_lastActivity:s.lastActivity,_taskLabel:s.taskLabel,_status:s.status,action:()=>{w.current(),It(s.id),V.selectAgent(s.id),V.getState().viewMode!=="flat"&&V.requestTerminalExpand()}}}):[],[t,h,g]),Ae=d.useMemo(()=>t?Array.from(E.values()).map(s=>{var p;return{id:`area-${s.id}`,type:"area",title:s.name,subtitle:`${s.assignedAgentIds.length} agents • ${((p=s.directories)==null?void 0:p.length)||0} folders`,icon:f.jsx(ne,{name:"map",size:16}),action:()=>{w.current(),V.selectArea(s.id)}}}):[],[t,E]),je=d.useMemo(()=>{const s=new Map;for(const p of he)p._agentId&&s.set(p._agentId,p);return s},[he]),Ne=d.useMemo(()=>{const s=new Map;if(!t)return s;for(const p of h.values()){const C=V.getAreaForAgent(p.id);if(!C||C.archived)continue;const F=s.get(C.id);F?F.push(p):s.set(C.id,[p])}return s},[t,h,E]),Pe=d.useMemo(()=>{const s=new Map;for(const p of m)s.has(p.agentId)||s.set(p.agentId,p.timestamp);return s},[m]),Be=d.useMemo(()=>{if(!t)return[];const s=D.trim().toLowerCase(),p=Dt({sortMode:Ms(),agentsWithUnseenOutput:S,getLatestToolTimestamp:v=>Pe.get(v)}),C=Array.from(E.values()).filter(v=>!v.archived).filter(v=>s?v.name.toLowerCase().includes(s):!0).sort((v,L)=>v.name.localeCompare(L.name,void 0,{sensitivity:"base"})),F=[];for(const v of C){const k=(Ne.get(v.id)||[]).slice().sort(p).map(P=>je.get(P.id)).filter(P=>!!P);!s&&k.length===0||F.push({areaId:v.id,areaName:v.name,areaColor:v.color,agents:k})}return F},[t,D,E,Ne,je,S,Pe]),ye=d.useMemo(()=>t?Array.from(x.values()).filter(s=>s.type==="server"||s.type==="boss"||s.type==="database"||s.type==="tests").map(s=>{var P,U,Y,ue,ee;const p=s.status==="running"?"#4ade80":s.status==="stopped"?"#f87171":"#facc15",C=s.type==="boss"?"crown":s.type==="database"?"database":s.type==="tests"?"flask":"desktop",F=s.type==="boss"?"Boss":s.type==="database"?"Database":s.type==="tests"?"Tests":"Server";let v=`${F} • ${s.status}`;if(s.type==="database"&&((U=(P=s.database)==null?void 0:P.connections)!=null&&U.length)){const z=s.database.connections[0];v+=` • ${z.engine} @ ${z.host}`}else s.type==="tests"&&s.folderPath?v=`${F} • ${s.folderPath}`:s.cwd&&(v+=` • ${s.cwd}`);const L=((Y=s.pm2Status)==null?void 0:Y.ports)||[];let k=`${s.name} ${s.type} ${s.status} ${s.cwd||""} ${((ue=s.pm2)==null?void 0:ue.name)||""}`;if(s.type==="tests"&&(k+=` ${s.folderPath||""} tests junit maven`),L.length>0&&(k+=` ${L.join(" ")}`),s.type==="database"&&((ee=s.database)!=null&&ee.connections))for(const z of s.database.connections)k+=` ${z.name} ${z.engine} ${z.host} ${z.database||""} mysql postgresql sql`;return{id:`building-${s.id}`,type:"building",title:s.name,subtitle:v,_ports:L,icon:f.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[f.jsx(ne,{name:"status-pending",size:10,weight:"fill",color:p}),f.jsx(ne,{name:C,size:16})]}),_searchText:k,action:()=>{var z;w.current(),s.type==="boss"?ie.current(s.id):s.type==="database"?$.current(s.id):s.type==="tests"?V.openTestsBuilding(s.id):s.type==="http"?V.openHttpBuilding(s.id):(z=s.pm2)!=null&&z.enabled&&oe.current(s.id)}}}):[],[t,x]),Ke=d.useMemo(()=>{if(!t)return[];const s=g||[],p=new Set,C=[];for(const F of s){if(p.has(F.filePath))continue;p.add(F.filePath);const v=F.filePath.split("/").pop()||F.filePath,L=F.action==="created"?"Created":F.action==="modified"?"Modified":F.action==="deleted"?"Deleted":"Read";if(C.push({id:`modified-${F.filePath}-${F.timestamp}`,type:"modified-file",title:v,subtitle:`${L} by ${F.agentName} • ${F.filePath}`,matchedText:F.filePath,icon:F.action==="deleted"?f.jsx(ne,{name:"trash",size:16}):kt(F.filePath),action:()=>{w.current();const k=Array.from(V.getState().areas.values());for(const P of k)for(const U of P.directories||[])if(F.filePath.startsWith(U)){V.setFileViewerPath(F.filePath),W.current(P.id);return}V.selectAgent(F.agentId)}}),C.length>=50)break}return C},[t,g]),Oe=d.useMemo(()=>t?X.map(s=>{const p=s.isGitRepo&&s.gitBranch?`${s.path} • ${s.gitBranch}`:s.path;return{id:`folder-${s.path}`,type:"folder",title:s.name,subtitle:p,matchedText:s.path,icon:f.jsx(ne,{name:s.isGitRepo?"git-branch":"folder",size:16}),_searchText:`${s.name} ${s.path}`,_isGitRepo:s.isGitRepo,_gitBranch:s.gitBranch,action:()=>{w.current(),V.openFileExplorer(s.path)}}}):[],[t,X]),ze=d.useMemo(()=>new q(he,{keys:["title","subtitle","_searchText","lastUserInput"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[he]),Ge=d.useMemo(()=>new q(me,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[me]),Qe=d.useMemo(()=>new q(Ae,{keys:["title","subtitle"],threshold:.4,includeScore:!0,includeMatches:!0}),[Ae]),We=d.useMemo(()=>new q(Ke,{keys:["title","subtitle","matchedText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[Ke]),He=d.useMemo(()=>new q(ye,{keys:["title","subtitle","_searchText"],threshold:.4,ignoreLocation:!0,includeScore:!0,includeMatches:!0}),[ye]),de=d.useMemo(()=>{if(!D.trim()){const A=[];A.push(...ye);const I=[...he].sort((b,K)=>{const te=Ee(b._agentId,b._lastActivity,ge);return Ee(K._agentId,K._lastActivity,ge)-te});A.push(...I),A.push(...me.slice(0,2)),A.push(...Ae.slice(0,2));const _={};return Es.forEach((b,K)=>{_[b]=K}),A.sort((b,K)=>(_[b.type]??999)-(_[K.type]??999)),A}const s=D.trim().toLowerCase(),p=ze.search(D).slice(0,8),C=Ge.search(D).slice(0,3),F=Qe.search(D).slice(0,2),v=We.search(D).slice(0,3),L=Oe.slice(0,8),k=He.search(D).filter(A=>{const I=A.score??1;return`${A.item.title} ${A.item.subtitle||""} ${A.item._searchText||""}`.toLowerCase().includes(s)||I<=.2}).slice(0,4),P={agent:6,building:5,folder:4,command:3,area:2,"modified-file":1},U=A=>{if(!s)return 1;const I=A.title.toLowerCase();return I===s?6:I.startsWith(s)?5:I.split(/[^a-z0-9]+/i).includes(s)?4:I.includes(s)?3:`${A.subtitle||""} ${A._searchText||""} ${A.matchedText||""}`.toLowerCase().includes(s)?2:1},Y=(A,I)=>{const _=(1-Math.min(1,I??1))*4;return U(A)*100+(P[A.type]??0)*5+_},ue=new Map,ee=(A,I)=>{const _=ue.get(A.type),b={item:A,score:Y(A,I)};_?_.push(b):ue.set(A.type,[b])};for(const A of p){const I={...A.item};if(I._modifiedFiles&&I._modifiedFiles.length>0){const _=I._modifiedFiles.filter(b=>{var se;const K=((se=b.split("/").pop())==null?void 0:se.toLowerCase())||"",te=b.toLowerCase();return K.includes(s)||te.includes(s)});_.length>0&&(I.matchedFiles=_)}if(I._userQueries&&I._userQueries.length>0){const _=I._userQueries.find(b=>b.toLowerCase().includes(s));if(_)if(_.length>200){const K=_.toLowerCase().indexOf(s),te=Math.max(0,K-60),se=Math.min(_.length,K+s.length+100);I.matchedQuery=(te>0?"...":"")+_.slice(te,se)+(se<_.length?"...":"")}else I.matchedQuery=_}ee(I,A.score)}for(const A of k)ee(A.item,A.score);for(const A of C)ee(A.item,A.score);for(const A of F)ee(A.item,A.score);for(const A of v)ee(A.item,A.score);for(const A of L)ee(A,void 0);for(const[A,I]of ue)A==="agent"?I.sort((_,b)=>{const K=U(_.item),te=U(b.item);if(te!==K)return te-K;const se=Ee(_.item._agentId,_.item._lastActivity,ge),Ye=Ee(b.item._agentId,b.item._lastActivity,ge);return Ye!==se?Ye-se:b.score-_.score}):I.sort((_,b)=>b.score-_.score);const z=A=>A.reduce((I,_)=>Math.max(I,_.score),-1),Ue=[];return Array.from(ue.values()).sort((A,I)=>z(I)-z(A)).forEach(A=>{for(const I of A)Ue.push(I.item)}),Ue},[D,ze,Ge,Qe,We,He,me,he,Ae,ye,Oe,ge]),J=d.useMemo(()=>{switch(M){case"agents":return de.filter(s=>s.type==="agent");case"buildings":return de.filter(s=>s.type==="building");case"commands":return de.filter(s=>s.type==="command");case"folders":return de.filter(s=>s.type==="folder");case"areas":return Be.flatMap(s=>s.agents);case"all":default:return de}},[M,de,Be]);d.useEffect(()=>{H>=J.length&&B(Math.max(0,J.length-1))},[J.length,H]);const pt=d.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 p=s.key.toLowerCase();B(p==="p"?C=>C>0?C-1:J.length-1:C=>C<J.length-1?C+1:0);return}switch(s.key){case"Escape":s.preventDefault(),w.current();break;case"ArrowUp":s.preventDefault(),B(p=>p>0?p-1:J.length-1);break;case"ArrowDown":s.preventDefault(),B(p=>p<J.length-1?p+1:0);break;case"Enter":s.preventDefault(),J[H]&&J[H].action();break}},[J,H]),mt=d.useCallback((s,p)=>{if(!p||!s)return s;const C=s.toLowerCase(),F=p.toLowerCase(),v=[];let L=0,k=C.indexOf(F),P=0;for(;k!==-1;)k>L&&v.push(s.slice(L,k)),v.push(ve.createElement("mark",{key:P++,className:"spotlight-highlight"},s.slice(k,k+p.length))),L=k+p.length,k=C.indexOf(F,L);return L<s.length&&v.push(s.slice(L)),v.length>0?ve.createElement(ve.Fragment,null,...v):s},[]);return{query:D,setQuery:ft,selectedIndex:H,setSelectedIndex:B,results:J,activeTab:M,setActiveTab:we,cycleTab:gt,areaSections:Be,handleKeyDown:pt,highlightMatch:mt}}const ws=d.forwardRef(function({query:e,onQueryChange:n,onKeyDown:r,onResetSelection:i},c){const{t:o}=Fe(["common"]);return f.jsxs("div",{className:"spotlight-input-wrapper",children:[f.jsx("span",{className:"spotlight-search-icon",children:"⌘"}),f.jsx("input",{ref:c,type:"text",className:"spotlight-input",placeholder:o("common:search.spotlightPlaceholder"),value:e,onChange:a=>{n(a.target.value),i()},onKeyDown:r,autoFocus:!0,spellCheck:!1}),f.jsxs("div",{className:"spotlight-input-hints",children:[f.jsx("span",{className:"spotlight-shortcut-hint",children:"↑↓"}),f.jsx("span",{className:"spotlight-shortcut-hint",children:"Enter"}),f.jsx("span",{className:"spotlight-shortcut-hint",children:"Esc"})]})]})}),Ss=d.memo(function({activeTab:e,onSelect:n}){const{t:r}=Fe(["terminal"]);return f.jsxs("div",{className:"spotlight-tabs",role:"tablist","aria-label":r("terminal:spotlight.tabsLabel"),children:[fe.map(i=>f.jsx("button",{type:"button",role:"tab","aria-selected":i===e,tabIndex:-1,className:`spotlight-tab${i===e?" active":""}`,onClick:()=>n(i),children:r(`terminal:spotlight.tabs.${i}`)},i)),f.jsx("span",{className:"spotlight-tabs-hint",children:f.jsx("kbd",{children:"Tab"})})]})}),Bs=d.forwardRef(function({results:e,selectedIndex:n,query:r,activeTab:i,areaSections:c,highlightMatch:o,onSelectIndex:a},u){const{t:l}=Fe(["terminal"]),h=d.useRef(!1);d.useEffect(()=>{h.current=!1},[e]),d.useEffect(()=>{const g=typeof u=="function"?null:u==null?void 0:u.current;if(!g)return;const m=()=>{h.current=!0};return g.addEventListener("mousemove",m),()=>{g.removeEventListener("mousemove",m)}},[u,e]);const E={command:l("terminal:spotlight.categories.commands"),agent:l("terminal:spotlight.categories.agents"),building:l("terminal:spotlight.categories.infrastructure"),area:l("terminal:spotlight.categories.areas"),folder:l("terminal:spotlight.categories.folders"),"modified-file":l("terminal:spotlight.categories.modifiedFiles")},x=d.useMemo(()=>{const g=[];let m=null,S=[];return e.forEach((w,T)=>{w.type!==m&&(m!==null&&S.length>0&&g.push([m,S]),m=w.type,S=[]),S.push({result:w,index:T})}),m!==null&&S.length>0&&g.push([m,S]),g},[e]);if(d.useEffect(()=>{if(!u||typeof u=="function")return;const g=u.current;if(!g)return;const m=g.querySelector(".spotlight-item.selected");m&&m.scrollIntoView({block:"nearest",behavior:"smooth"})},[n,u]),i==="areas"){if(c.length===0)return f.jsx("div",{className:"spotlight-results",ref:u,children:f.jsx("div",{className:"spotlight-empty",children:l("terminal:spotlight.noResults")})});let g=0;return f.jsx("div",{className:"spotlight-results",ref:u,children:c.map(m=>f.jsxs("div",{children:[f.jsxs("div",{className:"spotlight-category-header spotlight-area-section-header",children:[f.jsx("span",{className:"spotlight-area-dot",style:{background:m.areaColor},"aria-hidden":"true"}),f.jsx("span",{className:"spotlight-area-name",children:m.areaName}),f.jsx("span",{className:"spotlight-area-count",children:m.agents.length})]}),m.agents.length===0?f.jsx("div",{className:"spotlight-area-empty",children:l("terminal:spotlight.noAgentsInArea")}):m.agents.map(S=>{const w=g++;return f.jsx(Je,{result:S,isSelected:w===n,query:r,highlightMatch:o,onClick:()=>S.action(),onMouseEnter:()=>{h.current&&a(w)}},S.id)})]},m.areaId))})}return e.length===0?f.jsx("div",{className:"spotlight-results",ref:u,children:f.jsx("div",{className:"spotlight-empty",children:l("terminal:spotlight.noResults")})}):f.jsx("div",{className:"spotlight-results",ref:u,children:x.map(([g,m])=>f.jsxs("div",{children:[x.length>1&&f.jsx("div",{className:"spotlight-category-header",children:E[g]||g}),m.map(({result:S,index:w})=>f.jsx(Je,{result:S,isSelected:w===n,query:r,highlightMatch:o,onClick:()=>S.action(),onMouseEnter:()=>{h.current&&a(w)}},S.id))]},g))})}),vs=d.memo(function(){const{t:e}=Fe(["terminal"]);return f.jsxs("div",{className:"spotlight-footer",children:[f.jsxs("div",{className:"spotlight-footer-left",children:[f.jsxs("span",{className:"spotlight-footer-hint",children:[f.jsx("kbd",{children:"↑"}),f.jsx("kbd",{children:"↓"})," ",f.jsx("kbd",{children:"Alt+N"}),f.jsx("kbd",{children:"Alt+P"})," ",e("terminal:spotlight.navigate")]}),f.jsxs("span",{className:"spotlight-footer-hint",children:[f.jsx("kbd",{children:"Enter"})," ",e("terminal:spotlight.select")]}),f.jsxs("span",{className:"spotlight-footer-hint",children:[f.jsx("kbd",{children:"Tab"})," ",e("terminal:spotlight.switchTabs")]})]}),f.jsx("div",{className:"spotlight-footer-right",children:f.jsxs("span",{className:"spotlight-footer-hint",children:[f.jsx("kbd",{children:"Esc"})," ",e("common:buttons.close")]})})]})}),Is=768;function Rs({isOpen:t,onClose:e,onOpenSpawnModal:n,onOpenCommanderView:r,onOpenToolbox:i,onOpenFileExplorer:c,onOpenPM2LogsModal:o,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l}){const h=d.useRef(null),E=d.useRef(null),x=d.useRef(null),g=d.useRef(0),{query:m,setQuery:S,selectedIndex:w,setSelectedIndex:T,results:j,activeTab:Q,setActiveTab:W,cycleTab:oe,areaSections:ie,handleKeyDown:$,highlightMatch:N}=Fs({isOpen:t,onClose:e,onOpenSpawnModal:n,onOpenCommanderView:r,onOpenToolbox:i,onOpenFileExplorer:c,onOpenPM2LogsModal:o,onOpenBossLogsModal:a,onOpenDatabasePanel:u,onOpenMonitoringModal:l});g.current=j.length;const D=d.useRef(oe);D.current=oe,d.useEffect(()=>{t&&setTimeout(()=>{var B,M;(B=h.current)==null||B.focus(),(M=h.current)==null||M.select()},50)},[t]),d.useEffect(()=>{if(!t)return;const B=window.visualViewport;if(!B||window.innerWidth>Is)return;const M=()=>{const R=E.current;R&&(R.style.height=`${B.height}px`,R.style.top=`${B.offsetTop}px`)};return M(),B.addEventListener("resize",M),B.addEventListener("scroll",M),()=>{B.removeEventListener("resize",M),B.removeEventListener("scroll",M);const R=E.current;R&&(R.style.height="",R.style.top="")}},[t]),d.useEffect(()=>{if(!t)return;const B=M=>{if(M.key==="Escape"){M.preventDefault(),M.stopPropagation(),M.stopImmediatePropagation(),e();return}if(M.key==="Tab"){M.preventDefault(),M.stopPropagation(),M.stopImmediatePropagation(),D.current(M.shiftKey?-1:1);return}if(M.altKey&&!M.ctrlKey&&!M.metaKey&&(M.key==="n"||M.key==="p"||M.key==="N"||M.key==="P")){M.preventDefault(),M.stopPropagation(),M.stopImmediatePropagation();const R=M.key.toLowerCase(),X=g.current;T(R==="p"?O=>O>0?O-1:X-1:O=>O<X-1?O+1:0);return}};return window.addEventListener("keydown",B,{capture:!0}),()=>{window.removeEventListener("keydown",B,{capture:!0})}},[t,e]);const ae=d.useCallback(B=>{B.target===B.currentTarget&&e()},[e]),H=d.useCallback(()=>{T(0)},[T]);return t?f.jsx("div",{ref:E,className:"spotlight-overlay",onClick:ae,children:f.jsxs("div",{className:"spotlight-modal",children:[f.jsx(ws,{ref:h,query:m,onQueryChange:S,onKeyDown:$,onResetSelection:H}),f.jsx(Ss,{activeTab:Q,onSelect:W}),f.jsx(Bs,{ref:x,results:j,selectedIndex:w,query:m,activeTab:Q,areaSections:ie,highlightMatch:N,onSelectIndex:T}),f.jsx(vs,{})]})}):null}export{Ls as FILE_ICON_NAMES,Rs as Spotlight,vs as SpotlightFooter,ws as SpotlightInput,Je as SpotlightItem,Bs as SpotlightResults,$s as formatDuration,js as formatRelativeTime,Ns as getAgentIcon,kt as getFileIconFromPath,Ps as getTypeLabel,Fs as useSpotlightSearch};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
:root{--bg-primary: #0d0d14;--bg-secondary: #14141e;--bg-tertiary: #1c1c28;--border-color: #2a2a3a;--text-primary: #d0d0d8;--text-secondary: #8a8a98;--text-muted: #606070;--accent-blue: #5a8fd4;--accent-green: #5cb88a;--accent-orange: #d4a05a;--accent-red: #d45a5a;--accent-purple: #8a6fbf;--accent-cyan: #5ab8c8;--accent-claude: #a06848;--accent-claude-light: #c8896a;--accent-pink: #5a8fd4;--accent-yellow: #d0d0d8;--font-size-base: 14px;--line-height-base: 1.5;--msg-user-bg: color-mix(in srgb, #5ab8c8 8%, transparent);--msg-user-highlight-bg: var(--msg-user-bg);--msg-user-border: #5ab8c8;--msg-user-text: #d0d0d8;--msg-assistant-bg: color-mix(in srgb, #5cb88a 8%, transparent);--msg-assistant-border: #5cb88a;--msg-assistant-text: #d0d0d8;--tool-use-bg: color-mix(in srgb, #d4a05a 8%, transparent);--tool-use-border: #d4a05a;--tool-use-text: #d4a05a;--tool-use-name: #d4a05a;--tool-result-bg: color-mix(in srgb, #8a6fbf 6%, transparent);--tool-result-border: #8a6fbf;--tool-result-text: #5cb88a;--context-bar-bg: #1c1c28;--context-bar-fill: #8a6fbf;--output-line-bg: transparent;--task-label-color: #5ab8c8}.view-mode-toggle{display:flex;gap:2px;position:relative;background:#0009;border-radius:6px;padding:3px;border:1px solid #2a2a3a}.view-mode-toggle__indicator{position:absolute;top:3px;bottom:3px;background:#d4a05a2e;border-radius:4px;transition:left .2s cubic-bezier(.4,0,.2,1),width .2s cubic-bezier(.4,0,.2,1);pointer-events:none;z-index:0}.view-mode-toggle__btn{display:flex;align-items:center;gap:5px;padding:5px 10px;border:none;border-radius:4px;background:transparent;color:#8a8a98;font-size:11px;font-weight:600;font-family:JetBrains Mono,SF Mono,Fira Code,Consolas,monospace;cursor:pointer;transition:color .15s ease,background .15s ease;white-space:nowrap;position:relative;z-index:1}.view-mode-toggle__btn:hover:not(.view-mode-toggle__btn--active){background:#ffffff14;color:#d0d0d8}.view-mode-toggle__btn--active{color:#d4a05a}.view-mode-toggle__btn--active svg{stroke:#d4a05a}.view-mode-toggle__icon{display:flex;align-items:center;justify-content:center;flex-shrink:0}.view-mode-toggle__label{line-height:1}.view-mode-toggle--floating{position:fixed;bottom:70px;left:60px;z-index:150;box-shadow:0 2px 8px #0000004d}@media(max-width:768px){.view-mode-toggle__btn{padding:10px 14px;min-height:44px;min-width:44px;font-size:12px;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.view-mode-toggle__btn:active{opacity:.7;transform:scale(.95)}.view-mode-toggle__icon svg{width:16px;height:16px}.view-mode-toggle__label{font-size:11px}}@media(max-width:480px){.view-mode-toggle--floating{padding:3px}.view-mode-toggle__btn{padding:8px 10px;min-height:44px}.view-mode-toggle__label{display:none}}.app.view-mode-flat .guake-terminal{display:none}.flat-view{--flat-middle-width: 1fr;--flat-inspector-width: 320px;display:grid;grid-template-columns:var(--flat-middle-width) 3px 1fr;height:100%;width:100%;background:#282a36;overflow:hidden;padding-left:64px;box-sizing:border-box;transition:grid-template-columns .25s ease}.flat-view--with-inspector{grid-template-columns:var(--flat-middle-width) 3px 1fr 3px var(--flat-inspector-width)}.flat-splitter{position:relative;cursor:col-resize;background:#ffffff0a;touch-action:none;-webkit-user-select:none;user-select:none;transition:background .15s ease;z-index:2}.flat-splitter:before{content:"";position:absolute;top:0;bottom:0;left:-5px;right:-5px}.flat-splitter:hover{background:#8be9fd73}body.flat-splitter-dragging{cursor:col-resize!important;-webkit-user-select:none!important;user-select:none!important}body.flat-splitter-dragging .flat-splitter{background:#8be9fd99}body.flat-splitter-dragging .flat-view{transition:none!important}.flat-middle{display:flex;flex-direction:column;background:#282a36;border-right:1px solid rgba(255,255,255,.06);overflow:hidden;min-width:280px}.flat-middle__header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid rgba(255,255,255,.06);flex-shrink:0;gap:12px}.flat-middle__title{font-size:14px;font-weight:600;color:#f8f8f2;margin:0}.flat-middle__actions{display:flex;gap:6px;flex-shrink:0}.flat-middle__content{flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:8px}.flat-middle__content::-webkit-scrollbar{width:6px}.flat-middle__content::-webkit-scrollbar-track{background:transparent}.flat-middle__content::-webkit-scrollbar-thumb{background:#ffffff1a;border-radius:3px}.flat-middle__content::-webkit-scrollbar-thumb:hover{background:#fff3}.flat-cta-btn{padding:4px 10px;font-size:11px;font-weight:500;border:none;border-radius:4px;cursor:pointer;transition:all .15s ease;white-space:nowrap}.flat-cta-btn--agent{background:#50fa7b26;color:#50fa7b}.flat-cta-btn--agent:hover{background:#50fa7b40}.flat-cta-btn--boss{background:#ffd70026;color:gold}.flat-cta-btn--boss:hover{background:#ffd70040}.flat-cta-btn--building{background:#8be9fd26;color:#8be9fd}.flat-cta-btn--building:hover{background:#8be9fd40}.flat-cta-btn--area{background:#bd93f926;color:#bd93f9}.flat-cta-btn--area:hover{background:#bd93f940}.flat-middle .agent-overview-panel{position:relative;inset:auto;width:100%;height:100%;border-right:none;flex:1;min-height:0;z-index:auto}.flat-middle .agent-overview-panel .aop-row-controls .close-btn{display:none}.flat-middle__content:has(>.agent-overview-panel){padding:0;overflow:hidden}.flat-right{display:flex;flex-direction:column;background:#21222c;overflow:hidden}.flat-chat{display:flex;flex-direction:column;height:100%}.flat-chat--empty{align-items:center;justify-content:center}.flat-chat__placeholder{display:flex;flex-direction:column;align-items:center;gap:12px;color:#6272a4}.flat-chat__placeholder-icon{font-size:48px;opacity:.5}.flat-chat__placeholder-text{font-size:14px}.flat-map{display:flex;flex-direction:column;height:100%;padding:12px 16px;gap:10px;overflow-y:auto;position:relative}.flat-map::-webkit-scrollbar{width:6px}.flat-map::-webkit-scrollbar-track{background:transparent}.flat-map::-webkit-scrollbar-thumb{background:#ffffff1a;border-radius:3px}.flat-map::-webkit-scrollbar-thumb:hover{background:#fff3}.flat-map__header{display:flex;align-items:baseline;justify-content:space-between;gap:12px;flex-shrink:0;padding-right:130px}.flat-map__title{font-size:13px;font-weight:600;color:#f8f8f2}.flat-map__hint{font-size:11px;color:#6272a4}.flat-map__view-mode{position:absolute;top:10px;right:12px;z-index:5;background:color-mix(in srgb,#1e1f29 92%,transparent);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);border-radius:999px;box-shadow:0 2px 8px #0000004d}.flat-map__grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px;align-content:start}.flat-map__empty{grid-column:1/-1;display:flex;align-items:center;justify-content:center;padding:40px;color:#6272a4;font-size:13px}.flat-map-area-card{display:flex;flex-direction:column;position:relative;isolation:isolate;background:color-mix(in srgb,var(--area-color, #6272a4) 12%,#363848);border:1px solid color-mix(in srgb,var(--area-color, #6272a4) 38%,transparent);border-radius:8px;overflow:hidden;transition:border-color .15s ease,box-shadow .15s ease,background .15s ease}.flat-map-area-card:hover{border-color:color-mix(in srgb,var(--area-color, #6272a4) 58%,transparent);box-shadow:0 2px 8px #00000040}.flat-map-area-card__header{display:flex;align-items:center;gap:6px;padding:6px 8px;background:transparent;border:none;cursor:pointer;width:100%;text-align:left;color:#f8f8f2;font-size:12px;font-weight:600;transition:background .15s ease}.flat-map-area-card__header:hover{background:#ffffff0a}.flat-map-area-card__color{width:8px;height:8px;border-radius:50%;flex-shrink:0}.flat-map-area-card__logo{position:absolute;right:8px;bottom:8px;width:88px;height:88px;max-width:55%;max-height:72%;object-fit:contain;opacity:.3;pointer-events:none;-webkit-user-select:none;user-select:none;z-index:-1;border-radius:4px}.flat-map-area-card__name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.flat-map-area-card__count{font-size:10px;font-weight:500;color:#6272a4;background:#ffffff0f;padding:1px 5px;border-radius:8px;flex-shrink:0}.flat-map-area-card__caret{font-size:10px;color:#6272a4;flex-shrink:0;width:12px;text-align:center}.flat-map-area-card__agents{display:flex;flex-wrap:wrap;gap:4px;padding:0 8px 8px}.flat-map-agent-chip{position:relative;display:inline-flex;align-items:center;gap:5px;padding:3px 7px 6px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;color:#9a9caa;font-size:11px;text-align:left;transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap;min-width:0;overflow:hidden}.flat-map-agent-chip:hover{background:#ffffff14;border-color:#ffffff1f;color:#f8f8f2}.flat-map-agent-chip.working{overflow:visible;isolation:isolate;background-color:#4a9eff1f;background-image:linear-gradient(100deg,transparent 30%,rgba(180,230,255,.45) 49%,rgba(139,220,240,.3) 51%,transparent 70%),linear-gradient(100deg,transparent 32%,rgba(139,233,253,.3) 50%,transparent 68%);background-size:220% 100%,260% 100%;background-repeat:no-repeat,no-repeat;background-position:150% 0,150% 0;border-color:#8be9fdb3;color:#f8f8f2;box-shadow:0 0 8px #4a9eff59,inset 0 0 0 1px #8be9fd00;transform-origin:center;will-change:transform,background-position,box-shadow,border-color;animation:flat-map-agent-working-shimmer .75s linear infinite,flat-map-agent-working-shimmer-2 1.15s linear infinite,flat-map-agent-working-pulse 1.1s ease-in-out infinite,flat-map-agent-working-beat .85s ease-in-out infinite,flat-map-agent-working-iris 3.2s linear infinite}.flat-map-agent-chip.working:before{content:"";position:absolute;top:-2px;right:-2px;bottom:-2px;left:-2px;border-radius:inherit;pointer-events:none;z-index:-1;background:conic-gradient(from 0deg,#8be9fd00,#8bc8fd8c,#a082e680,#dc82c873,#dcb48266,#8bc8fd8c,#8be9fd00);filter:blur(8px);transform-origin:center;will-change:transform,opacity;animation:flat-map-agent-working-spin 3.8s linear infinite,flat-map-agent-working-breath 2.6s ease-in-out infinite}.flat-map-agent-chip.working:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border-radius:inherit;pointer-events:none;z-index:1;background-image:radial-gradient(1px 1px at 18% 32%,rgba(255,255,255,.7) 0%,transparent 60%),radial-gradient(1px 1px at 72% 58%,rgba(200,240,255,.65) 0%,transparent 60%),radial-gradient(1.5px 1.5px at 42% 80%,rgba(220,200,255,.55) 0%,transparent 60%),radial-gradient(1px 1px at 88% 22%,rgba(255,255,255,.6) 0%,transparent 60%),radial-gradient(1px 1px at 12% 70%,rgba(210,190,255,.55) 0%,transparent 60%),radial-gradient(1px 1px at 58% 18%,rgba(255,255,255,.55) 0%,transparent 60%);mix-blend-mode:screen;opacity:.5;animation:flat-map-agent-working-twinkle 1.9s ease-in-out infinite}.flat-map-agent-chip.working .flat-map-agent-chip__dot{position:relative;z-index:2;box-shadow:0 0 6px #4a9effb3;animation:flat-map-agent-working-dot .65s ease-in-out infinite}.flat-map-agent-chip.working .flat-map-agent-chip__name,.flat-map-agent-chip.working .flat-map-agent-chip__provider-icon,.flat-map-agent-chip.working .flat-map-agent-chip__crown{position:relative;z-index:2}@keyframes flat-map-agent-working-shimmer{0%{background-position:150% 0,150% 0}to{background-position:-70% 0,150% 0}}@keyframes flat-map-agent-working-shimmer-2{0%{background-position:150% 0,150% 0}to{background-position:150% 0,-70% 0}}@keyframes flat-map-agent-working-pulse{0%,to{border-color:#4a9eff8c;box-shadow:0 0 6px #4a9eff59,inset 0 0 0 1px #8be9fd00}50%{border-color:#b4faff;box-shadow:0 0 18px #4a9effcc,0 0 30px #8be9fd59,inset 0 0 0 1px #b4faff8c}}@keyframes flat-map-agent-working-beat{0%,to{transform:scale(1)}35%{transform:scale(1.035)}55%{transform:scale(.99)}75%{transform:scale(1.015)}}@keyframes flat-map-agent-working-dot{0%,to{transform:scale(1);box-shadow:0 0 6px #4a9effb3}50%{transform:scale(1.7);box-shadow:0 0 12px #b4faff,0 0 22px #4a9effb3}}@keyframes flat-map-agent-working-iris{0%{border-color:#8be9fdb3}25%{border-color:#b482ffd9}50%{border-color:#ff78dccc}75%{border-color:#ffc878bf}to{border-color:#8be9fdb3}}@keyframes flat-map-agent-working-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes flat-map-agent-working-breath{0%,to{opacity:.3;filter:blur(7px)}40%{opacity:.7;filter:blur(11px)}70%{opacity:.45;filter:blur(8px)}}@keyframes flat-map-agent-working-twinkle{0%,to{opacity:.25;transform:translate(0) scale(.9)}25%{opacity:1;transform:translate(1px,-1px) scale(1.1)}50%{opacity:.55;transform:translate(-1px,1px) scale(.95)}75%{opacity:1;transform:translate(1px,1px) scale(1.15)}}@media(prefers-reduced-motion:reduce){.flat-map-agent-chip.working{animation:flat-map-agent-working-shimmer 5s linear infinite;background-image:linear-gradient(110deg,transparent 40%,rgba(139,233,253,.3) 50%,transparent 60%),linear-gradient(110deg,transparent 40%,rgba(139,233,253,0) 50%,transparent 60%);transform:none}.flat-map-agent-chip.working:before,.flat-map-agent-chip.working:after{animation:none;opacity:.3}.flat-map-agent-chip.working .flat-map-agent-chip__dot{animation:none}}.flat-map-agent-chip__name{min-width:0;overflow:hidden;text-overflow:ellipsis}.flat-map-agent-chip__dot{width:6px;height:6px;border-radius:50%;flex-shrink:0}.flat-map-agent-chip__provider-icon{width:12px;height:12px;object-fit:contain;flex-shrink:0;filter:drop-shadow(0 1px 2px rgba(0,0,0,.25))}.flat-map-agent-chip__crown{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.flat-map-agent-chip__context-bar{position:absolute;left:0;right:0;bottom:0;height:2px;background:#ffffff0f;pointer-events:none}.flat-map-agent-chip__context-bar-fill{display:block;height:100%;transition:width .2s ease,background-color .2s ease}.flat-map-area-card__buildings,.flat-map-area-card__folders{display:flex;flex-wrap:wrap;gap:4px;padding:6px 8px 8px;border-top:1px dashed rgba(255,255,255,.05);margin-top:2px}.flat-map-folder-chip{display:inline-flex;align-items:center;gap:5px;padding:3px 7px;background:#ffffff06;border:1px solid rgba(255,255,255,.06);border-radius:8px;cursor:pointer;color:#9a9caa;font-size:11px;font-family:JetBrains Mono,Fira Code,monospace;text-align:left;transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap;min-width:0;max-width:100%;overflow:hidden}.flat-map-folder-chip:hover{background:#ffffff12;border-color:#ffffff2e;color:#f8f8f2}.flat-map-folder-chip__name{min-width:0;overflow:hidden;text-overflow:ellipsis}.flat-map-building-chip{display:inline-flex;align-items:center;gap:5px;padding:3px 7px;background:#ffffff06;border:1px dashed rgba(255,255,255,.08);border-left:2px solid var(--building-type-color, rgba(255, 255, 255, .08));border-radius:8px;cursor:pointer;color:#9a9caa;font-size:11px;text-align:left;transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap;min-width:0;overflow:hidden}.flat-map-building-chip:hover{background:#ffffff12;border-color:#ffffff2e;border-left-color:var(--building-type-color, rgba(255, 255, 255, .18));color:#f8f8f2}.flat-map-building-chip__name{min-width:0;overflow:hidden;text-overflow:ellipsis}.flat-map-building-chip__dot{width:6px;height:6px;border-radius:50%;flex-shrink:0}.flat-map-building-chip--error{border-color:#ff4a4a66}.flat-map-building-chip--running{border-style:solid;border-color:#4aff9e40}.flat-terminal-wrapper{display:flex;flex-direction:column;height:100%;min-height:0;position:relative;background:#21222c;overflow:hidden;--guake-side-panel-width: 380px}.flat-terminal-wrapper--with-side-panel>*:not(.guake-git-panel):not(.guake-buildings-panel):not(.guake-workflow-panel):not(.agent-debug-panel){margin-right:var(--guake-side-panel-width);transition:margin-right .2s ease}.flat-terminal-wrapper__header{display:flex;flex-direction:row;align-items:center;gap:12px;padding:10px 12px 6px;border-bottom:1px solid rgba(255,255,255,.06);background:#1e1f29;flex-shrink:0;min-height:40px;overflow:visible}.flat-terminal-wrapper__header-main{display:flex;align-items:center;gap:10px;min-width:0;flex:1 1 auto;overflow:visible;padding:4px 6px;margin:0;background:transparent;border:1px solid transparent;border-radius:8px;color:inherit;font:inherit;text-align:left;cursor:pointer;transition:background .15s ease,border-color .15s ease}.flat-terminal-wrapper__header-main:hover{background:#ffffff0a;border-color:#ffffff0f}.flat-terminal-wrapper__header-main--active{background:#bd93f92e;border-color:#bd93f973}.flat-terminal-wrapper__header-main--active:hover{background:#bd93f942}.flat-terminal-wrapper__header-avatar{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;position:relative;width:28px;height:28px;border-radius:8px;overflow:visible;transform-origin:center center;border:1.5px solid transparent;box-sizing:border-box}.flat-terminal-wrapper__header-avatar>*{display:block;width:100%;height:100%;object-fit:cover;border-radius:7px}.flat-terminal-wrapper__header-avatar.is-working{border-color:#8be9fd8c;animation:flat-header-avatar-sway 1.2s ease-in-out infinite!important;z-index:1;will-change:transform;transform-origin:center center}.flat-terminal-wrapper__header-meta{display:flex;align-items:center;justify-content:flex-end;gap:6px;flex:0 0 auto;flex-wrap:nowrap}.flat-terminal-wrapper__statusbar{display:flex;align-items:center;gap:10px;padding:6px 12px;flex-shrink:0;background:#1e1f29;border-top:1px solid rgba(255,255,255,.06);min-height:32px;box-sizing:border-box}.flat-terminal-wrapper__statusbar .flat-terminal-wrapper__cwd,.flat-terminal-wrapper__statusbar .flat-terminal-wrapper__context{background:transparent;border-color:#ffffff0a}.flat-terminal-wrapper__statusbar-spacer{flex:1 1 auto}.flat-terminal-wrapper__buildings{display:inline-flex;align-items:center;gap:4px;padding:2px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px}.flat-terminal-wrapper__building-btn{display:inline-flex;align-items:center;justify-content:center;width:26px;height:22px;padding:0;color:#6272a4;background:transparent;border:none;border-radius:7px;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-terminal-wrapper__building-btn:hover{color:#f8f8f2;background:#ffffff14}.flat-terminal-wrapper__building-btn--offline{color:#ffb86cbf}.flat-terminal-wrapper__building-btn--offline:hover{color:#ffb86c}.flat-terminal-wrapper__building-btn--active{color:#f8f8f2;background:#bd93f947;box-shadow:0 0 0 1px #bd93f973}.flat-terminal-wrapper__building-btn--active:hover{background:#bd93f95c}.flat-terminal-wrapper__building-btn--tests-working{color:#8be9fd;background:#8be9fd24;box-shadow:0 0 0 1px #8be9fd66;animation:flat-tests-glow 1.4s ease-in-out infinite}.flat-terminal-wrapper__building-btn--tests-working svg{animation:flat-tests-shake 1.1s ease-in-out infinite}.flat-terminal-wrapper__building-btn--tests-working:hover{color:#8be9fd;background:#8be9fd38}.flat-terminal-wrapper__detached{display:inline-flex;align-items:center;gap:6px;padding:3px 9px;font-size:11px;font-weight:500;color:#ffb86c;background:#ffb86c1f;border:1px solid rgba(255,184,108,.35);border-radius:10px;animation:blink 1.6s ease-in-out infinite}.flat-terminal-wrapper__area-dir{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;font-size:11px;font-family:SF Mono,Menlo,Consolas,monospace;color:#9a9caa;background:#ffffff08;border:1px solid rgba(255,255,255,.05);border-radius:10px;cursor:pointer;max-width:240px;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:background .15s ease,color .15s ease,border-color .15s ease}.flat-terminal-wrapper__area-dir:hover{background:#ffffff14;color:#f8f8f2;border-color:#ffffff24}.flat-terminal-wrapper__area-dir-name{overflow:hidden;text-overflow:ellipsis}.flat-terminal-wrapper__area-dir-branch{display:inline-flex;align-items:center;gap:3px;color:#8be9fd;opacity:.85}.flat-terminal-wrapper__branch-ahead{display:inline-flex;align-items:center;color:#50fa7b}.flat-terminal-wrapper__branch-behind{display:inline-flex;align-items:center;color:#ffb86c}.flat-terminal-wrapper__area-fetch{display:inline-flex;align-items:center;padding:1px 3px;border-radius:4px;color:#6272a4;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-terminal-wrapper__area-fetch:hover{background:#ffffff14;color:#f8f8f2}.flat-terminal-wrapper__area-fetch--fetching{animation:blink 1s ease-in-out infinite}.flat-terminal-wrapper__context-label{color:#6272a4;margin-right:2px}.flat-terminal-wrapper__context-free{color:#6272a4;font-size:10px}.flat-terminal-wrapper__actions{display:inline-flex;align-items:center;gap:4px;padding:2px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px}.flat-terminal-wrapper__action-btn{display:inline-flex;align-items:center;justify-content:center;width:26px;height:24px;padding:0;font-size:12px;line-height:1;color:#6272a4;background:transparent;border:none;border-radius:7px;cursor:pointer;transition:background .15s ease,color .15s ease,box-shadow .15s ease}.flat-terminal-wrapper__action-btn:hover:not(:disabled){color:#f8f8f2;background:#ffffff0f}.flat-terminal-wrapper__action-btn:disabled{opacity:.35;cursor:not-allowed}.flat-terminal-wrapper__action-btn--active{color:#f8f8f2;background:#bd93f947;box-shadow:0 0 0 1px #bd93f973}.flat-terminal-wrapper__action-btn--active:hover{background:#bd93f95c}.flat-terminal-wrapper__action-btn--danger{color:#ff5555d9}.flat-terminal-wrapper__action-btn--danger:hover{color:#f55;background:#ff55551f}.flat-terminal-wrapper__action-btn--confirm{color:#f55;background:#ff55552e;box-shadow:0 0 0 1px #ff555580;animation:blink 1s ease-in-out infinite}.flat-terminal-wrapper__more{position:relative;display:inline-flex}.flat-terminal-wrapper__more-menu{position:absolute;top:calc(100% + 4px);right:0;min-width:220px;padding:4px;background:#363848;border:1px solid rgba(255,255,255,.08);border-radius:8px;box-shadow:0 8px 28px #00000073;z-index:100}.flat-terminal-wrapper__more-item{display:flex;align-items:center;gap:8px;width:100%;padding:6px 10px;font-size:12px;color:#f8f8f2;background:transparent;border:none;border-radius:6px;cursor:pointer;text-align:left;transition:background .15s ease,color .15s ease}.flat-terminal-wrapper__more-item:hover:not(:disabled){background:#ffffff0f}.flat-terminal-wrapper__more-item:disabled{opacity:.45;cursor:not-allowed}.flat-terminal-wrapper__more-item--danger{color:#ff5555e6}.flat-terminal-wrapper__more-item--danger:hover:not(:disabled){color:#f55;background:#ff55551f}.flat-terminal-wrapper__more-divider{height:1px;margin:4px 2px;background:#ffffff0f}.flat-terminal-wrapper__header-info{display:flex;flex-direction:row;align-items:center;gap:6px;min-width:0;flex:1 1 auto;overflow:hidden}.flat-terminal-wrapper__header-name{font-size:13px;font-weight:600;color:#f8f8f2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;flex:1 1 auto}.flat-terminal-wrapper__header-status{font-size:10px;text-transform:capitalize;flex-shrink:0}.flat-terminal-wrapper__header-task{font-size:11px;color:#6272a4;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:2px 8px;border-radius:10px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);flex-shrink:1}.flat-terminal-wrapper__header-model{display:inline-flex;align-items:center;gap:6px;flex-shrink:0;min-width:0}.flat-terminal-wrapper__header-provider-icon{width:16px;height:16px;object-fit:contain;flex-shrink:0;filter:drop-shadow(0 1px 2px rgba(0,0,0,.25))}.flat-terminal-wrapper__header-model-chip{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;font-size:10px;font-family:SF Mono,Menlo,Consolas,monospace;font-weight:600;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:999px;white-space:nowrap;max-width:180px;overflow:hidden;text-overflow:ellipsis;line-height:1.4}.flat-terminal-wrapper__header-model-name{color:#f8f8f2;text-transform:lowercase;overflow:hidden;text-overflow:ellipsis}.flat-terminal-wrapper__header-model-sep{opacity:.6}.flat-terminal-wrapper__header-model-effort{color:#bd93f9;text-transform:lowercase}.flat-terminal-wrapper__cwd{display:inline-flex;align-items:center;gap:6px;padding:4px 9px;font-size:11px;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;max-width:240px;transition:background .15s ease,border-color .15s ease,color .15s ease}.flat-terminal-wrapper__cwd:hover{background:#ffffff14;border-color:#ffffff24;color:#f8f8f2}.flat-terminal-wrapper__cwd-icon{font-size:12px;line-height:1}.flat-terminal-wrapper__cwd-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:SF Mono,Menlo,Consolas,monospace}.flat-terminal-wrapper__context{display:inline-flex;align-items:center;gap:6px;padding:4px 9px;font-size:11px;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;transition:background .15s ease,border-color .15s ease}.flat-terminal-wrapper__context:hover{background:#ffffff14;border-color:#ffffff24}.flat-terminal-wrapper__context-icon{font-size:12px;line-height:1}.flat-terminal-wrapper__context-bar{position:relative;width:56px;height:5px;border-radius:3px;background:#ffffff14;overflow:hidden}.flat-terminal-wrapper__context-bar-fill{position:absolute;left:0;top:0;height:100%;border-radius:3px;transition:width .2s ease,background-color .2s ease}.flat-terminal-wrapper__context-tokens{font-family:SF Mono,Menlo,Consolas,monospace;font-size:11px;font-weight:600;font-variant-numeric:tabular-nums}.flat-terminal-wrapper__context-warning{font-size:11px;opacity:.8}.flat-terminal-wrapper__view-mode{display:inline-flex;align-items:center;padding:2px;gap:2px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px}.flat-terminal-wrapper__view-mode-btn{display:inline-flex;align-items:center;gap:5px;padding:4px 9px;font-size:11px;font-weight:500;color:#6272a4;background:transparent;border:none;border-radius:8px;cursor:pointer;transition:background .15s ease,color .15s ease,box-shadow .15s ease}.flat-terminal-wrapper__view-mode-btn:hover{color:#f8f8f2;background:#ffffff0a}.flat-terminal-wrapper__view-mode-btn--active{color:#f8f8f2;background:#bd93f947;box-shadow:0 0 0 1px #bd93f980,0 1px 3px #00000040}.flat-terminal-wrapper__view-mode-btn--active:hover{background:#bd93f95c}.flat-terminal-wrapper__view-mode-icon{font-size:13px;line-height:1}.flat-terminal-wrapper__view-mode-label{line-height:1}.flat-terminal-wrapper__theme{display:inline-flex;align-items:center}.flat-terminal-wrapper__theme .theme-selector-trigger{padding:4px 9px;font-size:11px;border-radius:10px;background:#ffffff0a;border:1px solid rgba(255,255,255,.06)}.flat-terminal-wrapper__theme .theme-selector-trigger:hover{background:#ffffff14;border-color:#ffffff24}.flat-terminal-wrapper__inspector-toggle{display:inline-flex;align-items:center;gap:5px;padding:4px 9px;font-size:11px;font-weight:500;color:#9a9caa;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;transition:background .15s ease,border-color .15s ease,color .15s ease,box-shadow .15s ease}.flat-terminal-wrapper__inspector-toggle:hover{color:#f8f8f2;background:#ffffff14;border-color:#ffffff24}.flat-terminal-wrapper__inspector-toggle--active{color:#f8f8f2;background:#bd93f938;border-color:#bd93f98c;box-shadow:0 0 0 1px #bd93f959,0 1px 3px #00000040}.flat-terminal-wrapper__inspector-toggle--active:hover{background:#bd93f952}.flat-terminal-wrapper__inspector-icon{display:inline-flex;align-items:center;justify-content:center;line-height:1}.flat-terminal-wrapper__inspector-label{line-height:1}.flat-terminal-wrapper__close{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;color:#6272a4;background:#ffffff0a;border:1px solid rgba(255,255,255,.06);border-radius:10px;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.flat-terminal-wrapper__close:hover{color:#f55;background:#ff55551f;border-color:#f556}@media(max-width:1100px){.flat-terminal-wrapper__view-mode-label,.flat-terminal-wrapper__inspector-label{display:none}.flat-terminal-wrapper__cwd{max-width:160px}}.flat-terminal-wrapper .guake-output{flex:1 1 auto;min-height:0;overflow-y:auto;padding:14px 18px}.flat-terminal-wrapper .guake-output::-webkit-scrollbar{width:6px}.flat-terminal-wrapper .guake-output::-webkit-scrollbar-track{background:transparent}.flat-terminal-wrapper .guake-output::-webkit-scrollbar-thumb{background:#ffffff1a;border-radius:3px}.flat-terminal-wrapper .guake-input-container{position:relative;flex-shrink:0;border-top:1px solid rgba(255,255,255,.06);background:#1e1f29}.flat-terminal-wrapper .guake-search-bar,.flat-terminal-wrapper .atp-search-bar{position:sticky;top:0;z-index:10;background:#1e1f29}.flat-terminal-wrapper .guake-handle,.flat-terminal-wrapper .atp-resize-handle{display:none}.flat-terminal-wrapper .compacting-indicator{padding:12px;margin:8px}@keyframes blink{0%,to{opacity:1}50%{opacity:.3}}.flat-inspector{display:flex;flex-direction:column;min-width:0;min-height:0;height:100%;background:#1e1f29;border-left:1px solid rgba(255,255,255,.06);overflow:hidden;animation:flat-inspector-slide-in .22s ease}.flat-inspector__header{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:1px solid rgba(255,255,255,.06);background:#21222c;flex-shrink:0}.flat-inspector__tabs{display:inline-flex;align-items:center;gap:4px;padding:2px;background:#00000040;border:1px solid rgba(255,255,255,.06);border-radius:6px}.flat-inspector__tab{padding:4px 10px;font-size:12px;font-weight:500;color:#6272a4;background:transparent;border:none;border-radius:4px;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-inspector__tab:hover{color:#f8f8f2}.flat-inspector__tab--active{color:#f8f8f2;background:#ffffff14}.flat-inspector__close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;font-size:13px;color:#6272a4;background:transparent;border:1px solid transparent;border-radius:6px;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.flat-inspector__close:hover{color:#f8f8f2;background:#ffffff0f;border-color:#ffffff1a}.flat-inspector__body{flex:1 1 auto;min-height:0;min-width:0;overflow-y:auto;overflow-x:hidden;display:flex;flex-direction:column}.flat-inspector__body .unit-panel{flex:1 1 auto;min-height:0;min-width:0;padding:10px}.flat-inspector__empty{display:flex;align-items:center;justify-content:center;flex:1;color:#6272a4;font-size:13px}@keyframes flat-inspector-slide-in{0%{opacity:0;transform:translate(12px)}to{opacity:1;transform:translate(0)}}.flat-mobile-sidebar-toggle,.flat-mobile-sidebar-backdrop{display:none}@media(max-width:1024px){.flat-view,.flat-view--with-inspector{grid-template-columns:1fr}.flat-splitter{display:none}.flat-right{grid-column:1/-1}.flat-right>.flat-terminal-wrapper,.flat-right>.flat-chat{flex:1 1 auto;min-height:0;height:auto}.flat-middle{position:fixed;top:0;left:0;bottom:0;width:min(380px,92vw);z-index:185;transform:translate(-110%);transition:transform .22s ease;border-right:1px solid rgba(255,255,255,.08);box-shadow:6px 0 32px #0009}.flat-view--mobile-sidebar-open .flat-middle{transform:translate(0)}.flat-mobile-sidebar-toggle{display:inline-flex;align-items:center;gap:8px;align-self:flex-start;margin:10px 12px 0;padding:8px 12px;font-size:12px;font-weight:500;color:#f8f8f2;background:#363848f2;border:1px solid rgba(255,255,255,.08);border-radius:10px;cursor:pointer;min-height:36px;flex-shrink:0;transition:background .15s ease,border-color .15s ease}.flat-mobile-sidebar-toggle:hover,.flat-mobile-sidebar-toggle:active{background:#bd93f947;border-color:#bd93f980}.flat-mobile-sidebar-toggle__label{line-height:1}.flat-mobile-sidebar-backdrop{display:block;position:fixed;top:0;right:0;bottom:0;left:0;z-index:184;background:#000000ad;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);animation:flat-inspector-fade-in .18s ease}.flat-inspector{position:fixed;top:0;right:0;bottom:0;left:0;z-index:186;border-left:none;animation:none;transform:translate(100%);transition:transform .22s ease}.flat-inspector--open{transform:translate(0)}.flat-inspector--closing{transform:translate(100%)}}@media(max-width:768px){.app.view-mode-flat .mobile-fab-toggle,.app.view-mode-flat .mobile-fab-menu,.app.view-mode-flat .voice-assistant-btn.mobile-voice-assistant{display:none!important}.app.view-mode-flat .flat-view{padding-left:0}.app.view-mode-flat .main-content{height:calc(100% - var(--mobile-bottom-stack-height, 72px))!important;max-height:calc(100% - var(--mobile-bottom-stack-height, 72px))!important;overflow:hidden}.app.view-mode-flat .flat-terminal-wrapper__header,.app.view-mode-flat .flat-inspector__header,.app.view-mode-flat .flat-middle__header,.app.view-mode-flat .flat-map__header{padding-top:calc(6px + env(safe-area-inset-top,0px))}.app.view-mode-flat .flat-inspector__body,.app.view-mode-flat .flat-middle__content{padding-bottom:var(--mobile-bottom-stack-height, 72px)}.flat-view{padding-left:56px}.flat-middle__header{flex-wrap:wrap;padding:10px 12px;gap:8px}.flat-middle__content{padding:8px}.flat-cta-btn{padding:8px 10px;font-size:11px;min-height:34px}.flat-chat--empty{align-items:stretch;justify-content:flex-start}.flat-map{width:100%;padding:10px 12px;gap:8px;overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch;touch-action:pan-y}.flat-map__grid{width:100%;gap:6px}.flat-map-area-card__header{padding:8px 6px;gap:4px;min-height:36px}.flat-map-area-card__name{font-size:11px}.flat-map-area-card__count{font-size:9px;padding:0 4px}.flat-map-area-card__caret{flex-shrink:0;margin-left:auto;opacity:.7}.flat-map-area-card--collapsed .flat-map-area-card__agents,.flat-map-area-card--collapsed .flat-map-area-card__buildings,.flat-map-area-card--collapsed .flat-map-area-card__folders{display:none}.flat-map-area-card:not(.flat-map-area-card--collapsed){grid-column:1/-1!important}.flat-map-area-card__agents{gap:6px}.flat-map-agent-chip{padding:7px 10px 9px;font-size:12px;min-height:34px}.flat-terminal-wrapper__header{flex-wrap:nowrap;padding:10px 10px 6px;gap:8px;min-height:40px;overflow:visible}.flat-terminal-wrapper__header-main{flex:1 1 auto;min-width:0;overflow:hidden}.flat-terminal-wrapper__header-info{min-width:0;flex:1 1 auto}.flat-terminal-wrapper__header-name{flex:1 1 auto;min-width:0}.flat-terminal-wrapper__header-status{font-size:9px;padding:1px 6px;border-radius:999px;background:#ffffff0f;max-width:72px;overflow:hidden;text-overflow:ellipsis}.flat-terminal-wrapper__header-model{display:none}.flat-terminal-wrapper__header-meta{flex:0 0 auto;justify-content:flex-end;flex-wrap:nowrap;gap:4px}.flat-terminal-wrapper__header-task{display:none}.flat-terminal-wrapper__header-avatar,.flat-terminal-wrapper__header-avatar>*{width:32px;height:32px}.flat-terminal-wrapper__action-btn,.flat-terminal-wrapper__building-btn{min-width:36px;min-height:36px}.flat-terminal-wrapper__statusbar{flex-wrap:wrap;padding:6px 10px;gap:6px;row-gap:6px}.flat-terminal-wrapper__action-btn,.flat-terminal-wrapper__building-btn,.flat-terminal-wrapper__close{width:28px;height:28px}.flat-terminal-wrapper__inspector-toggle{padding:4px 6px}.flat-terminal-wrapper__inspector-label{display:none}.flat-terminal-wrapper__actions{flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none}.flat-terminal-wrapper__actions::-webkit-scrollbar{display:none}.flat-terminal-wrapper{--guake-side-panel-width: 100%;background:var(--bg-primary)}.flat-right{background:var(--bg-primary)}.flat-terminal-wrapper--with-side-panel>*:not(.guake-git-panel):not(.guake-buildings-panel):not(.guake-workflow-panel):not(.agent-debug-panel){margin-right:0}.flat-terminal-wrapper .guake-git-panel,.flat-terminal-wrapper .guake-buildings-panel,.flat-terminal-wrapper .guake-workflow-panel,.flat-terminal-wrapper .agent-debug-panel{width:100%}.flat-bottom-panel{height:180px}.flat-terminal-wrapper__view-mode{display:none}.flat-terminal-wrapper__actions .flat-terminal-wrapper__action-btn:nth-child(1),.flat-terminal-wrapper__actions .flat-terminal-wrapper__action-btn:nth-child(2){display:none}.flat-terminal-wrapper__close,.flat-terminal-wrapper__statusbar,.app.view-mode-flat .flat-mobile-sidebar-toggle,.app.view-mode-flat .flat-terminal-wrapper__inspector-toggle{display:none}}@media(max-width:480px){.flat-view{padding-left:52px}.flat-middle{width:100vw;max-width:100vw;box-shadow:none}.flat-middle__header{padding:8px 10px}.flat-middle__actions{gap:4px}.flat-cta-btn{padding:6px 8px;font-size:10px;min-height:32px}.flat-map-area-card__header{padding:8px 10px;font-size:13px}.flat-map-agent-chip{font-size:12px;padding:6px 8px 8px}.flat-terminal-wrapper__header-name{font-size:12px}.flat-terminal-wrapper__header-model-chip{font-size:9px;max-width:130px}.flat-inspector__body{padding-bottom:env(safe-area-inset-bottom,0)}}@media(min-width:1400px){.flat-view{--flat-middle-width: minmax(280px, 400px);--flat-inspector-width: 360px}}@keyframes flat-inspector-fade-in{0%{opacity:0}to{opacity:1}}.flat-classic-terminal{flex:1 1 auto;min-height:0;display:flex;position:relative;overflow:hidden;background:#1a1a2e}.flat-classic-terminal .guake-bottom-terminal-embed{flex:1 1 auto;width:100%;height:100%;min-height:0}.flat-classic-terminal--message{align-items:center;justify-content:center;color:#6272a4;font-size:13px}.flat-bottom-panel{display:flex;flex-direction:column;flex-shrink:0;height:250px;min-height:0;background:#1e1f29;border-top:1px solid rgba(255,255,255,.08);overflow:hidden}.flat-bottom-panel__header{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:4px 10px;background:#21222c;border-bottom:1px solid rgba(255,255,255,.06);flex-shrink:0;min-height:28px}.flat-bottom-panel__title{display:inline-flex;align-items:center;gap:6px;font-size:11px;font-weight:500;color:#f8f8f2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.flat-bottom-panel__muted{color:#6272a4;font-weight:400;font-size:10px}.flat-bottom-panel__header-actions{display:inline-flex;align-items:center;gap:2px;flex-shrink:0}.flat-bottom-panel__close{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;color:#6272a4;background:transparent;border:none;border-radius:6px;cursor:pointer;transition:background .15s ease,color .15s ease}.flat-bottom-panel__close:hover{color:#f8f8f2;background:#ffffff14}.flat-bottom-panel__body{flex:1 1 auto;min-height:0;display:flex;background:#282a36}.flat-bottom-panel__body>*{flex:1 1 auto;min-height:0}.flat-bottom-panel__placeholder{flex:1 1 auto;display:flex;align-items:center;justify-content:center;color:#6272a4;font-size:12px}@keyframes flat-tests-shake{0%,to{transform:rotate(0)}20%{transform:rotate(-14deg)}40%{transform:rotate(10deg)}60%{transform:rotate(-7deg)}80%{transform:rotate(4deg)}}@keyframes flat-tests-glow{0%,to{box-shadow:0 0 0 1px #8be9fd4d}50%{box-shadow:0 0 6px 1px #8be9fdb3}}@keyframes flat-header-avatar-sway{0%,to{transform:rotate(0)}25%{transform:rotate(-8deg)}75%{transform:rotate(8deg)}}
|