tide-commander 1.48.0 → 1.49.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.
Files changed (49) hide show
  1. package/dist/assets/{BossLogsModal-CFwfed1-.js → BossLogsModal-buht3LyW.js} +1 -1
  2. package/dist/assets/{BossSpawnModal-DUQ6HEgW.js → BossSpawnModal-D7M1JocE.js} +1 -1
  3. package/dist/assets/{ControlsModal-BU8Ip7nq.js → ControlsModal-C3-j1E6y.js} +1 -1
  4. package/dist/assets/{DockerLogsModal-CbYYg1sc.js → DockerLogsModal-CA2j24QX.js} +1 -1
  5. package/dist/assets/{EmbeddedEditor-C_REDOwe.js → EmbeddedEditor-CrLtAaIO.js} +1 -1
  6. package/dist/assets/GmailOAuthSetup-CG2BmCyg.js +303 -0
  7. package/dist/assets/GoogleOAuthSetup-DlaXAoyq.js +236 -0
  8. package/dist/assets/{IframeModal-Ca7ZWrHU.js → IframeModal-CvJ6LEIu.js} +1 -1
  9. package/dist/assets/IntegrationsPanel-iTByepHj.js +2 -0
  10. package/dist/assets/{LogViewerModal-DnCVSAMs.js → LogViewerModal-C75Yyse9.js} +1 -1
  11. package/dist/assets/{MonitoringModal-Cu8Kz_D_.js → MonitoringModal-C3NapNrP.js} +1 -1
  12. package/dist/assets/{PM2LogsModal-DTBPwViK.js → PM2LogsModal-CaacRI13.js} +1 -1
  13. package/dist/assets/{RestoreArchivedAreaModal-C7ym_R1q.js → RestoreArchivedAreaModal-mwQqJ4qp.js} +1 -1
  14. package/dist/assets/{SaveSnapshotModal-Byqak-Tf.js → SaveSnapshotModal-Didvj3hf.js} +1 -1
  15. package/dist/assets/{Scene2DCanvas-Bzggyv_C.js → Scene2DCanvas-chSGLBlj.js} +1 -1
  16. package/dist/assets/{SceneManager-CzgjrwbM.js → SceneManager-G0H-cWU4.js} +1 -1
  17. package/dist/assets/{SkillsPanel-Djr7DSvf.js → SkillsPanel-nKzb0E59.js} +1 -1
  18. package/dist/assets/{SnapshotManager-BfGQUnsS.js → SnapshotManager-DoQRZCNb.js} +1 -1
  19. package/dist/assets/{SpawnModal-BbKpL82w.js → SpawnModal-CPTZGYNR.js} +1 -1
  20. package/dist/assets/{SubordinateAssignmentModal-B1TZX27W.js → SubordinateAssignmentModal-B2XP8wZU.js} +1 -1
  21. package/dist/assets/{SupervisorPanel-PK5vEWzs.js → SupervisorPanel-LlgMdGCQ.js} +1 -1
  22. package/dist/assets/{TriggerManagerPanel-DVK-bbLW.js → TriggerManagerPanel-DMiK0_y5.js} +1 -1
  23. package/dist/assets/{WorkflowEditorPanel-Brdqd-Ad.js → WorkflowEditorPanel-DPwmjV2f.js} +1 -1
  24. package/dist/assets/{index-B5tIXl_r.js → index-BCuYxI5F.js} +2 -2
  25. package/dist/assets/{index-BExjQf95.js → index-BIt0Cgpm.js} +1 -1
  26. package/dist/assets/{index-BF9QVox6.js → index-BM1s5vTS.js} +3 -3
  27. package/dist/assets/{index--5OtsLD2.js → index-CG-I_YeN.js} +1 -1
  28. package/dist/assets/{index-wIjtXnz9.js → index-CxEHgPe3.js} +1 -1
  29. package/dist/assets/{index-BgUdbPaM.js → index-D33VRpYX.js} +1 -1
  30. package/dist/assets/{index-BP3hr2mC.js → index-DYwDeYnm.js} +1 -1
  31. package/dist/assets/{index-RJgcrQXD.js → index-XXW1ctrV.js} +1 -1
  32. package/dist/assets/{main-CMpDB4wb.js → main-D-o_EGqJ.js} +4 -4
  33. package/dist/assets/{web-N6EXBTZp.js → web-Blb26Kj7.js} +1 -1
  34. package/dist/assets/{web-BN1vvWmX.js → web-hHpxvpTK.js} +1 -1
  35. package/dist/index.html +1 -1
  36. package/dist/src/packages/server/data/event-queries.js +15 -0
  37. package/dist/src/packages/server/data/migrations/005_drive_actions.sql +19 -0
  38. package/dist/src/packages/server/index.js +1 -0
  39. package/dist/src/packages/server/integrations/gmail/index.js +8 -6
  40. package/dist/src/packages/server/integrations/google-drive/drive-client.js +605 -0
  41. package/dist/src/packages/server/integrations/google-drive/drive-config.js +127 -0
  42. package/dist/src/packages/server/integrations/google-drive/drive-routes.js +365 -0
  43. package/dist/src/packages/server/integrations/google-drive/drive-skill.js +248 -0
  44. package/dist/src/packages/server/integrations/google-drive/index.js +60 -0
  45. package/dist/src/packages/server/integrations/integration-registry.js +2 -0
  46. package/package.json +1 -1
  47. package/dist/assets/GmailOAuthSetup-DjgTvBxC.js +0 -270
  48. package/dist/assets/GoogleOAuthSetup-Cg9TpR8P.js +0 -203
  49. package/dist/assets/IntegrationsPanel-8a2TGZA7.js +0 -2
