tide-commander 1.29.0 → 1.30.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 (115) hide show
  1. package/dist/assets/{BossLogsModal-yZMMUymF.js → BossLogsModal-Cq4ACTZY.js} +1 -1
  2. package/dist/assets/{BossSpawnModal-DTYHA3bs.js → BossSpawnModal-Br7CFZ81.js} +1 -1
  3. package/dist/assets/{ControlsModal-q01g5mtX.js → ControlsModal-CsQcHHW4.js} +1 -1
  4. package/dist/assets/{DockerLogsModal-ChMsMs6X.js → DockerLogsModal-Bht-dslu.js} +1 -1
  5. package/dist/assets/{EmbeddedEditor-CsR8Jffx.js → EmbeddedEditor-CzmmUa4p.js} +1 -1
  6. package/dist/assets/GmailOAuthSetup-CKhNTAO8.js +222 -0
  7. package/dist/assets/GoogleOAuthSetup-BmsWwk5V.js +203 -0
  8. package/dist/assets/{IframeModal-BizOIQC2.js → IframeModal-Ch7zlEYj.js} +1 -1
  9. package/dist/assets/IntegrationsPanel-BDAZiN6r.js +2 -0
  10. package/dist/assets/{LogViewerModal-wKmq37Bu.js → LogViewerModal-D7lbw4o9.js} +1 -1
  11. package/dist/assets/MonitoringModal-Civ9dFgI.js +1 -0
  12. package/dist/assets/{PM2LogsModal-620HJLNq.js → PM2LogsModal-ChyrQvw8.js} +1 -1
  13. package/dist/assets/{RestoreArchivedAreaModal-DSPSAN4u.js → RestoreArchivedAreaModal-BuiF3gv9.js} +1 -1
  14. package/dist/assets/{SaveSnapshotModal-Dw-EHO0V.js → SaveSnapshotModal-BogH6UN5.js} +1 -1
  15. package/dist/assets/{Scene2DCanvas-B-5kHM6-.js → Scene2DCanvas-BOgxF64_.js} +1 -1
  16. package/dist/assets/SceneManager-rWXQAS2D.js +104 -0
  17. package/dist/assets/{SkillsPanel-lmUsjmSB.js → SkillsPanel-V68IEsTj.js} +3 -3
  18. package/dist/assets/{SnapshotManager--SX8oMOb.js → SnapshotManager-CMLhfgv6.js} +1 -1
  19. package/dist/assets/{SpawnModal-B8E6Nbxi.js → SpawnModal-x2evooz9.js} +1 -1
  20. package/dist/assets/{SubordinateAssignmentModal-Dyok_6p1.js → SubordinateAssignmentModal-Bx1LnJk8.js} +1 -1
  21. package/dist/assets/{SupervisorPanel-C69P3fSQ.js → SupervisorPanel-DL2d4Xwf.js} +1 -1
  22. package/dist/assets/WorkflowEditorPanel-BrG_FDub.js +42 -0
  23. package/dist/assets/camera-D1o0Ciem.js +1 -0
  24. package/dist/assets/index-4CCOgro2.js +8 -0
  25. package/dist/assets/{index-D4qywTfe.js → index-BvZNNZtq.js} +3 -3
  26. package/dist/assets/{index-ixBTiGHK.js → index-C80umZZb.js} +2 -2
  27. package/dist/assets/index-CuAt6Oqe.js +1 -0
  28. package/dist/assets/{index-2eGWcGUM.js → index-D-6vOLCa.js} +3 -3
  29. package/dist/assets/{index-B5NAnuEW.js → index-D2CKk7Xr.js} +1 -1
  30. package/dist/assets/index-XqDzWlTr.js +1 -0
  31. package/dist/assets/index-j6tzxIWx.js +1 -0
  32. package/dist/assets/main-CL_Hkk_O.js +152 -0
  33. package/dist/assets/{vendor-three-BvqnFOow.js → vendor-three-Chj50gSY.js} +167 -167
  34. package/dist/assets/{web-DGB_bLvv.js → web-CUb6s69a.js} +1 -1
  35. package/dist/assets/{web-dPW2_YeE.js → web-DPMrxFYP.js} +1 -1
  36. package/dist/index.html +2 -2
  37. package/dist/locales/de/terminal.json +1 -0
  38. package/dist/locales/en/terminal.json +1 -0
  39. package/dist/locales/es/terminal.json +1 -0
  40. package/dist/locales/fr/terminal.json +1 -0
  41. package/dist/locales/hi/terminal.json +1 -0
  42. package/dist/locales/it/terminal.json +1 -0
  43. package/dist/locales/ja/terminal.json +1 -0
  44. package/dist/locales/pt/terminal.json +1 -0
  45. package/dist/locales/ru/terminal.json +1 -0
  46. package/dist/locales/zh-CN/terminal.json +1 -0
  47. package/dist/src/packages/server/auth/index.js +6 -1
  48. package/dist/src/packages/server/data/builtin-skills/index.js +2 -0
  49. package/dist/src/packages/server/data/builtin-skills/workflow-designer.js +180 -0
  50. package/dist/src/packages/server/data/event-db.js +122 -0
  51. package/dist/src/packages/server/data/event-queries.js +933 -0
  52. package/dist/src/packages/server/data/migrations/001_initial_schema.sql +270 -0
  53. package/dist/src/packages/server/data/trigger-store.js +111 -0
  54. package/dist/src/packages/server/data/workflow-store.js +100 -0
  55. package/dist/src/packages/server/index.js +83 -2
  56. package/dist/src/packages/server/integrations/docx/docx-config.js +41 -0
  57. package/dist/src/packages/server/integrations/docx/docx-engine.js +246 -0
  58. package/dist/src/packages/server/integrations/docx/docx-events.js +29 -0
  59. package/dist/src/packages/server/integrations/docx/docx-routes.js +121 -0
  60. package/dist/src/packages/server/integrations/docx/docx-skill.js +45 -0
  61. package/dist/src/packages/server/integrations/docx/index.js +81 -0
  62. package/dist/src/packages/server/integrations/gmail/gmail-client.js +544 -0
  63. package/dist/src/packages/server/integrations/gmail/gmail-config.js +42 -0
  64. package/dist/src/packages/server/integrations/gmail/gmail-routes.js +206 -0
  65. package/dist/src/packages/server/integrations/gmail/gmail-skill.js +137 -0
  66. package/dist/src/packages/server/integrations/gmail/index.js +81 -0
  67. package/dist/src/packages/server/integrations/google-calendar/calendar-client.js +257 -0
  68. package/dist/src/packages/server/integrations/google-calendar/calendar-config.js +157 -0
  69. package/dist/src/packages/server/integrations/google-calendar/calendar-routes.js +188 -0
  70. package/dist/src/packages/server/integrations/google-calendar/calendar-skill.js +69 -0
  71. package/dist/src/packages/server/integrations/google-calendar/index.js +62 -0
  72. package/dist/src/packages/server/integrations/integration-registry.js +96 -0
  73. package/dist/src/packages/server/integrations/jira/index.js +112 -0
  74. package/dist/src/packages/server/integrations/jira/jira-client.js +200 -0
  75. package/dist/src/packages/server/integrations/jira/jira-config.js +92 -0
  76. package/dist/src/packages/server/integrations/jira/jira-routes.js +252 -0
  77. package/dist/src/packages/server/integrations/jira/jira-skill.js +113 -0
  78. package/dist/src/packages/server/integrations/jira/jira-trigger-handler.js +144 -0
  79. package/dist/src/packages/server/integrations/slack/index.js +56 -0
  80. package/dist/src/packages/server/integrations/slack/slack-client.js +377 -0
  81. package/dist/src/packages/server/integrations/slack/slack-config.js +116 -0
  82. package/dist/src/packages/server/integrations/slack/slack-routes.js +141 -0
  83. package/dist/src/packages/server/integrations/slack/slack-skill.js +79 -0
  84. package/dist/src/packages/server/integrations/slack/slack-trigger-handler.js +61 -0
  85. package/dist/src/packages/server/routes/event-routes.js +193 -0
  86. package/dist/src/packages/server/routes/index.js +23 -1
  87. package/dist/src/packages/server/routes/integration-routes.js +85 -0
  88. package/dist/src/packages/server/routes/trigger-routes.js +229 -0
  89. package/dist/src/packages/server/routes/workflow-routes.js +217 -0
  90. package/dist/src/packages/server/services/cron-service.js +208 -0
  91. package/dist/src/packages/server/services/database-service.js +326 -0
  92. package/dist/src/packages/server/services/event-retention-service.js +134 -0
  93. package/dist/src/packages/server/services/index.js +4 -0
  94. package/dist/src/packages/server/services/llm-matcher-service.js +215 -0
  95. package/dist/src/packages/server/services/secrets-service.js +2 -1
  96. package/dist/src/packages/server/services/trigger-service.js +488 -0
  97. package/dist/src/packages/server/services/workflow-chat-service.js +295 -0
  98. package/dist/src/packages/server/services/workflow-service.js +638 -0
  99. package/dist/src/packages/server/websocket/handler.js +21 -2
  100. package/dist/src/packages/server/websocket/handlers/trigger-handler.js +83 -0
  101. package/dist/src/packages/server/websocket/handlers/workflow-handler.js +120 -0
  102. package/dist/src/packages/shared/database-types.js +2 -0
  103. package/dist/src/packages/shared/event-types.js +5 -0
  104. package/dist/src/packages/shared/integration-types.js +7 -0
  105. package/dist/src/packages/shared/trigger-types.js +9 -0
  106. package/dist/src/packages/shared/types.js +3 -0
  107. package/dist/src/packages/shared/workflow-types.js +190 -0
  108. package/package.json +15 -2
  109. package/dist/assets/SceneManager-C_C81vSz.js +0 -104
  110. package/dist/assets/camera-3pUjdK0X.js +0 -1
  111. package/dist/assets/index-BfrJ-1c_.js +0 -1
  112. package/dist/assets/index-BnBMyrJu.js +0 -1
  113. package/dist/assets/index-D1eq7t6u.js +0 -8
  114. package/dist/assets/index-jo_HBZE1.js +0 -1
  115. package/dist/assets/main-B_diMezF.js +0 -152
