tide-commander 1.85.0 → 1.87.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 (46) hide show
  1. package/dist/assets/{BossLogsModal-uPeGcb3I.js → BossLogsModal-S3Rke-8g.js} +1 -1
  2. package/dist/assets/{BossSpawnModal-D7iyXoJq.js → BossSpawnModal-BjWGNCnz.js} +1 -1
  3. package/dist/assets/{ControlsModal-DXnnGYp5.js → ControlsModal-6yfU0XjZ.js} +1 -1
  4. package/dist/assets/{DockerLogsModal-DxmUWbDV.js → DockerLogsModal-CYq0hNz6.js} +1 -1
  5. package/dist/assets/{EmbeddedEditor-BUi6dUs3.js → EmbeddedEditor-ZBdqRDqm.js} +1 -1
  6. package/dist/assets/GmailOAuthSetup-BcV5jAse.js +388 -0
  7. package/dist/assets/{GoogleOAuthSetup-BPMmX5ua.js → GoogleOAuthSetup-DyUW_STE.js} +2 -2
  8. package/dist/assets/{IframeModal-CVJjFAPp.js → IframeModal-D9A3dUUc.js} +1 -1
  9. package/dist/assets/{IntegrationsPanel-DpQUsPg2.js → IntegrationsPanel-CHaNJBJW.js} +2 -2
  10. package/dist/assets/{LogViewerModal-tBZ1aP8p.js → LogViewerModal-BWkbY7wa.js} +1 -1
  11. package/dist/assets/{MonitoringModal-B4A0qczU.js → MonitoringModal-AZzokZAZ.js} +1 -1
  12. package/dist/assets/{PM2LogsModal-i7fxasp0.js → PM2LogsModal-q98eiBfq.js} +1 -1
  13. package/dist/assets/{RestoreArchivedAreaModal-UurWP1-j.js → RestoreArchivedAreaModal-CTxRP2qE.js} +1 -1
  14. package/dist/assets/{Scene2DCanvas-B9DuBLip.js → Scene2DCanvas-C11dztp1.js} +1 -1
  15. package/dist/assets/{SceneManager-xEBRq68j.js → SceneManager-CsW9MYrD.js} +1 -1
  16. package/dist/assets/{SkillsPanel-BDyKxve4.js → SkillsPanel-BeZr9w6E.js} +2 -2
  17. package/dist/assets/{SpawnModal-CBKT43_l.js → SpawnModal-DY_KM6lX.js} +1 -1
  18. package/dist/assets/{SubordinateAssignmentModal-CddDPiHW.js → SubordinateAssignmentModal-D6RvjGX9.js} +1 -1
  19. package/dist/assets/{TriggerManagerPanel-CcVCNnhm.js → TriggerManagerPanel-BmqjXv9T.js} +1 -1
  20. package/dist/assets/{WorkflowEditorPanel-C5meCq60.js → WorkflowEditorPanel-Rd5ZjJmt.js} +1 -1
  21. package/dist/assets/index-BOr_tbLK.js +2 -0
  22. package/dist/assets/{index-BfUS9DYN.js → index-BYVHgVEo.js} +1 -1
  23. package/dist/assets/{index-JUHUy-Tv.js → index-BoORE9Q1.js} +1 -1
  24. package/dist/assets/{index-DtDo7QHt.js → index-BtJyOo4p.js} +3 -3
  25. package/dist/assets/{index-BNQjdC7D.js → index-BxaEkSIx.js} +3 -3
  26. package/dist/assets/{index-CrpntCm1.js → index-Co7njQ0Q.js} +5 -5
  27. package/dist/assets/{index-huFbdygq.js → index-DHHRkTG1.js} +1 -1
  28. package/dist/assets/{index-C7Mu39PP.js → index-DRGyDtmm.js} +1 -1
  29. package/dist/assets/{index-CQll-mer.js → index-DSvJOrb7.js} +2 -2
  30. package/dist/assets/{main-Q3uQGSTr.js → main-BrZe9Zbd.js} +41 -41
  31. package/dist/assets/{web-_0kug6fn.js → web-D3zCwsS9.js} +1 -1
  32. package/dist/assets/web-DEq3Te_H.js +1 -0
  33. package/dist/assets/{web-ko2U5w1Z.js → web-DS0FHmg8.js} +1 -1
  34. package/dist/index.html +1 -1
  35. package/dist/src/packages/server/integrations/gmail/gmail-client.js +15 -2
  36. package/dist/src/packages/server/integrations/gmail/gmail-config.js +8 -0
  37. package/dist/src/packages/server/integrations/gmail/index.js +12 -2
  38. package/dist/src/packages/server/integrations/google-calendar/calendar-client.js +10 -2
  39. package/dist/src/packages/server/integrations/google-calendar/calendar-config.js +13 -0
  40. package/dist/src/packages/server/integrations/google-calendar/index.js +7 -0
  41. package/dist/src/packages/server/integrations/google-drive/drive-client.js +10 -2
  42. package/dist/src/packages/server/integrations/google-drive/drive-config.js +13 -0
  43. package/dist/src/packages/server/integrations/google-drive/index.js +7 -0
  44. package/package.json +2 -1
  45. package/dist/assets/GmailOAuthSetup-iCnmfNtc.js +0 -388
  46. package/dist/assets/index-D_wtUWqj.js +0 -2