@@ -1 +1 @@
1
- import{u as M,f as N,r as m,s as u,j as r}from"./main-CMpDB4wb.js";import{L as v}from"./LogViewerModal-DnCVSAMs.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function C(o){const n=["#3498db","#2ecc71","#9b59b6","#e67e22","#1abc9c","#e74c3c","#f1c40f","#00bcd4"];let a=0;for(let t=0;t<o.length;t++)a=o.charCodeAt(t)+((a<<5)-a);return n[Math.abs(a)%n.length]}function w({building:o,isOpen:n,onClose:a}){const{t}=M(["terminal","common"]),{bossStreamingLogs:b,buildings:f}=N(),l=b.get(o.id)||[],[i,d]=m.useState(null),c=o.subordinateBuildingIds||[],g=c.map(e=>f.get(e)).filter(e=>e!==void 0);m.useEffect(()=>(n&&c.length>0&&u.startBossLogStreaming(o.id),()=>{o.id&&u.stopBossLogStreaming(o.id)}),[n,o.id,c.length]);const h=m.useMemo(()=>{const e=new Set;return l.forEach(s=>e.add(s.subordinateName)),Array.from(e)},[l]),p=m.useMemo(()=>(i?l.filter(s=>s.subordinateName===i):l).map((s,j)=>({text:s.chunk,lineNumber:j+1,sourceLabel:s.subordinateName,sourceColor:C(s.subordinateName),isError:s.isError})),[l,i]),x=g.some(e=>{var s;return(s=e.pm2)==null?void 0:s.enabled}),S=h.length>1?r.jsxs("select",{className:"toolbar-btn source-filter",value:i||"",onChange:e=>d(e.target.value||null),children:[r.jsx("option",{value:"",children:t("terminal:logs.allSources")}),h.map(e=>r.jsx("option",{value:e,children:e},e))]}):void 0,L=i?r.jsxs("div",{className:"shortcut",style:{marginLeft:"auto"},children:[r.jsxs("span",{children:[t("terminal:logs.filtered"),": ",i]}),r.jsx("button",{style:{background:"transparent",border:"none",color:"inherit",cursor:"pointer",marginLeft:"0.5rem"},onClick:()=>d(null),children:"x"})]}):void 0;return r.jsx(v,{isOpen:n,onClose:a,title:`${o.name} - ${t("terminal:logs.bossLogs")}`,icon:"👑",lines:p,isStreaming:c.length>0,streamingIndicatorLabel:`${g.length} ${t("terminal:logs.units")}`,onClear:()=>u.clearBossStreamingLogs(o.id),emptyMessage:x?l.length===0?t("terminal:logs.waitingForLogs"):t("terminal:logs.noMatchingLogs"):t("terminal:logs.noPM2Subordinates"),extraToolbar:S,extraFooter:L,modalClassName:"boss-logs-modal"})}export{w as BossLogsModal};
1
+ import{u as M,f as N,r as m,s as u,j as r}from"./main-D-o_EGqJ.js";import{L as v}from"./LogViewerModal-C75Yyse9.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function C(o){const n=["#3498db","#2ecc71","#9b59b6","#e67e22","#1abc9c","#e74c3c","#f1c40f","#00bcd4"];let a=0;for(let t=0;t<o.length;t++)a=o.charCodeAt(t)+((a<<5)-a);return n[Math.abs(a)%n.length]}function w({building:o,isOpen:n,onClose:a}){const{t}=M(["terminal","common"]),{bossStreamingLogs:b,buildings:f}=N(),l=b.get(o.id)||[],[i,d]=m.useState(null),c=o.subordinateBuildingIds||[],g=c.map(e=>f.get(e)).filter(e=>e!==void 0);m.useEffect(()=>(n&&c.length>0&&u.startBossLogStreaming(o.id),()=>{o.id&&u.stopBossLogStreaming(o.id)}),[n,o.id,c.length]);const h=m.useMemo(()=>{const e=new Set;return l.forEach(s=>e.add(s.subordinateName)),Array.from(e)},[l]),p=m.useMemo(()=>(i?l.filter(s=>s.subordinateName===i):l).map((s,j)=>({text:s.chunk,lineNumber:j+1,sourceLabel:s.subordinateName,sourceColor:C(s.subordinateName),isError:s.isError})),[l,i]),x=g.some(e=>{var s;return(s=e.pm2)==null?void 0:s.enabled}),S=h.length>1?r.jsxs("select",{className:"toolbar-btn source-filter",value:i||"",onChange:e=>d(e.target.value||null),children:[r.jsx("option",{value:"",children:t("terminal:logs.allSources")}),h.map(e=>r.jsx("option",{value:e,children:e},e))]}):void 0,L=i?r.jsxs("div",{className:"shortcut",style:{marginLeft:"auto"},children:[r.jsxs("span",{children:[t("terminal:logs.filtered"),": ",i]}),r.jsx("button",{style:{background:"transparent",border:"none",color:"inherit",cursor:"pointer",marginLeft:"0.5rem"},onClick:()=>d(null),children:"x"})]}):void 0;return r.jsx(v,{isOpen:n,onClose:a,title:`${o.name} - ${t("terminal:logs.bossLogs")}`,icon:"👑",lines:p,isStreaming:c.length>0,streamingIndicatorLabel:`${g.length} ${t("terminal:logs.units")}`,onClear:()=>u.clearBossStreamingLogs(o.id),emptyMessage:x?l.length===0?t("terminal:logs.waitingForLogs"):t("terminal:logs.noMatchingLogs"):t("terminal:logs.noPM2Subordinates"),extraToolbar:S,extraFooter:L,modalClassName:"boss-logs-modal"})}export{w as BossLogsModal};
@@ -1 +1 @@
1
- import{u as Ae,f as Le,N as Ee,M as Ie,r as t,U as _e,S as ee,l as De,V as O,A as se,a3 as T,a4 as j,j as s,C as S,X as Be,Z as Re,_ as P,$ as g,a0 as E,a2 as Oe,s as Te}from"./main-CMpDB4wb.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function ae(m){const h=j.filter(C=>!m.has(`Boss ${C}`));return h.length===0?`Boss ${j[Math.floor(Math.random()*j.length)]}-${Date.now()%1e3}`:`Boss ${h[Math.floor(Math.random()*h.length)]}`}function ze({isOpen:m,onClose:h,onSpawnStart:C,onSpawnEnd:I,spawnPosition:ne}){const{t:n}=Ae(["terminal","common"]),{agents:k}=Le(),o=Ee(),M=Ie(),[r,p]=t.useState(""),[y,le]=t.useState(()=>_e(ee.LAST_CWD)),[c,_]=t.useState("boss"),[U,q]=t.useState(!1),[te,$]=t.useState(!1),[F,ie]=t.useState(!0),[z,ce]=t.useState("bypass"),[d,D]=t.useState("claude"),[b,N]=t.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[W,oe]=t.useState("claude-opus-4-7"),[G,re]=t.useState("gpt-5.3-codex"),[v,A]=t.useState(new Set),[K,B]=t.useState(new Set),[u,de]=t.useState(""),[f,pe]=t.useState(""),[H,ue]=t.useState(""),L=t.useRef(null),R=t.useRef(!1),J=t.useRef(!1),x=t.useMemo(()=>M.filter(e=>e.enabled),[M]),V=t.useMemo(()=>{if(!f.trim())return x;const e=f.toLowerCase();return x.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.slug.toLowerCase().includes(e))},[x,f]),me=t.useMemo(()=>{var a;const e=o.find(l=>l.id===c);return(a=e==null?void 0:e.defaultSkillIds)!=null&&a.length?M.filter(l=>e.defaultSkillIds.includes(l.id)):[]},[o,c,M]),he=["full-notifications","streaming-exec","task-label","report-task-to-boss"];t.useEffect(()=>{if(m&&!J.current&&x.length>0){const a=x.filter(l=>he.includes(l.slug)).map(l=>l.id);a.length>0&&B(new Set(a))}J.current=m},[m,x]);const we=t.useCallback(e=>{B(a=>{const l=new Set(a);return l.has(e)?l.delete(e):l.add(e),l})},[]),i=t.useMemo(()=>o.find(e=>e.id===c),[o,c]),xe=t.useMemo(()=>{if(i!=null&&i.model)return i.model},[i]),be=t.useMemo(()=>{if(i!=null&&i.customModelPath)return De(`/api/custom-models/${i.id}`)},[i]),fe=i==null?void 0:i.modelScale,je=t.useMemo(()=>i?"scout":c==="boss"?"architect":c,[c,i]),X=Array.from(k.values()).filter(e=>!e.isBoss&&e.class!=="boss"&&!e.bossId),Y=t.useMemo(()=>{if(!u.trim())return o;const e=u.toLowerCase();return o.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.id.toLowerCase().includes(e))},[o,u]),Z=t.useMemo(()=>{if(!u.trim())return O;const e=u.toLowerCase();return O.filter(a=>{const l=se[a.id];return l?a.name.toLowerCase().includes(e)||a.id.toLowerCase().includes(e)||l.description.toLowerCase().includes(e):!1})},[u]),Q=t.useMemo(()=>{if(!u.trim())return!0;const e=u.toLowerCase(),a=T.boss;return"boss".includes(e)||a.description.toLowerCase().includes(e)},[u]);t.useEffect(()=>{if(m&&!R.current){R.current=!0;const e=new Set(Array.from(k.values()).map(l=>l.name)),a=o.find(l=>l.id===c);if(a){const l=j.filter(w=>!e.has(`${a.name} ${w}`));if(l.length===0){const w=j[Math.floor(Math.random()*j.length)];p(`${a.name} ${w}-${Date.now()%1e3}`)}else p(`${a.name} ${l[Math.floor(Math.random()*l.length)]}`)}else p(ae(e));A(new Set),L.current&&(L.current.focus(),L.current.select())}else m||(R.current=!1)},[m,k]),t.useEffect(()=>{if(!m)return;const e=o.find(a=>a.id===c);if(e)if(r.startsWith("Boss ")){const a=r.substring(5);p(`${e.name} ${a}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);p(`${e.name} ${l}`)}else p(`${e.name} ${r}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);p(`Boss ${l}`)}else r.startsWith("Boss ")||p(`Boss ${r}`)}},[c]);const Ne=()=>{if($(!1),!y.trim()){$(!0);return}if(!r.trim()){const l=new Set(Array.from(k.values()).map(w=>w.name));p(ae(l));return}Oe(ee.LAST_CWD,y),C();const e=H.trim()||void 0,a=Array.from(K);Te.spawnBossAgent(r.trim(),c,y.trim(),ne||void 0,Array.from(v),d==="claude"?F:!1,z,d,d==="codex"?b:void 0,d==="codex"?G:void 0,d==="claude"?W:void 0,e,a),p(""),A(new Set),B(new Set),I(),h()},ve=()=>{q(!1),p(""),A(new Set),I(),h()},Se=()=>{q(!1),$(!0),I()};t.useEffect(()=>(window.__bossSpawnModalSuccess=ve,window.__bossSpawnModalError=Se,()=>{delete window.__bossSpawnModalSuccess,delete window.__bossSpawnModalError}),[r]);const ge=e=>{e.target===e.currentTarget&&h()},Ce=e=>{e.key==="Escape"&&h()},ke=e=>{const a=new Set(v);a.has(e)?a.delete(e):a.add(e),A(a)};if(!m)return null;const Me=T.boss;return s.jsx("div",{className:`modal-overlay ${m?"visible":""}`,onClick:ge,onKeyDown:Ce,children:s.jsxs("div",{className:"modal boss-spawn-modal",children:[s.jsxs("div",{className:"modal-header",children:[s.jsx(S,{classId:"boss",size:22,className:"boss-header-icon"}),n("terminal:spawn.deployBossTitle")]}),s.jsxs("div",{className:"modal-body spawn-modal-body",children:[s.jsxs("div",{className:"spawn-top-section",children:[s.jsx("div",{className:"spawn-preview-compact",children:s.jsx(Be,{agentClass:je,modelFile:xe,customModelUrl:be,modelScale:fe,width:100,height:120})}),s.jsxs("div",{className:"spawn-class-section",children:[s.jsx("div",{className:"spawn-class-label",children:n("terminal:spawn.bossClass")}),o.length+O.length+1>6&&s.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:n("terminal:spawn.filterClasses"),value:u,onChange:e=>de(e.target.value)}),s.jsxs("div",{className:"class-selector-inline",children:[Y.map(e=>s.jsxs("button",{className:`class-chip ${c===e.id?"selected":""}`,onClick:()=>_(e.id),title:e.description,children:[s.jsx(S,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),Q&&s.jsxs("button",{className:`class-chip ${c==="boss"?"selected":""}`,onClick:()=>_("boss"),title:Me.description,children:[s.jsx(S,{classId:"boss",size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:n("terminal:spawn.bossClassName")})]}),Z.map(e=>{const a=se[e.id];return a?s.jsxs("button",{className:`class-chip ${c===e.id?"selected":""}`,onClick:()=>_(e.id),title:a.description,children:[s.jsx(S,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id):null}),u&&Y.length===0&&!Q&&Z.length===0&&s.jsx("div",{className:"class-search-empty",children:n("terminal:spawn.noClassesMatch",{query:u})})]})]})]}),s.jsxs("div",{className:"spawn-form-section",children:[s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.name")}),s.jsx("input",{ref:L,type:"text",className:"spawn-input",placeholder:n("terminal:spawn.bossNamePlaceholder"),value:r,onChange:e=>p(e.target.value)})]}),s.jsxs("div",{className:"spawn-field spawn-field-wide",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.workingDir")}),s.jsx(Re,{value:y,onChange:e=>{le(e),$(!1)},placeholder:n("terminal:spawn.workingDirPlaceholder"),className:"spawn-input",hasError:te,directoriesOnly:!0})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.runtime")}),s.jsxs("div",{className:"spawn-select-row",children:[s.jsxs("button",{className:`spawn-select-btn ${d==="claude"?"selected":""}`,onClick:()=>D("claude"),title:n("terminal:spawn.useClaudeCli"),children:[s.jsx("img",{src:"/assets/claude.ico",alt:"Claude",className:"spawn-provider-icon"}),s.jsx("span",{children:"Claude"})]}),s.jsxs("button",{className:`spawn-select-btn ${d==="codex"?"selected":""}`,onClick:()=>D("codex"),title:n("terminal:spawn.useCodexCli"),children:[s.jsx("img",{src:"/assets/codex.ico",alt:"Codex",className:"spawn-provider-icon"}),s.jsx("span",{children:"Codex"})]}),s.jsxs("button",{className:`spawn-select-btn spawn-select-btn--opencode ${d==="opencode"?"selected":""}`,onClick:()=>D("opencode"),title:"Use OpenCode CLI (multi-provider)",children:[s.jsx("span",{children:"🟢"}),s.jsx("span",{children:"OpenCode"})]})]})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.permissions")}),s.jsx("div",{className:"spawn-select-row",children:Object.keys(P).map(e=>s.jsxs("button",{className:`spawn-select-btn ${z===e?"selected":""}`,onClick:()=>ce(e),title:P[e].description,children:[s.jsx("span",{children:e==="bypass"?"⚡":"🔐"}),s.jsx("span",{children:P[e].label})]},e))})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.model")}),d==="claude"?s.jsx("div",{className:"spawn-select-row",children:Object.keys(g).filter(e=>!g[e].deprecated).map(e=>s.jsxs("button",{className:`spawn-select-btn ${W===e?"selected":""}`,onClick:()=>oe(e),title:g[e].description,children:[s.jsx("span",{children:g[e].icon}),s.jsx("span",{children:g[e].label})]},e))}):d==="codex"?s.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(E).map(e=>s.jsxs("button",{className:`spawn-select-btn ${G===e?"selected":""}`,onClick:()=>re(e),title:E[e].description,children:[s.jsx("span",{children:E[e].icon}),s.jsx("span",{children:E[e].label})]},e))}):d==="opencode"?s.jsx("input",{type:"text",className:"spawn-input",defaultValue:"minimax/MiniMax-M1-80k",placeholder:"provider/model (e.g., minimax/MiniMax-M1-80k)"}):s.jsx("div",{className:"spawn-inline-hint",children:n("terminal:spawn.codex.configuration")})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.browser")}),s.jsx("div",{className:"spawn-form-row spawn-options-row",children:s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:F,onChange:e=>ie(e.target.checked),disabled:d!=="claude"}),s.jsx("span",{children:n("terminal:spawn.chromeBrowser")})]})})]})]}),d==="codex"&&s.jsx("div",{className:"spawn-form-row",children:s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.codex.config")}),s.jsxs("div",{className:"spawn-options-row",style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:b.fullAuto!==!1,onChange:e=>N(a=>({...a,fullAuto:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.useFullAuto")})]}),s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:!!b.search,onChange:e=>N(a=>({...a,search:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.enableSearch")})]}),b.fullAuto===!1&&s.jsxs(s.Fragment,{children:[s.jsxs("select",{className:"spawn-input",value:b.sandbox||"workspace-write",onChange:e=>N(a=>({...a,sandbox:e.target.value})),children:[s.jsx("option",{value:"read-only",children:n("terminal:spawn.codex.sandboxReadOnly")}),s.jsx("option",{value:"workspace-write",children:n("terminal:spawn.codex.sandboxWorkspaceWrite")}),s.jsx("option",{value:"danger-full-access",children:n("terminal:spawn.codex.sandboxDangerFullAccess")})]}),s.jsxs("select",{className:"spawn-input",value:b.approvalMode||"on-request",onChange:e=>N(a=>({...a,approvalMode:e.target.value})),children:[s.jsx("option",{value:"untrusted",children:n("terminal:spawn.codex.approvalsUntrusted")}),s.jsx("option",{value:"on-failure",children:n("terminal:spawn.codex.approvalsOnFailure")}),s.jsx("option",{value:"on-request",children:n("terminal:spawn.codex.approvalsOnRequest")}),s.jsx("option",{value:"never",children:n("terminal:spawn.codex.approvalsNever")})]})]}),s.jsx("input",{type:"text",className:"spawn-input",placeholder:n("terminal:spawn.codex.profileOptional"),value:b.profile||"",onChange:e=>N(a=>({...a,profile:e.target.value||void 0}))})]})]})}),x.length>0&&s.jsxs("div",{className:"spawn-skills-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.skills")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),x.length>6&&s.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:n("terminal:spawn.filterSkills"),value:f,onChange:e=>pe(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[V.map(e=>{const a=K.has(e.id);return me.some(w=>w.id===e.id)?null:s.jsxs("button",{className:`spawn-skill-chip ${a?"selected":""}`,onClick:()=>we(e.id),title:e.description,children:[a&&s.jsx("span",{className:"spawn-skill-check",children:"✓"}),s.jsx("span",{children:e.name}),e.builtin&&s.jsx("span",{className:"spawn-skill-builtin",children:"TC"})]},e.id)}),f&&V.length===0&&s.jsx("div",{className:"skill-search-empty",children:n("terminal:spawn.noSkillsMatch",{query:f})})]})]}),s.jsxs("div",{className:"spawn-custom-instructions-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.customInstructions")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),s.jsx("textarea",{className:"spawn-input spawn-textarea",placeholder:n("terminal:spawn.customInstructionsBossPlaceholder"),value:H,onChange:e=>ue(e.target.value),rows:3})]}),s.jsxs("div",{className:"spawn-subordinates-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.initialSubordinates")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),s.jsx("div",{className:"subordinates-selector-compact",children:X.length===0?s.jsx("div",{className:"subordinates-empty",children:n("terminal:spawn.noAvailableAgents")}):X.map(e=>{const a=v.has(e.id),l=T[e.class],w=o.find($e=>$e.id===e.class),ye=l||w||{color:"#888888"};return s.jsxs("button",{className:`subordinate-chip ${a?"selected":""}`,onClick:()=>ke(e.id),children:[a&&s.jsx("span",{className:"subordinate-check",children:"✓"}),s.jsx("span",{className:"subordinate-chip-icon",style:{color:ye.color},children:s.jsx(S,{classId:e.class,size:16})}),s.jsx("span",{className:"subordinate-chip-name",children:e.name})]},e.id)})}),v.size>0&&s.jsxs("div",{className:"subordinates-count",children:[v.size," ",n("common:labels.selected").toLowerCase()]})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:h,children:n("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-boss",onClick:Ne,disabled:U,children:n(U?"common:buttons.deploying":"common:buttons2.deployBoss")})]})]})})}export{ze as BossSpawnModal};
1
+ import{u as Ae,f as Le,N as Ee,M as Ie,r as t,U as _e,S as ee,l as De,V as O,A as se,a3 as T,a4 as j,j as s,C as S,X as Be,Z as Re,_ as P,$ as g,a0 as E,a2 as Oe,s as Te}from"./main-D-o_EGqJ.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function ae(m){const h=j.filter(C=>!m.has(`Boss ${C}`));return h.length===0?`Boss ${j[Math.floor(Math.random()*j.length)]}-${Date.now()%1e3}`:`Boss ${h[Math.floor(Math.random()*h.length)]}`}function ze({isOpen:m,onClose:h,onSpawnStart:C,onSpawnEnd:I,spawnPosition:ne}){const{t:n}=Ae(["terminal","common"]),{agents:k}=Le(),o=Ee(),M=Ie(),[r,p]=t.useState(""),[y,le]=t.useState(()=>_e(ee.LAST_CWD)),[c,_]=t.useState("boss"),[U,q]=t.useState(!1),[te,$]=t.useState(!1),[F,ie]=t.useState(!0),[z,ce]=t.useState("bypass"),[d,D]=t.useState("claude"),[b,N]=t.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[W,oe]=t.useState("claude-opus-4-7"),[G,re]=t.useState("gpt-5.3-codex"),[v,A]=t.useState(new Set),[K,B]=t.useState(new Set),[u,de]=t.useState(""),[f,pe]=t.useState(""),[H,ue]=t.useState(""),L=t.useRef(null),R=t.useRef(!1),J=t.useRef(!1),x=t.useMemo(()=>M.filter(e=>e.enabled),[M]),V=t.useMemo(()=>{if(!f.trim())return x;const e=f.toLowerCase();return x.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.slug.toLowerCase().includes(e))},[x,f]),me=t.useMemo(()=>{var a;const e=o.find(l=>l.id===c);return(a=e==null?void 0:e.defaultSkillIds)!=null&&a.length?M.filter(l=>e.defaultSkillIds.includes(l.id)):[]},[o,c,M]),he=["full-notifications","streaming-exec","task-label","report-task-to-boss"];t.useEffect(()=>{if(m&&!J.current&&x.length>0){const a=x.filter(l=>he.includes(l.slug)).map(l=>l.id);a.length>0&&B(new Set(a))}J.current=m},[m,x]);const we=t.useCallback(e=>{B(a=>{const l=new Set(a);return l.has(e)?l.delete(e):l.add(e),l})},[]),i=t.useMemo(()=>o.find(e=>e.id===c),[o,c]),xe=t.useMemo(()=>{if(i!=null&&i.model)return i.model},[i]),be=t.useMemo(()=>{if(i!=null&&i.customModelPath)return De(`/api/custom-models/${i.id}`)},[i]),fe=i==null?void 0:i.modelScale,je=t.useMemo(()=>i?"scout":c==="boss"?"architect":c,[c,i]),X=Array.from(k.values()).filter(e=>!e.isBoss&&e.class!=="boss"&&!e.bossId),Y=t.useMemo(()=>{if(!u.trim())return o;const e=u.toLowerCase();return o.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.id.toLowerCase().includes(e))},[o,u]),Z=t.useMemo(()=>{if(!u.trim())return O;const e=u.toLowerCase();return O.filter(a=>{const l=se[a.id];return l?a.name.toLowerCase().includes(e)||a.id.toLowerCase().includes(e)||l.description.toLowerCase().includes(e):!1})},[u]),Q=t.useMemo(()=>{if(!u.trim())return!0;const e=u.toLowerCase(),a=T.boss;return"boss".includes(e)||a.description.toLowerCase().includes(e)},[u]);t.useEffect(()=>{if(m&&!R.current){R.current=!0;const e=new Set(Array.from(k.values()).map(l=>l.name)),a=o.find(l=>l.id===c);if(a){const l=j.filter(w=>!e.has(`${a.name} ${w}`));if(l.length===0){const w=j[Math.floor(Math.random()*j.length)];p(`${a.name} ${w}-${Date.now()%1e3}`)}else p(`${a.name} ${l[Math.floor(Math.random()*l.length)]}`)}else p(ae(e));A(new Set),L.current&&(L.current.focus(),L.current.select())}else m||(R.current=!1)},[m,k]),t.useEffect(()=>{if(!m)return;const e=o.find(a=>a.id===c);if(e)if(r.startsWith("Boss ")){const a=r.substring(5);p(`${e.name} ${a}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);p(`${e.name} ${l}`)}else p(`${e.name} ${r}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);p(`Boss ${l}`)}else r.startsWith("Boss ")||p(`Boss ${r}`)}},[c]);const Ne=()=>{if($(!1),!y.trim()){$(!0);return}if(!r.trim()){const l=new Set(Array.from(k.values()).map(w=>w.name));p(ae(l));return}Oe(ee.LAST_CWD,y),C();const e=H.trim()||void 0,a=Array.from(K);Te.spawnBossAgent(r.trim(),c,y.trim(),ne||void 0,Array.from(v),d==="claude"?F:!1,z,d,d==="codex"?b:void 0,d==="codex"?G:void 0,d==="claude"?W:void 0,e,a),p(""),A(new Set),B(new Set),I(),h()},ve=()=>{q(!1),p(""),A(new Set),I(),h()},Se=()=>{q(!1),$(!0),I()};t.useEffect(()=>(window.__bossSpawnModalSuccess=ve,window.__bossSpawnModalError=Se,()=>{delete window.__bossSpawnModalSuccess,delete window.__bossSpawnModalError}),[r]);const ge=e=>{e.target===e.currentTarget&&h()},Ce=e=>{e.key==="Escape"&&h()},ke=e=>{const a=new Set(v);a.has(e)?a.delete(e):a.add(e),A(a)};if(!m)return null;const Me=T.boss;return s.jsx("div",{className:`modal-overlay ${m?"visible":""}`,onClick:ge,onKeyDown:Ce,children:s.jsxs("div",{className:"modal boss-spawn-modal",children:[s.jsxs("div",{className:"modal-header",children:[s.jsx(S,{classId:"boss",size:22,className:"boss-header-icon"}),n("terminal:spawn.deployBossTitle")]}),s.jsxs("div",{className:"modal-body spawn-modal-body",children:[s.jsxs("div",{className:"spawn-top-section",children:[s.jsx("div",{className:"spawn-preview-compact",children:s.jsx(Be,{agentClass:je,modelFile:xe,customModelUrl:be,modelScale:fe,width:100,height:120})}),s.jsxs("div",{className:"spawn-class-section",children:[s.jsx("div",{className:"spawn-class-label",children:n("terminal:spawn.bossClass")}),o.length+O.length+1>6&&s.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:n("terminal:spawn.filterClasses"),value:u,onChange:e=>de(e.target.value)}),s.jsxs("div",{className:"class-selector-inline",children:[Y.map(e=>s.jsxs("button",{className:`class-chip ${c===e.id?"selected":""}`,onClick:()=>_(e.id),title:e.description,children:[s.jsx(S,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),Q&&s.jsxs("button",{className:`class-chip ${c==="boss"?"selected":""}`,onClick:()=>_("boss"),title:Me.description,children:[s.jsx(S,{classId:"boss",size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:n("terminal:spawn.bossClassName")})]}),Z.map(e=>{const a=se[e.id];return a?s.jsxs("button",{className:`class-chip ${c===e.id?"selected":""}`,onClick:()=>_(e.id),title:a.description,children:[s.jsx(S,{classId:e.id,size:18,className:"class-chip-icon"}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id):null}),u&&Y.length===0&&!Q&&Z.length===0&&s.jsx("div",{className:"class-search-empty",children:n("terminal:spawn.noClassesMatch",{query:u})})]})]})]}),s.jsxs("div",{className:"spawn-form-section",children:[s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.name")}),s.jsx("input",{ref:L,type:"text",className:"spawn-input",placeholder:n("terminal:spawn.bossNamePlaceholder"),value:r,onChange:e=>p(e.target.value)})]}),s.jsxs("div",{className:"spawn-field spawn-field-wide",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.workingDir")}),s.jsx(Re,{value:y,onChange:e=>{le(e),$(!1)},placeholder:n("terminal:spawn.workingDirPlaceholder"),className:"spawn-input",hasError:te,directoriesOnly:!0})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.runtime")}),s.jsxs("div",{className:"spawn-select-row",children:[s.jsxs("button",{className:`spawn-select-btn ${d==="claude"?"selected":""}`,onClick:()=>D("claude"),title:n("terminal:spawn.useClaudeCli"),children:[s.jsx("img",{src:"/assets/claude.ico",alt:"Claude",className:"spawn-provider-icon"}),s.jsx("span",{children:"Claude"})]}),s.jsxs("button",{className:`spawn-select-btn ${d==="codex"?"selected":""}`,onClick:()=>D("codex"),title:n("terminal:spawn.useCodexCli"),children:[s.jsx("img",{src:"/assets/codex.ico",alt:"Codex",className:"spawn-provider-icon"}),s.jsx("span",{children:"Codex"})]}),s.jsxs("button",{className:`spawn-select-btn spawn-select-btn--opencode ${d==="opencode"?"selected":""}`,onClick:()=>D("opencode"),title:"Use OpenCode CLI (multi-provider)",children:[s.jsx("span",{children:"🟢"}),s.jsx("span",{children:"OpenCode"})]})]})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.permissions")}),s.jsx("div",{className:"spawn-select-row",children:Object.keys(P).map(e=>s.jsxs("button",{className:`spawn-select-btn ${z===e?"selected":""}`,onClick:()=>ce(e),title:P[e].description,children:[s.jsx("span",{children:e==="bypass"?"⚡":"🔐"}),s.jsx("span",{children:P[e].label})]},e))})]})]}),s.jsxs("div",{className:"spawn-form-row",children:[s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.model")}),d==="claude"?s.jsx("div",{className:"spawn-select-row",children:Object.keys(g).filter(e=>!g[e].deprecated).map(e=>s.jsxs("button",{className:`spawn-select-btn ${W===e?"selected":""}`,onClick:()=>oe(e),title:g[e].description,children:[s.jsx("span",{children:g[e].icon}),s.jsx("span",{children:g[e].label})]},e))}):d==="codex"?s.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(E).map(e=>s.jsxs("button",{className:`spawn-select-btn ${G===e?"selected":""}`,onClick:()=>re(e),title:E[e].description,children:[s.jsx("span",{children:E[e].icon}),s.jsx("span",{children:E[e].label})]},e))}):d==="opencode"?s.jsx("input",{type:"text",className:"spawn-input",defaultValue:"minimax/MiniMax-M1-80k",placeholder:"provider/model (e.g., minimax/MiniMax-M1-80k)"}):s.jsx("div",{className:"spawn-inline-hint",children:n("terminal:spawn.codex.configuration")})]}),s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("common:labels.browser")}),s.jsx("div",{className:"spawn-form-row spawn-options-row",children:s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:F,onChange:e=>ie(e.target.checked),disabled:d!=="claude"}),s.jsx("span",{children:n("terminal:spawn.chromeBrowser")})]})})]})]}),d==="codex"&&s.jsx("div",{className:"spawn-form-row",children:s.jsxs("div",{className:"spawn-field",children:[s.jsx("label",{className:"spawn-label",children:n("terminal:spawn.codex.config")}),s.jsxs("div",{className:"spawn-options-row",style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:b.fullAuto!==!1,onChange:e=>N(a=>({...a,fullAuto:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.useFullAuto")})]}),s.jsxs("label",{className:"spawn-checkbox",children:[s.jsx("input",{type:"checkbox",checked:!!b.search,onChange:e=>N(a=>({...a,search:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.enableSearch")})]}),b.fullAuto===!1&&s.jsxs(s.Fragment,{children:[s.jsxs("select",{className:"spawn-input",value:b.sandbox||"workspace-write",onChange:e=>N(a=>({...a,sandbox:e.target.value})),children:[s.jsx("option",{value:"read-only",children:n("terminal:spawn.codex.sandboxReadOnly")}),s.jsx("option",{value:"workspace-write",children:n("terminal:spawn.codex.sandboxWorkspaceWrite")}),s.jsx("option",{value:"danger-full-access",children:n("terminal:spawn.codex.sandboxDangerFullAccess")})]}),s.jsxs("select",{className:"spawn-input",value:b.approvalMode||"on-request",onChange:e=>N(a=>({...a,approvalMode:e.target.value})),children:[s.jsx("option",{value:"untrusted",children:n("terminal:spawn.codex.approvalsUntrusted")}),s.jsx("option",{value:"on-failure",children:n("terminal:spawn.codex.approvalsOnFailure")}),s.jsx("option",{value:"on-request",children:n("terminal:spawn.codex.approvalsOnRequest")}),s.jsx("option",{value:"never",children:n("terminal:spawn.codex.approvalsNever")})]})]}),s.jsx("input",{type:"text",className:"spawn-input",placeholder:n("terminal:spawn.codex.profileOptional"),value:b.profile||"",onChange:e=>N(a=>({...a,profile:e.target.value||void 0}))})]})]})}),x.length>0&&s.jsxs("div",{className:"spawn-skills-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.skills")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),x.length>6&&s.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:n("terminal:spawn.filterSkills"),value:f,onChange:e=>pe(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[V.map(e=>{const a=K.has(e.id);return me.some(w=>w.id===e.id)?null:s.jsxs("button",{className:`spawn-skill-chip ${a?"selected":""}`,onClick:()=>we(e.id),title:e.description,children:[a&&s.jsx("span",{className:"spawn-skill-check",children:"✓"}),s.jsx("span",{children:e.name}),e.builtin&&s.jsx("span",{className:"spawn-skill-builtin",children:"TC"})]},e.id)}),f&&V.length===0&&s.jsx("div",{className:"skill-search-empty",children:n("terminal:spawn.noSkillsMatch",{query:f})})]})]}),s.jsxs("div",{className:"spawn-custom-instructions-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.customInstructions")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),s.jsx("textarea",{className:"spawn-input spawn-textarea",placeholder:n("terminal:spawn.customInstructionsBossPlaceholder"),value:H,onChange:e=>ue(e.target.value),rows:3})]}),s.jsxs("div",{className:"spawn-subordinates-section",children:[s.jsxs("label",{className:"spawn-label",children:[n("terminal:spawn.initialSubordinates")," ",s.jsxs("span",{className:"spawn-label-hint",children:["(",n("common:labels.optional"),")"]})]}),s.jsx("div",{className:"subordinates-selector-compact",children:X.length===0?s.jsx("div",{className:"subordinates-empty",children:n("terminal:spawn.noAvailableAgents")}):X.map(e=>{const a=v.has(e.id),l=T[e.class],w=o.find($e=>$e.id===e.class),ye=l||w||{color:"#888888"};return s.jsxs("button",{className:`subordinate-chip ${a?"selected":""}`,onClick:()=>ke(e.id),children:[a&&s.jsx("span",{className:"subordinate-check",children:"✓"}),s.jsx("span",{className:"subordinate-chip-icon",style:{color:ye.color},children:s.jsx(S,{classId:e.class,size:16})}),s.jsx("span",{className:"subordinate-chip-name",children:e.name})]},e.id)})}),v.size>0&&s.jsxs("div",{className:"subordinates-count",children:[v.size," ",n("common:labels.selected").toLowerCase()]})]})]})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:h,children:n("common:buttons.cancel")}),s.jsx("button",{className:"btn btn-boss",onClick:Ne,disabled:U,children:n(U?"common:buttons.deploying":"common:buttons2.deployBoss")})]})]})})}export{ze as BossSpawnModal};
@@ -1 +1 @@
1
- import{u as T,f as X,ba as W,bb as Z,r as x,z as _,h as q,b9 as L,bc as A,bd as H,j as e,be as Q,s as b,bf as V,bg as R}from"./main-CMpDB4wb.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const G={global:"terminal:controls.contextGlobal",commander:"terminal:controls.contextCommander",toolbox:"terminal:controls.contextToolbox"},J={global:"terminal:controls.contextGlobalDesc",commander:"terminal:controls.contextCommanderDesc",toolbox:"terminal:controls.contextToolboxDesc"},U={camera:["camera-pan","camera-orbit","camera-rotate","camera-zoom","camera-tilt"],interaction:["primary-action","selection-box","context-menu","move-command"]},ee={camera:"terminal:controls.cameraControls",interaction:"terminal:controls.interaction"};function ie({isOpen:s,onClose:r}){const{t:a}=T(["terminal","common"]),l=X(),c=W(),h=Z(),[m,v]=x.useState("keyboard"),[j,g]=x.useState(""),[p,N]=x.useState("all"),[d,f]=x.useState(!1),[o,k]=x.useState(null),u=_.useRef(null),{handleMouseDown:D,handleClick:w}=q(r);if(x.useEffect(()=>{if(!s||d)return;const t=n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),r())};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[s,r,d]),x.useEffect(()=>{s||(g(""),f(!1),k(null))},[s]),x.useEffect(()=>{if(!s||!d)return;const t=n=>{if(n.key==="Escape"){n.preventDefault(),n.stopPropagation(),f(!1),k(null);return}if(["Control","Alt","Shift","Meta"].includes(n.key))return;n.preventDefault(),n.stopPropagation();let i=n.key;n.code.startsWith("Key")&&n.code.length===4?i=n.code.charAt(3).toLowerCase():n.code.startsWith("Digit")&&n.code.length===6?i=n.code.charAt(5):n.code==="Space"&&(i="Space"),k({key:i,modifiers:{ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey,meta:n.metaKey}})};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[s,d]),!s)return null;const F=l.shortcuts.filter(t=>{const n=a(`terminal:controls.shortcuts.${t.id}.name`,{defaultValue:t.name}),i=a(`terminal:controls.shortcuts.${t.id}.description`,{defaultValue:t.description});if(d&&o){const O=C=>C===" "||C==="Space"?"Space":C.length===1?C.toLowerCase():C,$=O(t.key),B=O(o.key);if(!(B.length===1&&/^[a-zA-Z]$/.test($)?`Key${$.toUpperCase()}`==`Key${B.toUpperCase()}`:$===B))return!1;const S=t.modifiers,M=o.modifiers;return(S.ctrl||!1)===(M.ctrl||!1)&&(S.alt||!1)===(M.alt||!1)&&(S.shift||!1)===(M.shift||!1)&&(S.meta||!1)===(M.meta||!1)}if(!j)return!0;const y=j.toLowerCase();return n.toLowerCase().includes(y)||i.toLowerCase().includes(y)||L(t).toLowerCase().includes(y)}),K=Array.from(l.agents.values()).map(t=>t).filter(t=>t.shortcut&&t.shortcut.trim().length>0).filter(t=>{const n=A(t.shortcut).toLowerCase();if(d&&o){const y={key:o.key,code:o.key.length===1&&/^[a-zA-Z]$/.test(o.key)?`Key${o.key.toUpperCase()}`:o.key.length===1&&/^[0-9]$/.test(o.key)?`Digit${o.key}`:o.key==="Space"?"Space":o.key,ctrlKey:!!o.modifiers.ctrl,altKey:!!o.modifiers.alt,shiftKey:!!o.modifiers.shift,metaKey:!!o.modifiers.meta};return H(y,t.shortcut)}if(!j)return!0;const i=j.toLowerCase();return t.name.toLowerCase().includes(i)||n.toLowerCase().includes(i)}),P=F.reduce((t,n)=>(t[n.context]||(t[n.context]=[]),t[n.context].push(n),t),{}),Y=(t,n)=>{b.updateShortcut(t,n)},E=()=>{m==="keyboard"?confirm(a("terminal:controls.confirmResetKeyboard"))&&b.resetShortcuts():m==="mouse"?confirm(a("terminal:controls.confirmResetMouse"))&&b.resetMouseControls():m==="trackpad"&&confirm(a("terminal:controls.confirmResetTrackpad"))&&b.resetMouseControls()},z=["global","commander","toolbox"],I=c.bindings.reduce((t,n)=>(U.camera.includes(n.action)?t.camera.push(n):U.interaction.includes(n.action)&&t.interaction.push(n),t),{camera:[],interaction:[]});return e.jsx("div",{className:"shortcuts-modal-overlay",onMouseDown:D,onClick:w,children:e.jsxs("div",{className:"shortcuts-modal controls-modal",children:[e.jsxs("div",{className:"shortcuts-modal-header",children:[e.jsxs("div",{className:"shortcuts-modal-title",children:[e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),e.jsx("span",{children:a("terminal:controls.title")})]}),e.jsx("button",{className:"shortcuts-modal-close",onClick:r,children:"×"})]}),e.jsxs("div",{className:"controls-main-tabs",children:[e.jsxs("button",{className:`controls-main-tab ${m==="keyboard"?"active":""}`,onClick:()=>v("keyboard"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]}),a("terminal:controls.keyboard")]}),e.jsxs("button",{className:`controls-main-tab ${m==="mouse"?"active":""}`,onClick:()=>v("mouse"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"6",y:"3",width:"12",height:"18",rx:"6"}),e.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"11"})]}),a("terminal:controls.mouse")]}),e.jsxs("button",{className:`controls-main-tab ${m==="trackpad"?"active":""}`,onClick:()=>v("trackpad"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),a("terminal:controls.trackpad")]})]}),m==="keyboard"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[d?e.jsxs("div",{className:"shortcuts-search find-by-shortcut-active",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]}),o?e.jsxs("span",{className:"find-by-shortcut-display",children:[L({key:o.key,modifiers:o.modifiers}),e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>k(null),children:"×"})]}):e.jsx("span",{className:"find-by-shortcut-prompt",children:a("terminal:controls.pressKeyCombination")})]}):e.jsxs("div",{className:"shortcuts-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:u,type:"text",placeholder:a("terminal:controls.searchShortcuts"),value:j,onChange:t=>g(t.target.value),autoFocus:!0}),j&&e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>g(""),children:"×"})]}),e.jsx("button",{className:`shortcuts-find-by-key-btn ${d?"active":""}`,onClick:()=>{f(!d),k(null),g("")},title:a(d?"terminal:controls.switchToTextSearch":"terminal:controls.findByPressingKeys"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]})}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:E,children:a("common:buttons.reset")})]}),e.jsxs("div",{className:"shortcuts-context-tabs",children:[e.jsxs("button",{className:`shortcuts-context-tab ${p==="all"?"active":""}`,onClick:()=>N("all"),children:[a("common:labels.all"),e.jsx("span",{className:"shortcuts-context-tab-count",children:F.length})]}),z.map(t=>{var i;const n=((i=P[t])==null?void 0:i.length)||0;return e.jsxs("button",{className:`shortcuts-context-tab ${p===t?"active":""}`,onClick:()=>N(t),children:[a(G[t]),e.jsx("span",{className:"shortcuts-context-tab-count",children:n})]},t)})]}),e.jsxs("div",{className:"shortcuts-modal-content",children:[z.map(t=>{const n=P[t]||[];return n.length===0||p!=="all"&&p!==t?null:e.jsxs("div",{className:"shortcuts-context-group",children:[p==="all"&&e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:a(G[t])}),e.jsx("span",{className:"shortcuts-context-description",children:a(J[t])})]}),e.jsx("div",{className:"shortcuts-grid",children:n.map(i=>e.jsxs("div",{className:"shortcut-item",children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:a(`terminal:controls.shortcuts.${i.id}.name`,{defaultValue:i.name})}),e.jsx("span",{className:"shortcut-item-description",children:a(`terminal:controls.shortcuts.${i.id}.description`,{defaultValue:i.description})})]}),e.jsx(Q,{shortcut:i,onUpdate:y=>Y(i.id,y)})]},i.id))})]},t)}),F.length===0&&K.length===0&&e.jsx("div",{className:"shortcuts-empty",children:d?o?e.jsx("p",{children:a("terminal:controls.noShortcutBoundTo",{keys:L({key:o.key,modifiers:o.modifiers})})}):e.jsx("p",{children:a("terminal:controls.pressKeyCombinationToFind")}):e.jsx("p",{children:a("terminal:controls.noShortcutsFound",{query:j})})}),K.length>0&&(p==="all"||p==="global")&&e.jsxs("div",{className:"shortcuts-context-group",children:[p==="all"&&e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:"Agent Terminal Shortcuts"}),e.jsx("span",{className:"shortcuts-context-description",children:"Per-agent global shortcuts that open the guake terminal"})]}),e.jsx("div",{className:"shortcuts-grid",children:K.map(t=>e.jsxs("div",{className:"shortcut-item",children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:t.name}),e.jsx("span",{className:"shortcut-item-description",children:"Open terminal for this agent"})]}),e.jsx("div",{className:"key-capture-container",children:e.jsx("button",{className:"key-capture-input disabled",disabled:!0,children:e.jsx("span",{className:"key-capture-value",children:A(t.shortcut)})})})]},t.id))})]})]})]}),m==="mouse"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:a("terminal:controls.cameraAndInteraction")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:E,children:a("common:buttons.reset")})]}),e.jsxs("div",{className:"shortcuts-modal-content mouse-controls-content",children:[e.jsx("div",{className:"mouse-controls-bindings",children:Object.entries(I).map(([t,n])=>e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsx("div",{className:"shortcuts-context-header",children:e.jsx("span",{className:"shortcuts-context-label",children:a(ee[t])})}),e.jsx("div",{className:"shortcuts-grid",children:n.map(i=>e.jsx(se,{binding:i},i.id))})]},t))}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:a("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.adjustCameraSpeed")})]}),e.jsx(te,{sensitivity:c.sensitivity})]})]})]}),m==="trackpad"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:a("terminal:controls.trackpadGestureSettings")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:E,children:a("common:buttons.reset")})]}),e.jsx("div",{className:"shortcuts-modal-content trackpad-controls-content",children:e.jsx(ae,{config:h})})]}),e.jsx("div",{className:"shortcuts-modal-footer",children:e.jsx("span",{className:"shortcuts-modal-hint",children:a(m==="keyboard"?d?"terminal:controls.hintFindByShortcut":"terminal:controls.hintKeyboard":m==="mouse"?"terminal:controls.hintMouse":"terminal:controls.hintTrackpad")})})]})})}function se({binding:s}){const{t:r}=T(["terminal"]),a=W(),[l,c]=x.useState(!1),[h,m]=x.useState(null);x.useEffect(()=>{if(!l)return;const d=u=>{u.preventDefault(),u.stopPropagation();const w={0:"left",1:"middle",2:"right",3:"back",4:"forward"}[u.button];w&&m({button:w,modifiers:{ctrl:u.ctrlKey,alt:u.altKey,shift:u.shiftKey,meta:u.metaKey}})},f=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),c(!1),m(null))},o=()=>{h&&V(a.bindings,h,s.id).length===0&&b.updateMouseBinding(s.id,{button:h.button,modifiers:h.modifiers}),c(!1),m(null)},k=setTimeout(()=>{document.addEventListener("mousedown",d,!0),document.addEventListener("keydown",f,!0),document.addEventListener("click",o,!0)},100);return()=>{clearTimeout(k),document.removeEventListener("mousedown",d,!0),document.removeEventListener("keydown",f,!0),document.removeEventListener("click",o,!0)}},[l,h,s.id,a.bindings]);const v=h?V(a.bindings,h,s.id):[],j=r(`terminal:controls.mouseBindings.${s.id}.name`,{defaultValue:s.name}),g=r(`terminal:controls.mouseBindings.${s.id}.description`,{defaultValue:s.description}),p=d=>r(`terminal:controls.mouseButtons.${d}`,{defaultValue:d}),N=h?R({...s,...h},p):R(s,p);return e.jsxs("div",{className:`shortcut-item ${s.enabled?"":"disabled"}`,children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:j}),e.jsx("span",{className:"shortcut-item-description",children:g})]}),e.jsxs("div",{className:"key-capture-container",children:[e.jsx("button",{className:`key-capture-input ${l?"capturing":""} ${v.length>0?"conflict":""}`,onClick:()=>c(!0),children:l?h?e.jsx("span",{className:"key-capture-value",style:{color:"#f1fa8c"},children:N}):e.jsx("span",{style:{color:"#6272a4",fontStyle:"italic"},children:r("terminal:controls.clickToCapture")}):e.jsx("span",{className:"key-capture-value",children:N})}),v.length>0&&e.jsxs("span",{className:"key-capture-conflict",children:[r("terminal:controls.conflicts"),": ",v.map(d=>r(`terminal:controls.mouseBindings.${d.id}.name`,{defaultValue:d.name})).join(", ")]})]})]})}function te({sensitivity:s}){const{t:r}=T(["terminal"]),a=x.useCallback((l,c)=>{b.updateCameraSensitivity({[l]:c})},[]);return e.jsxs("div",{className:"sensitivity-inline-settings",children:[e.jsxs("div",{className:"sensitivity-sliders",children:[e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.panSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.panSpeed,onChange:l=>a("panSpeed",parseFloat(l.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[s.panSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.orbitSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.orbitSpeed,onChange:l=>a("orbitSpeed",parseFloat(l.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[s.orbitSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.zoomSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.zoomSpeed,onChange:l=>a("zoomSpeed",parseFloat(l.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[s.zoomSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.smoothing")}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:s.smoothing,onChange:l=>a("smoothing",parseFloat(l.target.value))}),e.jsx("span",{className:"sensitivity-slider-value",children:s.smoothing.toFixed(1)})]})]}),e.jsxs("div",{className:"sensitivity-checkboxes-inline",children:[e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertPanX,onChange:l=>a("invertPanX",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertPanX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertPanY,onChange:l=>a("invertPanY",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertPanY")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertOrbitX,onChange:l=>a("invertOrbitX",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertOrbitX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertOrbitY,onChange:l=>a("invertOrbitY",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertOrbitY")})]})]})]})}function ae({config:s}){const{t:r}=T(["terminal"]),a=x.useCallback((c,h)=>{b.updateTrackpadConfig({[c]:h})},[]),l=x.useCallback((c,h)=>{b.updateTrackpadConfig({sensitivity:{[c]:h}})},[]);return e.jsxs("div",{className:"trackpad-settings",children:[e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:r("terminal:controls.trackpadGestures")}),e.jsx("span",{className:"shortcuts-context-description",children:r("terminal:controls.enableTrackpadSupport")})]}),e.jsx("div",{className:"trackpad-toggle-row",children:e.jsxs("label",{className:"trackpad-toggle",children:[e.jsx("input",{type:"checkbox",checked:s.enabled,onChange:c=>a("enabled",c.target.checked)}),e.jsx("span",{className:"trackpad-toggle-label",children:r("terminal:controls.enableTrackpadGestures")})]})})]}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:r("terminal:controls.gestureControls")}),e.jsx("span",{className:"shortcuts-context-description",children:r("terminal:controls.enableDisableGestures")})]}),e.jsxs("div",{className:"trackpad-gestures-grid",children:[e.jsxs("label",{className:`trackpad-gesture-item ${s.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:s.pinchToZoom,onChange:c=>a("pinchToZoom",c.target.checked),disabled:!s.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:r("terminal:controls.pinchToZoom")}),e.jsx("span",{className:"trackpad-gesture-desc",children:r("terminal:controls.pinchToZoomDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${s.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:s.twoFingerPan,onChange:c=>a("twoFingerPan",c.target.checked),disabled:!s.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:r("terminal:controls.twoFingerPan")}),e.jsx("span",{className:"trackpad-gesture-desc",children:r("terminal:controls.twoFingerPanDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${s.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:s.shiftTwoFingerOrbit,onChange:c=>a("shiftTwoFingerOrbit",c.target.checked),disabled:!s.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:r("terminal:controls.shiftTwoFingerOrbit")}),e.jsx("span",{className:"trackpad-gesture-desc",children:r("terminal:controls.shiftTwoFingerOrbitDesc")})]})]})]})]}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:r("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:r("terminal:controls.adjustGestureSensitivity")})]}),e.jsxs("div",{className:"trackpad-sensitivity-sliders",children:[e.jsxs("div",{className:`trackpad-slider-row ${!s.enabled||!s.pinchToZoom?"disabled":""}`,children:[e.jsx("label",{children:r("terminal:controls.zoom")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.sensitivity.zoom,onChange:c=>l("zoom",parseFloat(c.target.value)),disabled:!s.enabled||!s.pinchToZoom}),e.jsxs("span",{className:"trackpad-slider-value",children:[s.sensitivity.zoom.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!s.enabled||!s.twoFingerPan?"disabled":""}`,children:[e.jsx("label",{children:r("terminal:controls.pan")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.sensitivity.pan,onChange:c=>l("pan",parseFloat(c.target.value)),disabled:!s.enabled||!s.twoFingerPan}),e.jsxs("span",{className:"trackpad-slider-value",children:[s.sensitivity.pan.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!s.enabled||!s.shiftTwoFingerOrbit?"disabled":""}`,children:[e.jsx("label",{children:r("terminal:controls.orbit")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.sensitivity.orbit,onChange:c=>l("orbit",parseFloat(c.target.value)),disabled:!s.enabled||!s.shiftTwoFingerOrbit}),e.jsxs("span",{className:"trackpad-slider-value",children:[s.sensitivity.orbit.toFixed(1),"x"]})]})]})]})]})}export{ie as ControlsModal};
1
+ import{u as T,f as X,ba as W,bb as Z,r as x,z as _,h as q,b9 as L,bc as A,bd as H,j as e,be as Q,s as b,bf as V,bg as R}from"./main-D-o_EGqJ.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const G={global:"terminal:controls.contextGlobal",commander:"terminal:controls.contextCommander",toolbox:"terminal:controls.contextToolbox"},J={global:"terminal:controls.contextGlobalDesc",commander:"terminal:controls.contextCommanderDesc",toolbox:"terminal:controls.contextToolboxDesc"},U={camera:["camera-pan","camera-orbit","camera-rotate","camera-zoom","camera-tilt"],interaction:["primary-action","selection-box","context-menu","move-command"]},ee={camera:"terminal:controls.cameraControls",interaction:"terminal:controls.interaction"};function ie({isOpen:s,onClose:r}){const{t:a}=T(["terminal","common"]),l=X(),c=W(),h=Z(),[m,v]=x.useState("keyboard"),[j,g]=x.useState(""),[p,N]=x.useState("all"),[d,f]=x.useState(!1),[o,k]=x.useState(null),u=_.useRef(null),{handleMouseDown:D,handleClick:w}=q(r);if(x.useEffect(()=>{if(!s||d)return;const t=n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),r())};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[s,r,d]),x.useEffect(()=>{s||(g(""),f(!1),k(null))},[s]),x.useEffect(()=>{if(!s||!d)return;const t=n=>{if(n.key==="Escape"){n.preventDefault(),n.stopPropagation(),f(!1),k(null);return}if(["Control","Alt","Shift","Meta"].includes(n.key))return;n.preventDefault(),n.stopPropagation();let i=n.key;n.code.startsWith("Key")&&n.code.length===4?i=n.code.charAt(3).toLowerCase():n.code.startsWith("Digit")&&n.code.length===6?i=n.code.charAt(5):n.code==="Space"&&(i="Space"),k({key:i,modifiers:{ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey,meta:n.metaKey}})};return document.addEventListener("keydown",t,!0),()=>document.removeEventListener("keydown",t,!0)},[s,d]),!s)return null;const F=l.shortcuts.filter(t=>{const n=a(`terminal:controls.shortcuts.${t.id}.name`,{defaultValue:t.name}),i=a(`terminal:controls.shortcuts.${t.id}.description`,{defaultValue:t.description});if(d&&o){const O=C=>C===" "||C==="Space"?"Space":C.length===1?C.toLowerCase():C,$=O(t.key),B=O(o.key);if(!(B.length===1&&/^[a-zA-Z]$/.test($)?`Key${$.toUpperCase()}`==`Key${B.toUpperCase()}`:$===B))return!1;const S=t.modifiers,M=o.modifiers;return(S.ctrl||!1)===(M.ctrl||!1)&&(S.alt||!1)===(M.alt||!1)&&(S.shift||!1)===(M.shift||!1)&&(S.meta||!1)===(M.meta||!1)}if(!j)return!0;const y=j.toLowerCase();return n.toLowerCase().includes(y)||i.toLowerCase().includes(y)||L(t).toLowerCase().includes(y)}),K=Array.from(l.agents.values()).map(t=>t).filter(t=>t.shortcut&&t.shortcut.trim().length>0).filter(t=>{const n=A(t.shortcut).toLowerCase();if(d&&o){const y={key:o.key,code:o.key.length===1&&/^[a-zA-Z]$/.test(o.key)?`Key${o.key.toUpperCase()}`:o.key.length===1&&/^[0-9]$/.test(o.key)?`Digit${o.key}`:o.key==="Space"?"Space":o.key,ctrlKey:!!o.modifiers.ctrl,altKey:!!o.modifiers.alt,shiftKey:!!o.modifiers.shift,metaKey:!!o.modifiers.meta};return H(y,t.shortcut)}if(!j)return!0;const i=j.toLowerCase();return t.name.toLowerCase().includes(i)||n.toLowerCase().includes(i)}),P=F.reduce((t,n)=>(t[n.context]||(t[n.context]=[]),t[n.context].push(n),t),{}),Y=(t,n)=>{b.updateShortcut(t,n)},E=()=>{m==="keyboard"?confirm(a("terminal:controls.confirmResetKeyboard"))&&b.resetShortcuts():m==="mouse"?confirm(a("terminal:controls.confirmResetMouse"))&&b.resetMouseControls():m==="trackpad"&&confirm(a("terminal:controls.confirmResetTrackpad"))&&b.resetMouseControls()},z=["global","commander","toolbox"],I=c.bindings.reduce((t,n)=>(U.camera.includes(n.action)?t.camera.push(n):U.interaction.includes(n.action)&&t.interaction.push(n),t),{camera:[],interaction:[]});return e.jsx("div",{className:"shortcuts-modal-overlay",onMouseDown:D,onClick:w,children:e.jsxs("div",{className:"shortcuts-modal controls-modal",children:[e.jsxs("div",{className:"shortcuts-modal-header",children:[e.jsxs("div",{className:"shortcuts-modal-title",children:[e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),e.jsx("span",{children:a("terminal:controls.title")})]}),e.jsx("button",{className:"shortcuts-modal-close",onClick:r,children:"×"})]}),e.jsxs("div",{className:"controls-main-tabs",children:[e.jsxs("button",{className:`controls-main-tab ${m==="keyboard"?"active":""}`,onClick:()=>v("keyboard"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]}),a("terminal:controls.keyboard")]}),e.jsxs("button",{className:`controls-main-tab ${m==="mouse"?"active":""}`,onClick:()=>v("mouse"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"6",y:"3",width:"12",height:"18",rx:"6"}),e.jsx("line",{x1:"12",y1:"7",x2:"12",y2:"11"})]}),a("terminal:controls.mouse")]}),e.jsxs("button",{className:`controls-main-tab ${m==="trackpad"?"active":""}`,onClick:()=>v("trackpad"),children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),a("terminal:controls.trackpad")]})]}),m==="keyboard"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[d?e.jsxs("div",{className:"shortcuts-search find-by-shortcut-active",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]}),o?e.jsxs("span",{className:"find-by-shortcut-display",children:[L({key:o.key,modifiers:o.modifiers}),e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>k(null),children:"×"})]}):e.jsx("span",{className:"find-by-shortcut-prompt",children:a("terminal:controls.pressKeyCombination")})]}):e.jsxs("div",{className:"shortcuts-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:u,type:"text",placeholder:a("terminal:controls.searchShortcuts"),value:j,onChange:t=>g(t.target.value),autoFocus:!0}),j&&e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>g(""),children:"×"})]}),e.jsx("button",{className:`shortcuts-find-by-key-btn ${d?"active":""}`,onClick:()=>{f(!d),k(null),g("")},title:a(d?"terminal:controls.switchToTextSearch":"terminal:controls.findByPressingKeys"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M6 12h.01M18 12h.01M8 16h8"})]})}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:E,children:a("common:buttons.reset")})]}),e.jsxs("div",{className:"shortcuts-context-tabs",children:[e.jsxs("button",{className:`shortcuts-context-tab ${p==="all"?"active":""}`,onClick:()=>N("all"),children:[a("common:labels.all"),e.jsx("span",{className:"shortcuts-context-tab-count",children:F.length})]}),z.map(t=>{var i;const n=((i=P[t])==null?void 0:i.length)||0;return e.jsxs("button",{className:`shortcuts-context-tab ${p===t?"active":""}`,onClick:()=>N(t),children:[a(G[t]),e.jsx("span",{className:"shortcuts-context-tab-count",children:n})]},t)})]}),e.jsxs("div",{className:"shortcuts-modal-content",children:[z.map(t=>{const n=P[t]||[];return n.length===0||p!=="all"&&p!==t?null:e.jsxs("div",{className:"shortcuts-context-group",children:[p==="all"&&e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:a(G[t])}),e.jsx("span",{className:"shortcuts-context-description",children:a(J[t])})]}),e.jsx("div",{className:"shortcuts-grid",children:n.map(i=>e.jsxs("div",{className:"shortcut-item",children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:a(`terminal:controls.shortcuts.${i.id}.name`,{defaultValue:i.name})}),e.jsx("span",{className:"shortcut-item-description",children:a(`terminal:controls.shortcuts.${i.id}.description`,{defaultValue:i.description})})]}),e.jsx(Q,{shortcut:i,onUpdate:y=>Y(i.id,y)})]},i.id))})]},t)}),F.length===0&&K.length===0&&e.jsx("div",{className:"shortcuts-empty",children:d?o?e.jsx("p",{children:a("terminal:controls.noShortcutBoundTo",{keys:L({key:o.key,modifiers:o.modifiers})})}):e.jsx("p",{children:a("terminal:controls.pressKeyCombinationToFind")}):e.jsx("p",{children:a("terminal:controls.noShortcutsFound",{query:j})})}),K.length>0&&(p==="all"||p==="global")&&e.jsxs("div",{className:"shortcuts-context-group",children:[p==="all"&&e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:"Agent Terminal Shortcuts"}),e.jsx("span",{className:"shortcuts-context-description",children:"Per-agent global shortcuts that open the guake terminal"})]}),e.jsx("div",{className:"shortcuts-grid",children:K.map(t=>e.jsxs("div",{className:"shortcut-item",children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:t.name}),e.jsx("span",{className:"shortcut-item-description",children:"Open terminal for this agent"})]}),e.jsx("div",{className:"key-capture-container",children:e.jsx("button",{className:"key-capture-input disabled",disabled:!0,children:e.jsx("span",{className:"key-capture-value",children:A(t.shortcut)})})})]},t.id))})]})]})]}),m==="mouse"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:a("terminal:controls.cameraAndInteraction")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:E,children:a("common:buttons.reset")})]}),e.jsxs("div",{className:"shortcuts-modal-content mouse-controls-content",children:[e.jsx("div",{className:"mouse-controls-bindings",children:Object.entries(I).map(([t,n])=>e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsx("div",{className:"shortcuts-context-header",children:e.jsx("span",{className:"shortcuts-context-label",children:a(ee[t])})}),e.jsx("div",{className:"shortcuts-grid",children:n.map(i=>e.jsx(se,{binding:i},i.id))})]},t))}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:a("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.adjustCameraSpeed")})]}),e.jsx(te,{sensitivity:c.sensitivity})]})]})]}),m==="trackpad"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:a("terminal:controls.trackpadGestureSettings")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:E,children:a("common:buttons.reset")})]}),e.jsx("div",{className:"shortcuts-modal-content trackpad-controls-content",children:e.jsx(ae,{config:h})})]}),e.jsx("div",{className:"shortcuts-modal-footer",children:e.jsx("span",{className:"shortcuts-modal-hint",children:a(m==="keyboard"?d?"terminal:controls.hintFindByShortcut":"terminal:controls.hintKeyboard":m==="mouse"?"terminal:controls.hintMouse":"terminal:controls.hintTrackpad")})})]})})}function se({binding:s}){const{t:r}=T(["terminal"]),a=W(),[l,c]=x.useState(!1),[h,m]=x.useState(null);x.useEffect(()=>{if(!l)return;const d=u=>{u.preventDefault(),u.stopPropagation();const w={0:"left",1:"middle",2:"right",3:"back",4:"forward"}[u.button];w&&m({button:w,modifiers:{ctrl:u.ctrlKey,alt:u.altKey,shift:u.shiftKey,meta:u.metaKey}})},f=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),c(!1),m(null))},o=()=>{h&&V(a.bindings,h,s.id).length===0&&b.updateMouseBinding(s.id,{button:h.button,modifiers:h.modifiers}),c(!1),m(null)},k=setTimeout(()=>{document.addEventListener("mousedown",d,!0),document.addEventListener("keydown",f,!0),document.addEventListener("click",o,!0)},100);return()=>{clearTimeout(k),document.removeEventListener("mousedown",d,!0),document.removeEventListener("keydown",f,!0),document.removeEventListener("click",o,!0)}},[l,h,s.id,a.bindings]);const v=h?V(a.bindings,h,s.id):[],j=r(`terminal:controls.mouseBindings.${s.id}.name`,{defaultValue:s.name}),g=r(`terminal:controls.mouseBindings.${s.id}.description`,{defaultValue:s.description}),p=d=>r(`terminal:controls.mouseButtons.${d}`,{defaultValue:d}),N=h?R({...s,...h},p):R(s,p);return e.jsxs("div",{className:`shortcut-item ${s.enabled?"":"disabled"}`,children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:j}),e.jsx("span",{className:"shortcut-item-description",children:g})]}),e.jsxs("div",{className:"key-capture-container",children:[e.jsx("button",{className:`key-capture-input ${l?"capturing":""} ${v.length>0?"conflict":""}`,onClick:()=>c(!0),children:l?h?e.jsx("span",{className:"key-capture-value",style:{color:"#f1fa8c"},children:N}):e.jsx("span",{style:{color:"#6272a4",fontStyle:"italic"},children:r("terminal:controls.clickToCapture")}):e.jsx("span",{className:"key-capture-value",children:N})}),v.length>0&&e.jsxs("span",{className:"key-capture-conflict",children:[r("terminal:controls.conflicts"),": ",v.map(d=>r(`terminal:controls.mouseBindings.${d.id}.name`,{defaultValue:d.name})).join(", ")]})]})]})}function te({sensitivity:s}){const{t:r}=T(["terminal"]),a=x.useCallback((l,c)=>{b.updateCameraSensitivity({[l]:c})},[]);return e.jsxs("div",{className:"sensitivity-inline-settings",children:[e.jsxs("div",{className:"sensitivity-sliders",children:[e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.panSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.panSpeed,onChange:l=>a("panSpeed",parseFloat(l.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[s.panSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.orbitSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.orbitSpeed,onChange:l=>a("orbitSpeed",parseFloat(l.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[s.orbitSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.zoomSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.zoomSpeed,onChange:l=>a("zoomSpeed",parseFloat(l.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[s.zoomSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:r("terminal:controls.smoothing")}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:s.smoothing,onChange:l=>a("smoothing",parseFloat(l.target.value))}),e.jsx("span",{className:"sensitivity-slider-value",children:s.smoothing.toFixed(1)})]})]}),e.jsxs("div",{className:"sensitivity-checkboxes-inline",children:[e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertPanX,onChange:l=>a("invertPanX",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertPanX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertPanY,onChange:l=>a("invertPanY",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertPanY")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertOrbitX,onChange:l=>a("invertOrbitX",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertOrbitX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:s.invertOrbitY,onChange:l=>a("invertOrbitY",l.target.checked)}),e.jsx("span",{children:r("terminal:controls.invertOrbitY")})]})]})]})}function ae({config:s}){const{t:r}=T(["terminal"]),a=x.useCallback((c,h)=>{b.updateTrackpadConfig({[c]:h})},[]),l=x.useCallback((c,h)=>{b.updateTrackpadConfig({sensitivity:{[c]:h}})},[]);return e.jsxs("div",{className:"trackpad-settings",children:[e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:r("terminal:controls.trackpadGestures")}),e.jsx("span",{className:"shortcuts-context-description",children:r("terminal:controls.enableTrackpadSupport")})]}),e.jsx("div",{className:"trackpad-toggle-row",children:e.jsxs("label",{className:"trackpad-toggle",children:[e.jsx("input",{type:"checkbox",checked:s.enabled,onChange:c=>a("enabled",c.target.checked)}),e.jsx("span",{className:"trackpad-toggle-label",children:r("terminal:controls.enableTrackpadGestures")})]})})]}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:r("terminal:controls.gestureControls")}),e.jsx("span",{className:"shortcuts-context-description",children:r("terminal:controls.enableDisableGestures")})]}),e.jsxs("div",{className:"trackpad-gestures-grid",children:[e.jsxs("label",{className:`trackpad-gesture-item ${s.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:s.pinchToZoom,onChange:c=>a("pinchToZoom",c.target.checked),disabled:!s.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:r("terminal:controls.pinchToZoom")}),e.jsx("span",{className:"trackpad-gesture-desc",children:r("terminal:controls.pinchToZoomDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${s.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:s.twoFingerPan,onChange:c=>a("twoFingerPan",c.target.checked),disabled:!s.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:r("terminal:controls.twoFingerPan")}),e.jsx("span",{className:"trackpad-gesture-desc",children:r("terminal:controls.twoFingerPanDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${s.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:s.shiftTwoFingerOrbit,onChange:c=>a("shiftTwoFingerOrbit",c.target.checked),disabled:!s.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:r("terminal:controls.shiftTwoFingerOrbit")}),e.jsx("span",{className:"trackpad-gesture-desc",children:r("terminal:controls.shiftTwoFingerOrbitDesc")})]})]})]})]}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:r("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:r("terminal:controls.adjustGestureSensitivity")})]}),e.jsxs("div",{className:"trackpad-sensitivity-sliders",children:[e.jsxs("div",{className:`trackpad-slider-row ${!s.enabled||!s.pinchToZoom?"disabled":""}`,children:[e.jsx("label",{children:r("terminal:controls.zoom")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.sensitivity.zoom,onChange:c=>l("zoom",parseFloat(c.target.value)),disabled:!s.enabled||!s.pinchToZoom}),e.jsxs("span",{className:"trackpad-slider-value",children:[s.sensitivity.zoom.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!s.enabled||!s.twoFingerPan?"disabled":""}`,children:[e.jsx("label",{children:r("terminal:controls.pan")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.sensitivity.pan,onChange:c=>l("pan",parseFloat(c.target.value)),disabled:!s.enabled||!s.twoFingerPan}),e.jsxs("span",{className:"trackpad-slider-value",children:[s.sensitivity.pan.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!s.enabled||!s.shiftTwoFingerOrbit?"disabled":""}`,children:[e.jsx("label",{children:r("terminal:controls.orbit")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:s.sensitivity.orbit,onChange:c=>l("orbit",parseFloat(c.target.value)),disabled:!s.enabled||!s.shiftTwoFingerOrbit}),e.jsxs("span",{className:"trackpad-slider-value",children:[s.sensitivity.orbit.toFixed(1),"x"]})]})]})]})]})}export{ie as ControlsModal};
@@ -1,2 +1,2 @@
1
- import{u as l,f as L,r as m,s as r,j as x}from"./main-CMpDB4wb.js";import{L as S}from"./LogViewerModal-DnCVSAMs.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function B({building:t,isOpen:o,onClose:n}){var a;const{t:i}=l(["terminal"]),{streamingBuildingLogs:c,streamingBuildingIds:g}=L(),s=c.get(t.id)||"",p=g.has(t.id);m.useEffect(()=>{var e;return o&&((e=t.docker)!=null&&e.enabled)&&r.startLogStreaming(t.id,200),()=>{t.id&&r.stopLogStreaming(t.id)}},[o,t.id,(a=t.docker)==null?void 0:a.enabled]);const d=m.useMemo(()=>s.split(`
1
+ import{u as l,f as L,r as m,s as r,j as x}from"./main-D-o_EGqJ.js";import{L as S}from"./LogViewerModal-C75Yyse9.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function B({building:t,isOpen:o,onClose:n}){var a;const{t:i}=l(["terminal"]),{streamingBuildingLogs:c,streamingBuildingIds:g}=L(),s=c.get(t.id)||"",p=g.has(t.id);m.useEffect(()=>{var e;return o&&((e=t.docker)!=null&&e.enabled)&&r.startLogStreaming(t.id,200),()=>{t.id&&r.stopLogStreaming(t.id)}},[o,t.id,(a=t.docker)==null?void 0:a.enabled]);const d=m.useMemo(()=>s.split(`
2
2
  `).map((e,f)=>({text:e,lineNumber:f+1})),[s]);return x.jsx(S,{isOpen:o,onClose:n,title:`${t.name} - ${i("terminal:logs.dockerLogs")}`,icon:"🐳",lines:d,isStreaming:p,onClear:()=>r.clearStreamingLogs(t.id)})}export{B as DockerLogsModal};
@@ -1 +1 @@
1
- import{r as e,j as s}from"./main-CMpDB4wb.js";import{g as j,o as k,E as f,l as N,h as R,a as T,f as A,d as w,r as C,i as K,b as L,c as M,e as q,j as B,s as D,k as G,m as H,n as O,p as V,q as W,t as F,u as I,v as U,w as Y,x as z}from"./index-BF9QVox6.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const J=1e3,ee=({content:_,extension:p,onSave:h,onCancel:b})=>{const c=e.useRef(null),i=e.useRef(null),t=e.useRef(null),o=e.useRef(!1),v=e.useRef(h);v.current=h;const[u,d]=e.useState("idle"),[S,l]=e.useState(null),a=e.useCallback(async()=>{if(!(!i.current||o.current)){o.current=!0,d("saving"),l(null);try{const r=i.current.state.doc.toString();await v.current(r),d("saved"),setTimeout(()=>d(n=>n==="saved"?"idle":n),1500)}catch(r){d("error"),l(r.message||"Save failed")}finally{o.current=!1}}},[]),x=e.useCallback(()=>{t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{a()},J)},[a]),g=e.useCallback(()=>{t.current&&(clearTimeout(t.current),t.current=null,a()),b()},[b,a]);return e.useEffect(()=>()=>{t.current&&clearTimeout(t.current)},[]),e.useEffect(()=>{if(!c.current)return;const r=j(p),n=[N(),R(),T(),A(),w(),C(),K(),L(),M(),q(),B(),D({top:!0}),G(z,{fallback:!0}),k,f.lineWrapping,H.of([...O,...V,...W,...F,...I,U,{key:"Mod-s",run:()=>(t.current&&(clearTimeout(t.current),t.current=null),a(),!0)},{key:"Escape",run:()=>(g(),!0)}]),f.updateListener.of(y=>{y.docChanged&&(l(null),x())})];r&&n.push(r);const E=Y.create({doc:_,extensions:n}),m=new f({state:E,parent:c.current});return i.current=m,requestAnimationFrame(()=>m.focus()),()=>{m.destroy(),i.current=null}},[]),s.jsxs("div",{className:"embedded-editor",children:[s.jsxs("div",{className:"embedded-editor__toolbar",children:[s.jsxs("div",{className:"embedded-editor__toolbar-left",children:[u==="saving"&&s.jsx("span",{className:"embedded-editor__status embedded-editor__status--saving",children:"Saving..."}),u==="saved"&&s.jsx("span",{className:"embedded-editor__status embedded-editor__status--saved",children:"Saved"}),u==="error"&&s.jsx("span",{className:"embedded-editor__status embedded-editor__status--error",children:S||"Save failed"})]}),s.jsxs("div",{className:"embedded-editor__toolbar-right",children:[s.jsx("span",{className:"embedded-editor__shortcut-hint",children:"Auto-saves · Esc to close"}),s.jsx("button",{className:"embedded-editor__btn embedded-editor__btn--close",onClick:g,children:"Close"})]})]}),s.jsx("div",{className:"embedded-editor__container",ref:c})]})};export{ee as EmbeddedEditor};
1
+ import{r as e,j as s}from"./main-D-o_EGqJ.js";import{g as j,o as k,E as f,l as N,h as R,a as T,f as A,d as w,r as C,i as K,b as L,c as M,e as q,j as B,s as D,k as G,m as H,n as O,p as V,q as W,t as F,u as I,v as U,w as Y,x as z}from"./index-BM1s5vTS.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const J=1e3,ee=({content:_,extension:p,onSave:h,onCancel:b})=>{const c=e.useRef(null),i=e.useRef(null),t=e.useRef(null),o=e.useRef(!1),v=e.useRef(h);v.current=h;const[u,d]=e.useState("idle"),[S,l]=e.useState(null),a=e.useCallback(async()=>{if(!(!i.current||o.current)){o.current=!0,d("saving"),l(null);try{const r=i.current.state.doc.toString();await v.current(r),d("saved"),setTimeout(()=>d(n=>n==="saved"?"idle":n),1500)}catch(r){d("error"),l(r.message||"Save failed")}finally{o.current=!1}}},[]),x=e.useCallback(()=>{t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{a()},J)},[a]),g=e.useCallback(()=>{t.current&&(clearTimeout(t.current),t.current=null,a()),b()},[b,a]);return e.useEffect(()=>()=>{t.current&&clearTimeout(t.current)},[]),e.useEffect(()=>{if(!c.current)return;const r=j(p),n=[N(),R(),T(),A(),w(),C(),K(),L(),M(),q(),B(),D({top:!0}),G(z,{fallback:!0}),k,f.lineWrapping,H.of([...O,...V,...W,...F,...I,U,{key:"Mod-s",run:()=>(t.current&&(clearTimeout(t.current),t.current=null),a(),!0)},{key:"Escape",run:()=>(g(),!0)}]),f.updateListener.of(y=>{y.docChanged&&(l(null),x())})];r&&n.push(r);const E=Y.create({doc:_,extensions:n}),m=new f({state:E,parent:c.current});return i.current=m,requestAnimationFrame(()=>m.focus()),()=>{m.destroy(),i.current=null}},[]),s.jsxs("div",{className:"embedded-editor",children:[s.jsxs("div",{className:"embedded-editor__toolbar",children:[s.jsxs("div",{className:"embedded-editor__toolbar-left",children:[u==="saving"&&s.jsx("span",{className:"embedded-editor__status embedded-editor__status--saving",children:"Saving..."}),u==="saved"&&s.jsx("span",{className:"embedded-editor__status embedded-editor__status--saved",children:"Saved"}),u==="error"&&s.jsx("span",{className:"embedded-editor__status embedded-editor__status--error",children:S||"Save failed"})]}),s.jsxs("div",{className:"embedded-editor__toolbar-right",children:[s.jsx("span",{className:"embedded-editor__shortcut-hint",children:"Auto-saves · Esc to close"}),s.jsx("button",{className:"embedded-editor__btn embedded-editor__btn--close",onClick:g,children:"Close"})]})]}),s.jsx("div",{className:"embedded-editor__container",ref:c})]})};export{ee as EmbeddedEditor};
@@ -0,0 +1,303 @@
1
+ import{r as t,W as D,l as y,j as e}from"./main-D-o_EGqJ.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function Z({integration:n,onSave:f,onCancel:k}){const[r,S]=t.useState(n.values.authMethod||"oauth2"),[u,P]=t.useState(n.values.clientId||""),[v,T]=t.useState(""),[h,U]=t.useState(""),[j,R]=t.useState(n.values.impersonateEmail||""),[m,A]=t.useState(String(n.values.pollingIntervalMs??3e4)),[p,C]=t.useState(n.values.defaultApprovalKeywords||"approved,aprobado,autorizado,yes,ok"),[z,I]=t.useState(null),[s,E]=t.useState(null),[c,d]=t.useState(!1),[O,i]=t.useState(null),[M,G]=t.useState(!1),[N,q]=t.useState(!1),[b,g]=t.useState(n.status.connected?"connected":"credentials"),w=r==="oauth2"&&n.values.clientId==="********"&&n.values.clientSecret==="********",l=t.useRef(null),_=t.useRef(n.status.connected),x=t.useCallback(async()=>{try{const a=await D(y("/api/email/status"));if(a.ok){const o=await a.json();E(o),o.authenticated&&(g("connected"),l.current&&(clearInterval(l.current),l.current=null))}}catch(a){console.error("Failed to fetch Gmail status:",a)}},[]);t.useEffect(()=>{const a=n.status.connected,o=_.current;a&&!o&&b!=="connected"?g("connected"):!a&&o&&b==="connected"&&g("credentials"),_.current=a},[n.status.connected]),t.useEffect(()=>(x(),()=>{l.current&&clearInterval(l.current)}),[x]);const J=async()=>{const a=await D(y("/api/email/auth/url"));if(!a.ok){const $=await a.json().catch(()=>({}));throw new Error($.error||`HTTP ${a.status}`)}const o=await a.json();if(!o.url)throw new Error("OAuth URL is empty");I(o.url),i(null),g("authorize"),l.current&&clearInterval(l.current),l.current=setInterval(x,3e3)},K=async()=>{d(!0),i(null);try{await J()}catch(a){i(a instanceof Error?a.message:"Failed to get OAuth URL")}finally{d(!1)}},L=async()=>{if(!u.trim()){i("Client ID is required");return}d(!0),i(null);try{const a={authMethod:"oauth2",pollingIntervalMs:parseInt(m)||3e4,defaultApprovalKeywords:p};u.trim()&&u.trim()!=="********"&&(a.clientId=u.trim()),v.trim()&&v.trim()!=="********"&&(a.clientSecret=v.trim()),await f(a),await J()}catch(a){const o=a instanceof Error?a.message:"Failed to get OAuth URL";i(o)}finally{d(!1)}},B=async()=>{if(!h.trim()){i("Service Account JSON is required");return}if(!j.trim()){i("Impersonate Email is required");return}try{const a=JSON.parse(h.trim());if(!a.client_email||!a.private_key){i("Service Account JSON must contain client_email and private_key");return}}catch{i("Invalid JSON in Service Account field");return}d(!0),i(null);try{await f({authMethod:"service_account",serviceAccountJson:h.trim(),impersonateEmail:j.trim(),pollingIntervalMs:parseInt(m)||3e4,defaultApprovalKeywords:p}),await new Promise(a=>setTimeout(a,1e3)),await x()}catch(a){const o=a instanceof Error?a.message:"Failed to save service account";i(o)}finally{d(!1)}},W=async()=>{G(!0),i(null);try{await f({pollingIntervalMs:parseInt(m)||3e4,defaultApprovalKeywords:p})}catch(a){i(a instanceof Error?a.message:"Failed to save settings")}finally{G(!1)}},Y=async()=>{d(!0),i(null);try{await f({refreshToken:"",serviceAccountJson:"",impersonateEmail:""}),E(null),I(null),g("credentials"),await x()}catch(a){i(a instanceof Error?a.message:"Failed to disconnect")}finally{d(!1)}},F=!!n.values.serviceAccountJson;return e.jsxs("div",{className:"gmail-oauth-setup",children:[O&&e.jsx("div",{className:"gmail-oauth-error",children:O}),b==="credentials"&&e.jsxs("div",{className:"gmail-oauth-section",children:[e.jsxs("div",{className:"gmail-oauth-field",style:{marginBottom:24},children:[e.jsx("label",{className:"integration-field-label",children:"Authentication Method"}),e.jsxs("div",{className:"gmail-auth-method-selector",children:[e.jsxs("button",{type:"button",className:`gmail-auth-method-btn ${r==="oauth2"?"active":""}`,onClick:()=>{S("oauth2"),i(null)},children:[e.jsx("span",{className:"gmail-auth-method-icon",children:"🔑"}),e.jsx("span",{className:"gmail-auth-method-label",children:"OAuth 2.0"}),e.jsx("span",{className:"gmail-auth-method-desc",children:"Browser login flow"})]}),e.jsxs("button",{type:"button",className:`gmail-auth-method-btn ${r==="service_account"?"active":""}`,onClick:()=>{S("service_account"),i(null)},children:[e.jsx("span",{className:"gmail-auth-method-icon",children:"🤖"}),e.jsx("span",{className:"gmail-auth-method-label",children:"Service Account"}),e.jsx("span",{className:"gmail-auth-method-desc",children:"Domain-wide delegation"})]})]})]}),r==="oauth2"&&w&&!N&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"gmail-oauth-section-title",children:"Google OAuth Credentials"}),e.jsxs("div",{className:"gmail-oauth-shared-banner",children:[e.jsxs("div",{className:"gmail-oauth-shared-title",children:[e.jsx("span",{children:"✓"}),e.jsx("span",{children:"Credentials already configured"})]}),e.jsx("div",{className:"gmail-oauth-shared-body",children:"Existing Google OAuth credentials (Client ID and Secret) are saved in your secrets store — they're shared between Gmail, Calendar, and Drive. You may still need to re-authorize once so the refresh token grants Gmail access."})]})]}),r==="oauth2"&&(!w||N)&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"gmail-oauth-section-title",children:"Google OAuth Credentials"}),e.jsxs("p",{className:"gmail-oauth-help",children:["Create OAuth2 credentials in the"," ",e.jsx("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noopener noreferrer",className:"gmail-oauth-link",children:"Google Cloud Console"}),". Enable the Gmail API and (optionally) the Calendar API. Set the redirect URI to:"," ",e.jsx("code",{className:"gmail-oauth-code",children:y("/api/email/auth/callback")})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsxs("label",{className:"integration-field-label",children:["OAuth Client ID ",e.jsx("span",{className:"integration-field-required",children:"*"})]}),e.jsx("input",{type:"text",className:"integration-field-input",value:u,placeholder:"xxxx.apps.googleusercontent.com",onChange:a=>P(a.target.value)})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsxs("label",{className:"integration-field-label",children:["OAuth Client Secret ",e.jsx("span",{className:"integration-field-required",children:"*"})]}),e.jsx("input",{type:"password",className:"integration-field-input",value:v,placeholder:n.values.clientSecret?"(saved)":"Enter client secret",onChange:a=>T(a.target.value),autoComplete:"off"})]})]}),r==="service_account"&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"gmail-oauth-section-title",children:"Service Account Credentials"}),e.jsxs("p",{className:"gmail-oauth-help",children:["Use a Google service account with"," ",e.jsx("a",{href:"https://admin.google.com/ac/owl/domainwidedelegation",target:"_blank",rel:"noopener noreferrer",className:"gmail-oauth-link",children:"domain-wide delegation"})," ","enabled. The service account must be authorized for Gmail scopes in Google Workspace Admin."]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsxs("label",{className:"integration-field-label",children:["Service Account JSON ",e.jsx("span",{className:"integration-field-required",children:"*"})]}),e.jsx("textarea",{className:"integration-field-input integration-field-textarea",value:h,placeholder:F?"(saved — paste new JSON to replace)":"Paste the full service account JSON key file contents",onChange:a=>U(a.target.value),rows:6,spellCheck:!1}),e.jsx("span",{className:"integration-field-description",children:"The JSON key file downloaded from Google Cloud Console containing client_email and private_key."})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsxs("label",{className:"integration-field-label",children:["Impersonate Email ",e.jsx("span",{className:"integration-field-required",children:"*"})]}),e.jsx("input",{type:"email",className:"integration-field-input",value:j,placeholder:"user@yourdomain.com",onChange:a=>R(a.target.value)}),e.jsx("span",{className:"integration-field-description",children:"The email address to impersonate via domain-wide delegation. Must be a user in your Google Workspace domain."})]})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsx("label",{className:"integration-field-label",children:"Polling Interval (ms)"}),e.jsx("input",{type:"number",className:"integration-field-input",value:m,onChange:a=>A(a.target.value)}),e.jsx("span",{className:"integration-field-description",children:"How often to check for new emails. Default: 30000 (30s)."})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsx("label",{className:"integration-field-label",children:"Approval Keywords"}),e.jsx("textarea",{className:"integration-field-input integration-field-textarea",value:p,onChange:a=>C(a.target.value),rows:2}),e.jsx("span",{className:"integration-field-description",children:"Comma-separated keywords that indicate email approval."})]}),e.jsxs("div",{className:"integration-form-actions",children:[e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:k,children:"Cancel"}),r==="oauth2"&&w&&!N?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"integration-btn secondary",onClick:()=>q(!0),disabled:c,children:"Edit credentials"}),e.jsx("button",{type:"button",className:"integration-btn save",onClick:K,disabled:c,children:c?"Loading...":"Authorize with existing credentials"})]}):r==="oauth2"?e.jsx("button",{type:"button",className:"integration-btn save",onClick:L,disabled:c||!u.trim(),children:c?"Saving...":"Save & Authorize"}):e.jsx("button",{type:"button",className:"integration-btn save",onClick:B,disabled:c||!j.trim()||!h.trim()&&!F,children:c?"Connecting...":"Save & Connect"})]})]}),b==="authorize"&&e.jsxs("div",{className:"gmail-oauth-section",children:[e.jsx("h4",{className:"gmail-oauth-section-title",children:"Authorize Gmail Access"}),e.jsx("p",{className:"gmail-oauth-help",children:"Click the link below to authorize Tide Commander to access your Gmail account. After granting access, you will be redirected back and the connection will be established automatically."}),z&&e.jsx("a",{href:z,target:"_blank",rel:"noopener noreferrer",className:"gmail-oauth-authorize-btn",children:"Authorize with Google"}),e.jsxs("div",{className:"gmail-oauth-waiting",children:[e.jsx("span",{className:"gmail-oauth-spinner"}),e.jsx("span",{children:"Waiting for authorization to complete..."})]}),e.jsx("div",{className:"integration-form-actions",children:e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:()=>{l.current&&(clearInterval(l.current),l.current=null),g("credentials")},children:"Back"})})]}),b==="connected"&&e.jsxs("div",{className:"gmail-oauth-section",children:[e.jsx("h4",{className:"gmail-oauth-section-title",children:"Gmail Connected"}),e.jsxs("div",{className:"gmail-oauth-connected-info",children:[e.jsx("span",{className:"gmail-oauth-connected-badge",children:"Connected"}),(s==null?void 0:s.emailAddress)&&e.jsx("span",{className:"gmail-oauth-email",children:s.emailAddress}),e.jsx("span",{className:"gmail-oauth-auth-type",children:r==="service_account"?"Service Account":"OAuth 2.0"})]}),(s==null?void 0:s.pollingActive)&&e.jsxs("p",{className:"gmail-oauth-help",children:["Email polling is active.",s.lastPollAt&&e.jsxs(e.Fragment,{children:[" Last checked: ",new Date(s.lastPollAt).toLocaleTimeString()]})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsx("label",{className:"integration-field-label",children:"Polling Interval (ms)"}),e.jsx("input",{type:"number",className:"integration-field-input",value:m,onChange:a=>A(a.target.value)})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsx("label",{className:"integration-field-label",children:"Approval Keywords"}),e.jsx("textarea",{className:"integration-field-input integration-field-textarea",value:p,onChange:a=>C(a.target.value),rows:2})]}),e.jsxs("div",{className:"integration-form-actions",children:[e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:k,children:"Close"}),e.jsx("button",{type:"button",className:"integration-btn",style:{backgroundColor:"#f38ba8",color:"#1e1e2e"},onClick:Y,disabled:c,children:c?"Disconnecting...":"Disconnect"}),e.jsx("button",{type:"button",className:"integration-btn save",onClick:W,disabled:M,children:M?"Saving...":"Save Settings"})]})]}),e.jsx("style",{children:`
2
+ .gmail-oauth-setup {
3
+ padding: 0;
4
+ }
5
+ .gmail-oauth-error {
6
+ background: linear-gradient(135deg, rgba(243, 139, 168, 0.2) 0%, rgba(243, 139, 168, 0.08) 100%);
7
+ border-left: 3px solid #f38ba8;
8
+ color: #f38ba8;
9
+ padding: 12px 16px;
10
+ border-radius: 8px;
11
+ margin-bottom: 18px;
12
+ font-size: 13px;
13
+ font-weight: 500;
14
+ }
15
+ .gmail-oauth-section {
16
+ background: linear-gradient(180deg, rgba(45, 49, 69, 0.4) 0%, rgba(30, 30, 46, 0.2) 100%);
17
+ border: 1px solid rgba(137, 180, 250, 0.15);
18
+ border-radius: 12px;
19
+ padding: 28px;
20
+ backdrop-filter: blur(10px);
21
+ }
22
+ .gmail-oauth-section-title {
23
+ margin: 0 0 16px 0;
24
+ color: #cdd6f4;
25
+ font-size: 18px;
26
+ font-weight: 700;
27
+ letter-spacing: -0.5px;
28
+ }
29
+ .gmail-oauth-help {
30
+ color: #a6adc8;
31
+ font-size: 13px;
32
+ line-height: 1.6;
33
+ margin: 0 0 20px 0;
34
+ font-weight: 400;
35
+ }
36
+ .gmail-oauth-link {
37
+ color: #89b4fa;
38
+ text-decoration: none;
39
+ border-bottom: 1.5px solid rgba(137, 180, 250, 0.4);
40
+ transition: all 0.2s ease;
41
+ font-weight: 500;
42
+ }
43
+ .gmail-oauth-link:hover {
44
+ color: #a8c5ff;
45
+ border-bottom-color: #89b4fa;
46
+ }
47
+ .gmail-oauth-code {
48
+ background: rgba(137, 180, 250, 0.15);
49
+ color: #89b4fa;
50
+ padding: 4px 10px;
51
+ border-radius: 6px;
52
+ font-size: 12px;
53
+ word-break: break-all;
54
+ font-weight: 500;
55
+ font-family: 'Monaco', 'Menlo', monospace;
56
+ }
57
+ .gmail-oauth-field {
58
+ margin-bottom: 18px;
59
+ }
60
+ .gmail-auth-method-selector {
61
+ display: flex;
62
+ gap: 12px;
63
+ }
64
+ .gmail-auth-method-btn {
65
+ flex: 1;
66
+ display: flex;
67
+ flex-direction: column;
68
+ align-items: center;
69
+ gap: 6px;
70
+ padding: 16px 12px;
71
+ background: rgba(30, 30, 46, 0.6);
72
+ border: 2px solid rgba(137, 180, 250, 0.15);
73
+ border-radius: 10px;
74
+ cursor: pointer;
75
+ transition: all 0.2s ease;
76
+ }
77
+ .gmail-auth-method-btn:hover {
78
+ border-color: rgba(137, 180, 250, 0.35);
79
+ background: rgba(30, 30, 46, 0.8);
80
+ }
81
+ .gmail-auth-method-btn.active {
82
+ border-color: #89b4fa;
83
+ background: rgba(137, 180, 250, 0.1);
84
+ box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.1);
85
+ }
86
+ .gmail-auth-method-icon {
87
+ font-size: 22px;
88
+ }
89
+ .gmail-auth-method-label {
90
+ color: #cdd6f4;
91
+ font-size: 14px;
92
+ font-weight: 600;
93
+ }
94
+ .gmail-auth-method-desc {
95
+ color: #7f849c;
96
+ font-size: 11px;
97
+ font-weight: 400;
98
+ }
99
+ .gmail-oauth-auth-type {
100
+ color: #7f849c;
101
+ font-size: 12px;
102
+ font-weight: 500;
103
+ margin-left: auto;
104
+ background: rgba(137, 180, 250, 0.1);
105
+ padding: 4px 10px;
106
+ border-radius: 6px;
107
+ }
108
+ .integration-field-label {
109
+ display: block;
110
+ margin-bottom: 8px;
111
+ color: #cdd6f4;
112
+ font-size: 14px;
113
+ font-weight: 600;
114
+ letter-spacing: 0.3px;
115
+ }
116
+ .integration-field-required {
117
+ color: #f38ba8;
118
+ }
119
+ .integration-field-input {
120
+ width: 100%;
121
+ background: rgba(30, 30, 46, 0.6);
122
+ border: 1.5px solid rgba(137, 180, 250, 0.2);
123
+ color: #cdd6f4;
124
+ padding: 11px 14px;
125
+ border-radius: 8px;
126
+ font-size: 13px;
127
+ transition: all 0.2s ease;
128
+ font-weight: 500;
129
+ }
130
+ .integration-field-input:focus {
131
+ outline: none;
132
+ border-color: #89b4fa;
133
+ background: rgba(30, 30, 46, 0.8);
134
+ box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.15);
135
+ }
136
+ .integration-field-input::placeholder {
137
+ color: #6c7086;
138
+ }
139
+ .integration-field-textarea {
140
+ resize: vertical;
141
+ min-height: 80px;
142
+ font-family: 'Monaco', 'Menlo', monospace;
143
+ font-size: 12px;
144
+ }
145
+ .integration-field-description {
146
+ display: block;
147
+ margin-top: 7px;
148
+ color: #7f849c;
149
+ font-size: 12px;
150
+ font-weight: 400;
151
+ }
152
+ .gmail-oauth-authorize-btn {
153
+ display: inline-block;
154
+ background: linear-gradient(135deg, #89b4fa 0%, #7aa3f0 100%);
155
+ color: #1e1e2e;
156
+ padding: 12px 32px;
157
+ border-radius: 8px;
158
+ text-decoration: none;
159
+ font-weight: 700;
160
+ font-size: 14px;
161
+ margin-bottom: 20px;
162
+ transition: all 0.25s ease;
163
+ border: none;
164
+ cursor: pointer;
165
+ box-shadow: 0 4px 12px rgba(137, 180, 250, 0.25);
166
+ letter-spacing: 0.3px;
167
+ }
168
+ .gmail-oauth-authorize-btn:hover {
169
+ transform: translateY(-2px);
170
+ box-shadow: 0 6px 16px rgba(137, 180, 250, 0.35);
171
+ background: linear-gradient(135deg, #a8c5ff 0%, #8eb8ff 100%);
172
+ }
173
+ .gmail-oauth-authorize-btn:active {
174
+ transform: translateY(0);
175
+ }
176
+ .gmail-oauth-waiting {
177
+ display: flex;
178
+ align-items: center;
179
+ gap: 12px;
180
+ color: #a6adc8;
181
+ font-size: 13px;
182
+ margin-bottom: 20px;
183
+ background: rgba(137, 180, 250, 0.08);
184
+ padding: 14px 16px;
185
+ border-radius: 8px;
186
+ border-left: 3px solid #89b4fa;
187
+ font-weight: 500;
188
+ }
189
+ .gmail-oauth-spinner {
190
+ display: inline-block;
191
+ width: 16px;
192
+ height: 16px;
193
+ border: 2.5px solid rgba(137, 180, 250, 0.25);
194
+ border-top-color: #89b4fa;
195
+ border-radius: 50%;
196
+ animation: gmail-spin 0.8s linear infinite;
197
+ flex-shrink: 0;
198
+ }
199
+ @keyframes gmail-spin {
200
+ to { transform: rotate(360deg); }
201
+ }
202
+ .gmail-oauth-connected-info {
203
+ display: flex;
204
+ align-items: center;
205
+ gap: 14px;
206
+ margin-bottom: 20px;
207
+ background: rgba(166, 227, 161, 0.08);
208
+ padding: 16px;
209
+ border-radius: 10px;
210
+ border-left: 3px solid #a6e3a1;
211
+ }
212
+ .gmail-oauth-connected-badge {
213
+ background: linear-gradient(135deg, rgba(166, 227, 161, 0.3) 0%, rgba(166, 227, 161, 0.15) 100%);
214
+ color: #a6e3a1;
215
+ padding: 6px 14px;
216
+ border-radius: 6px;
217
+ font-size: 12px;
218
+ font-weight: 700;
219
+ letter-spacing: 0.4px;
220
+ text-transform: uppercase;
221
+ border: 1px solid rgba(166, 227, 161, 0.3);
222
+ flex-shrink: 0;
223
+ }
224
+ .gmail-oauth-email {
225
+ color: #cdd6f4;
226
+ font-size: 14px;
227
+ font-weight: 600;
228
+ letter-spacing: 0.2px;
229
+ }
230
+ .integration-form-actions {
231
+ display: flex;
232
+ gap: 12px;
233
+ justify-content: flex-end;
234
+ margin-top: 24px;
235
+ padding-top: 20px;
236
+ border-top: 1px solid rgba(137, 180, 250, 0.1);
237
+ }
238
+ .integration-btn {
239
+ padding: 10px 24px;
240
+ border-radius: 8px;
241
+ font-weight: 600;
242
+ font-size: 13px;
243
+ border: none;
244
+ cursor: pointer;
245
+ transition: all 0.2s ease;
246
+ letter-spacing: 0.3px;
247
+ }
248
+ .integration-btn.save {
249
+ background: linear-gradient(135deg, #89b4fa 0%, #7aa3f0 100%);
250
+ color: #1e1e2e;
251
+ box-shadow: 0 4px 12px rgba(137, 180, 250, 0.25);
252
+ }
253
+ .integration-btn.save:hover:not(:disabled) {
254
+ transform: translateY(-2px);
255
+ box-shadow: 0 6px 16px rgba(137, 180, 250, 0.35);
256
+ }
257
+ .integration-btn.cancel {
258
+ background: rgba(137, 180, 250, 0.1);
259
+ color: #89b4fa;
260
+ border: 1.5px solid rgba(137, 180, 250, 0.2);
261
+ }
262
+ .integration-btn.cancel:hover:not(:disabled) {
263
+ background: rgba(137, 180, 250, 0.15);
264
+ border-color: #89b4fa;
265
+ }
266
+ .integration-btn.secondary {
267
+ background: rgba(249, 226, 175, 0.1);
268
+ color: #f9e2af;
269
+ border: 1.5px solid rgba(249, 226, 175, 0.25);
270
+ }
271
+ .integration-btn.secondary:hover:not(:disabled) {
272
+ background: rgba(249, 226, 175, 0.18);
273
+ border-color: #f9e2af;
274
+ }
275
+ .integration-btn:disabled {
276
+ opacity: 0.5;
277
+ cursor: not-allowed;
278
+ }
279
+ .gmail-oauth-shared-banner {
280
+ background: linear-gradient(135deg, rgba(166, 227, 161, 0.15) 0%, rgba(166, 227, 161, 0.05) 100%);
281
+ border: 1px solid rgba(166, 227, 161, 0.3);
282
+ border-left: 3px solid #a6e3a1;
283
+ border-radius: 10px;
284
+ padding: 16px 18px;
285
+ margin-bottom: 8px;
286
+ }
287
+ .gmail-oauth-shared-title {
288
+ display: flex;
289
+ align-items: center;
290
+ gap: 10px;
291
+ color: #a6e3a1;
292
+ font-size: 14px;
293
+ font-weight: 700;
294
+ letter-spacing: 0.2px;
295
+ margin-bottom: 8px;
296
+ }
297
+ .gmail-oauth-shared-body {
298
+ color: #a6adc8;
299
+ font-size: 13px;
300
+ line-height: 1.6;
301
+ font-weight: 400;
302
+ }
303
+ `})]})}export{Z as GmailOAuthSetup};