onairos 2.1.0 → 2.1.2

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.
@@ -0,0 +1,268 @@
1
+ # Mobile Training Routes Summary & SDK Guidelines
2
+
3
+ ## Issues Fixed
4
+
5
+ ### 1. **Strict Data Validation** ✅
6
+ **Problem**: Users with 70 upvoted but 0 downvoted interactions were allowed to proceed with training, creating severely imbalanced models.
7
+
8
+ **Solution**: Enhanced `checkSufficientData()` function to:
9
+ - **STOP training** if user has 0 negative interactions (previously was just a warning)
10
+ - **STOP training** if user has 0 positive interactions
11
+ - Require minimum 3+ positive AND 3+ negative interactions for training
12
+ - Provide clear error messages with specific guidance for each platform
13
+
14
+ **Impact**: Users will now get proper error messages telling them exactly what they need to do:
15
+ ```json
16
+ {
17
+ "error": "No negative interaction data found! You need to dislike/downvote content...",
18
+ "code": "INSUFFICIENT_DATA",
19
+ "details": {
20
+ "upvotedCount": 70,
21
+ "downvotedCount": 0,
22
+ "missingNegativeData": true,
23
+ "suggestions": [
24
+ "❌ CRITICAL: You have no negative data - model cannot learn without both positive and negative examples",
25
+ "👎 Dislike/downvote content on your connected platforms:",
26
+ "• YouTube: Dislike videos you don't enjoy",
27
+ "• Reddit: Downvote posts you disagree with"
28
+ ]
29
+ }
30
+ }
31
+ ```
32
+
33
+ ### 2. **Standardized Encryption + ARDrive Storage** ✅
34
+ **Problem**: Encryption and permanent storage were only available in a separate "advanced" route, but should be standard for ALL models.
35
+
36
+ **Solution**: Made encryption and ARDrive storage **standard for all training routes**:
37
+
38
+ #### **Route 1: `/mobile-training/clean` (Regular SDK Users)**
39
+ - **Purpose**: Standard mobile training for regular SDK users
40
+ - **Features**:
41
+ - ❌ NO inference testing
42
+ - ✅ Model training only
43
+ - ✅ **AES-256-CBC encryption with user PIN + server key**
44
+ - ✅ **ARDrive (Arweave) permanent storage**
45
+ - ✅ **S3 fallback if ARDrive fails**
46
+ - ✅ **gzip compression**
47
+ - ❌ No dual database storage
48
+ - **Use Case**: Regular mobile apps that need secure, permanent model storage
49
+
50
+ #### **Route 2: `/mobile-training/enoch` (Enoch SDK Users)**
51
+ - **Purpose**: Advanced training for Enoch SDK with inference and matching
52
+ - **Features**:
53
+ - ✅ WITH inference testing (72 test categories)
54
+ - ✅ Model training
55
+ - ✅ **AES-256-CBC encryption with user PIN + server key**
56
+ - ✅ **ARDrive (Arweave) permanent storage**
57
+ - ✅ **S3 fallback if ARDrive fails**
58
+ - ✅ **gzip compression**
59
+ - ✅ Stores in both main & Enoch databases
60
+ - ✅ Stores query scores for matching
61
+ - **Use Case**: Enoch SDK that needs inference results, matching, and secure storage
62
+
63
+ #### **~~Route 3: `/mobile-training/encrypted`~~ (REMOVED)**
64
+ - **Status**: ❌ **REMOVED** - Encryption is now standard for all routes
65
+ - **Migration**: Use `/mobile-training/clean` or `/mobile-training/enoch` instead
66
+
67
+ ### 3. **ARDrive Error Fixed** ✅
68
+ **Problem**: `ReferenceError: arDrive is not defined` error preventing ARDrive uploads.
69
+
70
+ **Solution**: Uncommented ARDrive imports in `src/utils/arweaveUtils.js`:
71
+ ```javascript
72
+ import Arweave from 'arweave';
73
+ import { ArDrive } from 'ardrive-core-js';
74
+ ```
75
+
76
+ ## SDK Implementation Guidelines
77
+
78
+ ### **Regular Mobile SDK (iOS/Android)**
79
+ **Use Route**: `/mobile-training/clean`
80
+
81
+ **Request Example**:
82
+ ```javascript
83
+ POST /mobile-training/clean
84
+ Headers: {
85
+ "Authorization": "Bearer <JWT_TOKEN>",
86
+ "Content-Type": "application/json"
87
+ }
88
+ Body: {
89
+ "socketId": "user_socket_id",
90
+ "connectedPlatforms": {
91
+ "platforms": [
92
+ {
93
+ "platform": "youtube",
94
+ "accessToken": "token",
95
+ "userData": {}
96
+ }
97
+ ]
98
+ }
99
+ }
100
+ ```
101
+
102
+ **Response Example**:
103
+ ```json
104
+ {
105
+ "success": true,
106
+ "message": "Clean mobile training started successfully",
107
+ "username": "user_123",
108
+ "features": {
109
+ "inference": false,
110
+ "storage": "ARDrive with S3 fallback",
111
+ "compression": true,
112
+ "encryption": true,
113
+ "type": "clean-mobile-training"
114
+ }
115
+ }
116
+ ```
117
+
118
+ ### **Enoch SDK**
119
+ **Use Route**: `/mobile-training/enoch`
120
+
121
+ **Request Example**: Same as above, but different endpoint
122
+
123
+ **Response Example**:
124
+ ```json
125
+ {
126
+ "success": true,
127
+ "message": "Enoch mobile training started successfully",
128
+ "username": "user_123",
129
+ "features": {
130
+ "inference": true,
131
+ "storage": "ARDrive with S3 fallback",
132
+ "compression": true,
133
+ "encryption": true,
134
+ "type": "enoch-mobile-training",
135
+ "databases": ["main", "enoch"],
136
+ "queryScores": true
137
+ }
138
+ }
139
+ ```
140
+
141
+ ### **~~Advanced/Encrypted SDK~~ (REMOVED)**
142
+ **Status**: ❌ **REMOVED** - Encryption is now standard for all routes
143
+ **Migration**: Use `/mobile-training/clean` or `/mobile-training/enoch` based on your needs
144
+ **Requirements**: All routes now require user to have PIN set up for encryption
145
+
146
+ ## Error Handling Updates
147
+
148
+ ### **New Error Codes**
149
+
150
+ #### `INSUFFICIENT_DATA`
151
+ - **When**: User has 0 positive OR 0 negative interactions
152
+ - **Action**: Show specific guidance for each platform
153
+ - **UI**: Display platform-specific instructions
154
+
155
+ #### `CONNECTIONS_REQUIRED`
156
+ - **When**: User has no connected social media accounts
157
+ - **Action**: Redirect to connection setup
158
+ - **UI**: Show available platforms to connect
159
+
160
+ #### `LIMITED_DATA`
161
+ - **When**: User has some data but less than recommended amounts
162
+ - **Action**: Warn user but allow training to continue
163
+ - **UI**: Show warning with suggestions for better results
164
+
165
+ #### `PIN_REQUIRED` (NEW)
166
+ - **When**: User doesn't have PIN set up (required for encryption)
167
+ - **Action**: Redirect to PIN setup flow
168
+ - **UI**: Show PIN setup instructions and requirements
169
+
170
+ ### **Socket Events**
171
+
172
+ All training routes emit these events:
173
+
174
+ ```javascript
175
+ // Progress updates
176
+ socket.on('trainingUpdate', (data) => {
177
+ if (data.error) {
178
+ // Handle error (stop training, show message)
179
+ console.error('Training error:', data.error);
180
+ } else if (data.warning) {
181
+ // Handle warning (show warning, continue training)
182
+ console.warn('Training warning:', data.warning);
183
+ } else {
184
+ // Handle status update
185
+ console.log('Training status:', data.status);
186
+ }
187
+ });
188
+
189
+ // Training completed
190
+ socket.on('trainingCompleted', (data) => {
191
+ console.log('Training completed:', data.status);
192
+ });
193
+
194
+ // Model ready
195
+ socket.on('modelStandby', (data) => {
196
+ console.log('Model ready:', data.message);
197
+ // data.inference = true/false (indicates if inference was run)
198
+ // data.storage = "ARDrive with S3 fallback" (indicates storage approach)
199
+ // data.encryption = true (all models are now encrypted)
200
+ });
201
+ ```
202
+
203
+ ## Migration Guide
204
+
205
+ ### **For Existing SDKs**
206
+
207
+ 1. **Identify your SDK type**:
208
+ - Regular mobile app → Use `/mobile-training/clean`
209
+ - Enoch SDK → Use `/mobile-training/enoch`
210
+ - ~~Advanced/encrypted~~ → **REMOVED** (encryption is now standard)
211
+
212
+ 2. **Update your endpoints**:
213
+ - Replace `/mobile-training/encrypted` → Use `/mobile-training/clean` or `/mobile-training/enoch`
214
+ - Replace existing training endpoints with appropriate new route
215
+ - Update error handling to support new error codes
216
+ - **IMPORTANT**: All routes now require user PIN for encryption
217
+
218
+ 3. **Test data validation**:
219
+ - Ensure your app handles `INSUFFICIENT_DATA` errors properly
220
+ - Test with users who have no negative data
221
+ - Verify UI shows appropriate platform-specific guidance
222
+ - **NEW**: Ensure your app handles encryption requirements (user PIN setup)
223
+
224
+ ### **For New SDKs**
225
+
226
+ 1. **Choose appropriate route** based on your needs
227
+ 2. **Implement proper error handling** for all new error codes
228
+ 3. **Test with various data scenarios**:
229
+ - No connections
230
+ - No negative data
231
+ - No positive data
232
+ - Limited data
233
+ - Sufficient data
234
+
235
+ ## Testing Checklist
236
+
237
+ - [ ] Test user with no connected accounts
238
+ - [ ] Test user with 0 negative interactions
239
+ - [ ] Test user with 0 positive interactions
240
+ - [ ] Test user with limited data (< 10 interactions)
241
+ - [ ] Test user with sufficient data (> 10 interactions)
242
+ - [ ] **NEW**: Test user without PIN setup (should get `PIN_REQUIRED` error)
243
+ - [ ] **NEW**: Test user with PIN setup (encryption should work)
244
+ - [ ] **NEW**: Test ARDrive upload success and S3 fallback scenarios
245
+ - [ ] Test socket connection handling
246
+ - [ ] Test error message display
247
+ - [ ] Test training completion flow
248
+ - [ ] Verify correct route is being used for your SDK type
249
+ - [ ] **NEW**: Verify encryption metadata is stored in user database
250
+
251
+ ## Summary
252
+
253
+ ✅ **Fixed**: Strict data validation prevents training with insufficient data
254
+ ✅ **Fixed**: Encryption and ARDrive storage now standard for ALL models
255
+ ✅ **Fixed**: Separate routes for different SDK types (clean vs inference)
256
+ ✅ **Fixed**: ARDrive error resolved
257
+ ✅ **Added**: Clear error messages with platform-specific guidance
258
+ ✅ **Added**: Two distinct training routes (removed separate encryption route)
259
+ ✅ **Added**: Comprehensive error handling and user guidance
260
+ ✅ **STANDARDIZED**: AES-256-CBC encryption + ARDrive storage for all models
261
+
262
+ **SDK teams should**:
263
+ 1. Choose the appropriate route for their SDK type (`/clean` or `/enoch`)
264
+ 2. **IMPORTANT**: Ensure users have PIN setup for encryption (now required for all routes)
265
+ 3. Update error handling to support new error codes
266
+ 4. Test with various data scenarios to ensure proper user guidance
267
+ 5. Verify training flows work correctly with the new validation rules
268
+ 6. Update any existing `/encrypted` endpoints to use `/clean` or `/enoch`
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("Onairos",["React"],t):"object"==typeof exports?exports.Onairos=t(require("react")):e.Onairos=t(e.React)}(this,(e=>(()=>{"use strict";var t={639:t=>{t.exports=e}},n={};function s(e){var o=n[e];if(void 0!==o)return o.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,s),a.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{s.r(o),s.d(o,{Onairos:()=>B,default:()=>q});var e=s(639),t=s.n(e);const n=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,((e,t,n)=>n?n.toUpperCase():t.toLowerCase())))(e);return t.charAt(0).toUpperCase()+t.slice(1)},a=(...e)=>e.filter(((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t)).join(" ").trim(),r=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const i=(0,e.forwardRef)((({color:t="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:i="",children:c,iconNode:m,...d},u)=>(0,e.createElement)("svg",{ref:u,...l,width:n,height:n,stroke:t,strokeWidth:o?24*Number(s)/Number(n):s,className:a("lucide",i),...!c&&!r(d)&&{"aria-hidden":"true"},...d},[...m.map((([t,n])=>(0,e.createElement)(t,n))),...Array.isArray(c)?c:[c]]))),c=(t,s)=>{const o=(0,e.forwardRef)((({className:o,...r},l)=>{return(0,e.createElement)(i,{ref:l,iconNode:s,className:a(`lucide-${c=n(t),c.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${t}`,o),...r});var c}));return o.displayName=n(t),o},m=c("mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]),d=c("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),u=c("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);function p(n){let{onSuccess:s,testMode:o=!0}=n;const[a,r]=(0,e.useState)(""),[l,i]=(0,e.useState)(""),[c,p]=(0,e.useState)("email"),[h,g]=(0,e.useState)(!1),[b,y]=(0,e.useState)(""),f=async e=>{if(e.preventDefault(),y(""),(e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))(a)){g(!0);try{if(o)setTimeout((()=>{p("code"),g(!1)}),1e3);else{if(!(await fetch("https://api2.onairos.uk/auth/send-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a})})).ok)throw new Error("Failed to send verification code");p("code"),g(!1)}}catch(e){y(e.message),g(!1)}}else y("Please enter a valid email address")},x=async e=>{if(e.preventDefault(),y(""),o&&"123456"===l)return p("success"),void setTimeout((()=>{s({email:a,verified:!0})}),1e3);if(o)y("Invalid code. Use 123456 for testing.");else{g(!0);try{const e=await fetch("https://api2.onairos.uk/auth/verify-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a,code:l})});if(!e.ok)throw new Error("Invalid verification code");const t=await e.json();p("success"),setTimeout((()=>{s({email:a,verified:!0,token:t.token})}),1e3)}catch(e){y(e.message),g(!1)}}};return t().createElement("div",{className:"flex flex-col items-center space-y-6 p-6 w-full"},"email"===c&&t().createElement("div",{className:"flex flex-col items-center space-y-6 w-full"},t().createElement("div",{className:"flex items-center justify-center w-16 h-16 bg-blue-100 rounded-full"},t().createElement(m,{className:"w-8 h-8 text-blue-600"})),t().createElement("div",{className:"text-center"},t().createElement("h2",{className:"text-xl font-semibold text-gray-900 mb-2"},"Sign in to Onairos"),t().createElement("p",{className:"text-gray-600"},"Enter your email address to continue"),o&&t().createElement("p",{className:"text-sm text-blue-600 mt-2"},"Test mode: Any valid email will work")),t().createElement("form",{onSubmit:f,className:"w-full max-w-md space-y-4"},t().createElement("div",null,t().createElement("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 mb-1"},"Email address"),t().createElement("input",{type:"email",id:"email",value:a,onChange:e=>r(e.target.value),placeholder:"Enter your email",className:"w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",required:!0})),b&&t().createElement("p",{className:"text-sm text-red-600"},b),t().createElement("button",{type:"submit",disabled:h,className:"w-full py-3 px-4 bg-blue-600 text-white rounded-lg font-semibold hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center"},h?t().createElement("div",{className:"animate-spin h-5 w-5 border-2 border-white rounded-full border-t-transparent"}):t().createElement(t().Fragment,null,"Continue",t().createElement(d,{className:"ml-2 w-4 h-4"}))))),"code"===c&&t().createElement("div",{className:"flex flex-col items-center space-y-6 w-full"},t().createElement("div",{className:"flex items-center justify-center w-16 h-16 bg-green-100 rounded-full"},t().createElement(m,{className:"w-8 h-8 text-green-600"})),t().createElement("div",{className:"text-center"},t().createElement("h2",{className:"text-xl font-semibold text-gray-900 mb-2"},"Check your email"),t().createElement("p",{className:"text-gray-600"},"We sent a verification code to"),t().createElement("p",{className:"text-gray-900 font-medium"},a),o&&t().createElement("p",{className:"text-sm text-blue-600 mt-2"},"Test mode: Use code 123456")),t().createElement("form",{onSubmit:x,className:"w-full max-w-md space-y-4"},t().createElement("div",null,t().createElement("label",{htmlFor:"code",className:"block text-sm font-medium text-gray-700 mb-1"},"Verification code"),t().createElement("input",{type:"text",id:"code",value:l,onChange:e=>i(e.target.value),placeholder:"Enter 6-digit code",className:"w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none text-center text-lg tracking-widest",maxLength:"6",required:!0})),b&&t().createElement("p",{className:"text-sm text-red-600"},b),t().createElement("button",{type:"submit",disabled:h,className:"w-full py-3 px-4 bg-blue-600 text-white rounded-lg font-semibold hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center"},h?t().createElement("div",{className:"animate-spin h-5 w-5 border-2 border-white rounded-full border-t-transparent"}):"Verify Code"),t().createElement("button",{type:"button",onClick:()=>p("email"),className:"w-full py-2 px-4 text-gray-600 hover:text-gray-800"},"Use a different email"))),"success"===c&&t().createElement("div",{className:"flex flex-col items-center space-y-6 w-full"},t().createElement("div",{className:"flex items-center justify-center w-16 h-16 bg-green-100 rounded-full"},t().createElement(u,{className:"w-8 h-8 text-green-600"})),t().createElement("div",{className:"text-center"},t().createElement("h2",{className:"text-xl font-semibold text-gray-900 mb-2"},"Email verified!"),t().createElement("p",{className:"text-gray-600"},"Setting up your account...")),t().createElement("div",{className:"w-8 h-8"},t().createElement("div",{className:"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent"}))))}class h extends e.Component{constructor(e){super(e),this.state={connected:!1,open:!1,isConnecting:!1},this.handleClose=this.handleClose.bind(this),this.handleOpen=this.handleOpen.bind(this),this.youtubeConnect=this.youtubeConnect.bind(this),this.setConnected=this.setConnected.bind(this),this.setDisconnected=this.setDisconnected.bind(this)}setConnected(){this.setState({connected:!0}),this.props.onConnectionChange&&this.props.onConnectionChange("YouTube",!0),this.handleClose()}setDisconnected(){this.updateConnections("Remove","Youtube").then((()=>{this.setState({connected:!1}),this.props.onConnectionChange&&this.props.onConnectionChange("YouTube",!1),this.handleClose()})).catch((e=>{console.error("Error removing YouTube connection:",e)}))}async updateConnections(e,t){const n={session:{username:localStorage.getItem("username")||this.props.username},updateType:e,newConnection:t};try{const e=await fetch("https://api2.onairos.uk/connections/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await e.json()}catch(e){throw console.error("UpdateConnections error:",e),e}}handleOpen(){this.setState({open:!0})}handleClose(){this.setState({open:!1}),this.props.onClose&&this.props.onClose()}async youtubeConnect(){this.setState({isConnecting:!0});const e={session:{username:localStorage.getItem("username")||this.props.username}};try{const t=await fetch("https://api2.onairos.uk/youtube/authorize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();n.youtubeURL?window.location.href=n.youtubeURL:(console.error("No YouTube URL received"),this.setState({isConnecting:!1}))}catch(e){console.error("YouTube connection error:",e),this.setState({isConnecting:!1})}}render(){const{open:e=this.props.open||this.state.open}=this.props;return e?t().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},t().createElement("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-hidden"},t().createElement("div",{className:"p-6"},t().createElement("h2",{className:"text-xl font-bold text-gray-900 mb-4"},"Grant Onairos Access to your YouTube Account?"),t().createElement("div",{className:"space-y-4 text-gray-700"},t().createElement("p",null,"Grant Permission to your YouTube Account, so we can build your Data Models."),t().createElement("div",null,t().createElement("p",{className:"font-medium mb-2"},"We will access your YouTube:"),t().createElement("ul",{className:"list-disc ml-6 space-y-1"},t().createElement("li",null,"Basic Account Info"),t().createElement("li",null,"Liked and Watched Videos"),t().createElement("li",null,"Subscribed Channels and Playlist Videos"))),t().createElement("p",null,"We will delete all the data used once your Model is Created"),t().createElement("p",{className:"text-sm"},t().createElement("a",{href:"https://onairos.uk/compliance-google-policy",className:"text-blue-600 hover:underline"},"Onairos")," ","complies with"," ",t().createElement("a",{href:"https://policies.google.com/privacy",className:"text-blue-600 hover:underline"},"Google API Services User Data Policy"))),t().createElement("div",{className:"flex space-x-3 mt-6"},t().createElement("button",{onClick:this.handleClose,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 disabled:opacity-50"},"Disagree"),t().createElement("button",{onClick:this.youtubeConnect,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"},this.state.isConnecting?"Connecting...":"Agree"))))):null}}const g=h;class b extends e.Component{constructor(e){super(e),this.state={connected:!1,open:!1,isConnecting:!1},this.handleClose=this.handleClose.bind(this),this.handleOpen=this.handleOpen.bind(this),this.linkedinConnect=this.linkedinConnect.bind(this),this.setConnected=this.setConnected.bind(this),this.setDisconnected=this.setDisconnected.bind(this)}setConnected(){this.setState({connected:!0}),this.props.onConnectionChange&&this.props.onConnectionChange("LinkedIn",!0),this.handleClose()}setDisconnected(){this.updateConnections("Remove","LinkedIn").then((()=>{this.setState({connected:!1}),this.props.onConnectionChange&&this.props.onConnectionChange("LinkedIn",!1),this.handleClose()})).catch((e=>{console.error("Error removing LinkedIn connection:",e)}))}async updateConnections(e,t){const n={session:{username:localStorage.getItem("username")||this.props.username},updateType:e,newConnection:t};try{const e=await fetch("https://api2.onairos.uk/connections/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await e.json()}catch(e){throw console.error("UpdateConnections error:",e),e}}handleOpen(){this.setState({open:!0})}handleClose(){this.setState({open:!1}),this.props.onClose&&this.props.onClose()}async linkedinConnect(){this.setState({isConnecting:!0});const e={session:{username:localStorage.getItem("username")||this.props.username}};try{const t=await fetch("https://api2.onairos.uk/linkedin/authorize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();n.linkedinURL?window.location.href=n.linkedinURL:(console.error("No LinkedIn URL received"),this.setState({isConnecting:!1}))}catch(e){console.error("LinkedIn connection error:",e),this.setState({isConnecting:!1})}}render(){const{open:e=this.props.open||this.state.open}=this.props;return e?t().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},t().createElement("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-hidden"},t().createElement("div",{className:"p-6"},t().createElement("h2",{className:"text-xl font-bold text-gray-900 mb-4"},"Grant Onairos Access to your LinkedIn Account?"),t().createElement("div",{className:"space-y-4 text-gray-700"},t().createElement("p",null,"Grant Permission to your LinkedIn Account, so we can build your Data Models."),t().createElement("div",null,t().createElement("p",{className:"font-medium mb-2"},"We will access your LinkedIn:"),t().createElement("ul",{className:"list-disc ml-6 space-y-1"},t().createElement("li",null,"Basic Profile Information"),t().createElement("li",null,"Professional Experience"),t().createElement("li",null,"Network Connections"),t().createElement("li",null,"Posts and Activity"))),t().createElement("p",null,"We will delete all the data used once your Model is Created"),t().createElement("p",{className:"text-sm"},t().createElement("a",{href:"https://onairos.uk/privacy-policy",className:"text-blue-600 hover:underline"},"Onairos Privacy Policy")," ","- Your professional data is handled with the highest security standards.")),t().createElement("div",{className:"flex space-x-3 mt-6"},t().createElement("button",{onClick:this.handleClose,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 disabled:opacity-50"},"Disagree"),t().createElement("button",{onClick:this.linkedinConnect,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"},this.state.isConnecting?"Connecting...":"Agree"))))):null}}const y=b;class f extends e.Component{constructor(e){super(e),this.state={connected:!1,open:!1,isConnecting:!1},this.handleClose=this.handleClose.bind(this),this.handleOpen=this.handleOpen.bind(this),this.instagramConnect=this.instagramConnect.bind(this),this.setConnected=this.setConnected.bind(this),this.setDisconnected=this.setDisconnected.bind(this)}setConnected(){this.setState({connected:!0}),this.props.onConnectionChange&&this.props.onConnectionChange("Instagram",!0),this.handleClose()}setDisconnected(){this.updateConnections("Remove","Instagram").then((()=>{this.setState({connected:!1}),this.props.onConnectionChange&&this.props.onConnectionChange("Instagram",!1),this.handleClose()})).catch((e=>{console.error("Error removing Instagram connection:",e)}))}async updateConnections(e,t){const n={session:{username:localStorage.getItem("username")||this.props.username},updateType:e,newConnection:t};try{const e=await fetch("https://api2.onairos.uk/connections/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await e.json()}catch(e){throw console.error("UpdateConnections error:",e),e}}handleOpen(){this.setState({open:!0})}handleClose(){this.setState({open:!1}),this.props.onClose&&this.props.onClose()}async instagramConnect(){this.setState({isConnecting:!0});const e={session:{username:localStorage.getItem("username")||this.props.username}};try{const t=await fetch("https://api2.onairos.uk/instagram/authorize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();n.instagramURL?window.location.href=n.instagramURL:(console.error("No Instagram URL received"),this.setState({isConnecting:!1}))}catch(e){console.error("Instagram connection error:",e),this.setState({isConnecting:!1})}}render(){const{open:e=this.props.open||this.state.open}=this.props;return e?t().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},t().createElement("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-hidden"},t().createElement("div",{className:"p-6"},t().createElement("h2",{className:"text-xl font-bold text-gray-900 mb-4"},"Grant Onairos Access to your Instagram Account?"),t().createElement("div",{className:"space-y-4 text-gray-700"},t().createElement("p",null,"Grant Permission to your Instagram Account, so we can build your Data Models."),t().createElement("div",null,t().createElement("p",{className:"font-medium mb-2"},"We will access your Instagram:"),t().createElement("ul",{className:"list-disc ml-6 space-y-1"},t().createElement("li",null,"Basic Profile Information"),t().createElement("li",null,"Posts and Stories"),t().createElement("li",null,"Liked Content"),t().createElement("li",null,"Following and Followers"))),t().createElement("p",null,"We will delete all the data used once your Model is Created"),t().createElement("p",{className:"text-sm"},t().createElement("a",{href:"https://onairos.uk/compliance-meta-policy",className:"text-blue-600 hover:underline"},"Onairos")," ","complies with"," ",t().createElement("a",{href:"https://developers.facebook.com/policy",className:"text-blue-600 hover:underline"},"Meta Platform Policy"))),t().createElement("div",{className:"flex space-x-3 mt-6"},t().createElement("button",{onClick:this.handleClose,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 disabled:opacity-50"},"Disagree"),t().createElement("button",{onClick:this.instagramConnect,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"},this.state.isConnecting?"Connecting...":"Agree"))))):null}}const x=f;class C extends e.Component{constructor(e){super(e),this.state={connected:!1,open:!1,isConnecting:!1},this.handleClose=this.handleClose.bind(this),this.handleOpen=this.handleOpen.bind(this),this.pinterestConnect=this.pinterestConnect.bind(this),this.setConnected=this.setConnected.bind(this),this.setDisconnected=this.setDisconnected.bind(this)}setConnected(){this.setState({connected:!0}),this.props.onConnectionChange&&this.props.onConnectionChange("Pinterest",!0),this.handleClose()}setDisconnected(){this.updateConnections("Remove","Pinterest").then((()=>{this.setState({connected:!1}),this.props.onConnectionChange&&this.props.onConnectionChange("Pinterest",!1),this.handleClose()})).catch((e=>{console.error("Error removing Pinterest connection:",e)}))}async updateConnections(e,t){const n={session:{username:localStorage.getItem("username")||this.props.username},updateType:e,newConnection:t};try{const e=await fetch("https://api2.onairos.uk/connections/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await e.json()}catch(e){throw console.error("UpdateConnections error:",e),e}}handleOpen(){this.setState({open:!0})}handleClose(){this.setState({open:!1}),this.props.onClose&&this.props.onClose()}async pinterestConnect(){this.setState({isConnecting:!0});const e={session:{username:localStorage.getItem("username")||this.props.username}};try{const t=await fetch("https://api2.onairos.uk/pinterest/authorize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();n.pinterestURL?window.location.href=n.pinterestURL:(console.error("No Pinterest URL received"),this.setState({isConnecting:!1}))}catch(e){console.error("Pinterest connection error:",e),this.setState({isConnecting:!1})}}render(){const{open:e=this.props.open||this.state.open}=this.props;return e?t().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},t().createElement("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-hidden"},t().createElement("div",{className:"p-6"},t().createElement("h2",{className:"text-xl font-bold text-gray-900 mb-4"},"Grant Onairos Access to your Pinterest Account?"),t().createElement("div",{className:"space-y-4 text-gray-700"},t().createElement("p",null,"Grant Permission to your Pinterest Account, so we can build your Data Models."),t().createElement("div",null,t().createElement("p",{className:"font-medium mb-2"},"We will access your Pinterest:"),t().createElement("ul",{className:"list-disc ml-6 space-y-1"},t().createElement("li",null,"Basic Profile Information"),t().createElement("li",null,"Boards and Pins"),t().createElement("li",null,"Saved and Liked Pins"),t().createElement("li",null,"Following and Followers"))),t().createElement("p",null,"We will delete all the data used once your Model is Created"),t().createElement("p",{className:"text-sm"},t().createElement("a",{href:"https://onairos.uk/privacy-policy",className:"text-blue-600 hover:underline"},"Onairos Privacy Policy")," ","- Your creative interests and preferences are securely processed.")),t().createElement("div",{className:"flex space-x-3 mt-6"},t().createElement("button",{onClick:this.handleClose,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 disabled:opacity-50"},"Disagree"),t().createElement("button",{onClick:this.pinterestConnect,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"},this.state.isConnecting?"Connecting...":"Agree"))))):null}}const E=C;class v extends e.Component{constructor(e){super(e),this.state={connected:!1,open:!1,isConnecting:!1},this.handleClose=this.handleClose.bind(this),this.handleOpen=this.handleOpen.bind(this),this.redditConnect=this.redditConnect.bind(this),this.setConnected=this.setConnected.bind(this),this.setDisconnected=this.setDisconnected.bind(this)}setConnected(){this.setState({connected:!0}),this.props.onConnectionChange&&this.props.onConnectionChange("Reddit",!0),this.handleClose()}setDisconnected(){this.updateConnections("Remove","Reddit").then((()=>{this.setState({connected:!1}),this.props.onConnectionChange&&this.props.onConnectionChange("Reddit",!1),this.handleClose()})).catch((e=>{console.error("Error removing Reddit connection:",e)}))}async updateConnections(e,t){const n={session:{username:localStorage.getItem("username")||this.props.username},updateType:e,newConnection:t};try{const e=await fetch("https://api2.onairos.uk/connections/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await e.json()}catch(e){throw console.error("UpdateConnections error:",e),e}}handleOpen(){this.setState({open:!0})}handleClose(){this.setState({open:!1}),this.props.onClose&&this.props.onClose()}async redditConnect(){this.setState({isConnecting:!0});const e={session:{username:localStorage.getItem("username")||this.props.username}};try{const t=await fetch("https://api2.onairos.uk/reddit/authorize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();n.redditURL?window.location.href=n.redditURL:(console.error("No Reddit URL received"),this.setState({isConnecting:!1}))}catch(e){console.error("Reddit connection error:",e),this.setState({isConnecting:!1})}}render(){const{open:e=this.props.open||this.state.open}=this.props;return e?t().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},t().createElement("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-hidden"},t().createElement("div",{className:"p-6"},t().createElement("h2",{className:"text-xl font-bold text-gray-900 mb-4"},"Grant Onairos Access to your Reddit Account?"),t().createElement("div",{className:"space-y-4 text-gray-700"},t().createElement("p",null,"Grant Permission to your Reddit Account, so we can build your Data Models."),t().createElement("div",null,t().createElement("p",{className:"font-medium mb-2"},"We will access your Reddit:"),t().createElement("ul",{className:"list-disc ml-6 space-y-1"},t().createElement("li",null,"Basic Profile Information"),t().createElement("li",null,"Posts and Comments"),t().createElement("li",null,"Upvoted and Saved Content"),t().createElement("li",null,"Subscribed Subreddits"))),t().createElement("p",null,"We will delete all the data used once your Model is Created"),t().createElement("p",{className:"text-sm"},t().createElement("a",{href:"https://onairos.uk/privacy-policy",className:"text-blue-600 hover:underline"},"Onairos Privacy Policy")," ","- Your Reddit activity helps us understand your interests and preferences.")),t().createElement("div",{className:"flex space-x-3 mt-6"},t().createElement("button",{onClick:this.handleClose,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 disabled:opacity-50"},"Disagree"),t().createElement("button",{onClick:this.redditConnect,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"},this.state.isConnecting?"Connecting...":"Agree"))))):null}}const w=v;class N extends e.Component{constructor(e){super(e),this.state={connected:!1,open:!1,isConnecting:!1},this.handleClose=this.handleClose.bind(this),this.handleOpen=this.handleOpen.bind(this),this.gmailConnect=this.gmailConnect.bind(this),this.setConnected=this.setConnected.bind(this),this.setDisconnected=this.setDisconnected.bind(this)}setConnected(){this.setState({connected:!0}),this.props.onConnectionChange&&this.props.onConnectionChange("Gmail",!0),this.handleClose()}setDisconnected(){this.updateConnections("Remove","Gmail").then((()=>{this.setState({connected:!1}),this.props.onConnectionChange&&this.props.onConnectionChange("Gmail",!1),this.handleClose()})).catch((e=>{console.error("Error removing Gmail connection:",e)}))}async updateConnections(e,t){const n={session:{username:localStorage.getItem("username")||this.props.username},updateType:e,newConnection:t};try{const e=await fetch("https://api2.onairos.uk/connections/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await e.json()}catch(e){throw console.error("UpdateConnections error:",e),e}}handleOpen(){this.setState({open:!0})}handleClose(){this.setState({open:!1}),this.props.onClose&&this.props.onClose()}async gmailConnect(){this.setState({isConnecting:!0});const e={session:{username:localStorage.getItem("username")||this.props.username}};try{const t=await fetch("https://api2.onairos.uk/gmail/authorize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();n.gmailURL?window.location.href=n.gmailURL:(console.error("No Gmail URL received"),this.setState({isConnecting:!1}))}catch(e){console.error("Gmail connection error:",e),this.setState({isConnecting:!1})}}render(){const{open:e=this.props.open||this.state.open}=this.props;return e?t().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},t().createElement("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-hidden"},t().createElement("div",{className:"p-6"},t().createElement("h2",{className:"text-xl font-bold text-gray-900 mb-4"},"Grant Onairos Access to your Gmail Account?"),t().createElement("div",{className:"space-y-4 text-gray-700"},t().createElement("p",null,"Grant Permission to your Gmail Account, so we can build your Data Models."),t().createElement("div",null,t().createElement("p",{className:"font-medium mb-2"},"We will access your Gmail:"),t().createElement("ul",{className:"list-disc ml-6 space-y-1"},t().createElement("li",null,"Basic Account Information"),t().createElement("li",null,"Email Metadata (subjects, dates, senders)"),t().createElement("li",null,"Email Categories and Labels"),t().createElement("li",null,"Communication Patterns"))),t().createElement("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-3"},t().createElement("p",{className:"text-yellow-800 text-sm font-medium"},t().createElement("strong",null,"Note:")," We do NOT read the content of your emails. Only metadata is processed.")),t().createElement("p",null,"We will delete all the data used once your Model is Created"),t().createElement("p",{className:"text-sm"},t().createElement("a",{href:"https://onairos.uk/compliance-google-policy",className:"text-blue-600 hover:underline"},"Onairos")," ","complies with"," ",t().createElement("a",{href:"https://policies.google.com/privacy",className:"text-blue-600 hover:underline"},"Google API Services User Data Policy"))),t().createElement("div",{className:"flex space-x-3 mt-6"},t().createElement("button",{onClick:this.handleClose,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 disabled:opacity-50"},"Disagree"),t().createElement("button",{onClick:this.gmailConnect,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"},this.state.isConnecting?"Connecting...":"Agree"))))):null}}const S=N;function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function P(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const j=[{name:"YouTube",icon:"📺",color:"bg-red-500",connector:"youtube"},{name:"Reddit",icon:"🔥",color:"bg-orange-500",connector:"reddit"},{name:"Instagram",icon:"📷",color:"bg-pink-500",connector:"instagram"},{name:"Pinterest",icon:"📌",color:"bg-red-600",connector:"pinterest"},{name:"LinkedIn",icon:"💼",color:"bg-blue-700",connector:"linkedin"},{name:"Gmail",icon:"📧",color:"bg-red-500",connector:"gmail"}];function I(n){let{onComplete:s,appIcon:o,appName:a="App",username:r}=n;const[l,i]=(0,e.useState)({}),[c,m]=(0,e.useState)(!1),[d,u]=(0,e.useState)(null),p=(e,t)=>{i((n=>k(k({},n),{},{[e]:t}))),u(null)},h=Object.values(l).filter(Boolean).length;return t().createElement("div",{className:"w-full max-w-md mx-auto bg-white rounded-lg shadow-xl overflow-hidden",style:{maxHeight:"90vh",height:"auto"}},t().createElement("div",{className:"p-4 sm:p-6 overflow-y-auto",style:{maxHeight:"calc(90vh - 4rem)"}},t().createElement("div",{className:"flex items-center justify-center mb-4 sm:mb-6"},t().createElement("div",{className:"flex items-center space-x-3"},t().createElement("img",{src:o||"https://onairos.sirv.com/Images/OnairosBlack.png",alt:a,className:"w-8 h-8 sm:w-10 sm:h-10 rounded-lg"}),t().createElement("div",{className:"flex items-center text-gray-400"},t().createElement("svg",{className:"w-5 h-5 sm:w-6 sm:h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},t().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 8l4 4m0 0l-4 4m4-4H3"}))),t().createElement("img",{src:"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos",className:"w-8 h-8 sm:w-10 sm:h-10 rounded-lg"}))),t().createElement("div",{className:"text-center mb-4 sm:mb-6"},t().createElement("h2",{className:"text-lg sm:text-xl font-bold text-gray-900 mb-2"},"Connect Your Accounts"),t().createElement("p",{className:"text-gray-600 text-xs sm:text-sm"},"Choose which accounts to connect for a personalized experience")),t().createElement("div",{className:"mb-4 sm:mb-6 p-2 sm:p-3 bg-blue-50 border border-blue-200 rounded-lg"},t().createElement("p",{className:"text-blue-800 text-xs sm:text-sm"},"🔒 Your data is never shared with anyone. It's only used to train your personal model and is stored securely.")),t().createElement("div",{className:"space-y-2 sm:space-y-3 mb-4 sm:mb-6"},j.map((e=>{const n=l[e.name]||!1;return t().createElement("div",{key:e.name,className:"flex items-center justify-between p-3 sm:p-4 border rounded-lg hover:bg-gray-50 transition-colors"},t().createElement("div",{className:"flex items-center space-x-3"},t().createElement("div",{className:"w-8 h-8 sm:w-10 sm:h-10 rounded-lg ".concat(e.color," flex items-center justify-center text-white text-base sm:text-lg")},e.icon),t().createElement("div",null,t().createElement("h3",{className:"font-medium text-gray-900 text-sm sm:text-base"},e.name),t().createElement("p",{className:"text-xs sm:text-sm text-gray-500"},n?"Connected":"Not connected"))),t().createElement("button",{onClick:()=>(async(e,t)=>{if(c)return;l[e]?i((t=>k(k({},t),{},{[e]:!1}))):u(t)})(e.name,e.connector),disabled:c,className:"relative inline-flex h-5 sm:h-6 w-9 sm:w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ".concat(n?"bg-blue-600":"bg-gray-200"," ").concat(c?"opacity-50 cursor-not-allowed":"cursor-pointer")},t().createElement("span",{className:"inline-block h-3 sm:h-4 w-3 sm:w-4 transform rounded-full bg-white transition-transform ".concat(n?"translate-x-5 sm:translate-x-6":"translate-x-1")})))}))),h>0&&t().createElement("div",{className:"mb-3 sm:mb-4 p-2 sm:p-3 bg-green-50 border border-green-200 rounded-lg"},t().createElement("p",{className:"text-green-800 text-xs sm:text-sm"},"✅ ",h," account",h>1?"s":""," connected")),t().createElement("button",{onClick:()=>{const e=Object.entries(l).filter((e=>{let[t,n]=e;return n})).map((e=>{let[t]=e;return t}));s({connectedAccounts:e,totalConnections:e.length})},disabled:0===h,className:"w-full py-2 sm:py-3 px-4 rounded-lg font-semibold transition-colors text-sm sm:text-base ".concat(h>0?"bg-blue-600 text-white hover:bg-blue-700":"bg-gray-300 text-gray-500 cursor-not-allowed")},"Continue ",h>0?"with ".concat(h," account").concat(h>1?"s":""):""),t().createElement("button",{onClick:()=>s({connectedAccounts:[],totalConnections:0}),className:"w-full mt-2 py-2 text-gray-500 hover:text-gray-700 text-xs sm:text-sm"},"Skip for now")),t().createElement(g,{open:"youtube"===d,onClose:()=>u(null),onConnectionChange:p,username:r}),t().createElement(y,{open:"linkedin"===d,onClose:()=>u(null),onConnectionChange:p,username:r}),t().createElement(x,{open:"instagram"===d,onClose:()=>u(null),onConnectionChange:p,username:r}),t().createElement(E,{open:"pinterest"===d,onClose:()=>u(null),onConnectionChange:p,username:r}),t().createElement(w,{open:"reddit"===d,onClose:()=>u(null),onConnectionChange:p,username:r}),t().createElement(S,{open:"gmail"===d,onClose:()=>u(null),onConnectionChange:p,username:r}))}function T(n){let{onComplete:s,userEmail:o}=n;const[a,r]=(0,e.useState)(""),[l,i]=(0,e.useState)(""),[c,m]=(0,e.useState)({length:!1,uppercase:!1,lowercase:!1,number:!1,special:!1});(0,e.useEffect)((()=>{m({length:a.length>=6,uppercase:/[A-Z]/.test(a),lowercase:/[a-z]/.test(a),number:/[0-9]/.test(a),special:/[!@#$%^&*(),.?":{}|<>]/.test(a)})}),[a]);const d=Object.values(c).every((e=>e)),u=a===l&&a.length>0,p=d&&u;return t().createElement("div",{className:"max-w-md mx-auto bg-white p-6"},t().createElement("div",{className:"text-center mb-6"},t().createElement("div",{className:"w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4"},t().createElement("svg",{className:"w-8 h-8 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},t().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-1a2 2 0 00-2-2H6a2 2 0 00-2 2v1a2 2 0 002 2zM12 7V3m0 4l3-3m-3 3L9 4"}))),t().createElement("h2",{className:"text-2xl font-bold text-gray-900 mb-2"},"Create Your Secure PIN"),t().createElement("p",{className:"text-gray-600"},"Your PIN will be used to securely access your data")),t().createElement("form",{onSubmit:e=>{e.preventDefault(),p&&s({pin:a,pinCreated:!0,timestamp:(new Date).toISOString()})},className:"space-y-4"},t().createElement("div",null,t().createElement("label",{htmlFor:"pin",className:"block text-sm font-medium text-gray-700 mb-2"},"Enter PIN"),t().createElement("input",{type:"password",id:"pin",value:a,onChange:e=>r(e.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your secure PIN"})),t().createElement("div",null,t().createElement("label",{htmlFor:"confirmPin",className:"block text-sm font-medium text-gray-700 mb-2"},"Confirm PIN"),t().createElement("input",{type:"password",id:"confirmPin",value:l,onChange:e=>i(e.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Confirm your PIN"}),l&&!u&&t().createElement("p",{className:"text-red-500 text-sm mt-1"},"PINs do not match"),l&&u&&t().createElement("p",{className:"text-green-500 text-sm mt-1"},"✅ PINs match")),t().createElement("div",{className:"bg-gray-50 p-4 rounded-lg"},t().createElement("h4",{className:"text-sm font-medium text-gray-700 mb-3"},"PIN Requirements:"),t().createElement("div",{className:"space-y-2"},Object.entries({length:"At least 6 characters",uppercase:"One uppercase letter (A-Z)",lowercase:"One lowercase letter (a-z)",number:"One number (0-9)",special:"One special character (!@#$%^&*)"}).map((e=>{let[n,s]=e;return t().createElement("div",{key:n,className:"flex items-center"},t().createElement("div",{className:"w-4 h-4 rounded-full mr-2 flex items-center justify-center ".concat(c[n]?"bg-green-500":"bg-gray-300")},c[n]&&t().createElement("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},t().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))),t().createElement("span",{className:"text-sm ".concat(c[n]?"text-green-600":"text-gray-600")},s))})))),t().createElement("button",{type:"submit",disabled:!p,className:"w-full py-3 px-4 rounded-lg font-semibold transition-colors ".concat(p?"bg-blue-600 text-white hover:bg-blue-700":"bg-gray-300 text-gray-500 cursor-not-allowed")},"Create PIN")),o&&t().createElement("p",{className:"text-center text-sm text-gray-500 mt-4"},"Securing account for: ",t().createElement("span",{className:"font-medium"},o)))}function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D(Object(n),!0).forEach((function(t){A(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function A(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const R=[{id:"basic",name:"Basic Information",description:"Name, email, and essential account details",icon:"👤",required:!0},{id:"memories",name:"Memories",description:"Preferences and interests",icon:"🧠",required:!1}];function U(n){let{onComplete:s,userEmail:o,appName:a="App",autoFetch:r=!0}=n;const[l,i]=(0,e.useState)({basic:!0,memories:!1}),[c,m]=(0,e.useState)(!1),[d,u]=(0,e.useState)(!1),[p,h]=(0,e.useState)(null),[g,b]=(0,e.useState)(null),y=e=>{let t=0;const n=e+Date.now().toString();for(let e=0;e<n.length;e++){t=(t<<5)-t+n.charCodeAt(e),t&=t}return"user_".concat(Math.abs(t).toString(36))},f=Object.values(l).filter(Boolean).length;return t().createElement("div",{className:"w-full max-w-md mx-auto bg-white rounded-lg shadow-xl overflow-hidden",style:{maxHeight:"90vh",height:"auto"}},t().createElement("div",{className:"p-4 sm:p-6 overflow-y-auto",style:{maxHeight:"calc(90vh - 4rem)"}},t().createElement("div",{className:"text-center mb-4 sm:mb-6"},t().createElement("div",{className:"w-12 h-12 sm:w-16 sm:h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-3 sm:mb-4"},t().createElement("svg",{className:"w-6 h-6 sm:w-8 sm:h-8 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},t().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"}))),t().createElement("h2",{className:"text-lg sm:text-xl font-semibold text-gray-900 mb-2"},"Data Access Request"),t().createElement("p",{className:"text-gray-600 text-xs sm:text-sm"},t().createElement("span",{className:"font-medium"},a)," would like to access some of your data.")),t().createElement("div",{className:"space-y-2 sm:space-y-3 mb-4 sm:mb-6"},R.map((e=>{const n=l[e.id]||!1,s=e.required;return t().createElement("div",{key:e.id,className:"flex items-center justify-between p-3 sm:p-4 border rounded-lg transition-colors ".concat(s?"bg-blue-50 border-blue-200":"hover:bg-gray-50")},t().createElement("div",{className:"flex items-center space-x-3"},t().createElement("div",{className:"text-xl sm:text-2xl"},e.icon),t().createElement("div",null,t().createElement("h3",{className:"font-medium text-gray-900 text-sm sm:text-base"},e.name,s&&t().createElement("span",{className:"text-blue-600 ml-1"},"*")),t().createElement("p",{className:"text-xs sm:text-sm text-gray-500"},e.description))),s?t().createElement("div",{className:"px-2 py-1 bg-blue-600 text-white text-xs rounded-full"},"Required"):t().createElement("button",{onClick:()=>{var t;"basic"!==(t=e.id)&&i((e=>L(L({},e),{},{[t]:!e[t]})))},className:"relative inline-flex h-5 sm:h-6 w-9 sm:w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ".concat(n?"bg-blue-600":"bg-gray-200")},t().createElement("span",{className:"inline-block h-3 sm:h-4 w-3 sm:w-4 transform rounded-full bg-white transition-transform ".concat(n?"translate-x-5 sm:translate-x-6":"translate-x-1")})))}))),t().createElement("div",{className:"mb-3 sm:mb-4 p-2 sm:p-3 bg-green-50 border border-green-200 rounded-lg"},t().createElement("p",{className:"text-green-800 text-xs sm:text-sm"},"✅ ",f," data type",f>1?"s":""," selected for sharing")),d&&t().createElement("div",{className:"mb-3 sm:mb-4 p-2 sm:p-3 bg-blue-50 border border-blue-200 rounded-lg"},t().createElement("p",{className:"text-blue-800 text-xs sm:text-sm"},"🔄 Processing your data request...")),g&&t().createElement("div",{className:"mb-3 sm:mb-4 p-2 sm:p-3 bg-red-50 border border-red-200 rounded-lg"},t().createElement("p",{className:"text-red-800 text-xs sm:text-sm"},"❌ ",g)),t().createElement("div",{className:"flex space-x-3"},t().createElement("button",{onClick:()=>{s({approved:!1,dataTypes:[],timestamp:(new Date).toISOString(),userEmail:o,userHash:y(o),appName:a})},disabled:c,className:"flex-1 py-2 sm:py-3 px-4 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 transition-colors disabled:opacity-50 text-sm sm:text-base"},"Deny"),t().createElement("button",{onClick:async()=>{if(!c){m(!0);try{const e=Object.entries(l).filter((e=>{let[t,n]=e;return n})).map((e=>{let[t]=e;return t})),t=y(o),n={approved:!0,dataTypes:e,timestamp:(new Date).toISOString(),userEmail:o,userHash:t,appName:a};let i=n;if(r)try{const t=await(async e=>{try{u(!0),b(null);const t=y(o),n=await fetch("https://api2.onairos.uk/inferenceTest",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approvedData:e,userEmail:o,userHash:t,appName:a,timestamp:(new Date).toISOString()})});if(!n.ok)throw new Error("API call failed with status: ".concat(n.status));const s=L(L({},await n.json()),{},{userHash:t});return h(s),s}catch(e){throw console.error("API call error:",e),b(e.message),e}finally{u(!1)}})(e);i=L(L({},n),{},{apiResponse:t,apiUrl:"https://api2.onairos.uk/inferenceTest"})}catch(e){i=L(L({},n),{},{apiError:e.message,apiUrl:"https://api2.onairos.uk/inferenceTest"})}await new Promise((e=>setTimeout(e,500))),s(i)}catch(e){console.error("Error in handleApprove:",e),b("Failed to process request")}finally{m(!1)}}},disabled:c,className:"flex-1 py-2 sm:py-3 px-4 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50 text-sm sm:text-base"},c?"Processing...":"Approve"))))}function M(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?M(Object(n),!0).forEach((function(t){G(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function G(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z(n){let{requestData:s,webpageName:o,inferenceData:a=null,onComplete:r=null,autoFetch:l=!0,proofMode:i=!1,textLayout:c="below",textColor:m="white",login:d=!1,buttonType:u="pill",loginReturn:h=null,loginType:g="signIn",visualType:b="full",appIcon:y=null}=n;const[f,x]=(0,e.useState)(!1),[C,E]=(0,e.useState)("email"),[v,w]=(0,e.useState)(null),[N,S]=(0,e.useState)(null);(0,e.useEffect)((()=>{(()=>{const e=localStorage.getItem("onairosUser");if(e)try{const t=JSON.parse(e);w(t),t.onboardingComplete&&t.pinCreated?E("dataRequest"):t.verified&&!t.onboardingComplete?E("onboarding"):t.onboardingComplete&&!t.pinCreated&&E("pin")}catch(e){console.error("Error parsing saved user data:",e),localStorage.removeItem("onairosUser")}})()}),[]);const O=()=>{x(!1),S(null)},k=e=>{console.log("Email auth successful:",e);const t=W(W({},e),{},{verified:!0,onboardingComplete:!1,pinCreated:!1});w(t),localStorage.setItem("onairosUser",JSON.stringify(t)),E("onboarding")},P=e=>{console.log("Onboarding completed:",e);const t=W(W({},v),{},{onboardingComplete:!0,connectedAccounts:e.connectedAccounts||[]});w(t),localStorage.setItem("onairosUser",JSON.stringify(t)),E("pin")},j=e=>{console.log("PIN setup completed:",e);const t=W(W(W({},v),e),{},{pinCreated:!0});w(t),localStorage.setItem("onairosUser",JSON.stringify(t)),E("dataRequest")},D=e=>{console.log("🔥 OnairosButton: Data request completed:",e);const t=W(W({},v),{},{lastDataRequest:e});if(w(t),localStorage.setItem("onairosUser",JSON.stringify(t)),x(!1),console.log("🔥 Calling onComplete callback with:",e),r)try{r(e),console.log("🔥 onComplete callback executed successfully")}catch(e){console.error("🔥 Error in onComplete callback:",e)}else console.log("🔥 No onComplete callback provided")},L="flex items-center justify-center font-bold rounded cursor-pointer ".concat("pill"===u?"px-4 py-2":"w-12 h-12"," bg-transparent OnairosConnect"),A={flexDirection:"below"===c?"column":"row",backgroundColor:"transparent",color:m,border:"1px solid transparent"},R={width:"20px",height:"20px",marginRight:"full"===b?"12px":"0"};return t().createElement(t().Fragment,null,t().createElement("button",{className:L,onClick:async()=>{try{console.log("🔥 openTerminal called"),x(!0)}catch(e){console.error("Error in openTerminal:",e)}},style:A},("full"===b||"icon"===b)&&t().createElement("img",{src:d?"https://onairos.sirv.com/Images/OnairosWhite.png":"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos Logo",style:R}),"icon"!==b&&t().createElement("span",{className:"".concat("black"===m?"text-black":"text-white"," ").concat("icon"===b?"sr-only":""," ").concat("right"===c?"ml-2":"left"===c?"mr-2":"")},(()=>{switch(g){case"signUp":return"Sign Up with Onairos";case"signOut":return"Sign Out of Onairos";default:return"Sign In with Onairos"}})())),f&&t().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",onClick:e=>{e.target===e.currentTarget&&O()}},t().createElement("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-hidden relative",onClick:e=>e.stopPropagation()},t().createElement("button",{onClick:O,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 z-10"},t().createElement("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},t().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))),t().createElement("div",{className:"overflow-y-auto max-h-[90vh]"},(()=>{switch(C){case"email":return t().createElement(p,{onSuccess:k,testMode:!0});case"onboarding":return t().createElement(I,{onComplete:P,appIcon:y||"https://onairos.sirv.com/Images/OnairosBlack.png",appName:o,username:(null==v?void 0:v.email)||(null==v?void 0:v.username)});case"pin":return t().createElement(T,{onComplete:j,userEmail:null==v?void 0:v.email});case"dataRequest":return t().createElement(U,{onComplete:D,userEmail:null==v?void 0:v.email,requestData:s,appName:o,autoFetch:l,appIcon:y});default:return t().createElement("div",{className:"flex flex-col items-center space-y-4 p-6"},t().createElement("div",{className:"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent"}),t().createElement("p",{className:"text-gray-600"},"Loading..."))}})()))))}function B(e){return t().createElement(t().Fragment,null,t().createElement(z,e))}const q=B})(),o})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("Onairos",["React"],t):"object"==typeof exports?exports.Onairos=t(require("react")):e.Onairos=t(e.React)}(this,(e=>(()=>{"use strict";var t={639:t=>{t.exports=e}},n={};function s(e){var o=n[e];if(void 0!==o)return o.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,s),a.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{s.r(o),s.d(o,{Onairos:()=>B,default:()=>J});var e=s(639),t=s.n(e);const n=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,((e,t,n)=>n?n.toUpperCase():t.toLowerCase())))(e);return t.charAt(0).toUpperCase()+t.slice(1)},a=(...e)=>e.filter(((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t)).join(" ").trim(),r=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var i={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const l=(0,e.forwardRef)((({color:t="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:l="",children:c,iconNode:m,...d},u)=>(0,e.createElement)("svg",{ref:u,...i,width:n,height:n,stroke:t,strokeWidth:o?24*Number(s)/Number(n):s,className:a("lucide",l),...!c&&!r(d)&&{"aria-hidden":"true"},...d},[...m.map((([t,n])=>(0,e.createElement)(t,n))),...Array.isArray(c)?c:[c]]))),c=(t,s)=>{const o=(0,e.forwardRef)((({className:o,...r},i)=>{return(0,e.createElement)(l,{ref:i,iconNode:s,className:a(`lucide-${c=n(t),c.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${t}`,o),...r});var c}));return o.displayName=n(t),o},m=c("mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]),d=c("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),u=c("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);function p(n){let{onSuccess:s,testMode:o=!0}=n;const[a,r]=(0,e.useState)(""),[i,l]=(0,e.useState)(""),[c,p]=(0,e.useState)("email"),[h,g]=(0,e.useState)(!1),[b,y]=(0,e.useState)(""),f=async e=>{if(e.preventDefault(),y(""),(e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))(a)){g(!0);try{if(o)setTimeout((()=>{p("code"),g(!1)}),1e3);else{if(!(await fetch("https://api2.onairos.uk/email/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a})})).ok)throw new Error("Failed to send verification code");p("code"),g(!1)}}catch(e){y(e.message),g(!1)}}else y("Please enter a valid email address")},x=async e=>{if(e.preventDefault(),y(""),o&&"123456"===i)return p("success"),void setTimeout((()=>{s({email:a,verified:!0})}),1e3);if(o)y("Invalid code. Use 123456 for testing.");else{g(!0);try{const e=await fetch("https://api2.onairos.uk/email/verify/confirm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a,code:i})});if(!e.ok)throw new Error("Invalid verification code");const t=await e.json();p("success"),setTimeout((()=>{s({email:a,verified:!0,token:t.token})}),1e3)}catch(e){y(e.message),g(!1)}}};return t().createElement("div",{className:"flex flex-col items-center space-y-6 p-6 w-full"},"email"===c&&t().createElement("div",{className:"flex flex-col items-center space-y-6 w-full"},t().createElement("div",{className:"flex items-center justify-center w-16 h-16 bg-blue-100 rounded-full"},t().createElement(m,{className:"w-8 h-8 text-blue-600"})),t().createElement("div",{className:"text-center"},t().createElement("h2",{className:"text-xl font-semibold text-gray-900 mb-2"},"Sign in to Onairos"),t().createElement("p",{className:"text-gray-600"},"Enter your email address to continue"),o&&t().createElement("p",{className:"text-sm text-blue-600 mt-2"},"Test mode: Any valid email will work")),t().createElement("form",{onSubmit:f,className:"w-full max-w-md space-y-4"},t().createElement("div",null,t().createElement("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 mb-1"},"Email address"),t().createElement("input",{type:"email",id:"email",value:a,onChange:e=>r(e.target.value),placeholder:"Enter your email",className:"w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",required:!0})),b&&t().createElement("p",{className:"text-sm text-red-600"},b),t().createElement("button",{type:"submit",disabled:h,className:"w-full py-3 px-4 bg-blue-600 text-white rounded-lg font-semibold hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center"},h?t().createElement("div",{className:"animate-spin h-5 w-5 border-2 border-white rounded-full border-t-transparent"}):t().createElement(t().Fragment,null,"Continue",t().createElement(d,{className:"ml-2 w-4 h-4"}))))),"code"===c&&t().createElement("div",{className:"flex flex-col items-center space-y-6 w-full"},t().createElement("div",{className:"flex items-center justify-center w-16 h-16 bg-green-100 rounded-full"},t().createElement(m,{className:"w-8 h-8 text-green-600"})),t().createElement("div",{className:"text-center"},t().createElement("h2",{className:"text-xl font-semibold text-gray-900 mb-2"},"Check your email"),t().createElement("p",{className:"text-gray-600"},"We sent a verification code to"),t().createElement("p",{className:"text-gray-900 font-medium"},a),o&&t().createElement("p",{className:"text-sm text-blue-600 mt-2"},"Test mode: Use code 123456")),t().createElement("form",{onSubmit:x,className:"w-full max-w-md space-y-4"},t().createElement("div",null,t().createElement("label",{htmlFor:"code",className:"block text-sm font-medium text-gray-700 mb-1"},"Verification code"),t().createElement("input",{type:"text",id:"code",value:i,onChange:e=>l(e.target.value),placeholder:"Enter 6-digit code",className:"w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none text-center text-lg tracking-widest",maxLength:"6",required:!0})),b&&t().createElement("p",{className:"text-sm text-red-600"},b),t().createElement("button",{type:"submit",disabled:h,className:"w-full py-3 px-4 bg-blue-600 text-white rounded-lg font-semibold hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center"},h?t().createElement("div",{className:"animate-spin h-5 w-5 border-2 border-white rounded-full border-t-transparent"}):"Verify Code"),t().createElement("button",{type:"button",onClick:()=>p("email"),className:"w-full py-2 px-4 text-gray-600 hover:text-gray-800"},"Use a different email"))),"success"===c&&t().createElement("div",{className:"flex flex-col items-center space-y-6 w-full"},t().createElement("div",{className:"flex items-center justify-center w-16 h-16 bg-green-100 rounded-full"},t().createElement(u,{className:"w-8 h-8 text-green-600"})),t().createElement("div",{className:"text-center"},t().createElement("h2",{className:"text-xl font-semibold text-gray-900 mb-2"},"Email verified!"),t().createElement("p",{className:"text-gray-600"},"Setting up your account...")),t().createElement("div",{className:"w-8 h-8"},t().createElement("div",{className:"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent"}))))}class h extends e.Component{constructor(e){super(e),this.state={connected:!1,open:!1,isConnecting:!1},this.handleClose=this.handleClose.bind(this),this.handleOpen=this.handleOpen.bind(this),this.youtubeConnect=this.youtubeConnect.bind(this),this.setConnected=this.setConnected.bind(this),this.setDisconnected=this.setDisconnected.bind(this)}setConnected(){this.setState({connected:!0}),this.props.onConnectionChange&&this.props.onConnectionChange("YouTube",!0),this.handleClose()}setDisconnected(){this.updateConnections("Remove","Youtube").then((()=>{this.setState({connected:!1}),this.props.onConnectionChange&&this.props.onConnectionChange("YouTube",!1),this.handleClose()})).catch((e=>{console.error("Error removing YouTube connection:",e)}))}async updateConnections(e,t){const n={session:{username:localStorage.getItem("username")||this.props.username},updateType:e,newConnection:t};try{const e=await fetch("https://api2.onairos.uk/connections/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await e.json()}catch(e){throw console.error("UpdateConnections error:",e),e}}handleOpen(){this.setState({open:!0})}handleClose(){this.setState({open:!1}),this.props.onClose&&this.props.onClose()}async youtubeConnect(){this.setState({isConnecting:!0});const e={session:{username:localStorage.getItem("username")||this.props.username}};try{const t=await fetch("https://api2.onairos.uk/youtube/authorize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();n.youtubeURL?window.location.href=n.youtubeURL:(console.error("No YouTube URL received"),this.setState({isConnecting:!1}))}catch(e){console.error("YouTube connection error:",e),this.setState({isConnecting:!1})}}render(){const{open:e=this.props.open||this.state.open}=this.props;return e?t().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},t().createElement("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-hidden"},t().createElement("div",{className:"p-6"},t().createElement("h2",{className:"text-xl font-bold text-gray-900 mb-4"},"Grant Onairos Access to your YouTube Account?"),t().createElement("div",{className:"space-y-4 text-gray-700"},t().createElement("p",null,"Grant Permission to your YouTube Account, so we can build your Data Models."),t().createElement("div",null,t().createElement("p",{className:"font-medium mb-2"},"We will access your YouTube:"),t().createElement("ul",{className:"list-disc ml-6 space-y-1"},t().createElement("li",null,"Basic Account Info"),t().createElement("li",null,"Liked and Watched Videos"),t().createElement("li",null,"Subscribed Channels and Playlist Videos"))),t().createElement("p",null,"We will delete all the data used once your Model is Created"),t().createElement("p",{className:"text-sm"},t().createElement("a",{href:"https://onairos.uk/compliance-google-policy",className:"text-blue-600 hover:underline"},"Onairos")," ","complies with"," ",t().createElement("a",{href:"https://policies.google.com/privacy",className:"text-blue-600 hover:underline"},"Google API Services User Data Policy"))),t().createElement("div",{className:"flex space-x-3 mt-6"},t().createElement("button",{onClick:this.handleClose,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 disabled:opacity-50"},"Disagree"),t().createElement("button",{onClick:this.youtubeConnect,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"},this.state.isConnecting?"Connecting...":"Agree"))))):null}}const g=h;class b extends e.Component{constructor(e){super(e),this.state={connected:!1,open:!1,isConnecting:!1},this.handleClose=this.handleClose.bind(this),this.handleOpen=this.handleOpen.bind(this),this.linkedinConnect=this.linkedinConnect.bind(this),this.setConnected=this.setConnected.bind(this),this.setDisconnected=this.setDisconnected.bind(this)}setConnected(){this.setState({connected:!0}),this.props.onConnectionChange&&this.props.onConnectionChange("LinkedIn",!0),this.handleClose()}setDisconnected(){this.updateConnections("Remove","LinkedIn").then((()=>{this.setState({connected:!1}),this.props.onConnectionChange&&this.props.onConnectionChange("LinkedIn",!1),this.handleClose()})).catch((e=>{console.error("Error removing LinkedIn connection:",e)}))}async updateConnections(e,t){const n={session:{username:localStorage.getItem("username")||this.props.username},updateType:e,newConnection:t};try{const e=await fetch("https://api2.onairos.uk/connections/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await e.json()}catch(e){throw console.error("UpdateConnections error:",e),e}}handleOpen(){this.setState({open:!0})}handleClose(){this.setState({open:!1}),this.props.onClose&&this.props.onClose()}async linkedinConnect(){this.setState({isConnecting:!0});const e={session:{username:localStorage.getItem("username")||this.props.username}};try{const t=await fetch("https://api2.onairos.uk/linkedin/authorize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();n.linkedinURL?window.location.href=n.linkedinURL:(console.error("No LinkedIn URL received"),this.setState({isConnecting:!1}))}catch(e){console.error("LinkedIn connection error:",e),this.setState({isConnecting:!1})}}render(){const{open:e=this.props.open||this.state.open}=this.props;return e?t().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},t().createElement("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-hidden"},t().createElement("div",{className:"p-6"},t().createElement("h2",{className:"text-xl font-bold text-gray-900 mb-4"},"Grant Onairos Access to your LinkedIn Account?"),t().createElement("div",{className:"space-y-4 text-gray-700"},t().createElement("p",null,"Grant Permission to your LinkedIn Account, so we can build your Data Models."),t().createElement("div",null,t().createElement("p",{className:"font-medium mb-2"},"We will access your LinkedIn:"),t().createElement("ul",{className:"list-disc ml-6 space-y-1"},t().createElement("li",null,"Basic Profile Information"),t().createElement("li",null,"Professional Experience"),t().createElement("li",null,"Network Connections"),t().createElement("li",null,"Posts and Activity"))),t().createElement("p",null,"We will delete all the data used once your Model is Created"),t().createElement("p",{className:"text-sm"},t().createElement("a",{href:"https://onairos.uk/privacy-policy",className:"text-blue-600 hover:underline"},"Onairos Privacy Policy")," ","- Your professional data is handled with the highest security standards.")),t().createElement("div",{className:"flex space-x-3 mt-6"},t().createElement("button",{onClick:this.handleClose,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 disabled:opacity-50"},"Disagree"),t().createElement("button",{onClick:this.linkedinConnect,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"},this.state.isConnecting?"Connecting...":"Agree"))))):null}}const y=b;class f extends e.Component{constructor(e){super(e),this.state={connected:!1,open:!1,isConnecting:!1},this.handleClose=this.handleClose.bind(this),this.handleOpen=this.handleOpen.bind(this),this.instagramConnect=this.instagramConnect.bind(this),this.setConnected=this.setConnected.bind(this),this.setDisconnected=this.setDisconnected.bind(this)}setConnected(){this.setState({connected:!0}),this.props.onConnectionChange&&this.props.onConnectionChange("Instagram",!0),this.handleClose()}setDisconnected(){this.updateConnections("Remove","Instagram").then((()=>{this.setState({connected:!1}),this.props.onConnectionChange&&this.props.onConnectionChange("Instagram",!1),this.handleClose()})).catch((e=>{console.error("Error removing Instagram connection:",e)}))}async updateConnections(e,t){const n={session:{username:localStorage.getItem("username")||this.props.username},updateType:e,newConnection:t};try{const e=await fetch("https://api2.onairos.uk/connections/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await e.json()}catch(e){throw console.error("UpdateConnections error:",e),e}}handleOpen(){this.setState({open:!0})}handleClose(){this.setState({open:!1}),this.props.onClose&&this.props.onClose()}async instagramConnect(){this.setState({isConnecting:!0});const e={session:{username:localStorage.getItem("username")||this.props.username}};try{const t=await fetch("https://api2.onairos.uk/instagram/authorize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();n.instagramURL?window.location.href=n.instagramURL:(console.error("No Instagram URL received"),this.setState({isConnecting:!1}))}catch(e){console.error("Instagram connection error:",e),this.setState({isConnecting:!1})}}render(){const{open:e=this.props.open||this.state.open}=this.props;return e?t().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},t().createElement("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-hidden"},t().createElement("div",{className:"p-6"},t().createElement("h2",{className:"text-xl font-bold text-gray-900 mb-4"},"Grant Onairos Access to your Instagram Account?"),t().createElement("div",{className:"space-y-4 text-gray-700"},t().createElement("p",null,"Grant Permission to your Instagram Account, so we can build your Data Models."),t().createElement("div",null,t().createElement("p",{className:"font-medium mb-2"},"We will access your Instagram:"),t().createElement("ul",{className:"list-disc ml-6 space-y-1"},t().createElement("li",null,"Basic Profile Information"),t().createElement("li",null,"Posts and Stories"),t().createElement("li",null,"Liked Content"),t().createElement("li",null,"Following and Followers"))),t().createElement("p",null,"We will delete all the data used once your Model is Created"),t().createElement("p",{className:"text-sm"},t().createElement("a",{href:"https://onairos.uk/compliance-meta-policy",className:"text-blue-600 hover:underline"},"Onairos")," ","complies with"," ",t().createElement("a",{href:"https://developers.facebook.com/policy",className:"text-blue-600 hover:underline"},"Meta Platform Policy"))),t().createElement("div",{className:"flex space-x-3 mt-6"},t().createElement("button",{onClick:this.handleClose,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 disabled:opacity-50"},"Disagree"),t().createElement("button",{onClick:this.instagramConnect,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"},this.state.isConnecting?"Connecting...":"Agree"))))):null}}const x=f;class C extends e.Component{constructor(e){super(e),this.state={connected:!1,open:!1,isConnecting:!1},this.handleClose=this.handleClose.bind(this),this.handleOpen=this.handleOpen.bind(this),this.pinterestConnect=this.pinterestConnect.bind(this),this.setConnected=this.setConnected.bind(this),this.setDisconnected=this.setDisconnected.bind(this)}setConnected(){this.setState({connected:!0}),this.props.onConnectionChange&&this.props.onConnectionChange("Pinterest",!0),this.handleClose()}setDisconnected(){this.updateConnections("Remove","Pinterest").then((()=>{this.setState({connected:!1}),this.props.onConnectionChange&&this.props.onConnectionChange("Pinterest",!1),this.handleClose()})).catch((e=>{console.error("Error removing Pinterest connection:",e)}))}async updateConnections(e,t){const n={session:{username:localStorage.getItem("username")||this.props.username},updateType:e,newConnection:t};try{const e=await fetch("https://api2.onairos.uk/connections/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await e.json()}catch(e){throw console.error("UpdateConnections error:",e),e}}handleOpen(){this.setState({open:!0})}handleClose(){this.setState({open:!1}),this.props.onClose&&this.props.onClose()}async pinterestConnect(){this.setState({isConnecting:!0});const e={session:{username:localStorage.getItem("username")||this.props.username}};try{const t=await fetch("https://api2.onairos.uk/pinterest/authorize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();n.pinterestURL?window.location.href=n.pinterestURL:(console.error("No Pinterest URL received"),this.setState({isConnecting:!1}))}catch(e){console.error("Pinterest connection error:",e),this.setState({isConnecting:!1})}}render(){const{open:e=this.props.open||this.state.open}=this.props;return e?t().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},t().createElement("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-hidden"},t().createElement("div",{className:"p-6"},t().createElement("h2",{className:"text-xl font-bold text-gray-900 mb-4"},"Grant Onairos Access to your Pinterest Account?"),t().createElement("div",{className:"space-y-4 text-gray-700"},t().createElement("p",null,"Grant Permission to your Pinterest Account, so we can build your Data Models."),t().createElement("div",null,t().createElement("p",{className:"font-medium mb-2"},"We will access your Pinterest:"),t().createElement("ul",{className:"list-disc ml-6 space-y-1"},t().createElement("li",null,"Basic Profile Information"),t().createElement("li",null,"Boards and Pins"),t().createElement("li",null,"Saved and Liked Pins"),t().createElement("li",null,"Following and Followers"))),t().createElement("p",null,"We will delete all the data used once your Model is Created"),t().createElement("p",{className:"text-sm"},t().createElement("a",{href:"https://onairos.uk/privacy-policy",className:"text-blue-600 hover:underline"},"Onairos Privacy Policy")," ","- Your creative interests and preferences are securely processed.")),t().createElement("div",{className:"flex space-x-3 mt-6"},t().createElement("button",{onClick:this.handleClose,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 disabled:opacity-50"},"Disagree"),t().createElement("button",{onClick:this.pinterestConnect,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"},this.state.isConnecting?"Connecting...":"Agree"))))):null}}const E=C;class v extends e.Component{constructor(e){super(e),this.state={connected:!1,open:!1,isConnecting:!1},this.handleClose=this.handleClose.bind(this),this.handleOpen=this.handleOpen.bind(this),this.redditConnect=this.redditConnect.bind(this),this.setConnected=this.setConnected.bind(this),this.setDisconnected=this.setDisconnected.bind(this)}setConnected(){this.setState({connected:!0}),this.props.onConnectionChange&&this.props.onConnectionChange("Reddit",!0),this.handleClose()}setDisconnected(){this.updateConnections("Remove","Reddit").then((()=>{this.setState({connected:!1}),this.props.onConnectionChange&&this.props.onConnectionChange("Reddit",!1),this.handleClose()})).catch((e=>{console.error("Error removing Reddit connection:",e)}))}async updateConnections(e,t){const n={session:{username:localStorage.getItem("username")||this.props.username},updateType:e,newConnection:t};try{const e=await fetch("https://api2.onairos.uk/connections/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await e.json()}catch(e){throw console.error("UpdateConnections error:",e),e}}handleOpen(){this.setState({open:!0})}handleClose(){this.setState({open:!1}),this.props.onClose&&this.props.onClose()}async redditConnect(){this.setState({isConnecting:!0});const e={session:{username:localStorage.getItem("username")||this.props.username}};try{const t=await fetch("https://api2.onairos.uk/reddit/authorize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();n.redditURL?window.location.href=n.redditURL:(console.error("No Reddit URL received"),this.setState({isConnecting:!1}))}catch(e){console.error("Reddit connection error:",e),this.setState({isConnecting:!1})}}render(){const{open:e=this.props.open||this.state.open}=this.props;return e?t().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},t().createElement("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-hidden"},t().createElement("div",{className:"p-6"},t().createElement("h2",{className:"text-xl font-bold text-gray-900 mb-4"},"Grant Onairos Access to your Reddit Account?"),t().createElement("div",{className:"space-y-4 text-gray-700"},t().createElement("p",null,"Grant Permission to your Reddit Account, so we can build your Data Models."),t().createElement("div",null,t().createElement("p",{className:"font-medium mb-2"},"We will access your Reddit:"),t().createElement("ul",{className:"list-disc ml-6 space-y-1"},t().createElement("li",null,"Basic Profile Information"),t().createElement("li",null,"Posts and Comments"),t().createElement("li",null,"Upvoted and Saved Content"),t().createElement("li",null,"Subscribed Subreddits"))),t().createElement("p",null,"We will delete all the data used once your Model is Created"),t().createElement("p",{className:"text-sm"},t().createElement("a",{href:"https://onairos.uk/privacy-policy",className:"text-blue-600 hover:underline"},"Onairos Privacy Policy")," ","- Your Reddit activity helps us understand your interests and preferences.")),t().createElement("div",{className:"flex space-x-3 mt-6"},t().createElement("button",{onClick:this.handleClose,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 disabled:opacity-50"},"Disagree"),t().createElement("button",{onClick:this.redditConnect,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"},this.state.isConnecting?"Connecting...":"Agree"))))):null}}const w=v;class N extends e.Component{constructor(e){super(e),this.state={connected:!1,open:!1,isConnecting:!1},this.handleClose=this.handleClose.bind(this),this.handleOpen=this.handleOpen.bind(this),this.gmailConnect=this.gmailConnect.bind(this),this.setConnected=this.setConnected.bind(this),this.setDisconnected=this.setDisconnected.bind(this)}setConnected(){this.setState({connected:!0}),this.props.onConnectionChange&&this.props.onConnectionChange("Gmail",!0),this.handleClose()}setDisconnected(){this.updateConnections("Remove","Gmail").then((()=>{this.setState({connected:!1}),this.props.onConnectionChange&&this.props.onConnectionChange("Gmail",!1),this.handleClose()})).catch((e=>{console.error("Error removing Gmail connection:",e)}))}async updateConnections(e,t){const n={session:{username:localStorage.getItem("username")||this.props.username},updateType:e,newConnection:t};try{const e=await fetch("https://api2.onairos.uk/connections/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return await e.json()}catch(e){throw console.error("UpdateConnections error:",e),e}}handleOpen(){this.setState({open:!0})}handleClose(){this.setState({open:!1}),this.props.onClose&&this.props.onClose()}async gmailConnect(){this.setState({isConnecting:!0});const e={session:{username:localStorage.getItem("username")||this.props.username}};try{const t=await fetch("https://api2.onairos.uk/gmail/authorize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();n.gmailURL?window.location.href=n.gmailURL:(console.error("No Gmail URL received"),this.setState({isConnecting:!1}))}catch(e){console.error("Gmail connection error:",e),this.setState({isConnecting:!1})}}render(){const{open:e=this.props.open||this.state.open}=this.props;return e?t().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"},t().createElement("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-hidden"},t().createElement("div",{className:"p-6"},t().createElement("h2",{className:"text-xl font-bold text-gray-900 mb-4"},"Grant Onairos Access to your Gmail Account?"),t().createElement("div",{className:"space-y-4 text-gray-700"},t().createElement("p",null,"Grant Permission to your Gmail Account, so we can build your Data Models."),t().createElement("div",null,t().createElement("p",{className:"font-medium mb-2"},"We will access your Gmail:"),t().createElement("ul",{className:"list-disc ml-6 space-y-1"},t().createElement("li",null,"Basic Account Information"),t().createElement("li",null,"Email Metadata (subjects, dates, senders)"),t().createElement("li",null,"Email Categories and Labels"),t().createElement("li",null,"Communication Patterns"))),t().createElement("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-3"},t().createElement("p",{className:"text-yellow-800 text-sm font-medium"},t().createElement("strong",null,"Note:")," We do NOT read the content of your emails. Only metadata is processed.")),t().createElement("p",null,"We will delete all the data used once your Model is Created"),t().createElement("p",{className:"text-sm"},t().createElement("a",{href:"https://onairos.uk/compliance-google-policy",className:"text-blue-600 hover:underline"},"Onairos")," ","complies with"," ",t().createElement("a",{href:"https://policies.google.com/privacy",className:"text-blue-600 hover:underline"},"Google API Services User Data Policy"))),t().createElement("div",{className:"flex space-x-3 mt-6"},t().createElement("button",{onClick:this.handleClose,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 disabled:opacity-50"},"Disagree"),t().createElement("button",{onClick:this.gmailConnect,disabled:this.state.isConnecting,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50"},this.state.isConnecting?"Connecting...":"Agree"))))):null}}const S=N;function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const P=[{name:"YouTube",icon:"📺",color:"bg-red-500",connector:"youtube"},{name:"Reddit",icon:"🔥",color:"bg-orange-500",connector:"reddit"},{name:"Instagram",icon:"📷",color:"bg-pink-500",connector:"instagram"},{name:"Pinterest",icon:"📌",color:"bg-red-600",connector:"pinterest"},{name:"LinkedIn",icon:"💼",color:"bg-blue-700",connector:"linkedin"},{name:"Gmail",icon:"📧",color:"bg-red-500",connector:"gmail"}];function I(n){let{onComplete:s,appIcon:o,appName:a="App",username:r}=n;const[i,l]=(0,e.useState)({}),[c,m]=(0,e.useState)(!1),[d,u]=(0,e.useState)(null),p=(e,t)=>{l((n=>k(k({},n),{},{[e]:t}))),u(null)},h=Object.values(i).filter(Boolean).length;return t().createElement("div",{className:"w-full max-w-md mx-auto bg-white rounded-lg shadow-xl overflow-hidden",style:{maxHeight:"90vh",height:"auto"}},t().createElement("div",{className:"p-4 sm:p-6 overflow-y-auto",style:{maxHeight:"calc(90vh - 4rem)"}},t().createElement("div",{className:"flex items-center justify-center mb-4 sm:mb-6"},t().createElement("div",{className:"flex items-center space-x-3"},t().createElement("img",{src:o||"https://onairos.sirv.com/Images/OnairosBlack.png",alt:a,className:"w-8 h-8 sm:w-10 sm:h-10 rounded-lg"}),t().createElement("div",{className:"flex items-center text-gray-400"},t().createElement("svg",{className:"w-5 h-5 sm:w-6 sm:h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},t().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 8l4 4m0 0l-4 4m4-4H3"}))),t().createElement("img",{src:"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos",className:"w-8 h-8 sm:w-10 sm:h-10 rounded-lg"}))),t().createElement("div",{className:"text-center mb-4 sm:mb-6"},t().createElement("h2",{className:"text-lg sm:text-xl font-bold text-gray-900 mb-2"},"Connect Your Accounts"),t().createElement("p",{className:"text-gray-600 text-xs sm:text-sm"},"Choose which accounts to connect for a personalized experience")),t().createElement("div",{className:"mb-4 sm:mb-6 p-2 sm:p-3 bg-blue-50 border border-blue-200 rounded-lg"},t().createElement("p",{className:"text-blue-800 text-xs sm:text-sm"},"🔒 Your data is never shared with anyone. It's only used to train your personal model and is stored securely.")),t().createElement("div",{className:"space-y-2 sm:space-y-3 mb-4 sm:mb-6"},P.map((e=>{const n=i[e.name]||!1;return t().createElement("div",{key:e.name,className:"flex items-center justify-between p-3 sm:p-4 border rounded-lg hover:bg-gray-50 transition-colors"},t().createElement("div",{className:"flex items-center space-x-3"},t().createElement("div",{className:"w-8 h-8 sm:w-10 sm:h-10 rounded-lg ".concat(e.color," flex items-center justify-center text-white text-base sm:text-lg")},e.icon),t().createElement("div",null,t().createElement("h3",{className:"font-medium text-gray-900 text-sm sm:text-base"},e.name),t().createElement("p",{className:"text-xs sm:text-sm text-gray-500"},n?"Connected":"Not connected"))),t().createElement("button",{onClick:()=>(async(e,t)=>{if(c)return;i[e]?l((t=>k(k({},t),{},{[e]:!1}))):u(t)})(e.name,e.connector),disabled:c,className:"relative inline-flex h-5 sm:h-6 w-9 sm:w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ".concat(n?"bg-blue-600":"bg-gray-200"," ").concat(c?"opacity-50 cursor-not-allowed":"cursor-pointer")},t().createElement("span",{className:"inline-block h-3 sm:h-4 w-3 sm:w-4 transform rounded-full bg-white transition-transform ".concat(n?"translate-x-5 sm:translate-x-6":"translate-x-1")})))}))),h>0&&t().createElement("div",{className:"mb-3 sm:mb-4 p-2 sm:p-3 bg-green-50 border border-green-200 rounded-lg"},t().createElement("p",{className:"text-green-800 text-xs sm:text-sm"},"✅ ",h," account",h>1?"s":""," connected")),t().createElement("button",{onClick:()=>{const e=Object.entries(i).filter((e=>{let[t,n]=e;return n})).map((e=>{let[t]=e;return t}));s({connectedAccounts:e,totalConnections:e.length})},disabled:0===h,className:"w-full py-2 sm:py-3 px-4 rounded-lg font-semibold transition-colors text-sm sm:text-base ".concat(h>0?"bg-blue-600 text-white hover:bg-blue-700":"bg-gray-300 text-gray-500 cursor-not-allowed")},"Continue ",h>0?"with ".concat(h," account").concat(h>1?"s":""):""),t().createElement("button",{onClick:()=>s({connectedAccounts:[],totalConnections:0}),className:"w-full mt-2 py-2 text-gray-500 hover:text-gray-700 text-xs sm:text-sm"},"Skip for now")),t().createElement(g,{open:"youtube"===d,onClose:()=>u(null),onConnectionChange:p,username:r}),t().createElement(y,{open:"linkedin"===d,onClose:()=>u(null),onConnectionChange:p,username:r}),t().createElement(x,{open:"instagram"===d,onClose:()=>u(null),onConnectionChange:p,username:r}),t().createElement(E,{open:"pinterest"===d,onClose:()=>u(null),onConnectionChange:p,username:r}),t().createElement(w,{open:"reddit"===d,onClose:()=>u(null),onConnectionChange:p,username:r}),t().createElement(S,{open:"gmail"===d,onClose:()=>u(null),onConnectionChange:p,username:r}))}function D(n){let{onComplete:s,userEmail:o}=n;const[a,r]=(0,e.useState)(""),[i,l]=(0,e.useState)({length:!1,number:!1,special:!1});(0,e.useEffect)((()=>{l({length:a.length>=8,number:/[0-9]/.test(a),special:/[!@#$%^&*(),.?":{}|<>]/.test(a)})}),[a]);const c=Object.values(i).every((e=>e))&&a.length>0;return t().createElement("div",{className:"max-w-md mx-auto bg-white p-6"},t().createElement("div",{className:"text-center mb-6"},t().createElement("div",{className:"w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4"},t().createElement("svg",{className:"w-8 h-8 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},t().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-1a2 2 0 00-2-2H6a2 2 0 00-2 2v1a2 2 0 002 2zM12 7V3m0 4l3-3m-3 3L9 4"}))),t().createElement("h2",{className:"text-2xl font-bold text-gray-900 mb-2"},"Create Your Secure PIN"),t().createElement("p",{className:"text-gray-600"},"Your PIN will be used to securely access your data")),t().createElement("form",{onSubmit:e=>{e.preventDefault(),c&&s({pin:a,pinCreated:!0,timestamp:(new Date).toISOString()})},className:"space-y-4"},t().createElement("div",null,t().createElement("label",{htmlFor:"pin",className:"block text-sm font-medium text-gray-700 mb-2"},"Create PIN"),t().createElement("input",{type:"password",id:"pin",value:a,onChange:e=>r(e.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your secure PIN"})),t().createElement("div",{className:"bg-gray-50 p-4 rounded-lg"},t().createElement("h4",{className:"text-sm font-medium text-gray-700 mb-3"},"PIN Requirements:"),t().createElement("div",{className:"space-y-2"},Object.entries({length:"At least 8 characters",number:"One number (0-9)",special:"One special character (!@#$%^&*)"}).map((e=>{let[n,s]=e;return t().createElement("div",{key:n,className:"flex items-center"},t().createElement("div",{className:"w-4 h-4 rounded-full mr-2 flex items-center justify-center ".concat(i[n]?"bg-green-500":"bg-gray-300")},i[n]&&t().createElement("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},t().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))),t().createElement("span",{className:"text-sm ".concat(i[n]?"text-green-600":"text-gray-600")},s))})))),t().createElement("button",{type:"submit",disabled:!c,className:"w-full py-3 px-4 rounded-lg font-semibold transition-colors ".concat(c?"bg-blue-600 text-white hover:bg-blue-700":"bg-gray-300 text-gray-500 cursor-not-allowed")},"Create PIN")),o&&t().createElement("p",{className:"text-center text-sm text-gray-500 mt-4"},"Securing account for: ",t().createElement("span",{className:"font-medium"},o)))}function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function R(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const A=[{id:"basic",name:"Basic Info",description:"Essential profile information and account details",icon:"👤",required:!1},{id:"personality",name:"Personality",description:"Personality traits, behavioral patterns and insights",icon:"🧠",required:!1},{id:"preferences",name:"Preferences",description:"User preferences, settings and choices",icon:"⚙️",required:!1}];function U(n){let{onComplete:s,userEmail:o,appName:a="App",autoFetch:r=!1,testMode:i=!1}=n;const[l,c]=(0,e.useState)({basic:!1,personality:!1,preferences:!1}),[m,d]=(0,e.useState)(!1),[u,p]=(0,e.useState)(!1),[h,g]=(0,e.useState)(null),[b,y]=(0,e.useState)(null),f=e=>{c((t=>L(L({},t),{},{[e]:!t[e]})))},x=async()=>{p(!0),y(null);try{const e=(e=>{let t=0;const n=e+Date.now().toString();for(let e=0;e<n.length;e++)t=(t<<5)-t+n.charCodeAt(e),t&=t;return"user_".concat(Math.abs(t).toString(36))})(o),t=Object.entries(l).filter((e=>{let[t,n]=e;return n})).map((e=>{let[t]=e;return t})),n=i?"https://api2.onairos.uk/inferenceTest":"https://api2.onairos.uk/inference",s={userHash:e,appName:a,approvedData:t,apiUrl:n,testMode:i,timestamp:(new Date).toISOString()};if(!r)return L(L({},s),{},{success:!0,message:"Data request approved. Use the provided API URL to fetch user data."});try{const e=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approvedData:t,userEmail:o,appName:a,testMode:i,timestamp:(new Date).toISOString()})});if(!e.ok)throw new Error("API call failed with status: ".concat(e.status));const r=await e.json();let l=r;return i&&r&&(l={InferenceResult:{output:r.croppedInference||r.output||r.inference,traits:r.traitResult||r.traits||r.personalityData}}),g(l),L(L({},s),{},{apiResponse:l,success:!0})}catch(e){return y(e.message),L(L({},s),{},{apiError:e.message,success:!1})}}catch(e){return y("Failed to process request: ".concat(e.message)),null}finally{p(!1)}},C=Object.values(l).filter(Boolean).length;return t().createElement("div",{className:"w-full max-w-md mx-auto bg-white rounded-lg shadow-xl overflow-hidden",style:{maxHeight:"90vh",height:"auto"}},t().createElement("div",{className:"p-4 sm:p-6 overflow-y-auto",style:{maxHeight:"calc(90vh - 4rem)"}},t().createElement("div",{className:"text-center mb-4 sm:mb-6"},t().createElement("h2",{className:"text-lg sm:text-xl font-bold text-gray-900 mb-2"},"Data Request"),t().createElement("p",{className:"text-gray-600 text-xs sm:text-sm"},"Select the data types you'd like to share with ",t().createElement("span",{className:"font-medium"},a))),t().createElement("div",{className:"mb-4 sm:mb-6 p-2 sm:p-3 bg-blue-50 border border-blue-200 rounded-lg"},t().createElement("p",{className:"text-blue-800 text-xs sm:text-sm"},"🔒 Your selected data will be securely processed and used only for the intended purpose.")),t().createElement("div",{className:"space-y-2 sm:space-y-3 mb-4 sm:mb-6"},A.map((e=>{const n=l[e.id]||!1,s=e.required;return t().createElement("div",{key:e.id,className:"flex items-center justify-between p-3 sm:p-4 border rounded-lg transition-colors ".concat(s?"bg-blue-50 border-blue-200":"hover:bg-gray-50 cursor-pointer"),onClick:()=>{return t=e.id,void f(t);var t}},t().createElement("div",{className:"flex items-center space-x-3"},t().createElement("div",{className:"text-xl sm:text-2xl"},e.icon),t().createElement("div",null,t().createElement("h3",{className:"font-medium text-gray-900 text-sm sm:text-base"},e.name,s&&t().createElement("span",{className:"text-blue-600 ml-1"},"*")),t().createElement("p",{className:"text-xs sm:text-sm text-gray-500"},e.description))),s?t().createElement("div",{className:"px-2 py-1 bg-blue-600 text-white text-xs rounded-full"},"Required"):t().createElement("button",{onClick:t=>{t.stopPropagation(),f(e.id)},className:"relative inline-flex h-5 sm:h-6 w-9 sm:w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ".concat(n?"bg-blue-600":"bg-gray-200")},t().createElement("span",{className:"inline-block h-3 sm:h-4 w-3 sm:w-4 transform rounded-full bg-white transition-transform ".concat(n?"translate-x-5 sm:translate-x-6":"translate-x-1")})))}))),t().createElement("div",{className:"mb-3 sm:mb-4 p-2 sm:p-3 bg-green-50 border border-green-200 rounded-lg"},t().createElement("p",{className:"text-green-800 text-xs sm:text-sm"},"✅ ",C," data type",C>1?"s":""," selected for sharing")),u&&t().createElement("div",{className:"mb-3 sm:mb-4 p-2 sm:p-3 bg-blue-50 border border-blue-200 rounded-lg"},t().createElement("p",{className:"text-blue-800 text-xs sm:text-sm"},"🔄 Processing your data request...")),b&&t().createElement("div",{className:"mb-3 sm:mb-4 p-2 sm:p-3 bg-red-50 border border-red-200 rounded-lg"},t().createElement("p",{className:"text-red-800 text-xs sm:text-sm"},"❌ ",b)),t().createElement("form",{onSubmit:async e=>{e.preventDefault(),d(!0);try{const e=await x();e&&s(e)}catch(e){y("Submission failed: ".concat(e.message))}finally{d(!1)}},className:"space-y-3"},t().createElement("button",{type:"submit",disabled:m||0===C,className:"w-full py-2 sm:py-3 px-4 rounded-lg font-semibold transition-colors text-sm sm:text-base ".concat(C>0&&!m?"bg-blue-600 text-white hover:bg-blue-700":"bg-gray-300 text-gray-500 cursor-not-allowed")},m?"Processing...":"Share ".concat(C," data type").concat(C>1?"s":"")),t().createElement("button",{type:"button",onClick:()=>s({selectedData:{},cancelled:!0}),className:"w-full py-2 text-gray-500 hover:text-gray-700 text-xs sm:text-sm"},"Cancel"))))}function M(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?M(Object(n),!0).forEach((function(t){G(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function G(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function q(n){let{requestData:s,webpageName:o,inferenceData:a=null,onComplete:r=null,autoFetch:i=!1,testMode:l=!1,proofMode:c=!1,textLayout:m="below",textColor:d="white",login:u=!1,buttonType:h="pill",loginReturn:g=null,loginType:b="signIn",visualType:y="full",appIcon:f=null}=n;const[x,C]=(0,e.useState)(!1),[E,v]=(0,e.useState)("email"),[w,N]=(0,e.useState)(null),[S,O]=(0,e.useState)(null);(0,e.useEffect)((()=>{(()=>{const e=localStorage.getItem("onairosUser");if(e)try{const t=JSON.parse(e);N(t),t.onboardingComplete&&t.pinCreated?v("dataRequest"):t.verified&&!t.onboardingComplete?v("onboarding"):t.onboardingComplete&&!t.pinCreated&&v("pin")}catch(e){console.error("Error parsing saved user data:",e),localStorage.removeItem("onairosUser")}})()}),[]);const k=()=>{C(!1),O(null)},j=e=>{console.log("Email auth successful:",e);const t=W(W({},e),{},{verified:!0,onboardingComplete:!1,pinCreated:!1});N(t),localStorage.setItem("onairosUser",JSON.stringify(t)),v("onboarding")},P=e=>{console.log("Onboarding completed:",e);const t=W(W({},w),{},{onboardingComplete:!0,connectedAccounts:e.connectedAccounts||[]});N(t),localStorage.setItem("onairosUser",JSON.stringify(t)),v("pin")},T=e=>{console.log("PIN setup completed:",e);const t=W(W(W({},w),e),{},{pinCreated:!0});N(t),localStorage.setItem("onairosUser",JSON.stringify(t)),v("dataRequest")},L=e=>{console.log("🔥 OnairosButton: Data request completed:",e);const t=W(W({},w),{},{lastDataRequest:e});if(N(t),localStorage.setItem("onairosUser",JSON.stringify(t)),C(!1),console.log("🔥 Calling onComplete callback with:",e),r)try{r(e),console.log("🔥 onComplete callback executed successfully")}catch(e){console.error("🔥 Error in onComplete callback:",e)}else console.log("🔥 No onComplete callback provided")},R="flex items-center justify-center font-bold rounded cursor-pointer ".concat("pill"===h?"px-4 py-2":"w-12 h-12"," bg-transparent OnairosConnect"),A={flexDirection:"below"===m?"column":"row",backgroundColor:"transparent",color:d,border:"1px solid transparent"},M={width:"20px",height:"20px",marginRight:"full"===y?"12px":"0"};return t().createElement(t().Fragment,null,t().createElement("button",{className:R,onClick:async()=>{try{console.log("🔥 openTerminal called"),C(!0)}catch(e){console.error("Error in openTerminal:",e)}},style:A},("full"===y||"icon"===y)&&t().createElement("img",{src:u?"https://onairos.sirv.com/Images/OnairosWhite.png":"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos Logo",style:M}),"icon"!==y&&t().createElement("span",{className:"".concat("black"===d?"text-black":"text-white"," ").concat("icon"===y?"sr-only":""," ").concat("right"===m?"ml-2":"left"===m?"mr-2":"")},(()=>{switch(b){case"signUp":return"Sign Up with Onairos";case"signOut":return"Sign Out of Onairos";default:return"Sign In with Onairos"}})())),x&&t().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",onClick:e=>{e.target===e.currentTarget&&k()}},t().createElement("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 max-h-[90vh] overflow-hidden relative",onClick:e=>e.stopPropagation()},t().createElement("button",{onClick:k,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 z-10"},t().createElement("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},t().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))),t().createElement("div",{className:"overflow-y-auto max-h-[90vh]"},(()=>{switch(E){case"email":return t().createElement(p,{onSuccess:j,testMode:l});case"onboarding":return t().createElement(I,{onComplete:P,appIcon:f||"https://onairos.sirv.com/Images/OnairosBlack.png",appName:o,username:(null==w?void 0:w.email)||(null==w?void 0:w.username)});case"pin":return t().createElement(D,{onComplete:T,userEmail:null==w?void 0:w.email});case"dataRequest":return t().createElement(U,{onComplete:L,userEmail:null==w?void 0:w.email,requestData:s,appName:o,autoFetch:i,testMode:l,appIcon:f});default:return t().createElement("div",{className:"flex flex-col items-center space-y-4 p-6"},t().createElement("div",{className:"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent"}),t().createElement("p",{className:"text-gray-600"},"Loading..."))}})()))))}function B(e){return t().createElement(t().Fragment,null,t().createElement(q,e))}const J=B})(),o})()));
2
2
  //# sourceMappingURL=onairos.bundle.js.map