@@ -0,0 +1,388 @@
1
+ import{r as t,aJ as S,l as y,j as e,I as B}from"./main-BrZe9Zbd.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function oe({integration:o,onSave:f,onCancel:z}){const[r,I]=t.useState(o.values.authMethod||"oauth2"),[g,L]=t.useState(o.values.clientId||""),[v,q]=t.useState(""),[w,K]=t.useState(o.values.redirectBaseUrl||""),[m,$]=t.useState(""),[j,Y]=t.useState(o.values.impersonateEmail||""),[p,E]=t.useState(String(o.values.pollingIntervalMs??3e4)),[x,O]=t.useState(o.values.defaultApprovalKeywords||"approved,aprobado,autorizado,yes,ok"),[M,G]=t.useState(null),[n,T]=t.useState(null),[c,d]=t.useState(!1),[P,i]=t.useState(null),[U,J]=t.useState(!1),[H,F]=t.useState(!1),[N,W]=t.useState(!1),[b,h]=t.useState(o.status.connected?"connected":"credentials"),k=r==="oauth2"&&o.values.clientId==="********"&&o.values.clientSecret==="********",s=t.useRef(null),_=t.useRef(o.status.connected),u=t.useCallback(async()=>{try{const a=await S(y("/api/email/status"));if(a.ok){const l=await a.json();T(l),l.authenticated&&(h("connected"),s.current&&(clearInterval(s.current),s.current=null))}}catch(a){console.error("Failed to fetch Gmail status:",a)}},[]);t.useEffect(()=>{const a=o.status.connected,l=_.current;a&&!l&&b!=="connected"?h("connected"):!a&&l&&b==="connected"&&h("credentials"),_.current=a},[o.status.connected]),t.useEffect(()=>(u(),()=>{s.current&&clearInterval(s.current)}),[u]);const R=async()=>{const a=await S(y("/api/email/auth/url"));if(!a.ok){const A=await a.json().catch(()=>({}));throw new Error(A.error||`HTTP ${a.status}`)}const l=await a.json();if(!l.url)throw new Error("OAuth URL is empty");G(l.url),i(null),h("authorize"),s.current&&clearInterval(s.current),s.current=setInterval(u,3e3)},X=async()=>{d(!0),i(null);try{await R()}catch(a){i(a instanceof Error?a.message:"Failed to get OAuth URL")}finally{d(!1)}},Q=async()=>{if(!g.trim()){i("Client ID is required");return}d(!0),i(null);try{const a={authMethod:"oauth2",redirectBaseUrl:w.trim(),pollingIntervalMs:parseInt(p)||3e4,defaultApprovalKeywords:x};g.trim()&&g.trim()!=="********"&&(a.clientId=g.trim()),v.trim()&&v.trim()!=="********"&&(a.clientSecret=v.trim()),await f(a),await R()}catch(a){const l=a instanceof Error?a.message:"Failed to get OAuth URL";i(l)}finally{d(!1)}},V=async()=>{if(!m.trim()){i("Service Account JSON is required");return}if(!j.trim()){i("Impersonate Email is required");return}try{const a=JSON.parse(m.trim());if(!a.client_email||!a.private_key){i("Service Account JSON must contain client_email and private_key");return}}catch{i("Invalid JSON in Service Account field");return}d(!0),i(null);try{await f({authMethod:"service_account",serviceAccountJson:m.trim(),impersonateEmail:j.trim(),pollingIntervalMs:parseInt(p)||3e4,defaultApprovalKeywords:x}),await new Promise(a=>setTimeout(a,1e3)),await u()}catch(a){const l=a instanceof Error?a.message:"Failed to save service account";i(l)}finally{d(!1)}},Z=async()=>{J(!0),i(null);try{await f({pollingIntervalMs:parseInt(p)||3e4,defaultApprovalKeywords:x})}catch(a){i(a instanceof Error?a.message:"Failed to save settings")}finally{J(!1)}},ee=async()=>{const a=!(n!=null&&n.pollingActive);F(!0),i(null);try{const l=a?"/api/email/polling/start":"/api/email/polling/stop",A=a?{intervalMs:parseInt(p)||3e4}:{},C=await S(y(l),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!C.ok){const te=await C.json().catch(()=>({}));throw new Error(te.error||`HTTP ${C.status}`)}await u()}catch(l){i(l instanceof Error?l.message:"Failed to toggle polling")}finally{F(!1)}},ae=async()=>{d(!0),i(null);try{await f({refreshToken:"",serviceAccountJson:"",impersonateEmail:""}),T(null),G(null),h("credentials"),await u()}catch(a){i(a instanceof Error?a.message:"Failed to disconnect")}finally{d(!1)}},D=!!o.values.serviceAccountJson;return e.jsxs("div",{className:"gmail-oauth-setup",children:[P&&e.jsx("div",{className:"gmail-oauth-error",children:P}),b==="credentials"&&e.jsxs("div",{className:"gmail-oauth-section",children:[e.jsxs("div",{className:"gmail-oauth-field",style:{marginBottom:24},children:[e.jsx("label",{className:"integration-field-label",children:"Authentication Method"}),e.jsxs("div",{className:"gmail-auth-method-selector",children:[e.jsxs("button",{type:"button",className:`gmail-auth-method-btn ${r==="oauth2"?"active":""}`,onClick:()=>{I("oauth2"),i(null)},children:[e.jsx("span",{className:"gmail-auth-method-icon",children:e.jsx(B,{name:"key",size:14})}),e.jsx("span",{className:"gmail-auth-method-label",children:"OAuth 2.0"}),e.jsx("span",{className:"gmail-auth-method-desc",children:"Browser login flow"})]}),e.jsxs("button",{type:"button",className:`gmail-auth-method-btn ${r==="service_account"?"active":""}`,onClick:()=>{I("service_account"),i(null)},children:[e.jsx("span",{className:"gmail-auth-method-icon",children:e.jsx(B,{name:"robot",size:14})}),e.jsx("span",{className:"gmail-auth-method-label",children:"Service Account"}),e.jsx("span",{className:"gmail-auth-method-desc",children:"Domain-wide delegation"})]})]})]}),r==="oauth2"&&k&&!N&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"gmail-oauth-section-title",children:"Google OAuth Credentials"}),e.jsxs("div",{className:"gmail-oauth-shared-banner",children:[e.jsxs("div",{className:"gmail-oauth-shared-title",children:[e.jsx("span",{children:"✓"}),e.jsx("span",{children:"Credentials already configured"})]}),e.jsx("div",{className:"gmail-oauth-shared-body",children:"Existing Google OAuth credentials (Client ID and Secret) are saved in your secrets store — they're shared between Gmail, Calendar, and Drive. You may still need to re-authorize once so the refresh token grants Gmail access."})]})]}),r==="oauth2"&&(!k||N)&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"gmail-oauth-section-title",children:"Google OAuth Credentials"}),e.jsxs("p",{className:"gmail-oauth-help",children:["Create OAuth2 credentials in the"," ",e.jsx("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noopener noreferrer",className:"gmail-oauth-link",children:"Google Cloud Console"}),". Enable the Gmail API and (optionally) the Calendar API. Set the redirect URI to:"," ",e.jsx("code",{className:"gmail-oauth-code",children:w.trim()?`${w.trim().replace(/\/$/,"")}/api/email/auth/callback`:y("/api/email/auth/callback")})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsxs("label",{className:"integration-field-label",children:["OAuth Client ID ",e.jsx("span",{className:"integration-field-required",children:"*"})]}),e.jsx("input",{type:"text",className:"integration-field-input",value:g,placeholder:"xxxx.apps.googleusercontent.com",onChange:a=>L(a.target.value)})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsxs("label",{className:"integration-field-label",children:["OAuth Client Secret ",e.jsx("span",{className:"integration-field-required",children:"*"})]}),e.jsx("input",{type:"password",className:"integration-field-input",value:v,placeholder:o.values.clientSecret?"(saved)":"Enter client secret",onChange:a=>q(a.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsx("label",{className:"integration-field-label",children:"OAuth Redirect Base URL"}),e.jsx("input",{type:"text",className:"integration-field-input",value:w,placeholder:"http://localhost:6200",onChange:a=>K(a.target.value),autoComplete:"off"}),e.jsxs("span",{className:"integration-field-description",children:["Override the base URL used to build the OAuth redirect (e.g. ",e.jsx("code",{children:"http://commander.local:10003"}),"). Leave empty to use the server's local address. Google does not accept raw IPs — use a domain (you can map one in ",e.jsx("code",{children:"/etc/hosts"}),")."]})]})]}),r==="service_account"&&e.jsxs(e.Fragment,{children:[e.jsx("h4",{className:"gmail-oauth-section-title",children:"Service Account Credentials"}),e.jsxs("p",{className:"gmail-oauth-help",children:["Use a Google service account with"," ",e.jsx("a",{href:"https://admin.google.com/ac/owl/domainwidedelegation",target:"_blank",rel:"noopener noreferrer",className:"gmail-oauth-link",children:"domain-wide delegation"})," ","enabled. The service account must be authorized for Gmail scopes in Google Workspace Admin."]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsxs("label",{className:"integration-field-label",children:["Service Account JSON ",e.jsx("span",{className:"integration-field-required",children:"*"})]}),e.jsx("textarea",{className:"integration-field-input integration-field-textarea",value:m,placeholder:D?"(saved — paste new JSON to replace)":"Paste the full service account JSON key file contents",onChange:a=>$(a.target.value),rows:6,spellCheck:!1}),e.jsx("span",{className:"integration-field-description",children:"The JSON key file downloaded from Google Cloud Console containing client_email and private_key."})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsxs("label",{className:"integration-field-label",children:["Impersonate Email ",e.jsx("span",{className:"integration-field-required",children:"*"})]}),e.jsx("input",{type:"email",className:"integration-field-input",value:j,placeholder:"user@yourdomain.com",onChange:a=>Y(a.target.value)}),e.jsx("span",{className:"integration-field-description",children:"The email address to impersonate via domain-wide delegation. Must be a user in your Google Workspace domain."})]})]}),e.jsxs("div",{className:"gmail-oauth-field",children:[e.jsx("label",{className:"integration-field-label",children:"Polling Interval (ms)"}),e.jsx("input",{type:"number",className:"integration-field-input",value:p,onChange:a=>E(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:x,onChange:a=>O(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:z,children:"Cancel"}),r==="oauth2"&&k&&!N?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"integration-btn secondary",onClick:()=>W(!0),disabled:c,children:"Edit credentials"}),e.jsx("button",{type:"button",className:"integration-btn save",onClick:X,disabled:c,children:c?"Loading...":"Authorize with existing credentials"})]}):r==="oauth2"?e.jsx("button",{type:"button",className:"integration-btn save",onClick:Q,disabled:c||!g.trim(),children:c?"Saving...":"Save & Authorize"}):e.jsx("button",{type:"button",className:"integration-btn save",onClick:V,disabled:c||!j.trim()||!m.trim()&&!D,children:c?"Connecting...":"Save & Connect"})]})]}),b==="authorize"&&e.jsxs("div",{className:"gmail-oauth-section",children:[e.jsx("h4",{className:"gmail-oauth-section-title",children:"Authorize Gmail Access"}),e.jsx("p",{className:"gmail-oauth-help",children:"Click the link below to authorize Tide Commander to access your Gmail account. After granting access, you will be redirected back and the connection will be established automatically."}),M&&e.jsx("a",{href:M,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:()=>{s.current&&(clearInterval(s.current),s.current=null),h("credentials")},children:"Back"})})]}),b==="connected"&&e.jsxs("div",{className:"gmail-oauth-section",children:[e.jsx("h4",{className:"gmail-oauth-section-title",children:"Gmail Connected"}),e.jsxs("div",{className:"gmail-oauth-connected-info",children:[e.jsx("span",{className:"gmail-oauth-connected-badge",children:"Connected"}),(n==null?void 0:n.emailAddress)&&e.jsx("span",{className:"gmail-oauth-email",children:n.emailAddress}),e.jsx("span",{className:"gmail-oauth-auth-type",children:r==="service_account"?"Service Account":"OAuth 2.0"})]}),e.jsxs("div",{className:"gmail-polling-toggle-row",children:[e.jsxs("div",{className:"gmail-polling-toggle-info",children:[e.jsx("div",{className:"gmail-polling-toggle-label",children:"Automatic Polling"}),e.jsx("div",{className:"gmail-polling-toggle-status",children:n!=null&&n.pollingActive?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"gmail-polling-dot active"}),"Active",n.lastChecked&&e.jsxs("span",{className:"gmail-polling-last",children:["— last checked ",new Date(n.lastChecked).toLocaleTimeString()]})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"gmail-polling-dot paused"}),"Paused — new emails will not be ingested"]})})]}),e.jsx("button",{type:"button",role:"switch","aria-checked":!!(n!=null&&n.pollingActive),"aria-label":"Toggle automatic polling",className:`gmail-polling-switch ${n!=null&&n.pollingActive?"on":"off"}`,onClick:ee,disabled:H,children:e.jsx("span",{className:"gmail-polling-switch-thumb"})})]}),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:p,onChange:a=>E(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:x,onChange:a=>O(a.target.value),rows:2})]}),e.jsxs("div",{className:"integration-form-actions",children:[e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:z,children:"Close"}),e.jsx("button",{type:"button",className:"integration-btn",style:{backgroundColor:"#f38ba8",color:"#1e1e2e"},onClick:ae,disabled:c,children:c?"Disconnecting...":"Disconnect"}),e.jsx("button",{type:"button",className:"integration-btn save",onClick:Z,disabled:U,children:U?"Saving...":"Save Settings"})]})]}),e.jsx("style",{children:`
2
+ .gmail-oauth-setup {
3
+ padding: 0;
4
+ }
5
+ .gmail-oauth-error {
6
+ background: linear-gradient(135deg, rgba(243, 139, 168, 0.2) 0%, rgba(243, 139, 168, 0.08) 100%);
7
+ border-left: 3px solid #f38ba8;
8
+ color: #f38ba8;
9
+ padding: 12px 16px;
10
+ border-radius: 8px;
11
+ margin-bottom: 18px;
12
+ font-size: 13px;
13
+ font-weight: 500;
14
+ }
15
+ .gmail-oauth-section {
16
+ background: linear-gradient(180deg, rgba(45, 49, 69, 0.4) 0%, rgba(30, 30, 46, 0.2) 100%);
17
+ border: 1px solid rgba(137, 180, 250, 0.15);
18
+ border-radius: 12px;
19
+ padding: 28px;
20
+ backdrop-filter: blur(10px);
21
+ }
22
+ .gmail-oauth-section-title {
23
+ margin: 0 0 16px 0;
24
+ color: #cdd6f4;
25
+ font-size: 18px;
26
+ font-weight: 700;
27
+ letter-spacing: -0.5px;
28
+ }
29
+ .gmail-oauth-help {
30
+ color: #a6adc8;
31
+ font-size: 13px;
32
+ line-height: 1.6;
33
+ margin: 0 0 20px 0;
34
+ font-weight: 400;
35
+ }
36
+ .gmail-oauth-link {
37
+ color: #89b4fa;
38
+ text-decoration: none;
39
+ border-bottom: 1.5px solid rgba(137, 180, 250, 0.4);
40
+ transition: all 0.2s ease;
41
+ font-weight: 500;
42
+ }
43
+ .gmail-oauth-link:hover {
44
+ color: #a8c5ff;
45
+ border-bottom-color: #89b4fa;
46
+ }
47
+ .gmail-oauth-code {
48
+ background: rgba(137, 180, 250, 0.15);
49
+ color: #89b4fa;
50
+ padding: 4px 10px;
51
+ border-radius: 6px;
52
+ font-size: 12px;
53
+ word-break: break-all;
54
+ font-weight: 500;
55
+ font-family: 'Monaco', 'Menlo', monospace;
56
+ }
57
+ .gmail-oauth-field {
58
+ margin-bottom: 18px;
59
+ }
60
+ .gmail-auth-method-selector {
61
+ display: flex;
62
+ gap: 12px;
63
+ }
64
+ .gmail-auth-method-btn {
65
+ flex: 1;
66
+ display: flex;
67
+ flex-direction: column;
68
+ align-items: center;
69
+ gap: 6px;
70
+ padding: 16px 12px;
71
+ background: rgba(30, 30, 46, 0.6);
72
+ border: 2px solid rgba(137, 180, 250, 0.15);
73
+ border-radius: 10px;
74
+ cursor: pointer;
75
+ transition: all 0.2s ease;
76
+ }
77
+ .gmail-auth-method-btn:hover {
78
+ border-color: rgba(137, 180, 250, 0.35);
79
+ background: rgba(30, 30, 46, 0.8);
80
+ }
81
+ .gmail-auth-method-btn.active {
82
+ border-color: #89b4fa;
83
+ background: rgba(137, 180, 250, 0.1);
84
+ box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.1);
85
+ }
86
+ .gmail-auth-method-icon {
87
+ font-size: 22px;
88
+ }
89
+ .gmail-auth-method-label {
90
+ color: #cdd6f4;
91
+ font-size: 14px;
92
+ font-weight: 600;
93
+ }
94
+ .gmail-auth-method-desc {
95
+ color: #7f849c;
96
+ font-size: 11px;
97
+ font-weight: 400;
98
+ }
99
+ .gmail-oauth-auth-type {
100
+ color: #7f849c;
101
+ font-size: 12px;
102
+ font-weight: 500;
103
+ margin-left: auto;
104
+ background: rgba(137, 180, 250, 0.1);
105
+ padding: 4px 10px;
106
+ border-radius: 6px;
107
+ }
108
+ .integration-field-label {
109
+ display: block;
110
+ margin-bottom: 8px;
111
+ color: #cdd6f4;
112
+ font-size: 14px;
113
+ font-weight: 600;
114
+ letter-spacing: 0.3px;
115
+ }
116
+ .integration-field-required {
117
+ color: #f38ba8;
118
+ }
119
+ .integration-field-input {
120
+ width: 100%;
121
+ background: rgba(30, 30, 46, 0.6);
122
+ border: 1.5px solid rgba(137, 180, 250, 0.2);
123
+ color: #cdd6f4;
124
+ padding: 11px 14px;
125
+ border-radius: 8px;
126
+ font-size: 13px;
127
+ transition: all 0.2s ease;
128
+ font-weight: 500;
129
+ }
130
+ .integration-field-input:focus {
131
+ outline: none;
132
+ border-color: #89b4fa;
133
+ background: rgba(30, 30, 46, 0.8);
134
+ box-shadow: 0 0 0 3px rgba(137, 180, 250, 0.15);
135
+ }
136
+ .integration-field-input::placeholder {
137
+ color: #6c7086;
138
+ }
139
+ .integration-field-textarea {
140
+ resize: vertical;
141
+ min-height: 80px;
142
+ font-family: 'Monaco', 'Menlo', monospace;
143
+ font-size: 12px;
144
+ }
145
+ .integration-field-description {
146
+ display: block;
147
+ margin-top: 7px;
148
+ color: #7f849c;
149
+ font-size: 12px;
150
+ font-weight: 400;
151
+ }
152
+ .gmail-oauth-authorize-btn {
153
+ display: inline-block;
154
+ background: linear-gradient(135deg, #89b4fa 0%, #7aa3f0 100%);
155
+ color: #1e1e2e;
156
+ padding: 12px 32px;
157
+ border-radius: 8px;
158
+ text-decoration: none;
159
+ font-weight: 700;
160
+ font-size: 14px;
161
+ margin-bottom: 20px;
162
+ transition: all 0.25s ease;
163
+ border: none;
164
+ cursor: pointer;
165
+ box-shadow: 0 4px 12px rgba(137, 180, 250, 0.25);
166
+ letter-spacing: 0.3px;
167
+ }
168
+ .gmail-oauth-authorize-btn:hover {
169
+ transform: translateY(-2px);
170
+ box-shadow: 0 6px 16px rgba(137, 180, 250, 0.35);
171
+ background: linear-gradient(135deg, #a8c5ff 0%, #8eb8ff 100%);
172
+ }
173
+ .gmail-oauth-authorize-btn:active {
174
+ transform: translateY(0);
175
+ }
176
+ .gmail-oauth-waiting {
177
+ display: flex;
178
+ align-items: center;
179
+ gap: 12px;
180
+ color: #a6adc8;
181
+ font-size: 13px;
182
+ margin-bottom: 20px;
183
+ background: rgba(137, 180, 250, 0.08);
184
+ padding: 14px 16px;
185
+ border-radius: 8px;
186
+ border-left: 3px solid #89b4fa;
187
+ font-weight: 500;
188
+ }
189
+ .gmail-oauth-spinner {
190
+ display: inline-block;
191
+ width: 16px;
192
+ height: 16px;
193
+ border: 2.5px solid rgba(137, 180, 250, 0.25);
194
+ border-top-color: #89b4fa;
195
+ border-radius: 50%;
196
+ animation: gmail-spin 0.8s linear infinite;
197
+ flex-shrink: 0;
198
+ }
199
+ @keyframes gmail-spin {
200
+ to { transform: rotate(360deg); }
201
+ }
202
+ .gmail-oauth-connected-info {
203
+ display: flex;
204
+ align-items: center;
205
+ gap: 14px;
206
+ margin-bottom: 20px;
207
+ background: rgba(166, 227, 161, 0.08);
208
+ padding: 16px;
209
+ border-radius: 10px;
210
+ border-left: 3px solid #a6e3a1;
211
+ }
212
+ .gmail-oauth-connected-badge {
213
+ background: linear-gradient(135deg, rgba(166, 227, 161, 0.3) 0%, rgba(166, 227, 161, 0.15) 100%);
214
+ color: #a6e3a1;
215
+ padding: 6px 14px;
216
+ border-radius: 6px;
217
+ font-size: 12px;
218
+ font-weight: 700;
219
+ letter-spacing: 0.4px;
220
+ text-transform: uppercase;
221
+ border: 1px solid rgba(166, 227, 161, 0.3);
222
+ flex-shrink: 0;
223
+ }
224
+ .gmail-oauth-email {
225
+ color: #cdd6f4;
226
+ font-size: 14px;
227
+ font-weight: 600;
228
+ letter-spacing: 0.2px;
229
+ }
230
+ .gmail-polling-toggle-row {
231
+ display: flex;
232
+ align-items: center;
233
+ justify-content: space-between;
234
+ gap: 16px;
235
+ margin: 0 0 20px 0;
236
+ padding: 14px 16px;
237
+ background: rgba(30, 30, 46, 0.6);
238
+ border: 1px solid rgba(137, 180, 250, 0.15);
239
+ border-radius: 10px;
240
+ }
241
+ .gmail-polling-toggle-info {
242
+ display: flex;
243
+ flex-direction: column;
244
+ gap: 4px;
245
+ min-width: 0;
246
+ }
247
+ .gmail-polling-toggle-label {
248
+ color: #cdd6f4;
249
+ font-size: 14px;
250
+ font-weight: 600;
251
+ letter-spacing: 0.2px;
252
+ }
253
+ .gmail-polling-toggle-status {
254
+ color: #a6adc8;
255
+ font-size: 12px;
256
+ font-weight: 500;
257
+ display: flex;
258
+ align-items: center;
259
+ gap: 6px;
260
+ flex-wrap: wrap;
261
+ }
262
+ .gmail-polling-last {
263
+ color: #7f849c;
264
+ font-weight: 400;
265
+ }
266
+ .gmail-polling-dot {
267
+ display: inline-block;
268
+ width: 8px;
269
+ height: 8px;
270
+ border-radius: 50%;
271
+ flex-shrink: 0;
272
+ }
273
+ .gmail-polling-dot.active {
274
+ background: #a6e3a1;
275
+ box-shadow: 0 0 6px rgba(166, 227, 161, 0.6);
276
+ }
277
+ .gmail-polling-dot.paused {
278
+ background: #fab387;
279
+ }
280
+ .gmail-polling-switch {
281
+ position: relative;
282
+ width: 44px;
283
+ height: 24px;
284
+ border-radius: 12px;
285
+ border: none;
286
+ cursor: pointer;
287
+ transition: background 0.2s ease;
288
+ flex-shrink: 0;
289
+ padding: 0;
290
+ }
291
+ .gmail-polling-switch.on {
292
+ background: linear-gradient(135deg, #a6e3a1 0%, #94d38f 100%);
293
+ }
294
+ .gmail-polling-switch.off {
295
+ background: rgba(108, 112, 134, 0.5);
296
+ }
297
+ .gmail-polling-switch:disabled {
298
+ opacity: 0.6;
299
+ cursor: wait;
300
+ }
301
+ .gmail-polling-switch-thumb {
302
+ position: absolute;
303
+ top: 2px;
304
+ left: 2px;
305
+ width: 20px;
306
+ height: 20px;
307
+ background: #ffffff;
308
+ border-radius: 50%;
309
+ transition: transform 0.2s ease;
310
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
311
+ }
312
+ .gmail-polling-switch.on .gmail-polling-switch-thumb {
313
+ transform: translateX(20px);
314
+ }
315
+ .integration-form-actions {
316
+ display: flex;
317
+ gap: 12px;
318
+ justify-content: flex-end;
319
+ margin-top: 24px;
320
+ padding-top: 20px;
321
+ border-top: 1px solid rgba(137, 180, 250, 0.1);
322
+ }
323
+ .integration-btn {
324
+ padding: 10px 24px;
325
+ border-radius: 8px;
326
+ font-weight: 600;
327
+ font-size: 13px;
328
+ border: none;
329
+ cursor: pointer;
330
+ transition: all 0.2s ease;
331
+ letter-spacing: 0.3px;
332
+ }
333
+ .integration-btn.save {
334
+ background: linear-gradient(135deg, #89b4fa 0%, #7aa3f0 100%);
335
+ color: #1e1e2e;
336
+ box-shadow: 0 4px 12px rgba(137, 180, 250, 0.25);
337
+ }
338
+ .integration-btn.save:hover:not(:disabled) {
339
+ transform: translateY(-2px);
340
+ box-shadow: 0 6px 16px rgba(137, 180, 250, 0.35);
341
+ }
342
+ .integration-btn.cancel {
343
+ background: rgba(137, 180, 250, 0.1);
344
+ color: #89b4fa;
345
+ border: 1.5px solid rgba(137, 180, 250, 0.2);
346
+ }
347
+ .integration-btn.cancel:hover:not(:disabled) {
348
+ background: rgba(137, 180, 250, 0.15);
349
+ border-color: #89b4fa;
350
+ }
351
+ .integration-btn.secondary {
352
+ background: rgba(249, 226, 175, 0.1);
353
+ color: #f9e2af;
354
+ border: 1.5px solid rgba(249, 226, 175, 0.25);
355
+ }
356
+ .integration-btn.secondary:hover:not(:disabled) {
357
+ background: rgba(249, 226, 175, 0.18);
358
+ border-color: #f9e2af;
359
+ }
360
+ .integration-btn:disabled {
361
+ opacity: 0.5;
362
+ cursor: not-allowed;
363
+ }
364
+ .gmail-oauth-shared-banner {
365
+ background: linear-gradient(135deg, rgba(166, 227, 161, 0.15) 0%, rgba(166, 227, 161, 0.05) 100%);
366
+ border: 1px solid rgba(166, 227, 161, 0.3);
367
+ border-left: 3px solid #a6e3a1;
368
+ border-radius: 10px;
369
+ padding: 16px 18px;
370
+ margin-bottom: 8px;
371
+ }
372
+ .gmail-oauth-shared-title {
373
+ display: flex;
374
+ align-items: center;
375
+ gap: 10px;
376
+ color: #a6e3a1;
377
+ font-size: 14px;
378
+ font-weight: 700;
379
+ letter-spacing: 0.2px;
380
+ margin-bottom: 8px;
381
+ }
382
+ .gmail-oauth-shared-body {
383
+ color: #a6adc8;
384
+ font-size: 13px;
385
+ line-height: 1.6;
386
+ font-weight: 400;
387
+ }
388
+ `})]})}export{oe as GmailOAuthSetup};
@@ -1,4 +1,4 @@
1
- import{r as o,aH as N,l as m,j as e}from"./main-Q3uQGSTr.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function R({integration:r,onSave:v,onCancel:h}){const[i,y]=o.useState(r.values.GOOGLE_CLIENT_ID||""),[p,C]=o.useState(""),[j,E]=o.useState(null),[g,S]=o.useState(null),[c,u]=o.useState(!1),[k,l]=o.useState(null),[z,G]=o.useState(!1),A=r.values.GOOGLE_CLIENT_ID==="********"&&r.values.GOOGLE_CLIENT_SECRET==="********",[b,x]=o.useState(r.status.connected?"connected":"credentials"),t=o.useRef(null),f=o.useCallback(async()=>{try{const s={gmail:"/api/email/status","google-calendar":"/api/calendar/status","google-drive":"/api/drive/status"}[r.id]||"/api/calendar/status",n=await N(m(s));if(n.ok){const d=await n.json();S(d),d.authenticated&&(x("connected"),t.current&&(clearInterval(t.current),t.current=null))}}catch(a){console.error("Failed to fetch Google auth status:",a)}},[r.id]);o.useEffect(()=>(f(),()=>{t.current&&clearInterval(t.current)}),[f]);const w=async()=>{const s={gmail:"/api/email/auth/url","google-calendar":"/api/calendar/auth/url","google-drive":"/api/drive/auth/url"}[r.id]||"/api/calendar/auth/url",n=await N(m(s));if(!n.ok){const L=await n.json().catch(()=>({}));throw new Error(L.error||`HTTP ${n.status}`)}const d=await n.json();if(!d.url)throw new Error("OAuth URL is empty");E(d.url),l(null),x("authorize"),t.current&&clearInterval(t.current),t.current=setInterval(f,3e3)},O=async()=>{u(!0),l(null);try{await w()}catch(a){l(a instanceof Error?a.message:"Failed to get OAuth URL")}finally{u(!1)}},I=async()=>{if(!i.trim()){l("Client ID is required");return}u(!0),l(null);try{const a={};i.trim()&&i.trim()!=="********"&&(a.GOOGLE_CLIENT_ID=i.trim()),p.trim()&&(a.GOOGLE_CLIENT_SECRET=p.trim()),console.log("Saving Google OAuth config...",a),await v(a),console.log("Config saved successfully"),await w()}catch(a){const s=a instanceof Error?a.message:"Failed to get OAuth URL";console.error("Error in handleSaveCredentials:",s,a),l(s)}finally{u(!1)}};return e.jsxs("div",{className:"google-oauth-setup",children:[k&&e.jsx("div",{className:"google-oauth-error",children:k}),b==="credentials"&&e.jsxs("div",{className:"google-oauth-section",children:[e.jsx("h4",{className:"google-oauth-section-title",children:"Google OAuth Credentials"}),A&&!z?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"google-oauth-shared-banner",children:[e.jsxs("div",{className:"google-oauth-shared-title",children:[e.jsx("span",{children:"✓"}),e.jsx("span",{children:"Credentials already configured"})]}),e.jsx("div",{className:"google-oauth-shared-body",children:"Existing Google OAuth credentials (Client ID and Secret) are saved in your secrets store — they're shared between Gmail, Calendar, and Drive. You may still need to re-authorize once so the refresh token grants access to this service."})]}),e.jsxs("div",{className:"integration-form-actions",children:[e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:h,children:"Cancel"}),e.jsx("button",{type:"button",className:"integration-btn secondary",onClick:()=>G(!0),disabled:c,children:"Edit credentials"}),e.jsx("button",{type:"button",className:"integration-btn save",onClick:O,disabled:c,children:c?"Loading...":"Authorize with existing credentials"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"google-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:"google-oauth-link",children:"Google Cloud Console"}),". Enable the relevant API (Gmail, Calendar, or Drive). Set the redirect URI to:"," ",e.jsx("code",{className:"google-oauth-code",children:m(r.id==="gmail"?"/api/email/auth/callback":r.id==="google-drive"?"/api/drive/auth/callback":"/api/calendar/auth/callback")})]}),e.jsxs("div",{className:"google-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:i,placeholder:"xxxx.apps.googleusercontent.com",onChange:a=>y(a.target.value)})]}),e.jsxs("div",{className:"google-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:p,placeholder:r.values.GOOGLE_CLIENT_SECRET?"(saved)":"Enter client secret",onChange:a=>C(a.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"integration-form-actions",children:[e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:h,children:"Cancel"}),e.jsx("button",{type:"button",className:"integration-btn save",onClick:I,disabled:c||!i.trim(),children:c?"Saving...":"Save & Authorize"})]})]})]}),b==="authorize"&&e.jsxs("div",{className:"google-oauth-section",children:[e.jsx("h4",{className:"google-oauth-section-title",children:"Authorize Google Access"}),e.jsx("p",{className:"google-oauth-help",children:"Click the link below to authorize Tide Commander to access your Google account. After granting access, you will be redirected back and the connection will be established automatically."}),j&&e.jsx("a",{href:j,target:"_blank",rel:"noopener noreferrer",className:"google-oauth-authorize-btn",children:"Authorize with Google"}),e.jsxs("div",{className:"google-oauth-waiting",children:[e.jsx("span",{className:"google-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:()=>{t.current&&(clearInterval(t.current),t.current=null),x("credentials")},children:"Back"})})]}),b==="connected"&&e.jsxs("div",{className:"google-oauth-section",children:[e.jsx("h4",{className:"google-oauth-section-title",children:"Google Connected"}),e.jsxs("div",{className:"google-oauth-connected-info",children:[e.jsx("span",{className:"google-oauth-connected-badge",children:"Connected"}),(g==null?void 0:g.emailAddress)&&e.jsx("span",{className:"google-oauth-email",children:g.emailAddress})]}),e.jsx("p",{className:"google-oauth-help",children:"Your Google account has been successfully connected."}),e.jsx("div",{className:"integration-form-actions",children:e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:async()=>{await v({}),h()},children:"Close"})})]}),e.jsx("style",{children:`
1
+ import{r as t,aJ as w,l as v,j as e}from"./main-BrZe9Zbd.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function B({integration:o,onSave:j,onCancel:h}){const[l,C]=t.useState(o.values.GOOGLE_CLIENT_ID||""),[p,E]=t.useState(""),[b,S]=t.useState(o.values.GOOGLE_REDIRECT_BASE_URL||""),[y,G]=t.useState(null),[g,O]=t.useState(null),[c,u]=t.useState(!1),[N,s]=t.useState(null),[A,z]=t.useState(!1),I=o.values.GOOGLE_CLIENT_ID==="********"&&o.values.GOOGLE_CLIENT_SECRET==="********",[x,f]=t.useState(o.status.connected?"connected":"credentials"),r=t.useRef(null),m=t.useCallback(async()=>{try{const n={gmail:"/api/email/status","google-calendar":"/api/calendar/status","google-drive":"/api/drive/status"}[o.id]||"/api/calendar/status",i=await w(v(n));if(i.ok){const d=await i.json();O(d),d.authenticated&&(f("connected"),r.current&&(clearInterval(r.current),r.current=null))}}catch(a){console.error("Failed to fetch Google auth status:",a)}},[o.id]);t.useEffect(()=>(m(),()=>{r.current&&clearInterval(r.current)}),[m]);const k=async()=>{const n={gmail:"/api/email/auth/url","google-calendar":"/api/calendar/auth/url","google-drive":"/api/drive/auth/url"}[o.id]||"/api/calendar/auth/url",i=await w(v(n));if(!i.ok){const _=await i.json().catch(()=>({}));throw new Error(_.error||`HTTP ${i.status}`)}const d=await i.json();if(!d.url)throw new Error("OAuth URL is empty");G(d.url),s(null),f("authorize"),r.current&&clearInterval(r.current),r.current=setInterval(m,3e3)},L=async()=>{u(!0),s(null);try{await k()}catch(a){s(a instanceof Error?a.message:"Failed to get OAuth URL")}finally{u(!1)}},R=async()=>{if(!l.trim()){s("Client ID is required");return}u(!0),s(null);try{const a={GOOGLE_REDIRECT_BASE_URL:b.trim()};l.trim()&&l.trim()!=="********"&&(a.GOOGLE_CLIENT_ID=l.trim()),p.trim()&&(a.GOOGLE_CLIENT_SECRET=p.trim()),console.log("Saving Google OAuth config...",a),await j(a),console.log("Config saved successfully"),await k()}catch(a){const n=a instanceof Error?a.message:"Failed to get OAuth URL";console.error("Error in handleSaveCredentials:",n,a),s(n)}finally{u(!1)}};return e.jsxs("div",{className:"google-oauth-setup",children:[N&&e.jsx("div",{className:"google-oauth-error",children:N}),x==="credentials"&&e.jsxs("div",{className:"google-oauth-section",children:[e.jsx("h4",{className:"google-oauth-section-title",children:"Google OAuth Credentials"}),I&&!A?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"google-oauth-shared-banner",children:[e.jsxs("div",{className:"google-oauth-shared-title",children:[e.jsx("span",{children:"✓"}),e.jsx("span",{children:"Credentials already configured"})]}),e.jsx("div",{className:"google-oauth-shared-body",children:"Existing Google OAuth credentials (Client ID and Secret) are saved in your secrets store — they're shared between Gmail, Calendar, and Drive. You may still need to re-authorize once so the refresh token grants access to this service."})]}),e.jsxs("div",{className:"integration-form-actions",children:[e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:h,children:"Cancel"}),e.jsx("button",{type:"button",className:"integration-btn secondary",onClick:()=>z(!0),disabled:c,children:"Edit credentials"}),e.jsx("button",{type:"button",className:"integration-btn save",onClick:L,disabled:c,children:c?"Loading...":"Authorize with existing credentials"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"google-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:"google-oauth-link",children:"Google Cloud Console"}),". Enable the relevant API (Gmail, Calendar, or Drive). Set the redirect URI to:"," ",e.jsx("code",{className:"google-oauth-code",children:(()=>{const a=o.id==="gmail"?"/api/email/auth/callback":o.id==="google-drive"?"/api/drive/auth/callback":"/api/calendar/auth/callback",n=b.trim();return n?`${n.replace(/\/$/,"")}${a}`:v(a)})()})]}),e.jsxs("div",{className:"google-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:l,placeholder:"xxxx.apps.googleusercontent.com",onChange:a=>C(a.target.value)})]}),e.jsxs("div",{className:"google-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:p,placeholder:o.values.GOOGLE_CLIENT_SECRET?"(saved)":"Enter client secret",onChange:a=>E(a.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"google-oauth-field",children:[e.jsx("label",{className:"integration-field-label",children:"OAuth Redirect Base URL"}),e.jsx("input",{type:"text",className:"integration-field-input",value:b,placeholder:"http://localhost:6200",onChange:a=>S(a.target.value),autoComplete:"off"}),e.jsxs("span",{className:"integration-field-description",style:{display:"block",marginTop:7,color:"#7f849c",fontSize:12},children:["Override the base URL used to build the OAuth redirect (e.g. ",e.jsx("code",{children:"http://commander.local:10003"}),"). Shared across Gmail, Calendar, and Drive. Leave empty to use the server's local address. Google does not accept raw IPs — use a domain (you can map one in ",e.jsx("code",{children:"/etc/hosts"}),")."]})]}),e.jsxs("div",{className:"integration-form-actions",children:[e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:h,children:"Cancel"}),e.jsx("button",{type:"button",className:"integration-btn save",onClick:R,disabled:c||!l.trim(),children:c?"Saving...":"Save & Authorize"})]})]})]}),x==="authorize"&&e.jsxs("div",{className:"google-oauth-section",children:[e.jsx("h4",{className:"google-oauth-section-title",children:"Authorize Google Access"}),e.jsx("p",{className:"google-oauth-help",children:"Click the link below to authorize Tide Commander to access your Google 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:"google-oauth-authorize-btn",children:"Authorize with Google"}),e.jsxs("div",{className:"google-oauth-waiting",children:[e.jsx("span",{className:"google-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:()=>{r.current&&(clearInterval(r.current),r.current=null),f("credentials")},children:"Back"})})]}),x==="connected"&&e.jsxs("div",{className:"google-oauth-section",children:[e.jsx("h4",{className:"google-oauth-section-title",children:"Google Connected"}),e.jsxs("div",{className:"google-oauth-connected-info",children:[e.jsx("span",{className:"google-oauth-connected-badge",children:"Connected"}),(g==null?void 0:g.emailAddress)&&e.jsx("span",{className:"google-oauth-email",children:g.emailAddress})]}),e.jsx("p",{className:"google-oauth-help",children:"Your Google account has been successfully connected."}),e.jsx("div",{className:"integration-form-actions",children:e.jsx("button",{type:"button",className:"integration-btn cancel",onClick:async()=>{await j({}),h()},children:"Close"})})]}),e.jsx("style",{children:`
2
2
  .google-oauth-setup {
3
3
  padding: 0;
4
4
  }
@@ -233,4 +233,4 @@ import{r as o,aH as N,l as m,j as e}from"./main-Q3uQGSTr.js";import"./vendor-rea
233
233
  line-height: 1.6;
234
234
  font-weight: 400;
235
235
  }
236
- `})]})}export{R as GoogleOAuthSetup};
236
+ `})]})}export{B as GoogleOAuthSetup};
@@ -1 +1 @@
1
- import{u as K,r as a,j as e}from"./main-Q3uQGSTr.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function se({url:l,title:W,isOpen:g,onClose:I,initialWidth:H=480,initialHeight:B=360,minWidth:M=320,minHeight:b=240}){const{t:n}=K(["terminal","common"]),[Z,h]=a.useState(!0),[L,k]=a.useState(!1),[o,$]=a.useState({width:H,height:B}),[s,y]=a.useState(null),[f,z]=a.useState(1),[O,R]=a.useState(!1),[T,X]=a.useState(!1),N=a.useRef(null),U=a.useRef(null),d=a.useRef(null),r=a.useRef(null);a.useEffect(()=>{if(g&&!s){const t=Math.max(50,(window.innerWidth-o.width)/2),c=Math.max(50,(window.innerHeight-o.height)/2);y({x:t,y:c})}},[g,s,o.width,o.height]),a.useEffect(()=>{h(!0),k(!1)},[l]);const A=a.useCallback(()=>{h(!1)},[]),V=a.useCallback(()=>{h(!1),k(!0)},[]),Y=a.useCallback(()=>{N.current&&(h(!0),k(!1),N.current.src=l)},[l]),_=a.useCallback(()=>{window.open(l,"_blank")},[l]),q=a.useCallback(()=>{z(t=>Math.min(2,t+.25))},[]),F=a.useCallback(()=>{z(t=>Math.max(.25,t-.25))},[]),G=a.useCallback(()=>{z(1)},[]),J=a.useCallback(t=>{if(t.target.closest(".iframe-modal-btn"))return;t.preventDefault(),R(!0),d.current={startX:t.clientX,startY:t.clientY,startPosX:(s==null?void 0:s.x)??0,startPosY:(s==null?void 0:s.y)??0};const c=m=>{if(!d.current)return;const w=m.clientX-d.current.startX,j=m.clientY-d.current.startY;y({x:Math.max(0,Math.min(window.innerWidth-100,d.current.startPosX+w)),y:Math.max(0,Math.min(window.innerHeight-50,d.current.startPosY+j))})},x=()=>{d.current=null,R(!1),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",x)};document.addEventListener("mousemove",c),document.addEventListener("mouseup",x)},[s]),i=a.useCallback((t,c)=>{t.preventDefault(),t.stopPropagation(),X(!0);const x={startX:t.clientX,startY:t.clientY,startW:o.width,startH:o.height,startPosX:(s==null?void 0:s.x)??0,startPosY:(s==null?void 0:s.y)??0,direction:c};r.current=x;const m=j=>{if(!r.current)return;const p=j.clientX-r.current.startX,C=j.clientY-r.current.startY,v=r.current.direction;let E=r.current.startW,D=r.current.startH,P=r.current.startPosX,S=r.current.startPosY;if(v.includes("e")&&(E=Math.max(M,r.current.startW+p)),v.includes("w")){const u=r.current.startW-p;u>=M&&(E=u,P=r.current.startPosX+p)}if(v.includes("s")&&(D=Math.max(b,r.current.startH+C)),v.includes("n")){const u=r.current.startH-C;u>=b&&(D=u,S=r.current.startPosY+C)}$({width:E,height:D}),y({x:P,y:S})},w=()=>{r.current=null,X(!1),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",w)};document.addEventListener("mousemove",m),document.addEventListener("mouseup",w)},[o,s,M,b]);return g?e.jsxs("div",{ref:U,className:`iframe-modal ${O?"dragging":""} ${T?"resizing":""}`,style:{left:(s==null?void 0:s.x)??0,top:(s==null?void 0:s.y)??0,width:o.width,height:o.height},children:[e.jsxs("div",{className:"iframe-modal-toolbar",onMouseDown:J,children:[e.jsx("div",{className:"iframe-modal-title",title:l,children:W||l}),e.jsxs("div",{className:"iframe-modal-actions",children:[e.jsx("button",{className:"iframe-modal-btn",onClick:F,title:n("terminal:iframeModal.zoomOut"),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("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),e.jsxs("button",{className:"iframe-modal-btn iframe-modal-zoom-label",onClick:G,title:n("terminal:iframeModal.resetZoom"),children:[Math.round(f*100),"%"]}),e.jsx("button",{className:"iframe-modal-btn",onClick:q,title:n("terminal:iframeModal.zoomIn"),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("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),e.jsx("div",{className:"iframe-modal-separator"}),e.jsx("button",{className:"iframe-modal-btn",onClick:Y,title:n("terminal:iframeModal.refresh"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M23 4v6h-6M1 20v-6h6"}),e.jsx("path",{d:"M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"})]})}),e.jsx("button",{className:"iframe-modal-btn",onClick:_,title:n("terminal:iframeModal.openInBrowser"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}),e.jsx("button",{className:"iframe-modal-btn iframe-modal-close",onClick:I,title:n("common:buttons.close"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsxs("div",{className:"iframe-modal-content",children:[Z&&e.jsxs("div",{className:"iframe-modal-loading",children:[e.jsx("div",{className:"iframe-modal-spinner"}),e.jsx("span",{children:n("common:status.loading")})]}),L&&e.jsxs("div",{className:"iframe-modal-error",children:[e.jsx("span",{children:n("terminal:iframeModal.failedToLoad")}),e.jsx("button",{onClick:Y,children:n("terminal:iframeModal.retry")})]}),e.jsx("iframe",{ref:N,src:l,className:"iframe-modal-frame",onLoad:A,onError:V,style:{display:L?"none":"block",transform:`scale(${f})`,transformOrigin:"top left",width:`${100/f}%`,height:`${100/f}%`}})]}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-n",onMouseDown:t=>i(t,"n")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-s",onMouseDown:t=>i(t,"s")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-e",onMouseDown:t=>i(t,"e")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-w",onMouseDown:t=>i(t,"w")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-ne",onMouseDown:t=>i(t,"ne")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-nw",onMouseDown:t=>i(t,"nw")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-se",onMouseDown:t=>i(t,"se")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-sw",onMouseDown:t=>i(t,"sw")})]}):null}export{se as IframeModal,se as default};
1
+ import{u as K,r as a,j as e}from"./main-BrZe9Zbd.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function se({url:l,title:W,isOpen:g,onClose:I,initialWidth:H=480,initialHeight:B=360,minWidth:M=320,minHeight:b=240}){const{t:n}=K(["terminal","common"]),[Z,h]=a.useState(!0),[L,k]=a.useState(!1),[o,$]=a.useState({width:H,height:B}),[s,y]=a.useState(null),[f,z]=a.useState(1),[O,R]=a.useState(!1),[T,X]=a.useState(!1),N=a.useRef(null),U=a.useRef(null),d=a.useRef(null),r=a.useRef(null);a.useEffect(()=>{if(g&&!s){const t=Math.max(50,(window.innerWidth-o.width)/2),c=Math.max(50,(window.innerHeight-o.height)/2);y({x:t,y:c})}},[g,s,o.width,o.height]),a.useEffect(()=>{h(!0),k(!1)},[l]);const A=a.useCallback(()=>{h(!1)},[]),V=a.useCallback(()=>{h(!1),k(!0)},[]),Y=a.useCallback(()=>{N.current&&(h(!0),k(!1),N.current.src=l)},[l]),_=a.useCallback(()=>{window.open(l,"_blank")},[l]),q=a.useCallback(()=>{z(t=>Math.min(2,t+.25))},[]),F=a.useCallback(()=>{z(t=>Math.max(.25,t-.25))},[]),G=a.useCallback(()=>{z(1)},[]),J=a.useCallback(t=>{if(t.target.closest(".iframe-modal-btn"))return;t.preventDefault(),R(!0),d.current={startX:t.clientX,startY:t.clientY,startPosX:(s==null?void 0:s.x)??0,startPosY:(s==null?void 0:s.y)??0};const c=m=>{if(!d.current)return;const w=m.clientX-d.current.startX,j=m.clientY-d.current.startY;y({x:Math.max(0,Math.min(window.innerWidth-100,d.current.startPosX+w)),y:Math.max(0,Math.min(window.innerHeight-50,d.current.startPosY+j))})},x=()=>{d.current=null,R(!1),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",x)};document.addEventListener("mousemove",c),document.addEventListener("mouseup",x)},[s]),i=a.useCallback((t,c)=>{t.preventDefault(),t.stopPropagation(),X(!0);const x={startX:t.clientX,startY:t.clientY,startW:o.width,startH:o.height,startPosX:(s==null?void 0:s.x)??0,startPosY:(s==null?void 0:s.y)??0,direction:c};r.current=x;const m=j=>{if(!r.current)return;const p=j.clientX-r.current.startX,C=j.clientY-r.current.startY,v=r.current.direction;let E=r.current.startW,D=r.current.startH,P=r.current.startPosX,S=r.current.startPosY;if(v.includes("e")&&(E=Math.max(M,r.current.startW+p)),v.includes("w")){const u=r.current.startW-p;u>=M&&(E=u,P=r.current.startPosX+p)}if(v.includes("s")&&(D=Math.max(b,r.current.startH+C)),v.includes("n")){const u=r.current.startH-C;u>=b&&(D=u,S=r.current.startPosY+C)}$({width:E,height:D}),y({x:P,y:S})},w=()=>{r.current=null,X(!1),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",w)};document.addEventListener("mousemove",m),document.addEventListener("mouseup",w)},[o,s,M,b]);return g?e.jsxs("div",{ref:U,className:`iframe-modal ${O?"dragging":""} ${T?"resizing":""}`,style:{left:(s==null?void 0:s.x)??0,top:(s==null?void 0:s.y)??0,width:o.width,height:o.height},children:[e.jsxs("div",{className:"iframe-modal-toolbar",onMouseDown:J,children:[e.jsx("div",{className:"iframe-modal-title",title:l,children:W||l}),e.jsxs("div",{className:"iframe-modal-actions",children:[e.jsx("button",{className:"iframe-modal-btn",onClick:F,title:n("terminal:iframeModal.zoomOut"),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("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),e.jsxs("button",{className:"iframe-modal-btn iframe-modal-zoom-label",onClick:G,title:n("terminal:iframeModal.resetZoom"),children:[Math.round(f*100),"%"]}),e.jsx("button",{className:"iframe-modal-btn",onClick:q,title:n("terminal:iframeModal.zoomIn"),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("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),e.jsx("div",{className:"iframe-modal-separator"}),e.jsx("button",{className:"iframe-modal-btn",onClick:Y,title:n("terminal:iframeModal.refresh"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M23 4v6h-6M1 20v-6h6"}),e.jsx("path",{d:"M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"})]})}),e.jsx("button",{className:"iframe-modal-btn",onClick:_,title:n("terminal:iframeModal.openInBrowser"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}),e.jsx("button",{className:"iframe-modal-btn iframe-modal-close",onClick:I,title:n("common:buttons.close"),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),e.jsxs("div",{className:"iframe-modal-content",children:[Z&&e.jsxs("div",{className:"iframe-modal-loading",children:[e.jsx("div",{className:"iframe-modal-spinner"}),e.jsx("span",{children:n("common:status.loading")})]}),L&&e.jsxs("div",{className:"iframe-modal-error",children:[e.jsx("span",{children:n("terminal:iframeModal.failedToLoad")}),e.jsx("button",{onClick:Y,children:n("terminal:iframeModal.retry")})]}),e.jsx("iframe",{ref:N,src:l,className:"iframe-modal-frame",onLoad:A,onError:V,style:{display:L?"none":"block",transform:`scale(${f})`,transformOrigin:"top left",width:`${100/f}%`,height:`${100/f}%`}})]}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-n",onMouseDown:t=>i(t,"n")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-s",onMouseDown:t=>i(t,"s")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-e",onMouseDown:t=>i(t,"e")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-w",onMouseDown:t=>i(t,"w")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-ne",onMouseDown:t=>i(t,"ne")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-nw",onMouseDown:t=>i(t,"nw")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-se",onMouseDown:t=>i(t,"se")}),e.jsx("div",{className:"iframe-modal-resize-handle iframe-modal-resize-sw",onMouseDown:t=>i(t,"sw")})]}):null}export{se as IframeModal,se as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GmailOAuthSetup-iCnmfNtc.js","assets/main-Q3uQGSTr.js","assets/vendor-react--Eh9ivFN.js","assets/vendor-three-Chj50gSY.js","assets/main-kpU9m5LW.css","assets/GoogleOAuthSetup-BPMmX5ua.js"])))=>i.map(i=>d[i]);
2
- import{r as d,aH as T,l as w,j as e,a9 as B,bA as R}from"./main-Q3uQGSTr.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const A={"gmail-oauth":d.lazy(()=>R(()=>import("./GmailOAuthSetup-iCnmfNtc.js"),__vite__mapDeps([0,1,2,3,4])).then(s=>({default:s.GmailOAuthSetup}))),"google-oauth":d.lazy(()=>R(()=>import("./GoogleOAuthSetup-BPMmX5ua.js"),__vite__mapDeps([5,1,2,3,4])).then(s=>({default:s.GoogleOAuthSetup})))},E={gmail:"✉️",slack:"💬",jira:"📋","google-calendar":"📅","google-drive":"📁",docx:"📄"},N={gmail:"Send and receive emails through Gmail. Supports OAuth 2.0 authentication for secure access to your inbox.",slack:"Connect to Slack workspaces. Send messages, receive notifications, and integrate with channels.",jira:"Manage Jira issues and projects. Create tickets, track progress, and handle service desk requests.","google-calendar":"Access Google Calendar events. Create, update, and monitor calendar entries.","google-drive":"Read, create, and edit files in Google Drive. Search and manage folders.",docx:"Generate and manipulate DOCX documents. Create reports, templates, and formatted documents."},z={gmail:["Google Cloud Console project","OAuth 2.0 credentials (Client ID & Secret)","Gmail API enabled"],slack:["Slack App with Bot Token and App-Level Token (Socket Mode)",'Enable Socket Mode in your app settings under "Socket Mode"','Enable Events in the "Event Subscriptions" section of your app config',"Subscribe to bot events: message.channels, message.groups, message.im","Required Bot Token scopes: channels:history, channels:read, chat:write, groups:history, groups:read, im:history, im:read, users:read"],jira:["Jira Cloud instance URL","API Token (from Atlassian account)","Account email address"],"google-calendar":["Google Cloud Console project","OAuth 2.0 credentials","Calendar API enabled"],"google-drive":["Google Cloud Console project","OAuth 2.0 credentials (Client ID & Secret)","Google Drive API enabled"],docx:["No external credentials required","Templates directory (optional)"]},o={overlay:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4,backdropFilter:"blur(4px)",animation:"fadeIn 0.15s ease-out"},modal:{background:"var(--surface-0, #1e1e2e)",borderRadius:12,border:"1px solid var(--border, #313244)",width:"90vw",maxWidth:720,maxHeight:"85vh",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.5)",animation:"slideUp 0.2s ease-out"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--border, #313244)",background:"var(--surface-1, #181825)"},headerTitle:{fontSize:16,fontWeight:600,color:"var(--text-primary, #cdd6f4)",display:"flex",alignItems:"center",gap:8},closeBtn:{background:"none",border:"none",color:"var(--text-secondary, #a6adc8)",fontSize:20,cursor:"pointer",padding:"4px 8px",borderRadius:6,lineHeight:1},tabs:{display:"flex",borderBottom:"1px solid var(--border, #313244)",background:"var(--surface-1, #181825)",overflowX:"auto",scrollbarWidth:"none"},tab:s=>({padding:"10px 16px",background:"none",border:"none",borderBottom:s?"2px solid var(--accent, #89b4fa)":"2px solid transparent",color:s?"var(--accent, #89b4fa)":"var(--text-secondary, #a6adc8)",fontSize:13,fontWeight:s?600:400,cursor:"pointer",display:"flex",alignItems:"center",gap:6,whiteSpace:"nowrap",transition:"color 0.15s, border-color 0.15s",flexShrink:0}),tabStatus:(s,u)=>({width:6,height:6,borderRadius:"50%",background:u?"#f38ba8":s?"#a6e3a1":"#fab387",flexShrink:0}),body:{flex:1,overflow:"auto",padding:20},integrationHeader:{display:"flex",alignItems:"flex-start",gap:12,marginBottom:16},iconCircle:{width:44,height:44,borderRadius:10,background:"var(--surface-1, #181825)",border:"1px solid var(--border, #313244)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:22,flexShrink:0},integrationMeta:{flex:1},integrationName:{fontSize:15,fontWeight:600,color:"var(--text-primary, #cdd6f4)",marginBottom:4,display:"flex",alignItems:"center",gap:8},description:{fontSize:13,color:"var(--text-secondary, #a6adc8)",lineHeight:1.5},statusBadge:(s,u)=>({display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:10,fontSize:11,fontWeight:600,background:u?"rgba(243, 139, 168, 0.15)":s?"rgba(166, 227, 161, 0.15)":"rgba(250, 179, 135, 0.15)",color:u?"#f38ba8":s?"#a6e3a1":"#fab387"}),section:{marginTop:16,padding:12,borderRadius:8,background:"var(--surface-1, #181825)",border:"1px solid var(--border, #313244)"},sectionTitle:{fontSize:12,fontWeight:600,color:"var(--text-secondary, #a6adc8)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:8},requirementList:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:4},requirementItem:{fontSize:12,color:"var(--text-secondary, #a6adc8)",display:"flex",alignItems:"center",gap:6},formSection:{marginTop:16},formSectionTitle:{fontSize:12,fontWeight:600,color:"var(--text-secondary, #a6adc8)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:12}};function G({integration:s,onSave:u,onCancel:g}){const[p,I]=d.useState({...s.values}),[m,x]=d.useState({}),[h,C]=d.useState(!1),[y,b]=d.useState(!1);d.useEffect(()=>{I({...s.values}),x({}),b(!1)},[s.id]);const f=(t,l)=>{I(r=>({...r,[t]:l})),x(r=>{const i={...r};return delete i[t],i}),b(!1)},k=async t=>{t.preventDefault();const l={};for(const r of s.schema)if(r.required&&!p[r.key]&&p[r.key]!==0&&p[r.key]!==!1&&(l[r.key]=`${r.label} is required`),r.validate){const i=r.validate(p[r.key]);i&&(l[r.key]=i)}if(Object.keys(l).length>0){x(l);return}C(!0);try{await u(p),b(!0),setTimeout(()=>b(!1),3e3)}catch(r){x({_form:String(r)})}finally{C(!1)}},v=new Map;for(const t of s.schema){const l=t.group||"";v.has(l)||v.set(l,[]),v.get(l).push(t)}const n={display:"flex",flexDirection:"column",gap:4,marginBottom:12},a={fontSize:13,fontWeight:500,color:"var(--text-primary, #cdd6f4)"},c={padding:"8px 10px",borderRadius:6,border:"1px solid var(--border, #313244)",background:"var(--surface-0, #1e1e2e)",color:"var(--text-primary, #cdd6f4)",fontSize:13,outline:"none",width:"100%",boxSizing:"border-box"},S={fontSize:11,color:"var(--text-secondary, #a6adc8)"},j={fontSize:11,color:"#f38ba8"},_=t=>{var r;const l=p[t.key]??t.defaultValue??"";switch(t.type){case"boolean":return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"var(--text-primary, #cdd6f4)",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!l,onChange:i=>f(t.key,i.target.checked)}),t.label]});case"select":return e.jsxs("select",{style:c,value:String(l),onChange:i=>f(t.key,i.target.value),children:[e.jsx("option",{value:"",children:t.placeholder||"Select..."}),(r=t.options)==null?void 0:r.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))]});case"textarea":return e.jsx("textarea",{style:{...c,resize:"vertical",minHeight:80},value:String(l),placeholder:t.placeholder,onChange:i=>f(t.key,i.target.value),rows:4});case"number":return e.jsx("input",{type:"number",style:c,value:l===""?"":Number(l),placeholder:t.placeholder,onChange:i=>f(t.key,i.target.value===""?"":Number(i.target.value))});case"password":return e.jsx("input",{type:"password",style:c,value:String(l),placeholder:t.placeholder,onChange:i=>f(t.key,i.target.value),autoComplete:"off"});default:return e.jsx("input",{type:t.type,style:c,value:String(l),placeholder:t.placeholder,onChange:i=>f(t.key,i.target.value)})}};return e.jsxs("form",{onSubmit:k,children:[m._form&&e.jsx("div",{style:{...j,marginBottom:12,padding:"8px 10px",borderRadius:6,background:"rgba(243, 139, 168, 0.1)"},children:m._form}),Array.from(v.entries()).map(([t,l])=>e.jsxs("div",{children:[t&&e.jsx("div",{style:{...o.sectionTitle,marginTop:16,marginBottom:8},children:t}),l.map(r=>e.jsxs("div",{style:n,children:[r.type!=="boolean"&&e.jsxs("label",{style:a,children:[r.label,r.required&&e.jsx("span",{style:{color:"#f38ba8",marginLeft:2},children:"*"})]}),_(r),r.description&&e.jsx("span",{style:S,children:r.description}),m[r.key]&&e.jsx("span",{style:j,children:m[r.key]})]},r.key))]},t||"_default")),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:16,paddingTop:12,borderTop:"1px solid var(--border, #313244)"},children:[e.jsx("button",{type:"button",onClick:g,style:{padding:"8px 16px",borderRadius:6,border:"1px solid var(--border, #313244)",background:"none",color:"var(--text-secondary, #a6adc8)",fontSize:13,cursor:"pointer"},children:"Cancel"}),e.jsx("button",{type:"submit",disabled:h,style:{padding:"8px 16px",borderRadius:6,border:"none",background:y?"#a6e3a1":"var(--accent, #89b4fa)",color:"#1e1e2e",fontSize:13,fontWeight:600,cursor:h?"wait":"pointer",opacity:h?.7:1},children:h?"Saving...":y?"Saved":"Save Configuration"})]})]})}function q({isOpen:s,onClose:u,initialTab:g}){const[p,I]=d.useState([]),[m,x]=d.useState(g||null),[h,C]=d.useState(!0),[y,b]=d.useState(null),f=d.useRef(g||null),k=d.useCallback(async()=>{try{const a=await T(w("/api/integrations"));if(!a.ok)throw new Error(`HTTP ${a.status}`);const c=await a.json();I(c),b(null),x(S=>{const j=S||g||(c.length>0?c[0].id:null);return f.current=j,j})}catch(a){b(`Failed to load integrations: ${a}`)}finally{C(!1)}},[g]);d.useEffect(()=>{s&&(C(!0),k(),g&&x(g))},[s,g]);const v=d.useCallback(async(a,c)=>{const S=await T(w(`/api/integrations/${a}/config`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!S.ok){const j=await S.json().catch(()=>({}));throw new Error(j.error||`HTTP ${S.status}`)}await k()},[k]);if(!s)return null;const n=p.find(a=>a.id===m);return e.jsx("div",{style:o.overlay,onClick:u,children:e.jsxs("div",{style:o.modal,onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{style:o.header,children:[e.jsxs("div",{style:o.headerTitle,children:[e.jsx("span",{children:"🔌"}),e.jsx("span",{children:"Integrations"})]}),e.jsx("button",{style:o.closeBtn,onClick:u,title:"Close",children:"×"})]}),h&&e.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--text-secondary, #a6adc8)"},children:"Loading integrations..."}),y&&e.jsxs("div",{style:{padding:20,textAlign:"center"},children:[e.jsx("div",{style:{color:"#f38ba8",marginBottom:8},children:y}),e.jsx("button",{onClick:k,style:{padding:"6px 12px",borderRadius:6,border:"1px solid var(--border, #313244)",background:"none",color:"var(--text-primary, #cdd6f4)",cursor:"pointer",fontSize:13},children:"Retry"})]}),!h&&!y&&p.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:o.tabs,children:p.map(a=>e.jsxs("button",{style:o.tab(m===a.id),onClick:()=>x(a.id),children:[e.jsx("span",{children:E[a.id]||"🔌"}),e.jsx("span",{children:a.name}),e.jsx("span",{style:o.tabStatus(a.status.connected,!!a.status.error)})]},a.id))}),e.jsx("div",{style:o.body,children:n&&e.jsxs("div",{children:[e.jsxs("div",{style:o.integrationHeader,children:[e.jsx("div",{style:o.iconCircle,children:E[n.id]||"🔌"}),e.jsxs("div",{style:o.integrationMeta,children:[e.jsxs("div",{style:o.integrationName,children:[n.name,e.jsx("span",{style:o.statusBadge(n.status.connected,!!n.status.error),children:n.status.error?"✗ Error":n.status.connected?"✓ Connected":"⚠ Not Configured"})]}),e.jsx("div",{style:o.description,children:N[n.id]||n.description})]})]}),n.status.error&&e.jsxs("div",{style:{...o.section,borderColor:"rgba(243, 139, 168, 0.3)",background:"rgba(243, 139, 168, 0.05)"},children:[e.jsx("div",{style:{...o.sectionTitle,color:"#f38ba8"},children:"Error"}),e.jsx("div",{style:{fontSize:12,color:"#f38ba8"},children:n.status.error})]}),z[n.id]&&e.jsxs("div",{style:o.section,children:[e.jsx("div",{style:o.sectionTitle,children:"Requirements"}),e.jsx("ul",{style:o.requirementList,children:z[n.id].map((a,c)=>e.jsxs("li",{style:o.requirementItem,children:[e.jsx("span",{style:{color:"var(--accent, #89b4fa)"},children:"•"}),a]},c))})]}),e.jsxs("div",{style:o.formSection,children:[e.jsx("div",{style:o.formSectionTitle,children:"Configuration"}),n.customComponent&&A[n.customComponent]?e.jsx(d.Suspense,{fallback:e.jsx("div",{style:{color:"var(--text-secondary)",fontSize:13},children:"Loading..."}),children:B.createElement(A[n.customComponent],{key:n.id,integration:n,onSave:a=>v(n.id,a),onCancel:u})}):e.jsx(G,{integration:n,onSave:a=>v(n.id,a),onCancel:u})]})]})})]}),!h&&!y&&p.length===0&&e.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--text-secondary, #a6adc8)"},children:"No integrations available."})]})})}export{q as IntegrationsPanel};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GmailOAuthSetup-BcV5jAse.js","assets/main-BrZe9Zbd.js","assets/vendor-react--Eh9ivFN.js","assets/vendor-three-Chj50gSY.js","assets/main-kpU9m5LW.css","assets/GoogleOAuthSetup-DyUW_STE.js"])))=>i.map(i=>d[i]);
2
+ import{r as d,aJ as T,l as w,j as e,ab as B,bC as R}from"./main-BrZe9Zbd.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const A={"gmail-oauth":d.lazy(()=>R(()=>import("./GmailOAuthSetup-BcV5jAse.js"),__vite__mapDeps([0,1,2,3,4])).then(s=>({default:s.GmailOAuthSetup}))),"google-oauth":d.lazy(()=>R(()=>import("./GoogleOAuthSetup-DyUW_STE.js"),__vite__mapDeps([5,1,2,3,4])).then(s=>({default:s.GoogleOAuthSetup})))},E={gmail:"✉️",slack:"💬",jira:"📋","google-calendar":"📅","google-drive":"📁",docx:"📄"},N={gmail:"Send and receive emails through Gmail. Supports OAuth 2.0 authentication for secure access to your inbox.",slack:"Connect to Slack workspaces. Send messages, receive notifications, and integrate with channels.",jira:"Manage Jira issues and projects. Create tickets, track progress, and handle service desk requests.","google-calendar":"Access Google Calendar events. Create, update, and monitor calendar entries.","google-drive":"Read, create, and edit files in Google Drive. Search and manage folders.",docx:"Generate and manipulate DOCX documents. Create reports, templates, and formatted documents."},z={gmail:["Google Cloud Console project","OAuth 2.0 credentials (Client ID & Secret)","Gmail API enabled"],slack:["Slack App with Bot Token and App-Level Token (Socket Mode)",'Enable Socket Mode in your app settings under "Socket Mode"','Enable Events in the "Event Subscriptions" section of your app config',"Subscribe to bot events: message.channels, message.groups, message.im","Required Bot Token scopes: channels:history, channels:read, chat:write, groups:history, groups:read, im:history, im:read, users:read"],jira:["Jira Cloud instance URL","API Token (from Atlassian account)","Account email address"],"google-calendar":["Google Cloud Console project","OAuth 2.0 credentials","Calendar API enabled"],"google-drive":["Google Cloud Console project","OAuth 2.0 credentials (Client ID & Secret)","Google Drive API enabled"],docx:["No external credentials required","Templates directory (optional)"]},o={overlay:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4,backdropFilter:"blur(4px)",animation:"fadeIn 0.15s ease-out"},modal:{background:"var(--surface-0, #1e1e2e)",borderRadius:12,border:"1px solid var(--border, #313244)",width:"90vw",maxWidth:720,maxHeight:"85vh",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.5)",animation:"slideUp 0.2s ease-out"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--border, #313244)",background:"var(--surface-1, #181825)"},headerTitle:{fontSize:16,fontWeight:600,color:"var(--text-primary, #cdd6f4)",display:"flex",alignItems:"center",gap:8},closeBtn:{background:"none",border:"none",color:"var(--text-secondary, #a6adc8)",fontSize:20,cursor:"pointer",padding:"4px 8px",borderRadius:6,lineHeight:1},tabs:{display:"flex",borderBottom:"1px solid var(--border, #313244)",background:"var(--surface-1, #181825)",overflowX:"auto",scrollbarWidth:"none"},tab:s=>({padding:"10px 16px",background:"none",border:"none",borderBottom:s?"2px solid var(--accent, #89b4fa)":"2px solid transparent",color:s?"var(--accent, #89b4fa)":"var(--text-secondary, #a6adc8)",fontSize:13,fontWeight:s?600:400,cursor:"pointer",display:"flex",alignItems:"center",gap:6,whiteSpace:"nowrap",transition:"color 0.15s, border-color 0.15s",flexShrink:0}),tabStatus:(s,u)=>({width:6,height:6,borderRadius:"50%",background:u?"#f38ba8":s?"#a6e3a1":"#fab387",flexShrink:0}),body:{flex:1,overflow:"auto",padding:20},integrationHeader:{display:"flex",alignItems:"flex-start",gap:12,marginBottom:16},iconCircle:{width:44,height:44,borderRadius:10,background:"var(--surface-1, #181825)",border:"1px solid var(--border, #313244)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:22,flexShrink:0},integrationMeta:{flex:1},integrationName:{fontSize:15,fontWeight:600,color:"var(--text-primary, #cdd6f4)",marginBottom:4,display:"flex",alignItems:"center",gap:8},description:{fontSize:13,color:"var(--text-secondary, #a6adc8)",lineHeight:1.5},statusBadge:(s,u)=>({display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:10,fontSize:11,fontWeight:600,background:u?"rgba(243, 139, 168, 0.15)":s?"rgba(166, 227, 161, 0.15)":"rgba(250, 179, 135, 0.15)",color:u?"#f38ba8":s?"#a6e3a1":"#fab387"}),section:{marginTop:16,padding:12,borderRadius:8,background:"var(--surface-1, #181825)",border:"1px solid var(--border, #313244)"},sectionTitle:{fontSize:12,fontWeight:600,color:"var(--text-secondary, #a6adc8)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:8},requirementList:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:4},requirementItem:{fontSize:12,color:"var(--text-secondary, #a6adc8)",display:"flex",alignItems:"center",gap:6},formSection:{marginTop:16},formSectionTitle:{fontSize:12,fontWeight:600,color:"var(--text-secondary, #a6adc8)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:12}};function G({integration:s,onSave:u,onCancel:g}){const[p,I]=d.useState({...s.values}),[m,x]=d.useState({}),[h,C]=d.useState(!1),[y,b]=d.useState(!1);d.useEffect(()=>{I({...s.values}),x({}),b(!1)},[s.id]);const f=(t,l)=>{I(r=>({...r,[t]:l})),x(r=>{const i={...r};return delete i[t],i}),b(!1)},k=async t=>{t.preventDefault();const l={};for(const r of s.schema)if(r.required&&!p[r.key]&&p[r.key]!==0&&p[r.key]!==!1&&(l[r.key]=`${r.label} is required`),r.validate){const i=r.validate(p[r.key]);i&&(l[r.key]=i)}if(Object.keys(l).length>0){x(l);return}C(!0);try{await u(p),b(!0),setTimeout(()=>b(!1),3e3)}catch(r){x({_form:String(r)})}finally{C(!1)}},v=new Map;for(const t of s.schema){const l=t.group||"";v.has(l)||v.set(l,[]),v.get(l).push(t)}const n={display:"flex",flexDirection:"column",gap:4,marginBottom:12},a={fontSize:13,fontWeight:500,color:"var(--text-primary, #cdd6f4)"},c={padding:"8px 10px",borderRadius:6,border:"1px solid var(--border, #313244)",background:"var(--surface-0, #1e1e2e)",color:"var(--text-primary, #cdd6f4)",fontSize:13,outline:"none",width:"100%",boxSizing:"border-box"},S={fontSize:11,color:"var(--text-secondary, #a6adc8)"},j={fontSize:11,color:"#f38ba8"},_=t=>{var r;const l=p[t.key]??t.defaultValue??"";switch(t.type){case"boolean":return e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"var(--text-primary, #cdd6f4)",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!l,onChange:i=>f(t.key,i.target.checked)}),t.label]});case"select":return e.jsxs("select",{style:c,value:String(l),onChange:i=>f(t.key,i.target.value),children:[e.jsx("option",{value:"",children:t.placeholder||"Select..."}),(r=t.options)==null?void 0:r.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))]});case"textarea":return e.jsx("textarea",{style:{...c,resize:"vertical",minHeight:80},value:String(l),placeholder:t.placeholder,onChange:i=>f(t.key,i.target.value),rows:4});case"number":return e.jsx("input",{type:"number",style:c,value:l===""?"":Number(l),placeholder:t.placeholder,onChange:i=>f(t.key,i.target.value===""?"":Number(i.target.value))});case"password":return e.jsx("input",{type:"password",style:c,value:String(l),placeholder:t.placeholder,onChange:i=>f(t.key,i.target.value),autoComplete:"off"});default:return e.jsx("input",{type:t.type,style:c,value:String(l),placeholder:t.placeholder,onChange:i=>f(t.key,i.target.value)})}};return e.jsxs("form",{onSubmit:k,children:[m._form&&e.jsx("div",{style:{...j,marginBottom:12,padding:"8px 10px",borderRadius:6,background:"rgba(243, 139, 168, 0.1)"},children:m._form}),Array.from(v.entries()).map(([t,l])=>e.jsxs("div",{children:[t&&e.jsx("div",{style:{...o.sectionTitle,marginTop:16,marginBottom:8},children:t}),l.map(r=>e.jsxs("div",{style:n,children:[r.type!=="boolean"&&e.jsxs("label",{style:a,children:[r.label,r.required&&e.jsx("span",{style:{color:"#f38ba8",marginLeft:2},children:"*"})]}),_(r),r.description&&e.jsx("span",{style:S,children:r.description}),m[r.key]&&e.jsx("span",{style:j,children:m[r.key]})]},r.key))]},t||"_default")),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:16,paddingTop:12,borderTop:"1px solid var(--border, #313244)"},children:[e.jsx("button",{type:"button",onClick:g,style:{padding:"8px 16px",borderRadius:6,border:"1px solid var(--border, #313244)",background:"none",color:"var(--text-secondary, #a6adc8)",fontSize:13,cursor:"pointer"},children:"Cancel"}),e.jsx("button",{type:"submit",disabled:h,style:{padding:"8px 16px",borderRadius:6,border:"none",background:y?"#a6e3a1":"var(--accent, #89b4fa)",color:"#1e1e2e",fontSize:13,fontWeight:600,cursor:h?"wait":"pointer",opacity:h?.7:1},children:h?"Saving...":y?"Saved":"Save Configuration"})]})]})}function q({isOpen:s,onClose:u,initialTab:g}){const[p,I]=d.useState([]),[m,x]=d.useState(g||null),[h,C]=d.useState(!0),[y,b]=d.useState(null),f=d.useRef(g||null),k=d.useCallback(async()=>{try{const a=await T(w("/api/integrations"));if(!a.ok)throw new Error(`HTTP ${a.status}`);const c=await a.json();I(c),b(null),x(S=>{const j=S||g||(c.length>0?c[0].id:null);return f.current=j,j})}catch(a){b(`Failed to load integrations: ${a}`)}finally{C(!1)}},[g]);d.useEffect(()=>{s&&(C(!0),k(),g&&x(g))},[s,g]);const v=d.useCallback(async(a,c)=>{const S=await T(w(`/api/integrations/${a}/config`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!S.ok){const j=await S.json().catch(()=>({}));throw new Error(j.error||`HTTP ${S.status}`)}await k()},[k]);if(!s)return null;const n=p.find(a=>a.id===m);return e.jsx("div",{style:o.overlay,onClick:u,children:e.jsxs("div",{style:o.modal,onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{style:o.header,children:[e.jsxs("div",{style:o.headerTitle,children:[e.jsx("span",{children:"🔌"}),e.jsx("span",{children:"Integrations"})]}),e.jsx("button",{style:o.closeBtn,onClick:u,title:"Close",children:"×"})]}),h&&e.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--text-secondary, #a6adc8)"},children:"Loading integrations..."}),y&&e.jsxs("div",{style:{padding:20,textAlign:"center"},children:[e.jsx("div",{style:{color:"#f38ba8",marginBottom:8},children:y}),e.jsx("button",{onClick:k,style:{padding:"6px 12px",borderRadius:6,border:"1px solid var(--border, #313244)",background:"none",color:"var(--text-primary, #cdd6f4)",cursor:"pointer",fontSize:13},children:"Retry"})]}),!h&&!y&&p.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:o.tabs,children:p.map(a=>e.jsxs("button",{style:o.tab(m===a.id),onClick:()=>x(a.id),children:[e.jsx("span",{children:E[a.id]||"🔌"}),e.jsx("span",{children:a.name}),e.jsx("span",{style:o.tabStatus(a.status.connected,!!a.status.error)})]},a.id))}),e.jsx("div",{style:o.body,children:n&&e.jsxs("div",{children:[e.jsxs("div",{style:o.integrationHeader,children:[e.jsx("div",{style:o.iconCircle,children:E[n.id]||"🔌"}),e.jsxs("div",{style:o.integrationMeta,children:[e.jsxs("div",{style:o.integrationName,children:[n.name,e.jsx("span",{style:o.statusBadge(n.status.connected,!!n.status.error),children:n.status.error?"✗ Error":n.status.connected?"✓ Connected":"⚠ Not Configured"})]}),e.jsx("div",{style:o.description,children:N[n.id]||n.description})]})]}),n.status.error&&e.jsxs("div",{style:{...o.section,borderColor:"rgba(243, 139, 168, 0.3)",background:"rgba(243, 139, 168, 0.05)"},children:[e.jsx("div",{style:{...o.sectionTitle,color:"#f38ba8"},children:"Error"}),e.jsx("div",{style:{fontSize:12,color:"#f38ba8"},children:n.status.error})]}),z[n.id]&&e.jsxs("div",{style:o.section,children:[e.jsx("div",{style:o.sectionTitle,children:"Requirements"}),e.jsx("ul",{style:o.requirementList,children:z[n.id].map((a,c)=>e.jsxs("li",{style:o.requirementItem,children:[e.jsx("span",{style:{color:"var(--accent, #89b4fa)"},children:"•"}),a]},c))})]}),e.jsxs("div",{style:o.formSection,children:[e.jsx("div",{style:o.formSectionTitle,children:"Configuration"}),n.customComponent&&A[n.customComponent]?e.jsx(d.Suspense,{fallback:e.jsx("div",{style:{color:"var(--text-secondary)",fontSize:13},children:"Loading..."}),children:B.createElement(A[n.customComponent],{key:n.id,integration:n,onSave:a=>v(n.id,a),onCancel:u})}):e.jsx(G,{integration:n,onSave:a=>v(n.id,a),onCancel:u})]})]})})]}),!h&&!y&&p.length===0&&e.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--text-secondary, #a6adc8)"},children:"No integrations available."})]})})}export{q as IntegrationsPanel};