@@ -1 +1 @@
1
- import{u as M,f as N,r as m,s as u,j as r}from"./main-B_diMezF.js";import{L as v}from"./LogViewerModal-wKmq37Bu.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.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-CL_Hkk_O.js";import{L as v}from"./LogViewerModal-D7lbw4o9.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.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 $e,f as Ae,E as Le,D as Ee,r as t,I as De,S as se,p as _e,J as R,A as ae,W as O,X as j,j as s,M as Ie,N as Be,P,O as A,U as L,V as Re,s as Oe}from"./main-B_diMezF.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function ne(p){const h=j.filter(S=>!p.has(`Boss ${S}`));return h.length===0?`Boss ${j[Math.floor(Math.random()*j.length)]}-${Date.now()%1e3}`:`Boss ${h[Math.floor(Math.random()*h.length)]}`}function Ue({isOpen:p,onClose:h,onSpawnStart:S,onSpawnEnd:E,spawnPosition:le}){const{t:n}=$e(["terminal","common"]),{agents:g}=Ae(),o=Le(),C=Ee(),[r,d]=t.useState(""),[k,te]=t.useState(()=>De(se.LAST_CWD)),[c,D]=t.useState("boss"),[T,q]=t.useState(!1),[ie,M]=t.useState(!1),[F,ce]=t.useState(!0),[U,oe]=t.useState("bypass"),[m,W]=t.useState("claude"),[f,N]=t.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[G,re]=t.useState("haiku"),[K,de]=t.useState("gpt-5.3-codex"),[v,y]=t.useState(new Set),[z,_]=t.useState(new Set),[u,ue]=t.useState(""),[b,pe]=t.useState(""),[J,me]=t.useState(""),$=t.useRef(null),I=t.useRef(!1),H=t.useRef(!1),x=t.useMemo(()=>C.filter(e=>e.enabled),[C]),X=t.useMemo(()=>{if(!b.trim())return x;const e=b.toLowerCase();return x.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.slug.toLowerCase().includes(e))},[x,b]),he=t.useMemo(()=>{var a;const e=o.find(l=>l.id===c);return(a=e==null?void 0:e.defaultSkillIds)!=null&&a.length?C.filter(l=>e.defaultSkillIds.includes(l.id)):[]},[o,c,C]),we=["full-notifications","streaming-exec","task-label","report-task-to-boss"];t.useEffect(()=>{if(p&&!H.current&&x.length>0){const a=x.filter(l=>we.includes(l.slug)).map(l=>l.id);a.length>0&&_(new Set(a))}H.current=p},[p,x]);const xe=t.useCallback(e=>{_(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]),fe=t.useMemo(()=>{if(i!=null&&i.model)return i.model},[i]),be=t.useMemo(()=>{if(i!=null&&i.customModelPath)return _e(`/api/custom-models/${i.id}`)},[i]),je=i==null?void 0:i.modelScale,Ne=t.useMemo(()=>i?"scout":c==="boss"?"architect":c,[c,i]),V=Array.from(g.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]),Q=t.useMemo(()=>{if(!u.trim())return R;const e=u.toLowerCase();return R.filter(a=>{const l=ae[a.id];return l?a.name.toLowerCase().includes(e)||a.id.toLowerCase().includes(e)||l.description.toLowerCase().includes(e):!1})},[u]),Z=t.useMemo(()=>{if(!u.trim())return!0;const e=u.toLowerCase(),a=O.boss;return"boss".includes(e)||a.description.toLowerCase().includes(e)},[u]);t.useEffect(()=>{if(p&&!I.current){I.current=!0;const e=new Set(Array.from(g.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)];d(`${a.name} ${w}-${Date.now()%1e3}`)}else d(`${a.name} ${l[Math.floor(Math.random()*l.length)]}`)}else d(ne(e));y(new Set),$.current&&($.current.focus(),$.current.select())}else p||(I.current=!1)},[p,g]),t.useEffect(()=>{if(!p)return;const e=o.find(a=>a.id===c);if(e)if(r.startsWith("Boss ")){const a=r.substring(5);d(`${e.name} ${a}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);d(`${e.name} ${l}`)}else d(`${e.name} ${r}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);d(`Boss ${l}`)}else r.startsWith("Boss ")||d(`Boss ${r}`)}},[c]);const ve=()=>{if(M(!1),!k.trim()){M(!0);return}if(!r.trim()){const l=new Set(Array.from(g.values()).map(w=>w.name));d(ne(l));return}Re(se.LAST_CWD,k),S();const e=J.trim()||void 0,a=Array.from(z);Oe.spawnBossAgent(r.trim(),c,k.trim(),le||void 0,Array.from(v),m==="claude"?F:!1,U,m,m==="codex"?f:void 0,m==="codex"?K:void 0,m==="claude"?G:void 0,e,a),d(""),y(new Set),_(new Set),E(),h()},Se=()=>{q(!1),d(""),y(new Set),E(),h()},ge=()=>{q(!1),M(!0),E()};t.useEffect(()=>(window.__bossSpawnModalSuccess=Se,window.__bossSpawnModalError=ge,()=>{delete window.__bossSpawnModalSuccess,delete window.__bossSpawnModalError}),[r]);const Ce=e=>{e.target===e.currentTarget&&h()},ke=e=>{e.key==="Escape"&&h()},Me=e=>{const a=new Set(v);a.has(e)?a.delete(e):a.add(e),y(a)};if(!p)return null;const B=O.boss;return s.jsx("div",{className:`modal-overlay ${p?"visible":""}`,onClick:Ce,onKeyDown:ke,children:s.jsxs("div",{className:"modal boss-spawn-modal",children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("span",{className:"boss-header-icon",children:B.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(Ie,{agentClass:Ne,modelFile:fe,customModelUrl:be,modelScale:je,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+R.length+1>6&&s.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:n("terminal:spawn.filterClasses"),value:u,onChange:e=>ue(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:()=>D(e.id),title:e.description,children:[s.jsx("span",{className:"class-chip-icon",children:e.icon}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),Z&&s.jsxs("button",{className:`class-chip ${c==="boss"?"selected":""}`,onClick:()=>D("boss"),title:B.description,children:[s.jsx("span",{className:"class-chip-icon",children:B.icon}),s.jsx("span",{className:"class-chip-name",children:n("terminal:spawn.bossClassName")})]}),Q.map(e=>{const a=ae[e.id];return a?s.jsxs("button",{className:`class-chip ${c===e.id?"selected":""}`,onClick:()=>D(e.id),title:a.description,children:[s.jsx("span",{className:"class-chip-icon",children:a.icon}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id):null}),u&&Y.length===0&&!Z&&Q.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:$,type:"text",className:"spawn-input",placeholder:n("terminal:spawn.bossNamePlaceholder"),value:r,onChange:e=>d(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(Be,{value:k,onChange:e=>{te(e),M(!1)},placeholder:n("terminal:spawn.workingDirPlaceholder"),className:"spawn-input",hasError:ie,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 ${m==="claude"?"selected":""}`,onClick:()=>W("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 ${m==="codex"?"selected":""}`,onClick:()=>W("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("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 ${U===e?"selected":""}`,onClick:()=>oe(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")}),m==="claude"?s.jsx("div",{className:"spawn-select-row",children:Object.keys(A).map(e=>s.jsxs("button",{className:`spawn-select-btn ${G===e?"selected":""}`,onClick:()=>re(e),title:A[e].description,children:[s.jsx("span",{children:A[e].icon}),s.jsx("span",{children:A[e].label})]},e))}):m==="codex"?s.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(L).map(e=>s.jsxs("button",{className:`spawn-select-btn ${K===e?"selected":""}`,onClick:()=>de(e),title:L[e].description,children:[s.jsx("span",{children:L[e].icon}),s.jsx("span",{children:L[e].label})]},e))}):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=>ce(e.target.checked),disabled:m!=="claude"}),s.jsx("span",{children:n("terminal:spawn.chromeBrowser")})]})})]})]}),m==="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:f.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:!!f.search,onChange:e=>N(a=>({...a,search:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.enableSearch")})]}),f.fullAuto===!1&&s.jsxs(s.Fragment,{children:[s.jsxs("select",{className:"spawn-input",value:f.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:f.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:f.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:b,onChange:e=>pe(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[X.map(e=>{const a=z.has(e.id);return he.some(w=>w.id===e.id)?null:s.jsxs("button",{className:`spawn-skill-chip ${a?"selected":""}`,onClick:()=>xe(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)}),b&&X.length===0&&s.jsx("div",{className:"skill-search-empty",children:n("terminal:spawn.noSkillsMatch",{query:b})})]})]}),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:J,onChange:e=>me(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:V.length===0?s.jsx("div",{className:"subordinates-empty",children:n("terminal:spawn.noAvailableAgents")}):V.map(e=>{const a=v.has(e.id),l=O[e.class],w=o.find(ye=>ye.id===e.class),ee=l||w||{icon:"🤖",color:"#888888"};return s.jsxs("button",{className:`subordinate-chip ${a?"selected":""}`,onClick:()=>Me(e.id),children:[a&&s.jsx("span",{className:"subordinate-check",children:"✓"}),s.jsx("span",{className:"subordinate-chip-icon",style:{color:ee.color},children:ee.icon}),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:ve,disabled:T,children:n(T?"common:buttons.deploying":"common:buttons2.deployBoss")})]})]})})}export{Ue as BossSpawnModal};
1
+ import{u as $e,f as Ae,G as Le,E as Ee,r as t,J as De,S as se,p as _e,K as R,A as ae,X as O,Y as j,j as s,M as Be,O as Ie,P,U as A,V as L,W as Re,s as Oe}from"./main-CL_Hkk_O.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-Chj50gSY.js";function ne(p){const h=j.filter(S=>!p.has(`Boss ${S}`));return h.length===0?`Boss ${j[Math.floor(Math.random()*j.length)]}-${Date.now()%1e3}`:`Boss ${h[Math.floor(Math.random()*h.length)]}`}function Ue({isOpen:p,onClose:h,onSpawnStart:S,onSpawnEnd:E,spawnPosition:le}){const{t:n}=$e(["terminal","common"]),{agents:g}=Ae(),o=Le(),C=Ee(),[r,d]=t.useState(""),[k,te]=t.useState(()=>De(se.LAST_CWD)),[c,D]=t.useState("boss"),[T,q]=t.useState(!1),[ie,M]=t.useState(!1),[F,ce]=t.useState(!0),[U,oe]=t.useState("bypass"),[m,W]=t.useState("claude"),[f,N]=t.useState({fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[G,re]=t.useState("haiku"),[K,de]=t.useState("gpt-5.3-codex"),[v,y]=t.useState(new Set),[z,_]=t.useState(new Set),[u,ue]=t.useState(""),[b,pe]=t.useState(""),[J,me]=t.useState(""),$=t.useRef(null),B=t.useRef(!1),H=t.useRef(!1),x=t.useMemo(()=>C.filter(e=>e.enabled),[C]),X=t.useMemo(()=>{if(!b.trim())return x;const e=b.toLowerCase();return x.filter(a=>a.name.toLowerCase().includes(e)||a.description.toLowerCase().includes(e)||a.slug.toLowerCase().includes(e))},[x,b]),he=t.useMemo(()=>{var a;const e=o.find(l=>l.id===c);return(a=e==null?void 0:e.defaultSkillIds)!=null&&a.length?C.filter(l=>e.defaultSkillIds.includes(l.id)):[]},[o,c,C]),we=["full-notifications","streaming-exec","task-label","report-task-to-boss"];t.useEffect(()=>{if(p&&!H.current&&x.length>0){const a=x.filter(l=>we.includes(l.slug)).map(l=>l.id);a.length>0&&_(new Set(a))}H.current=p},[p,x]);const xe=t.useCallback(e=>{_(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]),fe=t.useMemo(()=>{if(i!=null&&i.model)return i.model},[i]),be=t.useMemo(()=>{if(i!=null&&i.customModelPath)return _e(`/api/custom-models/${i.id}`)},[i]),je=i==null?void 0:i.modelScale,Ne=t.useMemo(()=>i?"scout":c==="boss"?"architect":c,[c,i]),Y=Array.from(g.values()).filter(e=>!e.isBoss&&e.class!=="boss"&&!e.bossId),V=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]),Q=t.useMemo(()=>{if(!u.trim())return R;const e=u.toLowerCase();return R.filter(a=>{const l=ae[a.id];return l?a.name.toLowerCase().includes(e)||a.id.toLowerCase().includes(e)||l.description.toLowerCase().includes(e):!1})},[u]),Z=t.useMemo(()=>{if(!u.trim())return!0;const e=u.toLowerCase(),a=O.boss;return"boss".includes(e)||a.description.toLowerCase().includes(e)},[u]);t.useEffect(()=>{if(p&&!B.current){B.current=!0;const e=new Set(Array.from(g.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)];d(`${a.name} ${w}-${Date.now()%1e3}`)}else d(`${a.name} ${l[Math.floor(Math.random()*l.length)]}`)}else d(ne(e));y(new Set),$.current&&($.current.focus(),$.current.select())}else p||(B.current=!1)},[p,g]),t.useEffect(()=>{if(!p)return;const e=o.find(a=>a.id===c);if(e)if(r.startsWith("Boss ")){const a=r.substring(5);d(`${e.name} ${a}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);d(`${e.name} ${l}`)}else d(`${e.name} ${r}`)}else{const a=o.find(l=>r.startsWith(l.name+" "));if(a){const l=r.substring(a.name.length+1);d(`Boss ${l}`)}else r.startsWith("Boss ")||d(`Boss ${r}`)}},[c]);const ve=()=>{if(M(!1),!k.trim()){M(!0);return}if(!r.trim()){const l=new Set(Array.from(g.values()).map(w=>w.name));d(ne(l));return}Re(se.LAST_CWD,k),S();const e=J.trim()||void 0,a=Array.from(z);Oe.spawnBossAgent(r.trim(),c,k.trim(),le||void 0,Array.from(v),m==="claude"?F:!1,U,m,m==="codex"?f:void 0,m==="codex"?K:void 0,m==="claude"?G:void 0,e,a),d(""),y(new Set),_(new Set),E(),h()},Se=()=>{q(!1),d(""),y(new Set),E(),h()},ge=()=>{q(!1),M(!0),E()};t.useEffect(()=>(window.__bossSpawnModalSuccess=Se,window.__bossSpawnModalError=ge,()=>{delete window.__bossSpawnModalSuccess,delete window.__bossSpawnModalError}),[r]);const Ce=e=>{e.target===e.currentTarget&&h()},ke=e=>{e.key==="Escape"&&h()},Me=e=>{const a=new Set(v);a.has(e)?a.delete(e):a.add(e),y(a)};if(!p)return null;const I=O.boss;return s.jsx("div",{className:`modal-overlay ${p?"visible":""}`,onClick:Ce,onKeyDown:ke,children:s.jsxs("div",{className:"modal boss-spawn-modal",children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("span",{className:"boss-header-icon",children:I.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:Ne,modelFile:fe,customModelUrl:be,modelScale:je,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+R.length+1>6&&s.jsx("input",{type:"text",className:"spawn-input class-search-input",placeholder:n("terminal:spawn.filterClasses"),value:u,onChange:e=>ue(e.target.value)}),s.jsxs("div",{className:"class-selector-inline",children:[V.map(e=>s.jsxs("button",{className:`class-chip ${c===e.id?"selected":""}`,onClick:()=>D(e.id),title:e.description,children:[s.jsx("span",{className:"class-chip-icon",children:e.icon}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id)),Z&&s.jsxs("button",{className:`class-chip ${c==="boss"?"selected":""}`,onClick:()=>D("boss"),title:I.description,children:[s.jsx("span",{className:"class-chip-icon",children:I.icon}),s.jsx("span",{className:"class-chip-name",children:n("terminal:spawn.bossClassName")})]}),Q.map(e=>{const a=ae[e.id];return a?s.jsxs("button",{className:`class-chip ${c===e.id?"selected":""}`,onClick:()=>D(e.id),title:a.description,children:[s.jsx("span",{className:"class-chip-icon",children:a.icon}),s.jsx("span",{className:"class-chip-name",children:e.name})]},e.id):null}),u&&V.length===0&&!Z&&Q.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:$,type:"text",className:"spawn-input",placeholder:n("terminal:spawn.bossNamePlaceholder"),value:r,onChange:e=>d(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(Ie,{value:k,onChange:e=>{te(e),M(!1)},placeholder:n("terminal:spawn.workingDirPlaceholder"),className:"spawn-input",hasError:ie,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 ${m==="claude"?"selected":""}`,onClick:()=>W("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 ${m==="codex"?"selected":""}`,onClick:()=>W("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("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 ${U===e?"selected":""}`,onClick:()=>oe(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")}),m==="claude"?s.jsx("div",{className:"spawn-select-row",children:Object.keys(A).map(e=>s.jsxs("button",{className:`spawn-select-btn ${G===e?"selected":""}`,onClick:()=>re(e),title:A[e].description,children:[s.jsx("span",{children:A[e].icon}),s.jsx("span",{children:A[e].label})]},e))}):m==="codex"?s.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(L).map(e=>s.jsxs("button",{className:`spawn-select-btn ${K===e?"selected":""}`,onClick:()=>de(e),title:L[e].description,children:[s.jsx("span",{children:L[e].icon}),s.jsx("span",{children:L[e].label})]},e))}):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=>ce(e.target.checked),disabled:m!=="claude"}),s.jsx("span",{children:n("terminal:spawn.chromeBrowser")})]})})]})]}),m==="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:f.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:!!f.search,onChange:e=>N(a=>({...a,search:e.target.checked}))}),s.jsx("span",{children:n("terminal:spawn.codex.enableSearch")})]}),f.fullAuto===!1&&s.jsxs(s.Fragment,{children:[s.jsxs("select",{className:"spawn-input",value:f.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:f.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:f.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:b,onChange:e=>pe(e.target.value)}),s.jsxs("div",{className:"spawn-skills-inline",children:[X.map(e=>{const a=z.has(e.id);return he.some(w=>w.id===e.id)?null:s.jsxs("button",{className:`spawn-skill-chip ${a?"selected":""}`,onClick:()=>xe(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)}),b&&X.length===0&&s.jsx("div",{className:"skill-search-empty",children:n("terminal:spawn.noSkillsMatch",{query:b})})]})]}),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:J,onChange:e=>me(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:Y.length===0?s.jsx("div",{className:"subordinates-empty",children:n("terminal:spawn.noAvailableAgents")}):Y.map(e=>{const a=v.has(e.id),l=O[e.class],w=o.find(ye=>ye.id===e.class),ee=l||w||{icon:"🤖",color:"#888888"};return s.jsxs("button",{className:`subordinate-chip ${a?"selected":""}`,onClick:()=>Me(e.id),children:[a&&s.jsx("span",{className:"subordinate-check",children:"✓"}),s.jsx("span",{className:"subordinate-chip-icon",style:{color:ee.color},children:ee.icon}),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:ve,disabled:T,children:n(T?"common:buttons.deploying":"common:buttons2.deployBoss")})]})]})})}export{Ue as BossSpawnModal};
@@ -1 +1 @@
1
- import{u as S,b0 as Y,r as m,b1 as X,a$ as w,j as e,f as _,b2 as W,b3 as Z,q as U,h as q,s as y,b4 as z,b5 as A}from"./main-B_diMezF.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.js";function H({shortcut:t,onUpdate:a}){const{t:s}=S(["config","terminal"]),o=Y(),[l,h]=m.useState(!1),[i,j]=m.useState(null),f=m.useRef(null),v=m.useMemo(()=>i?X(o,i,t.id,t.context):[],[i,o,t.id,t.context]);m.useEffect(()=>{if(!l)return;const p=c=>{if(c.preventDefault(),c.stopPropagation(),c.key==="Escape"&&!c.ctrlKey&&!c.altKey&&!c.shiftKey&&!c.metaKey){h(!1),j(null);return}if(["Control","Alt","Shift","Meta"].includes(c.key))return;let b=c.key;c.code.startsWith("Key")&&c.code.length===4?b=c.code.charAt(3).toLowerCase():c.code.startsWith("Digit")&&c.code.length===6?b=c.code.charAt(5):c.code==="Space"&&(b="Space");const x={key:b,modifiers:{ctrl:c.ctrlKey,alt:c.altKey,shift:c.shiftKey,meta:c.metaKey}};j(x)};return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[l]),m.useEffect(()=>{if(!l)return;const p=c=>{f.current&&!f.current.contains(c.target)&&(i&&v.length===0&&a(i),h(!1),j(null))};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[l,i,v,a]);const k=()=>{l?(i&&v.length===0&&a(i),h(!1),j(null)):(h(!0),j(null))},g=p=>{p.stopPropagation(),a({key:"",modifiers:{}})};let d;return l?i?d=w({...t,...i}):d=s("config:shortcuts.pressKeys"):t.key?d=w(t):d=s("config:shortcuts.notSet"),e.jsxs("div",{className:"key-capture-container",children:[e.jsx("button",{ref:f,className:`key-capture-input ${l?"capturing":""} ${v.length>0?"conflict":""} ${t.enabled?"":"disabled"}`,onClick:k,title:s(l?"config:shortcuts.pressKeysOrClick":"config:shortcuts.clickToChange"),children:e.jsx("span",{className:"key-capture-value",children:d})}),t.key&&!l&&e.jsx("button",{className:"key-capture-clear",onClick:g,title:s("config:shortcuts.clearShortcut"),children:"×"}),v.length>0&&e.jsx("div",{className:"key-capture-conflict",children:s("config:shortcuts.conflictsWith",{names:v.map(p=>s(`terminal:controls.shortcuts.${p.id}.name`,{defaultValue:p.name})).join(", ")})})]})}const V={global:"terminal:controls.contextGlobal",commander:"terminal:controls.contextCommander",toolbox:"terminal:controls.contextToolbox"},Q={global:"terminal:controls.contextGlobalDesc",commander:"terminal:controls.contextCommanderDesc",toolbox:"terminal:controls.contextToolboxDesc"},R={camera:["camera-pan","camera-orbit","camera-rotate","camera-zoom","camera-tilt"],interaction:["primary-action","selection-box","context-menu","move-command"]},J={camera:"terminal:controls.cameraControls",interaction:"terminal:controls.interaction"};function oe({isOpen:t,onClose:a}){const{t:s}=S(["terminal","common"]),o=_(),l=W(),h=Z(),[i,j]=m.useState("keyboard"),[f,v]=m.useState(""),[k,g]=m.useState("all"),[d,p]=m.useState(!1),[c,b]=m.useState(null),x=U.useRef(null),{handleMouseDown:D,handleClick:M}=q(a);if(m.useEffect(()=>{if(!t||d)return;const r=n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),a())};return document.addEventListener("keydown",r,!0),()=>document.removeEventListener("keydown",r,!0)},[t,a,d]),m.useEffect(()=>{t||(v(""),p(!1),b(null))},[t]),m.useEffect(()=>{if(!t||!d)return;const r=n=>{if(n.key==="Escape"){n.preventDefault(),n.stopPropagation(),p(!1),b(null);return}if(["Control","Alt","Shift","Meta"].includes(n.key))return;n.preventDefault(),n.stopPropagation();let u=n.key;n.code.startsWith("Key")&&n.code.length===4?u=n.code.charAt(3).toLowerCase():n.code.startsWith("Digit")&&n.code.length===6?u=n.code.charAt(5):n.code==="Space"&&(u="Space"),b({key:u,modifiers:{ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey,meta:n.metaKey}})};return document.addEventListener("keydown",r,!0),()=>document.removeEventListener("keydown",r,!0)},[t,d]),!t)return null;const E=o.shortcuts.filter(r=>{const n=s(`terminal:controls.shortcuts.${r.id}.name`,{defaultValue:r.name}),u=s(`terminal:controls.shortcuts.${r.id}.description`,{defaultValue:r.description});if(d&&c){const O=C=>C===" "||C==="Space"?"Space":C.length===1?C.toLowerCase():C,$=O(r.key),B=O(c.key);if(!(B.length===1&&/^[a-zA-Z]$/.test($)?`Key${$.toUpperCase()}`==`Key${B.toUpperCase()}`:$===B))return!1;const K=r.modifiers,T=c.modifiers;return(K.ctrl||!1)===(T.ctrl||!1)&&(K.alt||!1)===(T.alt||!1)&&(K.shift||!1)===(T.shift||!1)&&(K.meta||!1)===(T.meta||!1)}if(!f)return!0;const N=f.toLowerCase();return n.toLowerCase().includes(N)||u.toLowerCase().includes(N)||w(r).toLowerCase().includes(N)}),L=E.reduce((r,n)=>(r[n.context]||(r[n.context]=[]),r[n.context].push(n),r),{}),G=(r,n)=>{y.updateShortcut(r,n)},F=()=>{i==="keyboard"?confirm(s("terminal:controls.confirmResetKeyboard"))&&y.resetShortcuts():i==="mouse"?confirm(s("terminal:controls.confirmResetMouse"))&&y.resetMouseControls():i==="trackpad"&&confirm(s("terminal:controls.confirmResetTrackpad"))&&y.resetMouseControls()},P=["global","commander","toolbox"],I=l.bindings.reduce((r,n)=>(R.camera.includes(n.action)?r.camera.push(n):R.interaction.includes(n.action)&&r.interaction.push(n),r),{camera:[],interaction:[]});return e.jsx("div",{className:"shortcuts-modal-overlay",onMouseDown:D,onClick:M,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:s("terminal:controls.title")})]}),e.jsx("button",{className:"shortcuts-modal-close",onClick:a,children:"×"})]}),e.jsxs("div",{className:"controls-main-tabs",children:[e.jsxs("button",{className:`controls-main-tab ${i==="keyboard"?"active":""}`,onClick:()=>j("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"})]}),s("terminal:controls.keyboard")]}),e.jsxs("button",{className:`controls-main-tab ${i==="mouse"?"active":""}`,onClick:()=>j("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"})]}),s("terminal:controls.mouse")]}),e.jsxs("button",{className:`controls-main-tab ${i==="trackpad"?"active":""}`,onClick:()=>j("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"})]}),s("terminal:controls.trackpad")]})]}),i==="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"})]}),c?e.jsxs("span",{className:"find-by-shortcut-display",children:[w({key:c.key,modifiers:c.modifiers}),e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>b(null),children:"×"})]}):e.jsx("span",{className:"find-by-shortcut-prompt",children:s("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:x,type:"text",placeholder:s("terminal:controls.searchShortcuts"),value:f,onChange:r=>v(r.target.value),autoFocus:!0}),f&&e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>v(""),children:"×"})]}),e.jsx("button",{className:`shortcuts-find-by-key-btn ${d?"active":""}`,onClick:()=>{p(!d),b(null),v("")},title:s(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:F,children:s("common:buttons.reset")})]}),e.jsxs("div",{className:"shortcuts-context-tabs",children:[e.jsxs("button",{className:`shortcuts-context-tab ${k==="all"?"active":""}`,onClick:()=>g("all"),children:[s("common:labels.all"),e.jsx("span",{className:"shortcuts-context-tab-count",children:E.length})]}),P.map(r=>{var u;const n=((u=L[r])==null?void 0:u.length)||0;return e.jsxs("button",{className:`shortcuts-context-tab ${k===r?"active":""}`,onClick:()=>g(r),children:[s(V[r]),e.jsx("span",{className:"shortcuts-context-tab-count",children:n})]},r)})]}),e.jsxs("div",{className:"shortcuts-modal-content",children:[P.map(r=>{const n=L[r]||[];return n.length===0||k!=="all"&&k!==r?null:e.jsxs("div",{className:"shortcuts-context-group",children:[k==="all"&&e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:s(V[r])}),e.jsx("span",{className:"shortcuts-context-description",children:s(Q[r])})]}),e.jsx("div",{className:"shortcuts-grid",children:n.map(u=>e.jsxs("div",{className:"shortcut-item",children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:s(`terminal:controls.shortcuts.${u.id}.name`,{defaultValue:u.name})}),e.jsx("span",{className:"shortcut-item-description",children:s(`terminal:controls.shortcuts.${u.id}.description`,{defaultValue:u.description})})]}),e.jsx(H,{shortcut:u,onUpdate:N=>G(u.id,N)})]},u.id))})]},r)}),E.length===0&&e.jsx("div",{className:"shortcuts-empty",children:d?c?e.jsx("p",{children:s("terminal:controls.noShortcutBoundTo",{keys:w({key:c.key,modifiers:c.modifiers})})}):e.jsx("p",{children:s("terminal:controls.pressKeyCombinationToFind")}):e.jsx("p",{children:s("terminal:controls.noShortcutsFound",{query:f})})})]})]}),i==="mouse"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:s("terminal:controls.cameraAndInteraction")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:F,children:s("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(([r,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:s(J[r])})}),e.jsx("div",{className:"shortcuts-grid",children:n.map(u=>e.jsx(ee,{binding:u},u.id))})]},r))}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:s("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:s("terminal:controls.adjustCameraSpeed")})]}),e.jsx(te,{sensitivity:l.sensitivity})]})]})]}),i==="trackpad"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:s("terminal:controls.trackpadGestureSettings")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:F,children:s("common:buttons.reset")})]}),e.jsx("div",{className:"shortcuts-modal-content trackpad-controls-content",children:e.jsx(se,{config:h})})]}),e.jsx("div",{className:"shortcuts-modal-footer",children:e.jsx("span",{className:"shortcuts-modal-hint",children:s(i==="keyboard"?d?"terminal:controls.hintFindByShortcut":"terminal:controls.hintKeyboard":i==="mouse"?"terminal:controls.hintMouse":"terminal:controls.hintTrackpad")})})]})})}function ee({binding:t}){const{t:a}=S(["terminal"]),s=W(),[o,l]=m.useState(!1),[h,i]=m.useState(null);m.useEffect(()=>{if(!o)return;const d=x=>{x.preventDefault(),x.stopPropagation();const M={0:"left",1:"middle",2:"right",3:"back",4:"forward"}[x.button];M&&i({button:M,modifiers:{ctrl:x.ctrlKey,alt:x.altKey,shift:x.shiftKey,meta:x.metaKey}})},p=x=>{x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),l(!1),i(null))},c=()=>{h&&z(s.bindings,h,t.id).length===0&&y.updateMouseBinding(t.id,{button:h.button,modifiers:h.modifiers}),l(!1),i(null)},b=setTimeout(()=>{document.addEventListener("mousedown",d,!0),document.addEventListener("keydown",p,!0),document.addEventListener("click",c,!0)},100);return()=>{clearTimeout(b),document.removeEventListener("mousedown",d,!0),document.removeEventListener("keydown",p,!0),document.removeEventListener("click",c,!0)}},[o,h,t.id,s.bindings]);const j=h?z(s.bindings,h,t.id):[],f=a(`terminal:controls.mouseBindings.${t.id}.name`,{defaultValue:t.name}),v=a(`terminal:controls.mouseBindings.${t.id}.description`,{defaultValue:t.description}),k=d=>a(`terminal:controls.mouseButtons.${d}`,{defaultValue:d}),g=h?A({...t,...h},k):A(t,k);return e.jsxs("div",{className:`shortcut-item ${t.enabled?"":"disabled"}`,children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:f}),e.jsx("span",{className:"shortcut-item-description",children:v})]}),e.jsxs("div",{className:"key-capture-container",children:[e.jsx("button",{className:`key-capture-input ${o?"capturing":""} ${j.length>0?"conflict":""}`,onClick:()=>l(!0),children:o?h?e.jsx("span",{className:"key-capture-value",style:{color:"#f1fa8c"},children:g}):e.jsx("span",{style:{color:"#6272a4",fontStyle:"italic"},children:a("terminal:controls.clickToCapture")}):e.jsx("span",{className:"key-capture-value",children:g})}),j.length>0&&e.jsxs("span",{className:"key-capture-conflict",children:[a("terminal:controls.conflicts"),": ",j.map(d=>a(`terminal:controls.mouseBindings.${d.id}.name`,{defaultValue:d.name})).join(", ")]})]})]})}function te({sensitivity:t}){const{t:a}=S(["terminal"]),s=m.useCallback((o,l)=>{y.updateCameraSensitivity({[o]:l})},[]);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:a("terminal:controls.panSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.panSpeed,onChange:o=>s("panSpeed",parseFloat(o.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[t.panSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:a("terminal:controls.orbitSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.orbitSpeed,onChange:o=>s("orbitSpeed",parseFloat(o.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[t.orbitSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:a("terminal:controls.zoomSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.zoomSpeed,onChange:o=>s("zoomSpeed",parseFloat(o.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[t.zoomSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:a("terminal:controls.smoothing")}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:t.smoothing,onChange:o=>s("smoothing",parseFloat(o.target.value))}),e.jsx("span",{className:"sensitivity-slider-value",children:t.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:t.invertPanX,onChange:o=>s("invertPanX",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertPanX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:t.invertPanY,onChange:o=>s("invertPanY",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertPanY")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:t.invertOrbitX,onChange:o=>s("invertOrbitX",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertOrbitX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:t.invertOrbitY,onChange:o=>s("invertOrbitY",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertOrbitY")})]})]})]})}function se({config:t}){const{t:a}=S(["terminal"]),s=m.useCallback((l,h)=>{y.updateTrackpadConfig({[l]:h})},[]),o=m.useCallback((l,h)=>{y.updateTrackpadConfig({sensitivity:{[l]: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:a("terminal:controls.trackpadGestures")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.enableTrackpadSupport")})]}),e.jsx("div",{className:"trackpad-toggle-row",children:e.jsxs("label",{className:"trackpad-toggle",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:l=>s("enabled",l.target.checked)}),e.jsx("span",{className:"trackpad-toggle-label",children:a("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:a("terminal:controls.gestureControls")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.enableDisableGestures")})]}),e.jsxs("div",{className:"trackpad-gestures-grid",children:[e.jsxs("label",{className:`trackpad-gesture-item ${t.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:t.pinchToZoom,onChange:l=>s("pinchToZoom",l.target.checked),disabled:!t.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:a("terminal:controls.pinchToZoom")}),e.jsx("span",{className:"trackpad-gesture-desc",children:a("terminal:controls.pinchToZoomDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${t.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:t.twoFingerPan,onChange:l=>s("twoFingerPan",l.target.checked),disabled:!t.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:a("terminal:controls.twoFingerPan")}),e.jsx("span",{className:"trackpad-gesture-desc",children:a("terminal:controls.twoFingerPanDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${t.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:t.shiftTwoFingerOrbit,onChange:l=>s("shiftTwoFingerOrbit",l.target.checked),disabled:!t.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:a("terminal:controls.shiftTwoFingerOrbit")}),e.jsx("span",{className:"trackpad-gesture-desc",children:a("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:a("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.adjustGestureSensitivity")})]}),e.jsxs("div",{className:"trackpad-sensitivity-sliders",children:[e.jsxs("div",{className:`trackpad-slider-row ${!t.enabled||!t.pinchToZoom?"disabled":""}`,children:[e.jsx("label",{children:a("terminal:controls.zoom")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.sensitivity.zoom,onChange:l=>o("zoom",parseFloat(l.target.value)),disabled:!t.enabled||!t.pinchToZoom}),e.jsxs("span",{className:"trackpad-slider-value",children:[t.sensitivity.zoom.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!t.enabled||!t.twoFingerPan?"disabled":""}`,children:[e.jsx("label",{children:a("terminal:controls.pan")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.sensitivity.pan,onChange:l=>o("pan",parseFloat(l.target.value)),disabled:!t.enabled||!t.twoFingerPan}),e.jsxs("span",{className:"trackpad-slider-value",children:[t.sensitivity.pan.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!t.enabled||!t.shiftTwoFingerOrbit?"disabled":""}`,children:[e.jsx("label",{children:a("terminal:controls.orbit")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.sensitivity.orbit,onChange:l=>o("orbit",parseFloat(l.target.value)),disabled:!t.enabled||!t.shiftTwoFingerOrbit}),e.jsxs("span",{className:"trackpad-slider-value",children:[t.sensitivity.orbit.toFixed(1),"x"]})]})]})]})]})}export{oe as ControlsModal};
1
+ import{u as S,b1 as Y,r as m,b2 as X,b0 as w,j as e,f as _,b3 as W,b4 as Z,q as U,h as q,s as y,b5 as z,b6 as A}from"./main-CL_Hkk_O.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-Chj50gSY.js";function H({shortcut:t,onUpdate:a}){const{t:s}=S(["config","terminal"]),o=Y(),[l,h]=m.useState(!1),[i,j]=m.useState(null),f=m.useRef(null),v=m.useMemo(()=>i?X(o,i,t.id,t.context):[],[i,o,t.id,t.context]);m.useEffect(()=>{if(!l)return;const p=c=>{if(c.preventDefault(),c.stopPropagation(),c.key==="Escape"&&!c.ctrlKey&&!c.altKey&&!c.shiftKey&&!c.metaKey){h(!1),j(null);return}if(["Control","Alt","Shift","Meta"].includes(c.key))return;let b=c.key;c.code.startsWith("Key")&&c.code.length===4?b=c.code.charAt(3).toLowerCase():c.code.startsWith("Digit")&&c.code.length===6?b=c.code.charAt(5):c.code==="Space"&&(b="Space");const x={key:b,modifiers:{ctrl:c.ctrlKey,alt:c.altKey,shift:c.shiftKey,meta:c.metaKey}};j(x)};return document.addEventListener("keydown",p,!0),()=>document.removeEventListener("keydown",p,!0)},[l]),m.useEffect(()=>{if(!l)return;const p=c=>{f.current&&!f.current.contains(c.target)&&(i&&v.length===0&&a(i),h(!1),j(null))};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[l,i,v,a]);const k=()=>{l?(i&&v.length===0&&a(i),h(!1),j(null)):(h(!0),j(null))},g=p=>{p.stopPropagation(),a({key:"",modifiers:{}})};let d;return l?i?d=w({...t,...i}):d=s("config:shortcuts.pressKeys"):t.key?d=w(t):d=s("config:shortcuts.notSet"),e.jsxs("div",{className:"key-capture-container",children:[e.jsx("button",{ref:f,className:`key-capture-input ${l?"capturing":""} ${v.length>0?"conflict":""} ${t.enabled?"":"disabled"}`,onClick:k,title:s(l?"config:shortcuts.pressKeysOrClick":"config:shortcuts.clickToChange"),children:e.jsx("span",{className:"key-capture-value",children:d})}),t.key&&!l&&e.jsx("button",{className:"key-capture-clear",onClick:g,title:s("config:shortcuts.clearShortcut"),children:"×"}),v.length>0&&e.jsx("div",{className:"key-capture-conflict",children:s("config:shortcuts.conflictsWith",{names:v.map(p=>s(`terminal:controls.shortcuts.${p.id}.name`,{defaultValue:p.name})).join(", ")})})]})}const V={global:"terminal:controls.contextGlobal",commander:"terminal:controls.contextCommander",toolbox:"terminal:controls.contextToolbox"},Q={global:"terminal:controls.contextGlobalDesc",commander:"terminal:controls.contextCommanderDesc",toolbox:"terminal:controls.contextToolboxDesc"},R={camera:["camera-pan","camera-orbit","camera-rotate","camera-zoom","camera-tilt"],interaction:["primary-action","selection-box","context-menu","move-command"]},J={camera:"terminal:controls.cameraControls",interaction:"terminal:controls.interaction"};function oe({isOpen:t,onClose:a}){const{t:s}=S(["terminal","common"]),o=_(),l=W(),h=Z(),[i,j]=m.useState("keyboard"),[f,v]=m.useState(""),[k,g]=m.useState("all"),[d,p]=m.useState(!1),[c,b]=m.useState(null),x=U.useRef(null),{handleMouseDown:D,handleClick:M}=q(a);if(m.useEffect(()=>{if(!t||d)return;const r=n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),a())};return document.addEventListener("keydown",r,!0),()=>document.removeEventListener("keydown",r,!0)},[t,a,d]),m.useEffect(()=>{t||(v(""),p(!1),b(null))},[t]),m.useEffect(()=>{if(!t||!d)return;const r=n=>{if(n.key==="Escape"){n.preventDefault(),n.stopPropagation(),p(!1),b(null);return}if(["Control","Alt","Shift","Meta"].includes(n.key))return;n.preventDefault(),n.stopPropagation();let u=n.key;n.code.startsWith("Key")&&n.code.length===4?u=n.code.charAt(3).toLowerCase():n.code.startsWith("Digit")&&n.code.length===6?u=n.code.charAt(5):n.code==="Space"&&(u="Space"),b({key:u,modifiers:{ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey,meta:n.metaKey}})};return document.addEventListener("keydown",r,!0),()=>document.removeEventListener("keydown",r,!0)},[t,d]),!t)return null;const E=o.shortcuts.filter(r=>{const n=s(`terminal:controls.shortcuts.${r.id}.name`,{defaultValue:r.name}),u=s(`terminal:controls.shortcuts.${r.id}.description`,{defaultValue:r.description});if(d&&c){const O=C=>C===" "||C==="Space"?"Space":C.length===1?C.toLowerCase():C,$=O(r.key),B=O(c.key);if(!(B.length===1&&/^[a-zA-Z]$/.test($)?`Key${$.toUpperCase()}`==`Key${B.toUpperCase()}`:$===B))return!1;const K=r.modifiers,T=c.modifiers;return(K.ctrl||!1)===(T.ctrl||!1)&&(K.alt||!1)===(T.alt||!1)&&(K.shift||!1)===(T.shift||!1)&&(K.meta||!1)===(T.meta||!1)}if(!f)return!0;const N=f.toLowerCase();return n.toLowerCase().includes(N)||u.toLowerCase().includes(N)||w(r).toLowerCase().includes(N)}),L=E.reduce((r,n)=>(r[n.context]||(r[n.context]=[]),r[n.context].push(n),r),{}),G=(r,n)=>{y.updateShortcut(r,n)},F=()=>{i==="keyboard"?confirm(s("terminal:controls.confirmResetKeyboard"))&&y.resetShortcuts():i==="mouse"?confirm(s("terminal:controls.confirmResetMouse"))&&y.resetMouseControls():i==="trackpad"&&confirm(s("terminal:controls.confirmResetTrackpad"))&&y.resetMouseControls()},P=["global","commander","toolbox"],I=l.bindings.reduce((r,n)=>(R.camera.includes(n.action)?r.camera.push(n):R.interaction.includes(n.action)&&r.interaction.push(n),r),{camera:[],interaction:[]});return e.jsx("div",{className:"shortcuts-modal-overlay",onMouseDown:D,onClick:M,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:s("terminal:controls.title")})]}),e.jsx("button",{className:"shortcuts-modal-close",onClick:a,children:"×"})]}),e.jsxs("div",{className:"controls-main-tabs",children:[e.jsxs("button",{className:`controls-main-tab ${i==="keyboard"?"active":""}`,onClick:()=>j("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"})]}),s("terminal:controls.keyboard")]}),e.jsxs("button",{className:`controls-main-tab ${i==="mouse"?"active":""}`,onClick:()=>j("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"})]}),s("terminal:controls.mouse")]}),e.jsxs("button",{className:`controls-main-tab ${i==="trackpad"?"active":""}`,onClick:()=>j("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"})]}),s("terminal:controls.trackpad")]})]}),i==="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"})]}),c?e.jsxs("span",{className:"find-by-shortcut-display",children:[w({key:c.key,modifiers:c.modifiers}),e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>b(null),children:"×"})]}):e.jsx("span",{className:"find-by-shortcut-prompt",children:s("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:x,type:"text",placeholder:s("terminal:controls.searchShortcuts"),value:f,onChange:r=>v(r.target.value),autoFocus:!0}),f&&e.jsx("button",{className:"shortcuts-search-clear",onClick:()=>v(""),children:"×"})]}),e.jsx("button",{className:`shortcuts-find-by-key-btn ${d?"active":""}`,onClick:()=>{p(!d),b(null),v("")},title:s(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:F,children:s("common:buttons.reset")})]}),e.jsxs("div",{className:"shortcuts-context-tabs",children:[e.jsxs("button",{className:`shortcuts-context-tab ${k==="all"?"active":""}`,onClick:()=>g("all"),children:[s("common:labels.all"),e.jsx("span",{className:"shortcuts-context-tab-count",children:E.length})]}),P.map(r=>{var u;const n=((u=L[r])==null?void 0:u.length)||0;return e.jsxs("button",{className:`shortcuts-context-tab ${k===r?"active":""}`,onClick:()=>g(r),children:[s(V[r]),e.jsx("span",{className:"shortcuts-context-tab-count",children:n})]},r)})]}),e.jsxs("div",{className:"shortcuts-modal-content",children:[P.map(r=>{const n=L[r]||[];return n.length===0||k!=="all"&&k!==r?null:e.jsxs("div",{className:"shortcuts-context-group",children:[k==="all"&&e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:s(V[r])}),e.jsx("span",{className:"shortcuts-context-description",children:s(Q[r])})]}),e.jsx("div",{className:"shortcuts-grid",children:n.map(u=>e.jsxs("div",{className:"shortcut-item",children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:s(`terminal:controls.shortcuts.${u.id}.name`,{defaultValue:u.name})}),e.jsx("span",{className:"shortcut-item-description",children:s(`terminal:controls.shortcuts.${u.id}.description`,{defaultValue:u.description})})]}),e.jsx(H,{shortcut:u,onUpdate:N=>G(u.id,N)})]},u.id))})]},r)}),E.length===0&&e.jsx("div",{className:"shortcuts-empty",children:d?c?e.jsx("p",{children:s("terminal:controls.noShortcutBoundTo",{keys:w({key:c.key,modifiers:c.modifiers})})}):e.jsx("p",{children:s("terminal:controls.pressKeyCombinationToFind")}):e.jsx("p",{children:s("terminal:controls.noShortcutsFound",{query:f})})})]})]}),i==="mouse"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:s("terminal:controls.cameraAndInteraction")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:F,children:s("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(([r,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:s(J[r])})}),e.jsx("div",{className:"shortcuts-grid",children:n.map(u=>e.jsx(ee,{binding:u},u.id))})]},r))}),e.jsxs("div",{className:"shortcuts-context-group",children:[e.jsxs("div",{className:"shortcuts-context-header",children:[e.jsx("span",{className:"shortcuts-context-label",children:s("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:s("terminal:controls.adjustCameraSpeed")})]}),e.jsx(te,{sensitivity:l.sensitivity})]})]})]}),i==="trackpad"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shortcuts-modal-toolbar",children:[e.jsx("span",{className:"mouse-controls-subtitle",children:s("terminal:controls.trackpadGestureSettings")}),e.jsx("button",{className:"shortcuts-reset-all-btn",onClick:F,children:s("common:buttons.reset")})]}),e.jsx("div",{className:"shortcuts-modal-content trackpad-controls-content",children:e.jsx(se,{config:h})})]}),e.jsx("div",{className:"shortcuts-modal-footer",children:e.jsx("span",{className:"shortcuts-modal-hint",children:s(i==="keyboard"?d?"terminal:controls.hintFindByShortcut":"terminal:controls.hintKeyboard":i==="mouse"?"terminal:controls.hintMouse":"terminal:controls.hintTrackpad")})})]})})}function ee({binding:t}){const{t:a}=S(["terminal"]),s=W(),[o,l]=m.useState(!1),[h,i]=m.useState(null);m.useEffect(()=>{if(!o)return;const d=x=>{x.preventDefault(),x.stopPropagation();const M={0:"left",1:"middle",2:"right",3:"back",4:"forward"}[x.button];M&&i({button:M,modifiers:{ctrl:x.ctrlKey,alt:x.altKey,shift:x.shiftKey,meta:x.metaKey}})},p=x=>{x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),l(!1),i(null))},c=()=>{h&&z(s.bindings,h,t.id).length===0&&y.updateMouseBinding(t.id,{button:h.button,modifiers:h.modifiers}),l(!1),i(null)},b=setTimeout(()=>{document.addEventListener("mousedown",d,!0),document.addEventListener("keydown",p,!0),document.addEventListener("click",c,!0)},100);return()=>{clearTimeout(b),document.removeEventListener("mousedown",d,!0),document.removeEventListener("keydown",p,!0),document.removeEventListener("click",c,!0)}},[o,h,t.id,s.bindings]);const j=h?z(s.bindings,h,t.id):[],f=a(`terminal:controls.mouseBindings.${t.id}.name`,{defaultValue:t.name}),v=a(`terminal:controls.mouseBindings.${t.id}.description`,{defaultValue:t.description}),k=d=>a(`terminal:controls.mouseButtons.${d}`,{defaultValue:d}),g=h?A({...t,...h},k):A(t,k);return e.jsxs("div",{className:`shortcut-item ${t.enabled?"":"disabled"}`,children:[e.jsxs("div",{className:"shortcut-item-info",children:[e.jsx("span",{className:"shortcut-item-name",children:f}),e.jsx("span",{className:"shortcut-item-description",children:v})]}),e.jsxs("div",{className:"key-capture-container",children:[e.jsx("button",{className:`key-capture-input ${o?"capturing":""} ${j.length>0?"conflict":""}`,onClick:()=>l(!0),children:o?h?e.jsx("span",{className:"key-capture-value",style:{color:"#f1fa8c"},children:g}):e.jsx("span",{style:{color:"#6272a4",fontStyle:"italic"},children:a("terminal:controls.clickToCapture")}):e.jsx("span",{className:"key-capture-value",children:g})}),j.length>0&&e.jsxs("span",{className:"key-capture-conflict",children:[a("terminal:controls.conflicts"),": ",j.map(d=>a(`terminal:controls.mouseBindings.${d.id}.name`,{defaultValue:d.name})).join(", ")]})]})]})}function te({sensitivity:t}){const{t:a}=S(["terminal"]),s=m.useCallback((o,l)=>{y.updateCameraSensitivity({[o]:l})},[]);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:a("terminal:controls.panSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.panSpeed,onChange:o=>s("panSpeed",parseFloat(o.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[t.panSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:a("terminal:controls.orbitSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.orbitSpeed,onChange:o=>s("orbitSpeed",parseFloat(o.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[t.orbitSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:a("terminal:controls.zoomSpeed")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.zoomSpeed,onChange:o=>s("zoomSpeed",parseFloat(o.target.value))}),e.jsxs("span",{className:"sensitivity-slider-value",children:[t.zoomSpeed.toFixed(1),"x"]})]}),e.jsxs("div",{className:"sensitivity-slider-row",children:[e.jsx("label",{children:a("terminal:controls.smoothing")}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",value:t.smoothing,onChange:o=>s("smoothing",parseFloat(o.target.value))}),e.jsx("span",{className:"sensitivity-slider-value",children:t.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:t.invertPanX,onChange:o=>s("invertPanX",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertPanX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:t.invertPanY,onChange:o=>s("invertPanY",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertPanY")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:t.invertOrbitX,onChange:o=>s("invertOrbitX",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertOrbitX")})]}),e.jsxs("label",{className:"sensitivity-checkbox-inline",children:[e.jsx("input",{type:"checkbox",checked:t.invertOrbitY,onChange:o=>s("invertOrbitY",o.target.checked)}),e.jsx("span",{children:a("terminal:controls.invertOrbitY")})]})]})]})}function se({config:t}){const{t:a}=S(["terminal"]),s=m.useCallback((l,h)=>{y.updateTrackpadConfig({[l]:h})},[]),o=m.useCallback((l,h)=>{y.updateTrackpadConfig({sensitivity:{[l]: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:a("terminal:controls.trackpadGestures")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.enableTrackpadSupport")})]}),e.jsx("div",{className:"trackpad-toggle-row",children:e.jsxs("label",{className:"trackpad-toggle",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:l=>s("enabled",l.target.checked)}),e.jsx("span",{className:"trackpad-toggle-label",children:a("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:a("terminal:controls.gestureControls")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.enableDisableGestures")})]}),e.jsxs("div",{className:"trackpad-gestures-grid",children:[e.jsxs("label",{className:`trackpad-gesture-item ${t.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:t.pinchToZoom,onChange:l=>s("pinchToZoom",l.target.checked),disabled:!t.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:a("terminal:controls.pinchToZoom")}),e.jsx("span",{className:"trackpad-gesture-desc",children:a("terminal:controls.pinchToZoomDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${t.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:t.twoFingerPan,onChange:l=>s("twoFingerPan",l.target.checked),disabled:!t.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:a("terminal:controls.twoFingerPan")}),e.jsx("span",{className:"trackpad-gesture-desc",children:a("terminal:controls.twoFingerPanDesc")})]})]}),e.jsxs("label",{className:`trackpad-gesture-item ${t.enabled?"":"disabled"}`,children:[e.jsx("input",{type:"checkbox",checked:t.shiftTwoFingerOrbit,onChange:l=>s("shiftTwoFingerOrbit",l.target.checked),disabled:!t.enabled}),e.jsxs("div",{className:"trackpad-gesture-info",children:[e.jsx("span",{className:"trackpad-gesture-name",children:a("terminal:controls.shiftTwoFingerOrbit")}),e.jsx("span",{className:"trackpad-gesture-desc",children:a("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:a("terminal:controls.sensitivity")}),e.jsx("span",{className:"shortcuts-context-description",children:a("terminal:controls.adjustGestureSensitivity")})]}),e.jsxs("div",{className:"trackpad-sensitivity-sliders",children:[e.jsxs("div",{className:`trackpad-slider-row ${!t.enabled||!t.pinchToZoom?"disabled":""}`,children:[e.jsx("label",{children:a("terminal:controls.zoom")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.sensitivity.zoom,onChange:l=>o("zoom",parseFloat(l.target.value)),disabled:!t.enabled||!t.pinchToZoom}),e.jsxs("span",{className:"trackpad-slider-value",children:[t.sensitivity.zoom.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!t.enabled||!t.twoFingerPan?"disabled":""}`,children:[e.jsx("label",{children:a("terminal:controls.pan")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.sensitivity.pan,onChange:l=>o("pan",parseFloat(l.target.value)),disabled:!t.enabled||!t.twoFingerPan}),e.jsxs("span",{className:"trackpad-slider-value",children:[t.sensitivity.pan.toFixed(1),"x"]})]}),e.jsxs("div",{className:`trackpad-slider-row ${!t.enabled||!t.shiftTwoFingerOrbit?"disabled":""}`,children:[e.jsx("label",{children:a("terminal:controls.orbit")}),e.jsx("input",{type:"range",min:"0.1",max:"3",step:"0.1",value:t.sensitivity.orbit,onChange:l=>o("orbit",parseFloat(l.target.value)),disabled:!t.enabled||!t.shiftTwoFingerOrbit}),e.jsxs("span",{className:"trackpad-slider-value",children:[t.sensitivity.orbit.toFixed(1),"x"]})]})]})]})]})}export{oe 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-B_diMezF.js";import{L as S}from"./LogViewerModal-wKmq37Bu.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.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-CL_Hkk_O.js";import{L as S}from"./LogViewerModal-D7lbw4o9.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.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-B_diMezF.js";import{g as j,l as k,h as N,a as R,f as T,d as A,r as w,i as C,b as K,c as L,e as M,j as q,s as B,k as D,o as G,E as f,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-2eGWcGUM.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-BvqnFOow.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=[k(),N(),R(),T(),A(),w(),C(),K(),L(),M(),q(),B({top:!0}),D(z,{fallback:!0}),G,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-CL_Hkk_O.js";import{g as j,l as k,h as N,a as R,f as T,d as A,r as w,i as C,b as K,c as L,e as M,j as q,s as B,k as D,o as G,E as f,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-D-6vOLCa.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.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=[k(),N(),R(),T(),A(),w(),C(),K(),L(),M(),q(),B({top:!0}),D(z,{fallback:!0}),G,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,222 @@
1
+ import{r as t,L as E,p as v,j as e}from"./main-CL_Hkk_O.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react-uS-d4TUT.js";import"./vendor-three-Chj50gSY.js";function T({integration:l,onSave:x,onCancel:j}){const[d,R]=t.useState(l.values.clientId||""),[b,U]=t.useState(""),[g,w]=t.useState(String(l.values.pollingIntervalMs??3e4)),[p,N]=t.useState(l.values.defaultApprovalKeywords||"approved,aprobado,autorizado,yes,ok"),[y,k]=t.useState(null),[o,C]=t.useState(null),[u,h]=t.useState(!1),[A,r]=t.useState(null),[S,z]=t.useState(!1),[c,s]=t.useState(l.status.connected?"connected":"credentials"),i=t.useRef(null),I=t.useRef(l.status.connected),m=t.useCallback(async()=>{try{const a=await E(v("/api/email/status"));if(a.ok){const n=await a.json();C(n),n.authenticated&&(s("connected"),i.current&&(clearInterval(i.current),i.current=null))}}catch(a){console.error("Failed to fetch Gmail status:",a)}},[]);t.useEffect(()=>{const a=l.status.connected,n=I.current;a&&!n&&c!=="connected"?s("connected"):!a&&n&&c==="connected"&&s("credentials"),I.current=a},[l.status.connected]),t.useEffect(()=>(m(),()=>{i.current&&clearInterval(i.current)}),[m]);const G=async()=>{if(!d.trim()){r("Client ID is required");return}h(!0),r(null);try{const a={clientId:d.trim(),pollingIntervalMs:parseInt(g)||3e4,defaultApprovalKeywords:p};b.trim()&&(a.clientSecret=b.trim()),console.log("Saving Gmail config...",a),await x(a),console.log("Config saved successfully"),console.log("Fetching OAuth URL...");const n=await E(v("/api/email/auth/url"));if(console.log("OAuth URL response:",n.status),!n.ok){const M=await n.json().catch(()=>({}));throw new Error(M.error||`HTTP ${n.status}`)}const f=await n.json();if(console.log("Received OAuth URL:",f),console.log("Setting authUrl to:",f.url),!f.url)throw new Error("OAuth URL is empty");k(f.url),console.log("AuthUrl state updated"),r(null),s("authorize"),console.log("Step updated to authorize",{step:"authorize"}),i.current&&clearInterval(i.current),i.current=setInterval(m,3e3),console.log("Started polling for auth completion")}catch(a){const n=a instanceof Error?a.message:"Failed to get OAuth URL";console.error("Error in handleSaveCredentials:",n,a),r(n)}finally{h(!1)}},O=async()=>{z(!0),r(null);try{await x({pollingIntervalMs:parseInt(g)||3e4,defaultApprovalKeywords:p})}catch(a){r(a instanceof Error?a.message:"Failed to save settings")}finally{z(!1)}},L=async()=>{h(!0),r(null);try{await x({refreshToken:""}),C(null),k(null),s("credentials"),await m()}catch(a){r(a instanceof Error?a.message:"Failed to disconnect")}finally{h(!1)}};return e.jsxs("div",{className:"gmail-oauth-setup",children:[A&&e.jsx("div",{className:"gmail-oauth-error",children:A}),c==="credentials"&&e.jsxs("div",{className:"gmail-oauth-section",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:v("/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:d,placeholder:"xxxx.apps.googleusercontent.com",onChange:a=>R(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:b,placeholder:l.values.clientSecret?"(saved)":"Enter client secret",onChange:a=>U(a.target.value),autoComplete:"off"})]}),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:g,onChange:a=>w(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=>N(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:j,children:"Cancel"}),e.jsx("button",{type:"button",className:"integration-btn save",onClick:G,disabled:u||!d.trim(),children:u?"Saving...":"Save & Authorize"})]})]}),c==="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."}),y&&e.jsx("a",{href:y,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:()=>{i.current&&(clearInterval(i.current),i.current=null),s("credentials")},children:"Back"})})]}),c==="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"}),(o==null?void 0:o.emailAddress)&&e.jsx("span",{className:"gmail-oauth-email",children:o.emailAddress})]}),(o==null?void 0:o.pollingActive)&&e.jsxs("p",{className:"gmail-oauth-help",children:["Email polling is active.",o.lastPollAt&&e.jsxs(e.Fragment,{children:[" Last checked: ",new Date(o.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:g,onChange:a=>w(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=>N(a.target.value),rows:2})]}),e.jsxs("div",{className:"integration-form-actions",children:[e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:j,children:"Close"}),e.jsx("button",{type:"button",className:"integration-btn",style:{backgroundColor:"#f38ba8",color:"#1e1e2e"},onClick:L,disabled:u,children:u?"Disconnecting...":"Disconnect"}),e.jsx("button",{type:"button",className:"integration-btn save",onClick:O,disabled:S,children:S?"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
+ .integration-field-label {
61
+ display: block;
62
+ margin-bottom: 8px;
63
+ color: #cdd6f4;
64
+ font-size: 14px;
65
+ font-weight: 600;
66
+ letter-spacing: 0.3px;
67
+ }
68
+ .integration-field-required {
69
+ color: #f38ba8;
70
+ }
71
+ .integration-field-input {
72
+ width: 100%;
73
+ background: rgba(30, 30, 46, 0.6);
74
+ border: 1.5px solid rgba(137, 180, 250, 0.2);
75
+ color: #cdd6f4;
76
+ padding: 11px 14px;
77
+ border-radius: 8px;
78
+ font-size: 13px;
79
+ transition: all 0.2s ease;
80
+ font-weight: 500;
81
+ }
82
+ .integration-field-input:focus {
83
+ outline: none;
84
+ border-color: #89b4fa;
85
+ background: rgba(30, 30, 46, 0.8);
86
+ box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.15);
87
+ }
88
+ .integration-field-input::placeholder {
89
+ color: #6c7086;
90
+ }
91
+ .integration-field-textarea {
92
+ resize: vertical;
93
+ min-height: 80px;
94
+ font-family: 'Monaco', 'Menlo', monospace;
95
+ font-size: 12px;
96
+ }
97
+ .integration-field-description {
98
+ display: block;
99
+ margin-top: 7px;
100
+ color: #7f849c;
101
+ font-size: 12px;
102
+ font-weight: 400;
103
+ }
104
+ .gmail-oauth-authorize-btn {
105
+ display: inline-block;
106
+ background: linear-gradient(135deg, #89b4fa 0%, #7aa3f0 100%);
107
+ color: #1e1e2e;
108
+ padding: 12px 32px;
109
+ border-radius: 8px;
110
+ text-decoration: none;
111
+ font-weight: 700;
112
+ font-size: 14px;
113
+ margin-bottom: 20px;
114
+ transition: all 0.25s ease;
115
+ border: none;
116
+ cursor: pointer;
117
+ box-shadow: 0 4px 12px rgba(137, 180, 250, 0.25);
118
+ letter-spacing: 0.3px;
119
+ }
120
+ .gmail-oauth-authorize-btn:hover {
121
+ transform: translateY(-2px);
122
+ box-shadow: 0 6px 16px rgba(137, 180, 250, 0.35);
123
+ background: linear-gradient(135deg, #a8c5ff 0%, #8eb8ff 100%);
124
+ }
125
+ .gmail-oauth-authorize-btn:active {
126
+ transform: translateY(0);
127
+ }
128
+ .gmail-oauth-waiting {
129
+ display: flex;
130
+ align-items: center;
131
+ gap: 12px;
132
+ color: #a6adc8;
133
+ font-size: 13px;
134
+ margin-bottom: 20px;
135
+ background: rgba(137, 180, 250, 0.08);
136
+ padding: 14px 16px;
137
+ border-radius: 8px;
138
+ border-left: 3px solid #89b4fa;
139
+ font-weight: 500;
140
+ }
141
+ .gmail-oauth-spinner {
142
+ display: inline-block;
143
+ width: 16px;
144
+ height: 16px;
145
+ border: 2.5px solid rgba(137, 180, 250, 0.25);
146
+ border-top-color: #89b4fa;
147
+ border-radius: 50%;
148
+ animation: gmail-spin 0.8s linear infinite;
149
+ flex-shrink: 0;
150
+ }
151
+ @keyframes gmail-spin {
152
+ to { transform: rotate(360deg); }
153
+ }
154
+ .gmail-oauth-connected-info {
155
+ display: flex;
156
+ align-items: center;
157
+ gap: 14px;
158
+ margin-bottom: 20px;
159
+ background: rgba(166, 227, 161, 0.08);
160
+ padding: 16px;
161
+ border-radius: 10px;
162
+ border-left: 3px solid #a6e3a1;
163
+ }
164
+ .gmail-oauth-connected-badge {
165
+ background: linear-gradient(135deg, rgba(166, 227, 161, 0.3) 0%, rgba(166, 227, 161, 0.15) 100%);
166
+ color: #a6e3a1;
167
+ padding: 6px 14px;
168
+ border-radius: 6px;
169
+ font-size: 12px;
170
+ font-weight: 700;
171
+ letter-spacing: 0.4px;
172
+ text-transform: uppercase;
173
+ border: 1px solid rgba(166, 227, 161, 0.3);
174
+ flex-shrink: 0;
175
+ }
176
+ .gmail-oauth-email {
177
+ color: #cdd6f4;
178
+ font-size: 14px;
179
+ font-weight: 600;
180
+ letter-spacing: 0.2px;
181
+ }
182
+ .integration-form-actions {
183
+ display: flex;
184
+ gap: 12px;
185
+ justify-content: flex-end;
186
+ margin-top: 24px;
187
+ padding-top: 20px;
188
+ border-top: 1px solid rgba(137, 180, 250, 0.1);
189
+ }
190
+ .integration-btn {
191
+ padding: 10px 24px;
192
+ border-radius: 8px;
193
+ font-weight: 600;
194
+ font-size: 13px;
195
+ border: none;
196
+ cursor: pointer;
197
+ transition: all 0.2s ease;
198
+ letter-spacing: 0.3px;
199
+ }
200
+ .integration-btn.save {
201
+ background: linear-gradient(135deg, #89b4fa 0%, #7aa3f0 100%);
202
+ color: #1e1e2e;
203
+ box-shadow: 0 4px 12px rgba(137, 180, 250, 0.25);
204
+ }
205
+ .integration-btn.save:hover:not(:disabled) {
206
+ transform: translateY(-2px);
207
+ box-shadow: 0 6px 16px rgba(137, 180, 250, 0.35);
208
+ }
209
+ .integration-btn.cancel {
210
+ background: rgba(137, 180, 250, 0.1);
211
+ color: #89b4fa;
212
+ border: 1.5px solid rgba(137, 180, 250, 0.2);
213
+ }
214
+ .integration-btn.cancel:hover:not(:disabled) {
215
+ background: rgba(137, 180, 250, 0.15);
216
+ border-color: #89b4fa;
217
+ }
218
+ .integration-btn:disabled {
219
+ opacity: 0.5;
220
+ cursor: not-allowed;
221
+ }
222
+ `})]})}export{T as GmailOAuthSetup};