onairos 3.1.21 โ 3.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/241.js +1 -1
- package/dist/241.js.map +1 -1
- package/dist/991.js +1 -1
- package/dist/991.js.map +1 -1
- package/dist/onairos.bundle.js +1 -1
- package/dist/onairos.bundle.js.map +1 -1
- package/dist/onairos.esm.js +1 -1
- package/dist/onairos.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/241.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(this.webpackChunkOnairosLaravel=this.webpackChunkOnairosLaravel||[]).push([[241,540],{241:(e,t,n)=>{n.d(t,{OnairosButton:()=>ee});var r=n(540);function o(e){let{onContinue:t,onClose:n}=e;return r.createElement("div",{className:"w-full flex flex-col",style:{height:"100%"}},r.createElement("div",{className:"px-6 text-center flex-1 flex flex-col justify-center"},r.createElement("div",{className:"mb-8 flex justify-center"},r.createElement("div",{className:"w-16 h-16 bg-gray-100 rounded-2xl flex items-center justify-center"},r.createElement("div",{className:"w-8 h-8 relative"},r.createElement("svg",{viewBox:"0 0 32 32",className:"w-full h-full"},r.createElement("path",{d:"M4 12c0-2.2 1.8-4 4-4h16c2.2 0 4 1.8 4 4v8c0 2.2-1.8 4-4 4h-4l-2-3h-4l-2 3H8c-2.2 0-4-1.8-4-4v-8z",fill:"none",stroke:"currentColor",strokeWidth:"2"}),r.createElement("circle",{cx:"10",cy:"16",r:"2",fill:"currentColor"}),r.createElement("circle",{cx:"22",cy:"16",r:"2",fill:"currentColor"}),r.createElement("path",{d:"M12 24c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",stroke:"currentColor",strokeWidth:"2",fill:"none"}))))),r.createElement("p",{className:"text-gray-500 text-sm mb-2"},"Welcome to"),r.createElement("h1",{className:"text-4xl font-bold text-gray-900 mb-6 text-balance"},"Onairos"),r.createElement("p",{className:"text-gray-600 text-base leading-relaxed mb-12 text-pretty px-2"},"OnairOS personalizes your digital experience on every app so you can just enjoy being you!")),r.createElement("div",{className:"px-6 pb-8 flex-shrink-0"},r.createElement("button",{className:"w-full bg-gray-900 hover:bg-gray-800 text-white rounded-full py-4 text-base font-medium flex items-center justify-center gap-2 transition-colors",onClick:t},"Get Started",r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})))))}const a=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)},l=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),s=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 c=(0,r.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:a="",children:c,iconNode:u,...m},d)=>(0,r.createElement)("svg",{ref:d,...i,width:t,height:t,stroke:e,strokeWidth:o?24*Number(n)/Number(t):n,className:l("lucide",a),...!c&&!s(m)&&{"aria-hidden":"true"},...m},[...u.map(([e,t])=>(0,r.createElement)(e,t)),...Array.isArray(c)?c:[c]])),u=((e,t)=>{const n=(0,r.forwardRef)(({className:n,...o},s)=>{return(0,r.createElement)(c,{ref:s,iconNode:t,className:l(`lucide-${i=a(e),i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,n),...o});var i});return n.displayName=a(e),n})("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),m={btnGradStart:"#1A1A1A",btnGradEnd:"#000000",btnLabel:"#FFFFFF",btnBorder:"rgba(0, 0, 0, 0.2)",iconCircleGradientStart:"#333333",iconCircleGradientEnd:"#1A1A1A",background:"#FFFFFF",backgroundSecondary:"#F8F9FA",textPrimary:"#1A1A1A",textSecondary:"#6B7280",textMuted:"#9CA3AF",border:"#E5E7EB",borderLight:"#F3F4F6",success:"#10B981",error:"#EF4444",warning:"#F59E0B",info:"#3B82F6",hover:"rgba(0, 0, 0, 0.05)",pressed:"rgba(0, 0, 0, 0.1)",focus:"rgba(59, 130, 246, 0.1)"},d=["label","onClick","iconRight","loading","disabled","testId","className","style","textStyle","centered"];function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p.apply(null,arguments)}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(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 r=n.call(e,t||"default");if("object"!=typeof r)return r;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 h=e=>{let{size:t=40,children:n,className:o=""}=e;return r.createElement("div",{className:"relative flex items-center justify-center border border-black border-opacity-25 ".concat(o),style:{width:t,height:t,borderRadius:t/2,background:"linear-gradient(to bottom, ".concat(m.iconCircleGradientStart,", ").concat(m.iconCircleGradientEnd,")")}},n||r.createElement("span",{className:"font-semibold opacity-95",style:{fontSize:"20px",color:m.btnLabel,backgroundColor:"transparent"}},"โ"))},b=e=>{let{label:t="Get Started",onClick:n,iconRight:o,loading:a=!1,disabled:l=!1,testId:s,className:i="",style:c={},textStyle:u={},centered:f=!1}=e,y=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,d);const[b,v]=(0,r.useState)(!1),x=g({height:"48px",borderRadius:"100px",border:"1px solid ".concat(m.btnBorder),background:"linear-gradient(to bottom, ".concat(m.btnGradStart,", ").concat(m.btnGradEnd,")"),position:"relative",overflow:"hidden",width:f?"auto":"100%",minWidth:f?"250px":"auto",maxWidth:f?"350px":"none",margin:f?"0 auto":"0",cursor:l?"not-allowed":"pointer",opacity:l?.65:1,boxShadow:l?"none":"20px 30px 40px rgba(0,0,0,0.10)",transition:"all 0.2s ease"},c),w={position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,0.1)",borderRadius:"100px",opacity:b?1:0,transition:"opacity 0.1s ease"},E=g({fontFamily:"Inter, system-ui, sans-serif",fontWeight:"600",fontSize:"16px",color:m.btnLabel,textAlign:"center",backgroundColor:"transparent"},u);return r.createElement("button",p({className:"relative ".concat(i),style:x,onClick:n,onMouseDown:()=>v(!0),onMouseUp:()=>v(!1),onMouseLeave:()=>v(!1),disabled:l||a,"data-testid":s,"aria-label":t},y),r.createElement("div",{style:w}),r.createElement("div",{style:{position:"absolute",left:0,right:0,top:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"transparent"}},a?r.createElement("div",{className:"animate-spin rounded-full border-2 border-white border-t-transparent",style:{width:"20px",height:"20px"}}):r.createElement("span",{style:E},t)),r.createElement("div",{style:{position:"absolute",right:"4px",top:"4px",bottom:"4px",width:"40px",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"transparent"}},!a&&(o||r.createElement(h,null))))};function v(e){let{onSuccess:t,testMode:n=!0}=e;const[o,a]=(0,r.useState)(""),[l,s]=(0,r.useState)(""),[i,c]=(0,r.useState)("email"),[d,p]=(0,r.useState)(!1),[f,g]=(0,r.useState)("");(0,r.useEffect)(()=>{"code"===i&&setTimeout(()=>{const e=document.querySelector('input[maxLength="1"]');e&&e.focus()},100)},[i]);const y=async e=>{if(e.preventDefault(),g(""),(e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))(o)){p(!0);try{if(n)console.log("๐งช Test mode: Simulating email verification request for:",o),setTimeout(()=>{c("code"),p(!1),console.log("๐งช Test mode: Email verification simulated successfully")},800);else{const e=window.onairosApiKey||"test-key",t=await fetch("https://api2.onairos.uk/email/verification",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)},body:JSON.stringify({email:o,action:"request"})});if(!t.ok)throw new Error("Failed to send verification code");const n=await t.json();if(!n.success)throw new Error(n.error||"Failed to send verification code");console.log("๐ง Email request response:",n),c("code"),p(!1)}}catch(e){console.error("Email request error:",e),g(e.message),p(!1)}}else g("Please enter a valid email address")},h=async()=>{try{var e;const n={baseUrl:"https://api2.onairos.uk",apiKey:window.onairosApiKey||"test-key",enableHealthMonitoring:!0,enableAutoRefresh:!0,enableConnectionValidation:!0},r=localStorage.getItem("username")||(null===(e=localStorage.getItem("onairosUser"))||void 0===e?void 0:e.email)||"user@example.com",o="".concat(n.baseUrl,"/gmail/authorize"),a=new URLSearchParams({username:r,sdk_type:"web",return_url:window.location.origin+"/oauth-callback.html"}),l="".concat(o,"?").concat(a.toString());console.log("๐ Starting Google OAuth from email flow..."),console.log("๐ Google OAuth URL:",l);const s=window.open(l,"google_oauth","width=500,height=600,scrollbars=yes,resizable=yes");if(!s)throw new Error("Popup blocked. Please allow popups for this site.");const i=setInterval(()=>{s.closed&&(clearInterval(i),console.log("โ
Google OAuth popup closed"),t({email:"user@gmail.com",method:"google",connectedAccounts:{Google:!0}}))},1e3)}catch(e){console.error("โ Google OAuth failed:",e),g("Google authentication failed. Please try again.")}},v=async e=>{e.preventDefault(),g(""),p(!0);try{if(n)console.log("๐งช Test mode: Simulating code verification for:",o,"with code:",l),"123456"===l||6===l.length?(c("success"),setTimeout(()=>{const e={email:o,verified:!0,token:"test-token-"+Date.now(),userName:o.split("@")[0],existingUser:!1,accountInfo:null,isNewUser:!0,flowType:"onboarding",adminMode:!1,userCreated:!0,accountDetails:{email:o,createdAt:(new Date).toISOString(),testAccount:!0}};console.log("๐งช Test mode: Simulated verification successful, user data:",e),t(e)},600)):(g("Invalid code. Use any 6-digit code (e.g., 123456) for testing."),p(!1));else{const e=window.onairosApiKey||"test-key",n=await fetch("https://api2.onairos.uk/email/verification",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)},body:JSON.stringify({email:o,action:"verify",code:l})});if(!n.ok)throw new Error("Invalid verification code");const r=await n.json();if(!r.success)throw new Error(r.error||"Verification failed");console.log("๐ง Email verification response:",r),c("success"),setTimeout(()=>{t({email:o,verified:!0,token:r.token||r.jwtToken,userName:r.userName,existingUser:r.existingUser,accountInfo:r.accountInfo,isNewUser:!r.existingUser,flowType:r.existingUser?"dataRequest":"onboarding",adminMode:r.adminMode,userCreated:r.userCreated,accountDetails:r.accountDetails})},1e3)}}catch(e){console.error("Email verification error:",e),g(e.message||"Invalid code. Please try again."),p(!1)}};return r.createElement("div",{className:"w-full"},"email"===i&&r.createElement("div",{className:"w-full flex flex-col",style:{height:"100%"}},r.createElement("div",{className:"px-12 pt-16 pb-8 text-center flex-1 flex flex-col"},r.createElement("div",{className:"mb-8"},r.createElement("h1",{className:"text-2xl font-bold text-gray-900 mb-2 text-balance leading-tight"},"Use pre-existing Persona or create a new one in seconds"),r.createElement("p",{className:"text-gray-600 text-base"},"Sign in or create an account")),r.createElement("div",{className:"mb-6"},r.createElement("input",{type:"email",value:o,onChange:e=>a(e.target.value),placeholder:"Enter your email",className:"w-full max-w-sm mx-auto px-4 py-4 text-base bg-gray-50 border-0 rounded-xl placeholder:text-gray-400 focus:bg-white focus:ring-2 focus:ring-gray-200 outline-none transition-all duration-200",style:{fontFamily:"Inter, system-ui, sans-serif"},required:!0})),r.createElement("div",{className:"mb-6 text-center"},r.createElement("span",{className:"text-gray-500 text-sm"},"Or")),r.createElement("div",{className:"mb-8"},r.createElement("button",{type:"button",className:"w-full max-w-sm mx-auto py-4 text-base font-medium rounded-xl border border-gray-200 hover:bg-gray-50 flex items-center justify-center gap-3 bg-transparent transition-colors",style:{fontFamily:"Inter, system-ui, sans-serif"},onClick:h},r.createElement("svg",{className:"w-5 h-5",viewBox:"0 0 24 24"},r.createElement("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),r.createElement("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),r.createElement("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),r.createElement("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})),"Continue with Google")),f&&r.createElement("div",{className:"mb-6"},r.createElement("p",{className:"text-sm text-center",style:{color:m.error}},f))),r.createElement("div",{className:"px-12 pb-8 flex-shrink-0"},r.createElement("button",{className:"w-full max-w-sm mx-auto bg-gray-900 hover:bg-gray-800 text-white rounded-full py-4 text-base font-medium flex items-center justify-center gap-2 transition-colors disabled:opacity-50",onClick:y,disabled:d||!o.trim(),style:{fontFamily:"Inter, system-ui, sans-serif"}},d?"Loading...":"Continue",r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}))))),"code"===i&&r.createElement("div",{className:"w-full flex flex-col",style:{height:"100%"}},r.createElement("div",{className:"w-full pt-16 px-12 mb-10 text-center"},r.createElement("h1",{className:"font-bold mb-2",style:{fontFamily:"IBM Plex Sans, system-ui, sans-serif",fontWeight:"700",fontSize:"24px",lineHeight:"32px",color:m.textPrimary}},"Enter verification code"),r.createElement("p",{className:"mb-2",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"400",fontSize:"16px",lineHeight:"24px",color:m.textSecondary}},"We've sent a 6-digit code to ",o)),r.createElement("div",{className:"px-12 mb-6"},r.createElement("div",{className:"flex justify-center space-x-3"},Array.from({length:6},(e,t)=>r.createElement("input",{key:t,type:"text",maxLength:"1",value:l[t]||"",onChange:e=>{const n=l.split("");if(n[t]=e.target.value,s(n.join("")),e.target.value&&t<5){var r;const n=null===(r=e.target.parentElement)||void 0===r?void 0:r.children[t+1];n&&n.focus()}},onKeyDown:e=>{if("Backspace"===e.key&&!l[t]&&t>0){var n;const r=null===(n=e.target.parentElement)||void 0===n?void 0:n.children[t-1];r&&r.focus()}},className:"w-12 h-12 border rounded-lg text-center text-lg font-medium focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",style:{borderColor:m.border,backgroundColor:m.background,fontFamily:"Inter, system-ui, sans-serif"}})))),f&&r.createElement("div",{className:"px-12 mb-6"},r.createElement("p",{className:"text-sm text-center",style:{color:m.error}},f)),r.createElement("div",{className:"px-12 mb-6"},r.createElement("div",{className:"max-w-sm mx-auto"},r.createElement(b,{label:"Continue",onClick:v,loading:d,disabled:d||6!==l.length,testId:"verify-code-button"}))),r.createElement("div",{style:{flex:1,minHeight:"20px"}}),r.createElement("div",{className:"px-12 w-full"},r.createElement("div",{className:"max-w-sm mx-auto"},r.createElement("button",{type:"button",onClick:()=>c("email"),className:"w-full py-2 px-4 font-medium transition-colors text-sm",style:{color:m.textSecondary}},"Use a different email")))),"success"===i&&r.createElement("div",{className:"w-full flex flex-col items-center space-y-6 pt-16 px-12"},r.createElement("div",{className:"flex items-center justify-center w-16 h-16 rounded-full",style:{backgroundColor:"#D1FAE5"}},r.createElement(u,{className:"w-8 h-8",style:{color:m.success}})),r.createElement("div",{className:"text-center space-y-2"},r.createElement("h2",{className:"text-xl font-semibold",style:{color:m.textPrimary}},"Email verified!"),r.createElement("p",{style:{color:m.textSecondary}},"Setting up your account...")),r.createElement("div",{className:"w-8 h-8"},r.createElement("div",{className:"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent"}))))}function x(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?x(Object(n),!0).forEach(function(t){E(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function E(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 r=n.call(e,t||"default");if("object"!=typeof r)return r;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 k={1:"https://anushkasirv.sirv.com/persona1.png",2:"https://anushkasirv.sirv.com/persona2.png",3:"https://anushkasirv.sirv.com/persona3.png",4:"https://anushkasirv.sirv.com/persona4.png",5:"https://anushkasirv.sirv.com/persona5.png"},N=[{name:"Gmail",icon:r.createElement("svg",{className:"w-6 h-6",viewBox:"0 0 24 24"},r.createElement("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),r.createElement("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),r.createElement("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),r.createElement("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})),color:"bg-white",connector:"gmail",description:"We use your emails and search patterns to better understand your interests and communication style."},{name:"Google",icon:r.createElement("svg",{className:"w-6 h-6",viewBox:"0 0 24 24"},r.createElement("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),r.createElement("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),r.createElement("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),r.createElement("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})),color:"bg-white",connector:"google",description:"We use your search, YouTube, and location signals to better understand your interests and routines."},{name:"Reddit",icon:r.createElement("svg",{className:"w-6 h-6",viewBox:"0 0 24 24",fill:"#FF4500"},r.createElement("path",{d:"M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 1 1.108-.701zM9.25 12C8.561 12 8 12.562 8 13.25c0 .687.561 1.248 1.25 1.248.687 0 1.248-.561 1.248-1.249 0-.688-.561-1.249-1.249-1.249zm5.5 0c-.687 0-1.248.561-1.248 1.25 0 .687.561 1.248 1.249 1.248.688 0 1.249-.561 1.249-1.249 0-.687-.562-1.249-1.25-1.249zm-5.466 3.99a.327.327 0 0 0-.231.094.33.33 0 0 0 0 .463c.842.842 2.484.913 2.961.913.477 0 2.105-.056 2.961-.913a.361.361 0 0 0 .029-.463.33.33 0 0 0-.464 0c-.547.533-1.684.73-2.512.73-.828 0-1.979-.196-2.512-.73a.326.326 0 0 0-.232-.095z"})),color:"bg-white",connector:"reddit",description:"We use your posts and interactions to better understand your interests and preferences."},{name:"Instagram",icon:r.createElement("svg",{className:"w-6 h-6",viewBox:"0 0 24 24"},r.createElement("defs",null,r.createElement("radialGradient",{id:"instagram-gradient",cx:"0.5",cy:"1",r:"1"},r.createElement("stop",{offset:"0%",stopColor:"#FD5949"}),r.createElement("stop",{offset:"50%",stopColor:"#D6249F"}),r.createElement("stop",{offset:"100%",stopColor:"#285AEB"}))),r.createElement("path",{fill:"url(#instagram-gradient)",d:"M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.073-1.689-.073-4.849 0-3.204.013-3.583.072-4.948.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z"})),color:"bg-white",connector:"instagram",description:"We use your photos and interactions to better understand your visual preferences and lifestyle."},{name:"LinkedIn",icon:r.createElement("svg",{className:"w-6 h-6",viewBox:"0 0 24 24",fill:"#0077B5"},r.createElement("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})),color:"bg-white",connector:"linkedin",description:"We use your professional network and content to better understand your career interests."},{name:"Pinterest",icon:r.createElement("svg",{className:"w-6 h-6",viewBox:"0 0 24 24",fill:"#E60023"},r.createElement("path",{d:"M12 0C5.373 0 0 5.372 0 12s5.373 12 12 12c6.628 0 12-5.372 12-12S18.628 0 12 0zm0 19c-.721 0-1.418-.109-2.073-.312.286-.465.713-1.227.87-1.835l.437-1.664c.229.436.895.8 1.604.8 2.111 0 3.633-1.941 3.633-4.354 0-2.312-1.895-4.049-4.218-4.049-2.972 0-4.684 1.946-4.684 4.338 0 1.083.424 2.42 1.218 2.847.131.07.201.04.232-.107.023-.106.151-.602.2-.784.067-.25.041-.336-.145-.553-.408-.474-.615-1.088-.615-1.72 0-1.658 1.222-3.259 3.297-3.259 1.798 0 3.064 1.244 3.064 3.018 0 2.019-.864 3.423-2.024 3.423-.633 0-1.106-.537-.954-1.196.181-.788.532-1.637.532-2.204 0-.508-.267-.932-.822-.932-.652 0-1.176.685-1.176 1.602 0 .584.197.98.197.98l-.790 3.396C6.595 16.85 6.017 14.47 6.017 12c0-3.313 2.687-6 6-6s6 2.687 6 6-2.687 6-6 6z"})),color:"bg-white",connector:"pinterest",description:"We use your pins and boards to better understand your creative interests and style preferences."}],C={apiKey:process.env.REACT_APP_ONAIROS_API_KEY||"onairos_web_sdk_live_key_2024",baseUrl:process.env.REACT_APP_ONAIROS_BASE_URL||"https://api2.onairos.uk",sdkType:"web",enableHealthMonitoring:!0,enableAutoRefresh:!0,enableConnectionValidation:!0};function S(e){let{onComplete:t,onBack:n,appIcon:o,appName:a="App",personaImages:l,priorityPlatform:s=null,testMode:i=!1}=e;const c=null!=l?l:k,[u,m]=(0,r.useState)({}),[d,p]=(0,r.useState)(!1),[f,g]=(0,r.useState)(null),[y,h]=(0,r.useState)({}),[b,v]=(0,r.useState)({}),[x,E]=(0,r.useState)(0);(0,r.useEffect)(()=>{(()=>{const e=localStorage.getItem("onairos_oauth_platform");e&&(console.log("๐ฑ OAuth return detected for: ".concat(e)),localStorage.removeItem("onairos_oauth_platform"),localStorage.removeItem("onairos_oauth_return"),m(t=>w(w({},t),{},{[e]:!0})),h(t=>w(w({},t),{},{[e]:null})),console.log("โ
".concat(e," marked as connected from OAuth return")))})()},[]);const S=async e=>{console.log("๐ connectToPlatform called for: ".concat(e));const t=N.find(t=>t.name===e);if(null==t||!t.connector)return console.error("โ No connector found for platform: ".concat(e)),!1;try{var n;p(!0),g(e),h(t=>w(w({},t),{},{[e]:null})),console.log("๐ Starting OAuth connection for ".concat(e,"..."));const r=localStorage.getItem("username")||(null===(n=localStorage.getItem("onairosUser"))||void 0===n?void 0:n.email)||"user@example.com",o="".concat(C.baseUrl,"/").concat(t.connector,"/authorize"),a=await fetch(o,{method:"POST",headers:{"x-api-key":C.apiKey,"Content-Type":"application/json"},body:JSON.stringify({session:{username:r}})});if(!a.ok)throw new Error("HTTP ".concat(a.status,": ").concat(a.statusText));const l=await a.json();console.log("๐ ".concat(e," OAuth response:"),l);const s={youtube:["youtubeURL","youtubeUrl","youtube_url"],linkedin:["linkedinURL","linkedinUrl","linkedin_url"],reddit:["redditURL","redditUrl","reddit_url"],pinterest:["pinterestURL","pinterestUrl","pinterest_url"],instagram:["instagramURL","instagramUrl","instagram_url"],github:["githubURL","githubUrl","github_url"],facebook:["facebookURL","facebookUrl","facebook_url"],gmail:["gmailURL","gmailUrl","gmail_url"]}[t.connector]||["".concat(t.connector,"URL"),"".concat(t.connector,"Url"),"".concat(t.connector,"_url"),"platformURL","authUrl","url"];let i=null,c=null;for(const e of s)if(l[e]){i=l[e],c=e;break}if(!i)throw console.error("โ No OAuth URL found for ".concat(e,":")),console.error("Expected one of:",s),console.error("Response keys:",Object.keys(l)),console.error("Full response:",l),new Error("No OAuth URL found. Backend should return one of: ".concat(s.join(", ")));if(console.log("โ
Found OAuth URL for ".concat(e," using key: ").concat(c)),/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768)return localStorage.setItem("onairos_oauth_platform",e),localStorage.setItem("onairos_oauth_return",window.location.href),window.location.href=i,!0;{const n=window.open(i,"".concat(t.connector,"_oauth"),"width=500,height=600,scrollbars=yes,resizable=yes,status=no,location=no,toolbar=no,menubar=no");if(!n)throw new Error("Popup blocked. Please allow popups and try again.");let r=!1;const o=setInterval(()=>{try{if(n.location&&"onairos.uk"===n.location.hostname)return r=!0,console.log("๐ ".concat(e," popup navigated to onairos.uk - treating as success")),void n.close()}catch(t){r||(r=!0,console.log("๐ ".concat(e," popup navigated (cross-origin) - likely to onairos.uk")))}try{if(n.closed){clearInterval(o);const t=localStorage.getItem("onairos_".concat(e,"_success")),n=localStorage.getItem("onairos_".concat(e,"_error")),a=localStorage.getItem("onairos_".concat(e,"_timestamp")),l=a&&Date.now()-parseInt(a)<3e4;t&&l?(console.log("โ
".concat(e," OAuth completed successfully (callback page)")),localStorage.removeItem("onairos_".concat(e,"_success")),localStorage.removeItem("onairos_".concat(e,"_timestamp")),m(t=>w(w({},t),{},{[e]:!0})),h(t=>w(w({},t),{},{[e]:null}))):n&&l?(console.log("โ ".concat(e," OAuth failed:"),n),localStorage.removeItem("onairos_".concat(e,"_error")),localStorage.removeItem("onairos_".concat(e,"_timestamp")),h(t=>w(w({},t),{},{[e]:n}))):r?(console.log("โ
".concat(e," OAuth likely successful (navigated to onairos.uk)")),m(t=>w(w({},t),{},{[e]:!0})),h(t=>w(w({},t),{},{[e]:null}))):(console.log("โ ๏ธ ".concat(e," OAuth cancelled or no response")),h(t=>w(w({},t),{},{[e]:"Connection was cancelled"}))),p(!1),g(null)}}catch(e){}},1e3);return setTimeout(()=>{try{!n.closed&&n.location&&"onairos.uk"===n.location.hostname&&(console.log("๐ช Auto-closing ".concat(e," popup showing onairos.uk (not found)")),n.close())}catch(t){!n.closed&&r&&(console.log("๐ช Auto-closing ".concat(e," popup (cross-origin, likely onairos.uk)")),n.close())}},1e4),setTimeout(()=>{n.closed||(n.close(),clearInterval(o),h(t=>w(w({},t),{},{[e]:"Connection timeout"})),p(!1),g(null))},3e5),!0}}catch(t){return console.error("โ Error connecting to ".concat(e,":"),t),h(n=>w(w({},n),{},{[e]:t.message})),p(!1),g(null),!1}},O=async e=>{if(console.log("๐ฅ TOGGLE CLICKED: ".concat(e)),d&&f!==e)return void console.log("โ ๏ธ Already connecting to ".concat(f,", ignoring click on ").concat(e));u[e]?(console.log("๐ Disconnecting from ".concat(e,"...")),m(t=>w(w({},t),{},{[e]:!1})),h(t=>w(w({},t),{},{[e]:null}))):await S(e)},j=Object.values(u).filter(Boolean).length,P=Math.min(j+1,5);(()=>{if(!s)return N;const e=N.find(e=>e.name.toLowerCase()===s.toLowerCase()||e.connector.toLowerCase()===s.toLowerCase());if(!e)return N;const t=N.filter(t=>t!==e)})();return r.createElement("div",{className:"w-full h-full flex flex-col",style:{height:"90vh",minHeight:0}},r.createElement("div",{className:"px-6 pt-16 flex-1 flex flex-col",style:{minHeight:0,overflow:"hidden"}},r.createElement("div",{className:"mb-6 flex-shrink-0"},r.createElement("h1",{className:"text-2xl font-bold text-gray-900 mb-2 text-balance leading-tight"},"Connect app data"),r.createElement("p",{className:"text-gray-600 text-base"},"More connections, better personalization.")),r.createElement("div",{className:"mb-2 flex justify-center flex-shrink-0"},r.createElement("div",{className:"w-56 h-56 overflow-hidden"},r.createElement("img",{src:c[P],alt:"Persona ".concat(P),width:"256",height:"256",className:"w-full h-full object-cover",onLoad:()=>console.log("โ
Persona image loaded successfully!"),onError:e=>{console.log("โ Persona image failed to load:",c[P]),console.log("Connected count:",j),console.log("Persona number:",P),console.log("All persona URLs:",c),console.log("Current location:",window.location.href),console.log("Trying to load from:",c[P]),e.target.style.display="none",e.target.parentElement.style.background="linear-gradient(135deg, #f97316 0%, #ec4899 50%, #8b5cf6 100%)"}}))),r.createElement("div",{className:"flex-1 overflow-y-auto mt-4",style:{minHeight:0}},r.createElement("div",{className:"space-y-4 pb-4"},N.map(e=>{const t=u[e.name]||!1,n=f===e.name,o=y[e.name],a=d&&!n;(e=>{!!s&&(e.name.toLowerCase()===s.toLowerCase()||(e.connector.toLowerCase(),s.toLowerCase()))})(e);return r.createElement("div",{key:e.name,className:"flex items-start gap-4 p-4 rounded-xl hover:bg-gray-50 transition-colors",style:{backgroundColor:"#ffffff",border:"none",outline:"none",gap:"clamp(6px, 1.5vw, 10px)",padding:"clamp(6px, 1.5vw, 10px)",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",marginBottom:"clamp(3px, 0.8vw, 6px)"},onClick:()=>!a&&O(e.name)},r.createElement("div",{className:"bg-gray-50 rounded-full flex items-center justify-center flex-shrink-0 border-2 border-gray-200",style:{width:"clamp(28px, 6vw, 36px)",height:"clamp(28px, 6vw, 36px)"}},n?r.createElement("div",{className:"animate-spin h-5 w-5 border-2 border-gray-400 rounded-full border-t-transparent"}):e.icon),r.createElement("div",{className:"flex-1 min-w-0 pr-4"},r.createElement("h3",{className:"font-semibold",style:{color:"#111827",fontSize:"clamp(12px, 2.8vw, 15px)",marginBottom:"clamp(1px, 0.3vw, 3px)",lineHeight:"1.2"}},e.name),r.createElement("p",{className:"leading-tight",style:{color:"#6B7280",fontSize:"clamp(10px, 2.2vw, 12px)",lineHeight:"1.3"}},e.description),o&&r.createElement("p",{className:"text-xs text-red-600 mt-1"},o)),r.createElement("div",{className:"flex-shrink-0"},r.createElement("div",{onClick:t=>{t.stopPropagation(),a||O(e.name)},className:"relative inline-flex items-center rounded-full transition-all duration-300 ease-in-out cursor-pointer ".concat(t?"bg-blue-500":"bg-gray-300"," ").concat(a?"opacity-50 cursor-not-allowed":"cursor-pointer"),style:{height:"clamp(20px, 4vw, 26px)",width:"clamp(40px, 8vw, 52px)",boxShadow:t?"0 2px 4px rgba(59, 130, 246, 0.3)":"0 1px 2px rgba(0, 0, 0, 0.1)"}},r.createElement("span",{className:"inline-block rounded-full bg-white transition-all duration-300 ease-in-out shadow-lg ".concat(t?"translate-x-6":"translate-x-0.5"),style:{height:"clamp(16px, 3.5vw, 20px)",width:"clamp(16px, 3.5vw, 20px)"}}))))})))),r.createElement("div",{className:"flex-shrink-0",style:{padding:"clamp(8px, 2vw, 16px) clamp(16px, 4vw, 24px)",minHeight:"auto",display:"flex",flexDirection:"column",gap:"clamp(6px, 1.5vw, 10px)"}},r.createElement("div",{className:"w-full bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-semibold flex items-center justify-center gap-2 cursor-pointer transition-all duration-200 shadow-lg hover:shadow-xl",style:{padding:"clamp(10px, 2.5vw, 14px)",fontSize:"clamp(13px, 3.2vw, 16px)",minHeight:"clamp(36px, 7vw, 44px)"},onClick:()=>{const e=Object.entries(u).filter(e=>{let[t,n]=e;return n}).map(e=>{let[t]=e;return t});t({connectedAccounts:e,totalConnections:e.length,healthScore:x,connectionHealth:b,sdkVersion:"2.1.7",enhancedFeatures:{healthMonitoring:C.enableHealthMonitoring,autoRefresh:C.enableAutoRefresh,connectionValidation:C.enableConnectionValidation}})}},"Update",r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}))),j>0&&r.createElement("div",{onClick:()=>t({connectedAccounts:[],totalConnections:0}),className:"w-full text-gray-500 font-medium text-center cursor-pointer hover:text-gray-700 transition-colors",style:{padding:"clamp(6px, 1.5vw, 10px)",fontSize:"clamp(12px, 3vw, 15px)",minHeight:"clamp(28px, 5vw, 36px)"}},"Skip")))}function O(e){let{onComplete:t,onBack:n,userEmail:o}=e;const[a,l]=(0,r.useState)(""),[s,i]=(0,r.useState)({length:!1,uppercase:!1,number:!1});(0,r.useEffect)(()=>{i({length:a.length>=6,uppercase:/[A-Z]/.test(a),number:/\d/.test(a)})},[a]);const c=s.length&&s.uppercase&&s.number;return r.createElement("div",{className:"w-full h-full flex flex-col",style:{height:"100%",minHeight:0}},r.createElement("div",{className:"px-6 pt-16 flex-1 flex flex-col",style:{minHeight:0,overflow:"hidden"}},r.createElement("div",{className:"mb-6 flex-shrink-0"},r.createElement("h1",{className:"text-2xl font-bold text-gray-900 mb-2"},"Create a PIN"),r.createElement("p",{className:"text-gray-600 text-base"},"A PIN so only you have the access to your data")),r.createElement("div",{className:"mb-6 flex-shrink-0"},r.createElement("input",{type:"password",value:a,onChange:e=>l(e.target.value),className:"w-full px-4 py-4 border-2 border-gray-300 rounded-xl text-center text-lg font-medium focus:border-gray-900 focus:outline-none bg-gray-50",placeholder:"Enter your PIN",maxLength:20})),r.createElement("div",{className:"flex-1 overflow-y-auto",style:{minHeight:0}},r.createElement("div",{className:"space-y-3 pb-4"},r.createElement("p",{className:"text-gray-900 font-medium mb-4"},"Your PIN must:"),r.createElement("div",{className:"space-y-3"},r.createElement("div",{className:"flex items-center gap-3"},r.createElement("div",{className:"w-5 h-5 rounded-full border-2 ".concat(s.length?"border-green-500 bg-green-500":"border-gray-300 bg-white")},s.length&&r.createElement("svg",{className:"w-3 h-3 text-white m-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))),r.createElement("span",{className:"text-gray-700"},"Be at least 6 characters in length.")),r.createElement("div",{className:"flex items-center gap-3"},r.createElement("div",{className:"w-5 h-5 rounded-full border-2 ".concat(s.uppercase?"border-green-500 bg-green-500":"border-gray-300 bg-white")},s.uppercase&&r.createElement("svg",{className:"w-3 h-3 text-white m-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))),r.createElement("span",{className:"text-gray-700"},"Contain an uppercase letter.")),r.createElement("div",{className:"flex items-center gap-3"},r.createElement("div",{className:"w-5 h-5 rounded-full border-2 ".concat(s.number?"border-green-500 bg-green-500":"border-gray-300 bg-white")},s.number&&r.createElement("svg",{className:"w-3 h-3 text-white m-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))),r.createElement("span",{className:"text-gray-700"},"Contain a number.")))))),r.createElement("div",{className:"px-6 pb-6 pt-4 flex-shrink-0 space-y-3",style:{minHeight:"auto"}},r.createElement("div",{className:"w-full rounded-full py-4 text-base font-medium flex items-center justify-center gap-2 transition-colors ".concat(c?"bg-gray-900 hover:bg-gray-800 text-white cursor-pointer":"bg-gray-300 text-gray-500 cursor-not-allowed"),onClick:c?()=>{c&&t({pin:a,pinCreated:!0,timestamp:(new Date).toISOString()})}:void 0},"Continue",r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})))))}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach(function(t){I(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function I(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 r=n.call(e,t||"default");if("object"!=typeof r)return r;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 A(){return A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(null,arguments)}const R=[{id:"basic",name:"Basic Profile",description:"Essential profile information, account details, and basic demographics",icon:"User",required:!0,tooltip:"Includes name, email, basic profile information. This data is essential for personalization and is always included.",privacyLink:"https://onairos.uk/privacy#basic-info"},{id:"preferences",name:"User Preferences",description:"User preferences, interests, settings and personal choices",icon:"Grid3X3",required:!1,tooltip:"Your stated preferences and interests from connected platforms. Helps customize your experience.",privacyLink:"https://onairos.uk/privacy#preferences-data"},{id:"personality",name:"Personality Traits",description:"Personality traits, behavioral patterns and psychological insights",icon:"Brain",required:!1,tooltip:"AI-analyzed personality traits based on your social media activity and interactions. Used to improve content recommendations.",privacyLink:"https://onairos.uk/privacy#personality-data"}],L=e=>{let{dataType:t,isEnabled:n,onToggle:o,isLast:a}=e;return r.createElement("div",{className:"flex items-center justify-between p-4 rounded-xl bg-gray-50"},r.createElement("div",{className:"flex items-center gap-4"},r.createElement("div",{className:"w-10 h-10 bg-gray-200 rounded-full flex items-center justify-center"},(e=>{const t={className:"w-5 h-5 text-gray-600"};switch(e){case"User":return r.createElement("svg",A({},t,{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"}),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"}));case"Grid3X3":return r.createElement("svg",A({},t,{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"}),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"}));case"Brain":return r.createElement("svg",A({},t,{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"}),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"}));default:return r.createElement("span",{className:"text-xl"},e)}})(t.icon)),r.createElement("span",{className:"font-medium text-gray-900"},t.name)),r.createElement("div",{onClick:()=>{t.required||o(t.id,!n)},className:"w-6 h-6 rounded border-2 flex items-center justify-center cursor-pointer transition-colors ".concat(n?"bg-gray-900 border-gray-900":"bg-white border-gray-300")},n&&r.createElement("svg",{className:"w-4 h-4 text-white",fill:"currentColor",viewBox:"0 0 20 20"},r.createElement("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"}))))},_=e=>{let{userEmail:t="user@example.com",testMode:n=!0,onComplete:o,autoFetch:a=!0,appName:l="Test App",formatResponse:s=!1,responseFormat:i="simple"}=e;const[c,u]=(0,r.useState)({basic:!0,personality:!1,preferences:!1}),[m,d]=(0,r.useState)(!1),[p,f]=(0,r.useState)(null),g=(e,t)=>{const n=R.find(t=>t.id===e);null!=n&&n.required||u(n=>P(P({},n),{},{[e]:t}))},y=Object.values(c).filter(Boolean).length;return r.createElement("div",{className:"w-full h-full flex flex-col"},r.createElement("div",{className:"px-6 pt-16 flex-1 flex flex-col min-h-0 pb-4"},r.createElement("div",{className:"mb-6 flex justify-center items-center gap-4 flex-shrink-0"},r.createElement("div",{className:"w-16 h-16 bg-white rounded-2xl shadow-lg flex items-center justify-center border border-gray-100"},r.createElement("svg",{className:"w-8 h-8",viewBox:"0 0 24 24",fill:"none"},r.createElement("path",{d:"M12 2C13.1 2 14 2.9 14 4C14 5.1 13.1 6 12 6C10.9 6 10 5.1 10 4C10 2.9 10.9 2 12 2Z",fill:"black"}),r.createElement("path",{d:"M21 9V7L15 6.5V9C15 10.66 13.66 12 12 12C10.34 12 9 10.66 9 9V6.5L3 7V9C3 12.87 6.13 16 10 16V22H14V16C17.87 16 21 12.87 21 9Z",fill:"black"}))),r.createElement("svg",{className:"w-5 h-5 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})),r.createElement("div",{className:"w-16 h-16 bg-white rounded-2xl shadow-lg flex items-center justify-center border border-gray-100"},r.createElement("span",{className:"text-2xl font-serif font-bold text-black"},"E"))),r.createElement("div",{className:"mb-6 flex-shrink-0"},r.createElement("h1",{className:"text-2xl font-bold text-gray-900 mb-2 text-balance leading-tight"},"Enoch wants to personalize your experience"),r.createElement("p",{className:"text-gray-600 text-base"},"Choose what to share:")),r.createElement("div",{className:"flex-1 overflow-y-auto"},r.createElement("div",{className:"space-y-4 pb-6"},R.map((e,t)=>r.createElement(L,{key:e.id,dataType:e,isEnabled:c[e.id],onToggle:g,isLast:t===R.length-1}))))),r.createElement("div",{className:"px-6 pb-8 pt-4 flex-shrink-0 space-y-3"},r.createElement("div",{className:"w-full bg-gray-900 hover:bg-gray-800 text-white rounded-full py-4 text-base font-medium flex items-center justify-center gap-2 cursor-pointer transition-colors",onClick:async()=>{console.log("๐ฅ DataRequest: fetchUserData called"),console.log("๐ฅ DataRequest: onComplete function:",typeof o),console.log("๐ฅ DataRequest: selectedData:",c),console.log("๐ฅ DataRequest: selectedCount:",y),d(!0),f(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))})(t),r=Object.entries(c).filter(e=>{let[t,n]=e;return n}).map(e=>{let[t]=e;return t}),s=e=>{const t=[],n=(new Date).toISOString(),r={basic:"Medium",personality:"Large",preferences:"Traits"};return e.forEach(e=>{r[e]&&t.push({data:r[e],date:n})}),t},i=n?"https://api2.onairos.uk/inferenceTest":"https://api2.onairos.uk/getAPIurlMobile",u={userHash:e,appName:l,approvedData:r,apiUrl:i,testMode:n,timestamp:(new Date).toISOString()};if(a)if(n)console.log("๐งช Test mode: Simulating data request API call for:",r),setTimeout(()=>{const e={success:!0,message:"Data request simulated successfully",data:{personalityScores:{openness:.75,conscientiousness:.68,extraversion:.82,agreeableness:.71,neuroticism:.43},insights:["You show high creativity and openness to new experiences","Strong social tendencies with good interpersonal skills","Well-organized approach to tasks and goals"],dataProcessed:r,timestamp:(new Date).toISOString(),testMode:!0}},t=P(P({},u),{},{apiResponse:e,success:!0,simulated:!0});d(!1),console.log("๐งช Test mode: Simulated data request completed:",t),console.log("๐ฅ DataRequest: onComplete function type:",typeof o),o&&"function"==typeof o?(o(t),console.log("๐ฅ DataRequest: onComplete called successfully (test mode)")):console.error("๐ฅ DataRequest: onComplete is not a function or is undefined (test mode)")},1200);else try{const e=s(r),n={approvedData:r,userEmail:t,appName:l,confirmations:e};console.log("๐ฅ DataRequest: Making API call to:",i),console.log("๐ฅ Request body:",n);const a=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error("API request failed with status ".concat(a.status));const c=await a.json();console.log("๐ฅ API Response:",c);const m=P(P({},u),{},{apiResponse:c,success:!0});d(!1),console.log("๐ฅ DataRequest: Calling onComplete with result:",m),console.log("๐ฅ DataRequest: onComplete function type:",typeof o),o&&"function"==typeof o?(o(m),console.log("๐ฅ DataRequest: onComplete called successfully")):console.error("๐ฅ DataRequest: onComplete is not a function or is undefined")}catch(e){console.error("๐ฅ API Error:",e),f(e.message),d(!1);const t=P(P({},u),{},{apiResponse:null,error:e.message,success:!1});o(t)}else d(!1),console.log("๐ฅ DataRequest: Auto-fetch disabled, calling onComplete with base result"),console.log("๐ฅ DataRequest: onComplete function type:",typeof o),o&&"function"==typeof o?(o(u),console.log("๐ฅ DataRequest: onComplete called successfully (auto-fetch disabled)")):console.error("๐ฅ DataRequest: onComplete is not a function or is undefined (auto-fetch disabled)")}catch(e){console.error("๐ฅ DataRequest Error:",e),f(e.message),d(!1),o&&o({error:e.message,success:!1,userEmail:t,appName:l,testMode:n})}},disabled:m||0===y},m?"Processing...":"Accept & Continue",r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}))),r.createElement("div",{onClick:()=>o({cancelled:!0}),className:"w-full bg-gray-200 hover:bg-gray-300 text-gray-700 rounded-full py-4 text-base font-medium text-center cursor-pointer transition-colors"},"Decline"),p&&r.createElement("div",{className:"mt-4 p-3 rounded-lg text-center bg-red-50 border border-red-200 text-red-600"},r.createElement("p",{className:"text-sm"},p))))};function D(e){var t,n,o,a,l;let{onComplete:s,userEmail:i,appName:c="App",testMode:u=!0}=e;const[d,p]=(0,r.useState)(0),[f,g]=(0,r.useState)(0),[y,h]=(0,r.useState)(!1),b=[{title:"Setting up your personal AI",description:"Initializing your secure data model",icon:"๐ค",duration:u?800:2e3},{title:"Processing your connections",description:"Analyzing your social media patterns",icon:"๐",duration:u?600:2500},{title:"Training your model",description:"Building your personalized insights",icon:"๐ง ",duration:u?700:3e3},{title:"Finalizing setup",description:"Preparing your Onairos experience",icon:"โจ",duration:u?500:2e3}];return(0,r.useEffect)(()=>{let e,t;if(d<b.length){const n=b[d].duration,r=100/b.length;e=setInterval(()=>{g(e=>{const t=e+r/(n/100);return Math.min(t,(d+1)*r)})},100),t=setTimeout(()=>{if(d<b.length-1)p(e=>e+1);else{h(!0);const e=u?400:1e3;u&&console.log("๐งช Test mode: Training simulation completed"),setTimeout(()=>{s({trainingComplete:!0,timestamp:(new Date).toISOString(),userEmail:i,appName:c,testMode:u,simulatedTraining:u})},e)}},n)}return()=>{e&&clearInterval(e),t&&clearTimeout(t)}},[d,s,i,c]),r.createElement("div",{className:"w-full flex flex-col items-center space-y-8"},r.createElement("div",{className:"text-center"},r.createElement("div",{className:"w-20 h-20 rounded-full flex items-center justify-center mx-auto mb-4",style:{background:"linear-gradient(135deg, ".concat(m.info,", #8B5CF6)")}},r.createElement("div",{className:"text-3xl"},y?"๐":null===(t=b[d])||void 0===t?void 0:t.icon)),r.createElement("h2",{className:"text-2xl font-bold mb-2",style:{color:m.textPrimary}},y?"All set!":null===(n=b[d])||void 0===n?void 0:n.title),r.createElement("p",{style:{color:m.textSecondary}},y?"Your personal AI is ready to use":null===(o=b[d])||void 0===o?void 0:o.description)),r.createElement("div",{className:"w-full"},r.createElement("div",{className:"flex justify-between text-sm mb-2",style:{color:m.textSecondary}},r.createElement("span",null,"Progress"),r.createElement("span",null,Math.round(f),"%")),r.createElement("div",{className:"w-full rounded-full h-2",style:{backgroundColor:m.borderLight}},r.createElement("div",{className:"h-2 rounded-full transition-all duration-300 ease-out",style:{width:"".concat(f,"%"),background:"linear-gradient(90deg, ".concat(m.info,", #8B5CF6)")}}))),r.createElement("div",{className:"flex justify-center space-x-2"},b.map((e,t)=>r.createElement("div",{key:t,className:"w-3 h-3 rounded-full transition-all duration-300",style:{backgroundColor:t<=d?m.info:m.border}}))),r.createElement("div",{className:"p-4 rounded-lg w-full",style:{backgroundColor:m.backgroundSecondary}},r.createElement("div",{className:"flex items-center space-x-3"},r.createElement("div",{className:"w-8 h-8 rounded-full flex items-center justify-center",style:{backgroundColor:"#DBEAFE"}},r.createElement("div",{className:"text-sm"},y?"โ
":null===(a=b[d])||void 0===a?void 0:a.icon)),r.createElement("div",null,r.createElement("h3",{className:"font-medium",style:{color:m.textPrimary}},y?"Training Complete":"Step ".concat(d+1," of ").concat(b.length)),r.createElement("p",{className:"text-sm",style:{color:m.textSecondary}},y?"Your Onairos experience is ready":null===(l=b[d])||void 0===l?void 0:l.description)))),r.createElement("div",{className:"text-center"},r.createElement("p",{className:"text-sm",style:{color:m.textSecondary}},"Setting up for ",r.createElement("span",{className:"font-medium"},c)),i&&r.createElement("p",{className:"text-xs mt-1",style:{color:m.textMuted}},i)))}function M(e){let{onComplete:t}=e;const[n,o]=(0,r.useState)(0),[a,l]=(0,r.useState)(0),s=[{message:"Validating PIN and continuing training",progress:20},{message:"Uploading model to secure storage",progress:40},{message:"Running test inference",progress:60},{message:"Storing results in databases",progress:80},{message:"Complete!",progress:100}];(0,r.useEffect)(()=>{const e=setInterval(()=>{o(e=>{const n=e+1;return n>=s.length?(setTimeout(()=>{t()},1e3),e):n})},3e3);return()=>clearInterval(e)},[s.length,t]),(0,r.useEffect)(()=>{const e=setInterval(()=>{l(e=>(e+1)%4)},500);return()=>clearInterval(e)},[]);const i=s[n];return r.createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center p-6"},r.createElement("div",{className:"bg-white rounded-3xl w-full max-w-lg mx-auto shadow-2xl overflow-hidden flex flex-col",style:{maxWidth:"500px",height:"90vh"}},r.createElement("div",{className:"px-6 pt-6 pb-4 flex-shrink-0"}),r.createElement("div",{className:"flex-1 flex flex-col justify-center items-center px-6"},r.createElement("div",{className:"text-center mb-12"},r.createElement("h1",{className:"font-bold text-gray-900 leading-tight",style:{fontSize:"clamp(16px, 4vw, 20px)",marginBottom:"clamp(24px, 6vw, 48px)"}},i.message,"Complete!"!==i.message&&r.createElement("span",{className:"inline-block w-8 text-left"},".".repeat(a))),r.createElement("div",{className:"mx-auto",style:{width:"clamp(200px, 50vw, 300px)"}},r.createElement("div",{className:"w-full h-2 bg-gray-200 rounded-full"},r.createElement("div",{className:"h-2 bg-gray-900 rounded-full transition-all duration-1000 ease-out",style:{width:"".concat(i.progress,"%")}}))))),r.createElement("div",{className:"h-20 flex-shrink-0"})))}function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(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 r=n.call(e,t||"default");if("object"!=typeof r)return r;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 T=["Analyst","Diplomat","Sentinel","Explorer","Architect","Logician","Commander","Debater","Advocate","Mediator","Protagonist","Campaigner","Logistician","Defender","Executive","Consul"],z=["Openness","Conscientiousness","Extraversion","Agreeableness","Neuroticism"];function F(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{includeDictionary:r=!0,includeArray:o=!0}=n;if(!e)return e;const a=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B(Object(n),!0).forEach(function(t){U(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},e);if(null!==(t=e.InferenceResult)&&void 0!==t&&t.traits||e.traits||e.scores){var l;const t=(null===(l=e.InferenceResult)||void 0===l?void 0:l.traits)||e.traits||e.scores;if(Array.isArray(t)&&t.length>=16){if(r){const e={};T.forEach((n,r)=>{e[n]=t[r]}),a.InferenceResult?a.InferenceResult.personalityDict=e:a.personalityDict=e}var s;if(!o)null!==(s=a.InferenceResult)&&void 0!==s&&s.traits&&delete a.InferenceResult.traits,a.traits&&delete a.traits,a.scores&&delete a.scores}}if(e.traitResult||e.traits){const t=e.traitResult||e.traits;if(Array.isArray(t)&&r){const e={};z.forEach((n,r)=>{void 0!==t[r]&&(e[n]=t[r])}),a.traitDict=e}}return a}const q=["children","title","subtitle","icon","showHeader","showCloseButton","onClose","onBack","showBackButton","className","contentClassName","centerContent","style"],W=["children","visible","onClose","onBackdropClick","backdropStyle","modalStyle"];function H(){return H=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},H.apply(null,arguments)}function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach(function(t){$(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function $(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 r=n.call(e,t||"default");if("object"!=typeof r)return r;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 Y(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}const J=e=>{let{children:t,title:n,subtitle:o,icon:a,showHeader:l=!0,showCloseButton:s=!1,onClose:i,onBack:c,showBackButton:u=!1,className:d="",contentClassName:p="",centerContent:f=!0,style:g={}}=e,y=Y(e,q);const h=G({backgroundColor:m.background,minHeight:"100%",width:"100%",display:"flex",flexDirection:"column"},g),b={position:"sticky",top:0,backgroundColor:m.background,zIndex:10,padding:"clamp(8px, 2vw, 16px) clamp(16px, 4vw, 32px) clamp(6px, 1.5vw, 12px)"},v=G({flex:1,padding:"clamp(16px, 4vw, 32px)",display:"flex",flexDirection:"column",overflow:"auto",minHeight:0},f&&{alignItems:"center",justifyContent:"flex-start"}),x={fontFamily:"Inter, system-ui, sans-serif",fontSize:"clamp(20px, 5vw, 28px)",fontWeight:"700",color:m.textPrimary,margin:"0 0 clamp(6px, 1.5vw, 12px) 0",textAlign:f?"center":"left",lineHeight:"1.2"},w={fontFamily:"Inter, system-ui, sans-serif",fontSize:"clamp(14px, 3.5vw, 18px)",fontWeight:"400",color:m.textSecondary,margin:"0 0 clamp(20px, 5vw, 40px) 0",textAlign:f?"center":"left",lineHeight:"1.5"};return r.createElement("div",H({className:"onairos-page-layout ".concat(d),style:h},y),l&&r.createElement("div",{style:b},r.createElement("div",{className:"flex items-center justify-between"},u&&c&&r.createElement("button",{onClick:c,className:"flex items-center justify-center w-8 h-8 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Go back"},r.createElement("span",{style:{fontSize:"16px",color:m.textPrimary}},"โ")),s&&i&&r.createElement("button",{onClick:i,className:"flex items-center justify-center w-8 h-8 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Close"},r.createElement("span",{style:{fontSize:"16px",color:m.textPrimary}},"ร")))),r.createElement("div",{className:"onairos-page-content ".concat(p),style:v},a&&r.createElement("div",{style:{width:"clamp(40px, 8vw, 56px)",height:"clamp(40px, 8vw, 56px)",margin:"0 auto clamp(16px, 4vw, 32px)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"clamp(20px, 5vw, 28px)"}},"string"==typeof a?r.createElement("span",null,a):a),n&&r.createElement("h1",{style:x},n),o&&r.createElement("p",{style:w},o),t))},K=e=>{let{children:t,visible:n=!0,onClose:o,onBackdropClick:a,backdropStyle:l={},modalStyle:s={}}=e,i=Y(e,W);if(!n)return null;const c=G({position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center"},l),u=G({backgroundColor:m.background,borderTopLeftRadius:"24px",borderTopRightRadius:"24px",borderBottomLeftRadius:"24px",borderBottomRightRadius:"24px",height:"90vh",width:"100%",maxWidth:"500px",boxShadow:"0 -10px 40px rgba(0, 0, 0, 0.3)",overflow:"hidden",display:"flex",flexDirection:"column"},s);return r.createElement("div",{style:c,onClick:e=>{e.target===e.currentTarget&&(a?a():o&&o())}},r.createElement("div",{style:u},r.createElement(J,H({showHeader:!0,showCloseButton:!0,onClose:o},i),t)))};function Z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function X(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(n),!0).forEach(function(t){Q(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Q(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 r=n.call(e,t||"default");if("object"!=typeof r)return r;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 ee(e){let{requestData:t,webpageName:n,inferenceData:a=null,onComplete:l=null,autoFetch:s=!0,testMode:i=!0,proofMode:c=!1,textLayout:u="below",textColor:m="white",login:d=!1,buttonType:p="pill",loginReturn:f=null,loginType:g="signIn",visualType:y="full",appIcon:h=null,enableTraining:b=!0,formatResponse:x=!0,responseFormat:w={includeDictionary:!0,includeArray:!0},priorityPlatform:E=null}=e;const[k,N]=(0,r.useState)(!1),[C,j]=(0,r.useState)("welcome"),[P,I]=(0,r.useState)(null),[A,R]=(0,r.useState)(null);(0,r.useEffect)(()=>{(()=>{if(i)return console.log("๐งช Test mode: Starting fresh flow, clearing any cached user data"),localStorage.removeItem("onairosUser"),void j("welcome");const e=localStorage.getItem("onairosUser");if(e)try{const t=JSON.parse(e);I(t),t.onboardingComplete&&t.pinCreated?j("dataRequest"):t.verified&&!t.onboardingComplete?j("onboarding"):t.onboardingComplete&&!t.pinCreated&&j("pin")}catch(e){console.error("Error parsing saved user data:",e),localStorage.removeItem("onairosUser")}})()},[i]);const L=()=>{N(!1),R(null)},B=()=>{console.log("๐ฅ Welcome screen continue clicked"),j("email")},U=e=>{console.log("๐ฅ Email auth successful:",e),console.log("๐ง User State:",{isNewUser:e.isNewUser,userState:e.userState,flowType:e.flowType,existingUser:e.existingUser,hasAccountInfo:!!e.accountInfo});const t=!0===e.isNewUser||!1===e.existingUser||"onboarding"===e.flowType||"new"===e.userState||!e.accountInfo;console.log("๐ Flow determination:",{finalDecision:t?"NEW USER โ onboarding (data connectors)":"EXISTING USER โ dataRequest (data permissions)",reasoning:{isNewUser:e.isNewUser,existingUserFalse:!1===e.existingUser,flowTypeOnboarding:"onboarding"===e.flowType,noAccountInfo:!e.accountInfo}});const n=X(X({},e),{},{verified:!0,onboardingComplete:!t,pinCreated:!t});I(n),localStorage.setItem("onairosUser",JSON.stringify(n)),t?(console.log("๐ NEW USER detected โ Starting onboarding flow (data connectors page)"),j("onboarding")):(console.log("๐ EXISTING USER detected โ Going directly to data request (data permissions page)"),j("dataRequest"))},T=e=>{console.log("Onboarding completed:",e);const t=X(X({},P),{},{onboardingComplete:!0,connectedAccounts:e.connectedAccounts||[]});I(t),localStorage.setItem("onairosUser",JSON.stringify(t)),j("pin")},z=e=>{console.log("PIN setup completed:",e);const t=X(X(X({},P),e),{},{pinCreated:!0});I(t),localStorage.setItem("onairosUser",JSON.stringify(t)),j("loading")},q=e=>{console.log("๐ Training completed:",e);const t=X(X({},P),{},{trainingCompleted:!0},e);I(t),localStorage.setItem("onairosUser",JSON.stringify(t)),j("dataRequest")},W=e=>{console.log("๐ฅ OnairosButton: Data request completed:",e);const t=X(X({},P),{},{lastDataRequest:e});I(t),localStorage.setItem("onairosUser",JSON.stringify(t)),console.log("๐ฅ Closing overlay after data request completion"),N(!1);let n=e;if(x&&null!=e&&e.apiResponse)try{var r;n=X(X({},e),{},{apiResponse:F(e.apiResponse,w)}),console.log("๐ฅ Response formatted with dictionary:",(null===(r=n.apiResponse)||void 0===r?void 0:r.personalityDict)||"No personality data")}catch(e){console.warn("๐ฅ Error formatting response:",e)}if(console.log("๐ฅ Calling onComplete callback with:",n),l)try{l(n),console.log("๐ฅ onComplete callback executed successfully")}catch(e){console.error("๐ฅ Error in onComplete callback:",e)}else console.log("๐ฅ No onComplete callback provided")},H="flex items-center justify-center font-bold rounded cursor-pointer ".concat("pill"===p?"px-4 py-2":"w-12 h-12"," bg-transparent OnairosConnect"),V={flexDirection:"below"===u?"column":"row",backgroundColor:"transparent",color:m,border:"1px solid transparent"},G={width:"20px",height:"20px",marginRight:"full"===y?"12px":"0"};return r.createElement(r.Fragment,null,r.createElement("button",{className:H,onClick:async()=>{try{console.log("๐ฅ openTerminal called"),N(!0)}catch(e){console.error("Error in openTerminal:",e)}},style:V},("full"===y||"icon"===y)&&r.createElement("img",{src:d?"https://onairos.sirv.com/Images/OnairosWhite.png":"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos Logo",style:G}),"icon"!==y&&r.createElement("span",{className:"".concat("black"===m?"text-black":"text-white"," ").concat("icon"===y?"sr-only":""," ").concat("right"===u?"ml-2":"left"===u?"mr-2":"")},(()=>{switch(g){case"signUp":return"Sign Up with Onairos";case"signOut":return"Sign Out of Onairos";default:return"Sign In with Onairos"}})())),k&&r.createElement(r.Fragment,null,"email"===C?r.createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center z-50 p-6"},r.createElement("div",{className:"bg-white rounded-3xl w-full max-w-lg mx-auto shadow-2xl overflow-hidden flex flex-col",style:{maxWidth:"500px",height:"90vh"}},r.createElement("div",{className:"relative px-6 pt-6 pb-4 flex-shrink-0"},r.createElement("button",{onClick:L,className:"absolute left-4 top-4 p-2 hover:bg-gray-100 rounded-full transition-colors"},r.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})))),r.createElement("div",{className:"h-[min(85vh,700px)]"},r.createElement(v,{onSuccess:U,testMode:i})))):"onboarding"===C?r.createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center z-50 p-6"},r.createElement("div",{className:"bg-white rounded-3xl w-full max-w-lg mx-auto shadow-2xl overflow-hidden flex flex-col",style:{maxWidth:"500px",height:"90vh"}},r.createElement("div",{className:"relative px-6 pt-6 pb-4 flex-shrink-0"},r.createElement("button",{onClick:()=>j("email"),className:"absolute left-4 top-4 p-2 hover:bg-gray-100 rounded-full transition-colors"},r.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})))),r.createElement(S,{onComplete:T,onBack:()=>j("email"),appIcon:h||"https://onairos.sirv.com/Images/OnairosBlack.png",appName:n,username:(null==P?void 0:P.email)||(null==P?void 0:P.username),testMode:i,priorityPlatform:E}))):"dataRequest"===C?r.createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center z-50 p-6"},r.createElement("div",{className:"bg-white rounded-3xl w-full max-w-lg mx-auto shadow-2xl overflow-hidden flex flex-col",style:{maxWidth:"500px",height:"90vh"}},r.createElement("div",{className:"relative px-6 pt-6 pb-4 flex-shrink-0"},r.createElement("button",{onClick:()=>j("loading"),className:"absolute left-4 top-4 p-2 hover:bg-gray-100 rounded-full transition-colors"},r.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})))),r.createElement(_,{onComplete:W,userEmail:null==P?void 0:P.email,requestData:t,appName:n,autoFetch:s,testMode:i,appIcon:h,connectedAccounts:(null==P?void 0:P.connectedAccounts)||{}}))):"pin"===C?r.createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center z-50 p-6"},r.createElement("div",{className:"bg-white rounded-3xl w-full max-w-lg mx-auto shadow-2xl overflow-hidden flex flex-col",style:{maxWidth:"500px",height:"90vh"}},r.createElement("div",{className:"relative px-6 pt-6 pb-4 flex-shrink-0"},r.createElement("button",{onClick:()=>j("onboarding"),className:"absolute left-4 top-4 p-2 hover:bg-gray-100 rounded-full transition-colors"},r.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})))),r.createElement("div",{className:"flex-1 min-h-0"},r.createElement(O,{onComplete:z,onBack:()=>j("onboarding"),userEmail:null==P?void 0:P.email})))):"loading"===C?r.createElement(M,{onComplete:()=>{j("dataRequest")}}):r.createElement(K,{visible:k,onClose:L,showBackButton:"training"===C,onBack:()=>{"email"===C&&j("welcome"),"onboarding"===C&&j("email"),"pin"===C&&j("onboarding"),"training"===C&&j("pin")},title:(()=>{switch(C){case"welcome":case"email":default:return"";case"onboarding":return"Connect Your Data";case"pin":return"Secure Your Account";case"training":return"Training Your Model";case"dataRequest":return"Data Request"}})(),subtitle:(()=>{switch(C){case"welcome":case"email":default:return"";case"onboarding":return"Choose which accounts to connect for a personalized experience";case"pin":return"Create a secure PIN to protect your data";case"training":return"Building your personalized insights";case"dataRequest":return"Select the data you want to share with ".concat(n)}})(),icon:(()=>{switch(C){case"welcome":case"email":default:return"";case"onboarding":return"๐";case"pin":return"๐";case"training":return"โก";case"dataRequest":return"๐"}})(),centerContent:!0},(()=>{switch(C){case"welcome":return r.createElement(o,{onContinue:B,onClose:L,webpageName:n,appIcon:h,testMode:i});case"email":return r.createElement("div",{className:"h-[min(85vh,700px)]"},r.createElement(v,{onSuccess:U,testMode:i}));case"onboarding":return r.createElement(S,{onComplete:T,onBack:()=>j("email"),appIcon:h||"https://onairos.sirv.com/Images/OnairosBlack.png",appName:n,username:(null==P?void 0:P.email)||(null==P?void 0:P.username),testMode:i,priorityPlatform:E});case"pin":return r.createElement(O,{onComplete:z,userEmail:null==P?void 0:P.email});case"training":return r.createElement(D,{onComplete:q,userEmail:null==P?void 0:P.email,appName:n,connectedAccounts:(null==P?void 0:P.connectedAccounts)||[],testMode:i});case"dataRequest":return r.createElement(_,{onComplete:W,userEmail:null==P?void 0:P.email,requestData:t,appName:n,autoFetch:s,testMode:i,appIcon:h,connectedAccounts:(null==P?void 0:P.connectedAccounts)||{}});default:return r.createElement("div",{className:"flex flex-col items-center space-y-4 p-6"},r.createElement("div",{className:"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent"}),r.createElement("p",{className:"text-gray-600"},"Loading..."))}})())))}},287:(e,t)=>{var n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.iterator;var f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,y={};function h(e,t,n){this.props=e,this.context=t,this.refs=y,this.updater=n||f}function b(){}function v(e,t,n){this.props=e,this.context=t,this.refs=y,this.updater=n||f}h.prototype.isReactComponent={},h.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},h.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=h.prototype;var x=v.prototype=new b;x.constructor=v,g(x,h.prototype),x.isPureReactComponent=!0;var w=Array.isArray,E=Object.prototype.hasOwnProperty,k={current:null},N={key:!0,ref:!0,__self:!0,__source:!0};function C(e,t,r){var o,a={},l=null,s=null;if(null!=t)for(o in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(l=""+t.key),t)E.call(t,o)&&!N.hasOwnProperty(o)&&(a[o]=t[o]);var i=arguments.length-2;if(1===i)a.children=r;else if(1<i){for(var c=Array(i),u=0;u<i;u++)c[u]=arguments[u+2];a.children=c}if(e&&e.defaultProps)for(o in i=e.defaultProps)void 0===a[o]&&(a[o]=i[o]);return{$$typeof:n,type:e,key:l,ref:s,props:a,_owner:k.current}}function S(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}var O=/\/+/g;function j(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function P(e,t,o,a,l){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var i=!1;if(null===e)i=!0;else switch(s){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case n:case r:i=!0}}if(i)return l=l(i=e),e=""===a?"."+j(i,0):a,w(l)?(o="",null!=e&&(o=e.replace(O,"$&/")+"/"),P(l,t,o,"",function(e){return e})):null!=l&&(S(l)&&(l=function(e,t){return{$$typeof:n,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(l,o+(!l.key||i&&i.key===l.key?"":(""+l.key).replace(O,"$&/")+"/")+e)),t.push(l)),1;if(i=0,a=""===a?".":a+":",w(e))for(var c=0;c<e.length;c++){var u=a+j(s=e[c],c);i+=P(s,t,o,u,l)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=p&&e[p]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),c=0;!(s=e.next()).done;)i+=P(s=s.value,t,o,u=a+j(s,c++),l);else if("object"===s)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return i}function I(e,t,n){if(null==e)return e;var r=[],o=0;return P(e,r,"","",function(e){return t.call(n,e,o++)}),r}function A(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var R={current:null},L={transition:null},_={ReactCurrentDispatcher:R,ReactCurrentBatchConfig:L,ReactCurrentOwner:k};function D(){throw Error("act(...) is not supported in production builds of React.")}t.Children={map:I,forEach:function(e,t,n){I(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return I(e,function(){t++}),t},toArray:function(e){return I(e,function(e){return e})||[]},only:function(e){if(!S(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=h,t.Fragment=o,t.Profiler=l,t.PureComponent=v,t.StrictMode=a,t.Suspense=u,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_,t.act=D,t.cloneElement=function(e,t,r){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o=g({},e.props),a=e.key,l=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(l=t.ref,s=k.current),void 0!==t.key&&(a=""+t.key),e.type&&e.type.defaultProps)var i=e.type.defaultProps;for(c in t)E.call(t,c)&&!N.hasOwnProperty(c)&&(o[c]=void 0===t[c]&&void 0!==i?i[c]:t[c])}var c=arguments.length-2;if(1===c)o.children=r;else if(1<c){i=Array(c);for(var u=0;u<c;u++)i[u]=arguments[u+2];o.children=i}return{$$typeof:n,type:e.type,key:a,ref:l,props:o,_owner:s}},t.createContext=function(e){return(e={$$typeof:i,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:s,_context:e},e.Consumer=e},t.createElement=C,t.createFactory=function(e){var t=C.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:c,render:e}},t.isValidElement=S,t.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:A}},t.memo=function(e,t){return{$$typeof:m,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=L.transition;L.transition={};try{e()}finally{L.transition=t}},t.unstable_act=D,t.useCallback=function(e,t){return R.current.useCallback(e,t)},t.useContext=function(e){return R.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return R.current.useDeferredValue(e)},t.useEffect=function(e,t){return R.current.useEffect(e,t)},t.useId=function(){return R.current.useId()},t.useImperativeHandle=function(e,t,n){return R.current.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return R.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return R.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return R.current.useMemo(e,t)},t.useReducer=function(e,t,n){return R.current.useReducer(e,t,n)},t.useRef=function(e){return R.current.useRef(e)},t.useState=function(e){return R.current.useState(e)},t.useSyncExternalStore=function(e,t,n){return R.current.useSyncExternalStore(e,t,n)},t.useTransition=function(){return R.current.useTransition()},t.version="18.3.1"},540:(e,t,n)=>{e.exports=n(287)}}]);
|
|
1
|
+
"use strict";(this.webpackChunkOnairosLaravel=this.webpackChunkOnairosLaravel||[]).push([[241,540],{241:(e,t,n)=>{n.d(t,{OnairosButton:()=>ee});var r=n(540);function o(e){let{onContinue:t,onClose:n}=e;return r.createElement("div",{className:"w-full flex flex-col",style:{height:"100%"}},r.createElement("div",{className:"px-6 text-center flex-1 flex flex-col justify-center"},r.createElement("div",{className:"mb-8 flex justify-center"},r.createElement("div",{className:"w-16 h-16 bg-gray-100 rounded-2xl flex items-center justify-center"},r.createElement("div",{className:"w-8 h-8 relative"},r.createElement("svg",{viewBox:"0 0 32 32",className:"w-full h-full"},r.createElement("path",{d:"M4 12c0-2.2 1.8-4 4-4h16c2.2 0 4 1.8 4 4v8c0 2.2-1.8 4-4 4h-4l-2-3h-4l-2 3H8c-2.2 0-4-1.8-4-4v-8z",fill:"none",stroke:"currentColor",strokeWidth:"2"}),r.createElement("circle",{cx:"10",cy:"16",r:"2",fill:"currentColor"}),r.createElement("circle",{cx:"22",cy:"16",r:"2",fill:"currentColor"}),r.createElement("path",{d:"M12 24c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",stroke:"currentColor",strokeWidth:"2",fill:"none"}))))),r.createElement("p",{className:"text-gray-500 text-sm mb-2"},"Welcome to"),r.createElement("h1",{className:"text-4xl font-bold text-gray-900 mb-6 text-balance"},"Onairos"),r.createElement("p",{className:"text-gray-600 text-base leading-relaxed mb-12 text-pretty px-2"},"OnairOS personalizes your digital experience on every app so you can just enjoy being you!")),r.createElement("div",{className:"px-6 pb-8 flex-shrink-0"},r.createElement("button",{className:"w-full bg-gray-900 hover:bg-gray-800 text-white rounded-full py-4 text-base font-medium flex items-center justify-center gap-2 transition-colors",onClick:t},"Get Started",r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})))))}const a=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)},l=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),s=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 c=(0,r.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:a="",children:c,iconNode:u,...m},d)=>(0,r.createElement)("svg",{ref:d,...i,width:t,height:t,stroke:e,strokeWidth:o?24*Number(n)/Number(t):n,className:l("lucide",a),...!c&&!s(m)&&{"aria-hidden":"true"},...m},[...u.map(([e,t])=>(0,r.createElement)(e,t)),...Array.isArray(c)?c:[c]])),u=((e,t)=>{const n=(0,r.forwardRef)(({className:n,...o},s)=>{return(0,r.createElement)(c,{ref:s,iconNode:t,className:l(`lucide-${i=a(e),i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,n),...o});var i});return n.displayName=a(e),n})("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),m={btnGradStart:"#1A1A1A",btnGradEnd:"#000000",btnLabel:"#FFFFFF",btnBorder:"rgba(0, 0, 0, 0.2)",iconCircleGradientStart:"#333333",iconCircleGradientEnd:"#1A1A1A",background:"#FFFFFF",backgroundSecondary:"#F8F9FA",textPrimary:"#1A1A1A",textSecondary:"#6B7280",textMuted:"#9CA3AF",border:"#E5E7EB",borderLight:"#F3F4F6",success:"#10B981",error:"#EF4444",warning:"#F59E0B",info:"#3B82F6",hover:"rgba(0, 0, 0, 0.05)",pressed:"rgba(0, 0, 0, 0.1)",focus:"rgba(59, 130, 246, 0.1)"},d=["label","onClick","iconRight","loading","disabled","testId","className","style","textStyle","centered"];function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p.apply(null,arguments)}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(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 r=n.call(e,t||"default");if("object"!=typeof r)return r;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 h=e=>{let{size:t=40,children:n,className:o=""}=e;return r.createElement("div",{className:"relative flex items-center justify-center border border-black border-opacity-25 ".concat(o),style:{width:t,height:t,borderRadius:t/2,background:"linear-gradient(to bottom, ".concat(m.iconCircleGradientStart,", ").concat(m.iconCircleGradientEnd,")")}},n||r.createElement("span",{className:"font-semibold opacity-95",style:{fontSize:"20px",color:m.btnLabel,backgroundColor:"transparent"}},"โ"))},b=e=>{let{label:t="Get Started",onClick:n,iconRight:o,loading:a=!1,disabled:l=!1,testId:s,className:i="",style:c={},textStyle:u={},centered:f=!1}=e,y=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,d);const[b,v]=(0,r.useState)(!1),x=g({height:"48px",borderRadius:"100px",border:"1px solid ".concat(m.btnBorder),background:"linear-gradient(to bottom, ".concat(m.btnGradStart,", ").concat(m.btnGradEnd,")"),position:"relative",overflow:"hidden",width:f?"auto":"100%",minWidth:f?"250px":"auto",maxWidth:f?"350px":"none",margin:f?"0 auto":"0",cursor:l?"not-allowed":"pointer",opacity:l?.65:1,boxShadow:l?"none":"20px 30px 40px rgba(0,0,0,0.10)",transition:"all 0.2s ease"},c),w={position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,0.1)",borderRadius:"100px",opacity:b?1:0,transition:"opacity 0.1s ease"},E=g({fontFamily:"Inter, system-ui, sans-serif",fontWeight:"600",fontSize:"16px",color:m.btnLabel,textAlign:"center",backgroundColor:"transparent"},u);return r.createElement("button",p({className:"relative ".concat(i),style:x,onClick:n,onMouseDown:()=>v(!0),onMouseUp:()=>v(!1),onMouseLeave:()=>v(!1),disabled:l||a,"data-testid":s,"aria-label":t},y),r.createElement("div",{style:w}),r.createElement("div",{style:{position:"absolute",left:0,right:0,top:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"transparent"}},a?r.createElement("div",{className:"animate-spin rounded-full border-2 border-white border-t-transparent",style:{width:"20px",height:"20px"}}):r.createElement("span",{style:E},t)),r.createElement("div",{style:{position:"absolute",right:"4px",top:"4px",bottom:"4px",width:"40px",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"transparent"}},!a&&(o||r.createElement(h,null))))};function v(e){let{onSuccess:t,testMode:n=!0}=e;const[o,a]=(0,r.useState)(""),[l,s]=(0,r.useState)(""),[i,c]=(0,r.useState)("email"),[d,p]=(0,r.useState)(!1),[f,g]=(0,r.useState)("");(0,r.useEffect)(()=>{"code"===i&&setTimeout(()=>{const e=document.querySelector('input[maxLength="1"]');e&&e.focus()},100)},[i]);const y=async e=>{if(e.preventDefault(),g(""),(e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))(o)){p(!0);try{if(n)console.log("๐งช Test mode: Simulating email verification request for:",o),setTimeout(()=>{c("code"),p(!1),console.log("๐งช Test mode: Email verification simulated successfully")},800);else{const e=window.onairosApiKey||"test-key",t=await fetch("https://api2.onairos.uk/email/verification",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)},body:JSON.stringify({email:o,action:"request"})});if(!t.ok)throw new Error("Failed to send verification code");const n=await t.json();if(!n.success)throw new Error(n.error||"Failed to send verification code");console.log("๐ง Email request response:",n),c("code"),p(!1)}}catch(e){console.error("Email request error:",e),g(e.message),p(!1)}}else g("Please enter a valid email address")},h=async()=>{try{var e;const n={baseUrl:"https://api2.onairos.uk",apiKey:window.onairosApiKey||"test-key",enableHealthMonitoring:!0,enableAutoRefresh:!0,enableConnectionValidation:!0},r=localStorage.getItem("username")||(null===(e=localStorage.getItem("onairosUser"))||void 0===e?void 0:e.email)||"user@example.com",o="".concat(n.baseUrl,"/gmail/authorize"),a=new URLSearchParams({username:r,sdk_type:"web",return_url:window.location.origin+"/oauth-callback.html"}),l="".concat(o,"?").concat(a.toString());console.log("๐ Starting Google OAuth from email flow..."),console.log("๐ Google OAuth URL:",l);const s=window.open(l,"google_oauth","width=500,height=600,scrollbars=yes,resizable=yes");if(!s)throw new Error("Popup blocked. Please allow popups for this site.");const i=setInterval(()=>{s.closed&&(clearInterval(i),console.log("โ
Google OAuth popup closed"),t({email:"user@gmail.com",method:"google",connectedAccounts:{Google:!0}}))},1e3)}catch(e){console.error("โ Google OAuth failed:",e),g("Google authentication failed. Please try again.")}},v=async e=>{e.preventDefault(),g(""),p(!0);try{if(n)console.log("๐งช Test mode: Simulating code verification for:",o,"with code:",l),"123456"===l||6===l.length?(c("success"),setTimeout(()=>{const e={email:o,verified:!0,token:"test-token-"+Date.now(),userName:o.split("@")[0],existingUser:!1,accountInfo:null,isNewUser:!0,flowType:"onboarding",adminMode:!1,userCreated:!0,accountDetails:{email:o,createdAt:(new Date).toISOString(),testAccount:!0}};console.log("๐งช Test mode: Simulated verification successful, user data:",e),t(e)},600)):(g("Invalid code. Use any 6-digit code (e.g., 123456) for testing."),p(!1));else{const e=window.onairosApiKey||"test-key",n=await fetch("https://api2.onairos.uk/email/verification",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)},body:JSON.stringify({email:o,action:"verify",code:l})});if(!n.ok)throw new Error("Invalid verification code");const r=await n.json();if(!r.success)throw new Error(r.error||"Verification failed");console.log("๐ง Email verification response:",r),c("success"),setTimeout(()=>{t({email:o,verified:!0,token:r.token||r.jwtToken,userName:r.userName,existingUser:r.existingUser,accountInfo:r.accountInfo,isNewUser:!r.existingUser,flowType:r.existingUser?"dataRequest":"onboarding",adminMode:r.adminMode,userCreated:r.userCreated,accountDetails:r.accountDetails})},1e3)}}catch(e){console.error("Email verification error:",e),g(e.message||"Invalid code. Please try again."),p(!1)}};return r.createElement("div",{className:"w-full"},"email"===i&&r.createElement("div",{className:"w-full flex flex-col",style:{height:"100%"}},r.createElement("div",{className:"px-12 pt-16 pb-8 text-center flex-1 flex flex-col"},r.createElement("div",{className:"mb-8"},r.createElement("h1",{className:"text-2xl font-bold text-gray-900 mb-2 text-balance leading-tight"},"Use pre-existing Persona or create a new one in seconds"),r.createElement("p",{className:"text-gray-600 text-base"},"Sign in or create an account")),r.createElement("div",{className:"mb-6"},r.createElement("input",{type:"email",value:o,onChange:e=>a(e.target.value),placeholder:"Enter your email",className:"w-full max-w-sm mx-auto px-4 py-4 text-base bg-gray-50 border-0 rounded-xl placeholder:text-gray-400 focus:bg-white focus:ring-2 focus:ring-gray-200 outline-none transition-all duration-200",style:{fontFamily:"Inter, system-ui, sans-serif"},required:!0})),r.createElement("div",{className:"mb-6 text-center"},r.createElement("span",{className:"text-gray-500 text-sm"},"Or")),r.createElement("div",{className:"mb-8"},r.createElement("button",{type:"button",className:"w-full max-w-sm mx-auto py-4 text-base font-medium rounded-xl border border-gray-200 hover:bg-gray-50 flex items-center justify-center gap-3 bg-transparent transition-colors",style:{fontFamily:"Inter, system-ui, sans-serif"},onClick:h},r.createElement("svg",{className:"w-5 h-5",viewBox:"0 0 24 24"},r.createElement("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),r.createElement("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),r.createElement("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),r.createElement("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})),"Continue with Google")),f&&r.createElement("div",{className:"mb-6"},r.createElement("p",{className:"text-sm text-center",style:{color:m.error}},f))),r.createElement("div",{className:"px-12 pb-8 flex-shrink-0"},r.createElement("button",{className:"w-full max-w-sm mx-auto bg-gray-900 hover:bg-gray-800 text-white rounded-full py-4 text-base font-medium flex items-center justify-center gap-2 transition-colors disabled:opacity-50",onClick:y,disabled:d||!o.trim(),style:{fontFamily:"Inter, system-ui, sans-serif"}},d?"Loading...":"Continue",r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}))))),"code"===i&&r.createElement("div",{className:"w-full flex flex-col",style:{height:"100%"}},r.createElement("div",{className:"w-full pt-16 px-12 mb-10 text-center"},r.createElement("h1",{className:"font-bold mb-2",style:{fontFamily:"IBM Plex Sans, system-ui, sans-serif",fontWeight:"700",fontSize:"24px",lineHeight:"32px",color:m.textPrimary}},"Enter verification code"),r.createElement("p",{className:"mb-2",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"400",fontSize:"16px",lineHeight:"24px",color:m.textSecondary}},"We've sent a 6-digit code to ",o)),r.createElement("div",{className:"px-12 mb-6"},r.createElement("div",{className:"flex justify-center space-x-3"},Array.from({length:6},(e,t)=>r.createElement("input",{key:t,type:"text",maxLength:"1",value:l[t]||"",onChange:e=>{const n=l.split("");if(n[t]=e.target.value,s(n.join("")),e.target.value&&t<5){var r;const n=null===(r=e.target.parentElement)||void 0===r?void 0:r.children[t+1];n&&n.focus()}},onKeyDown:e=>{if("Backspace"===e.key&&!l[t]&&t>0){var n;const r=null===(n=e.target.parentElement)||void 0===n?void 0:n.children[t-1];r&&r.focus()}},className:"w-12 h-12 border rounded-lg text-center text-lg font-medium focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none",style:{borderColor:m.border,backgroundColor:m.background,fontFamily:"Inter, system-ui, sans-serif"}})))),f&&r.createElement("div",{className:"px-12 mb-6"},r.createElement("p",{className:"text-sm text-center",style:{color:m.error}},f)),r.createElement("div",{className:"px-12 mb-6"},r.createElement("div",{className:"max-w-sm mx-auto"},r.createElement(b,{label:"Continue",onClick:v,loading:d,disabled:d||6!==l.length,testId:"verify-code-button"}))),r.createElement("div",{style:{flex:1,minHeight:"20px"}}),r.createElement("div",{className:"px-12 w-full"},r.createElement("div",{className:"max-w-sm mx-auto"},r.createElement("button",{type:"button",onClick:()=>c("email"),className:"w-full py-2 px-4 font-medium transition-colors text-sm",style:{color:m.textSecondary}},"Use a different email")))),"success"===i&&r.createElement("div",{className:"w-full flex flex-col items-center space-y-6 pt-16 px-12"},r.createElement("div",{className:"flex items-center justify-center w-16 h-16 rounded-full",style:{backgroundColor:"#D1FAE5"}},r.createElement(u,{className:"w-8 h-8",style:{color:m.success}})),r.createElement("div",{className:"text-center space-y-2"},r.createElement("h2",{className:"text-xl font-semibold",style:{color:m.textPrimary}},"Email verified!"),r.createElement("p",{style:{color:m.textSecondary}},"Setting up your account...")),r.createElement("div",{className:"w-8 h-8"},r.createElement("div",{className:"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent"}))))}function x(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?x(Object(n),!0).forEach(function(t){E(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function E(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 r=n.call(e,t||"default");if("object"!=typeof r)return r;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 k={1:"https://anushkasirv.sirv.com/persona1.png",2:"https://anushkasirv.sirv.com/persona2.png",3:"https://anushkasirv.sirv.com/persona3.png",4:"https://anushkasirv.sirv.com/persona4.png",5:"https://anushkasirv.sirv.com/persona5.png"},N=[{name:"Gmail",icon:r.createElement("svg",{className:"w-6 h-6",viewBox:"0 0 24 24"},r.createElement("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),r.createElement("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),r.createElement("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),r.createElement("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})),color:"bg-white",connector:"gmail",description:"We use your emails and search patterns to better understand your interests and communication style."},{name:"Google",icon:r.createElement("svg",{className:"w-6 h-6",viewBox:"0 0 24 24"},r.createElement("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),r.createElement("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),r.createElement("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),r.createElement("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})),color:"bg-white",connector:"google",description:"We use your search, YouTube, and location signals to better understand your interests and routines."},{name:"Reddit",icon:r.createElement("svg",{className:"w-6 h-6",viewBox:"0 0 24 24",fill:"#FF4500"},r.createElement("path",{d:"M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 1 1.108-.701zM9.25 12C8.561 12 8 12.562 8 13.25c0 .687.561 1.248 1.25 1.248.687 0 1.248-.561 1.248-1.249 0-.688-.561-1.249-1.249-1.249zm5.5 0c-.687 0-1.248.561-1.248 1.25 0 .687.561 1.248 1.249 1.248.688 0 1.249-.561 1.249-1.249 0-.687-.562-1.249-1.25-1.249zm-5.466 3.99a.327.327 0 0 0-.231.094.33.33 0 0 0 0 .463c.842.842 2.484.913 2.961.913.477 0 2.105-.056 2.961-.913a.361.361 0 0 0 .029-.463.33.33 0 0 0-.464 0c-.547.533-1.684.73-2.512.73-.828 0-1.979-.196-2.512-.73a.326.326 0 0 0-.232-.095z"})),color:"bg-white",connector:"reddit",description:"We use your posts and interactions to better understand your interests and preferences."},{name:"Instagram",icon:r.createElement("svg",{className:"w-6 h-6",viewBox:"0 0 24 24"},r.createElement("defs",null,r.createElement("radialGradient",{id:"instagram-gradient",cx:"0.5",cy:"1",r:"1"},r.createElement("stop",{offset:"0%",stopColor:"#FD5949"}),r.createElement("stop",{offset:"50%",stopColor:"#D6249F"}),r.createElement("stop",{offset:"100%",stopColor:"#285AEB"}))),r.createElement("path",{fill:"url(#instagram-gradient)",d:"M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.073-1.689-.073-4.849 0-3.204.013-3.583.072-4.948.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z"})),color:"bg-white",connector:"instagram",description:"We use your photos and interactions to better understand your visual preferences and lifestyle."},{name:"LinkedIn",icon:r.createElement("svg",{className:"w-6 h-6",viewBox:"0 0 24 24",fill:"#0077B5"},r.createElement("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})),color:"bg-white",connector:"linkedin",description:"We use your professional network and content to better understand your career interests."},{name:"Pinterest",icon:r.createElement("svg",{className:"w-6 h-6",viewBox:"0 0 24 24",fill:"#E60023"},r.createElement("path",{d:"M12 0C5.373 0 0 5.372 0 12s5.373 12 12 12c6.628 0 12-5.372 12-12S18.628 0 12 0zm0 19c-.721 0-1.418-.109-2.073-.312.286-.465.713-1.227.87-1.835l.437-1.664c.229.436.895.8 1.604.8 2.111 0 3.633-1.941 3.633-4.354 0-2.312-1.895-4.049-4.218-4.049-2.972 0-4.684 1.946-4.684 4.338 0 1.083.424 2.42 1.218 2.847.131.07.201.04.232-.107.023-.106.151-.602.2-.784.067-.25.041-.336-.145-.553-.408-.474-.615-1.088-.615-1.72 0-1.658 1.222-3.259 3.297-3.259 1.798 0 3.064 1.244 3.064 3.018 0 2.019-.864 3.423-2.024 3.423-.633 0-1.106-.537-.954-1.196.181-.788.532-1.637.532-2.204 0-.508-.267-.932-.822-.932-.652 0-1.176.685-1.176 1.602 0 .584.197.98.197.98l-.790 3.396C6.595 16.85 6.017 14.47 6.017 12c0-3.313 2.687-6 6-6s6 2.687 6 6-2.687 6-6 6z"})),color:"bg-white",connector:"pinterest",description:"We use your pins and boards to better understand your creative interests and style preferences."}],C={apiKey:process.env.REACT_APP_ONAIROS_API_KEY||"onairos_web_sdk_live_key_2024",baseUrl:process.env.REACT_APP_ONAIROS_BASE_URL||"https://api2.onairos.uk",sdkType:"web",enableHealthMonitoring:!0,enableAutoRefresh:!0,enableConnectionValidation:!0};function S(e){let{onComplete:t,onBack:n,appIcon:o,appName:a="App",personaImages:l,priorityPlatform:s=null,testMode:i=!1}=e;const c=null!=l?l:k,[u,m]=(0,r.useState)({}),[d,p]=(0,r.useState)(!1),[f,g]=(0,r.useState)(null),[y,h]=(0,r.useState)({}),[b,v]=(0,r.useState)({}),[x,E]=(0,r.useState)(0);(0,r.useEffect)(()=>{(()=>{const e=localStorage.getItem("onairos_oauth_platform");e&&(console.log("๐ฑ OAuth return detected for: ".concat(e)),localStorage.removeItem("onairos_oauth_platform"),localStorage.removeItem("onairos_oauth_return"),m(t=>w(w({},t),{},{[e]:!0})),h(t=>w(w({},t),{},{[e]:null})),console.log("โ
".concat(e," marked as connected from OAuth return")))})()},[]);const S=async e=>{console.log("๐ connectToPlatform called for: ".concat(e));const t=N.find(t=>t.name===e);if(null==t||!t.connector)return console.error("โ No connector found for platform: ".concat(e)),!1;try{var n;p(!0),g(e),h(t=>w(w({},t),{},{[e]:null})),console.log("๐ Starting OAuth connection for ".concat(e,"..."));const r=localStorage.getItem("username")||(null===(n=localStorage.getItem("onairosUser"))||void 0===n?void 0:n.email)||"user@example.com",o="".concat(C.baseUrl,"/").concat(t.connector,"/authorize"),a=await fetch(o,{method:"POST",headers:{"x-api-key":C.apiKey,"Content-Type":"application/json"},body:JSON.stringify({session:{username:r}})});if(!a.ok)throw new Error("HTTP ".concat(a.status,": ").concat(a.statusText));const l=await a.json();console.log("๐ ".concat(e," OAuth response:"),l);const s={youtube:["youtubeURL","youtubeUrl","youtube_url"],linkedin:["linkedinURL","linkedinUrl","linkedin_url"],reddit:["redditURL","redditUrl","reddit_url"],pinterest:["pinterestURL","pinterestUrl","pinterest_url"],instagram:["instagramURL","instagramUrl","instagram_url"],github:["githubURL","githubUrl","github_url"],facebook:["facebookURL","facebookUrl","facebook_url"],gmail:["gmailURL","gmailUrl","gmail_url"]}[t.connector]||["".concat(t.connector,"URL"),"".concat(t.connector,"Url"),"".concat(t.connector,"_url"),"platformURL","authUrl","url"];let i=null,c=null;for(const e of s)if(l[e]){i=l[e],c=e;break}if(!i)throw console.error("โ No OAuth URL found for ".concat(e,":")),console.error("Expected one of:",s),console.error("Response keys:",Object.keys(l)),console.error("Full response:",l),new Error("No OAuth URL found. Backend should return one of: ".concat(s.join(", ")));if(console.log("โ
Found OAuth URL for ".concat(e," using key: ").concat(c)),/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=768)return localStorage.setItem("onairos_oauth_platform",e),localStorage.setItem("onairos_oauth_return",window.location.href),window.location.href=i,!0;{const n=window.open(i,"".concat(t.connector,"_oauth"),"width=500,height=600,scrollbars=yes,resizable=yes,status=no,location=no,toolbar=no,menubar=no");if(!n)throw new Error("Popup blocked. Please allow popups and try again.");let r=!1;const o=setInterval(()=>{try{if(n.location&&"onairos.uk"===n.location.hostname)return r=!0,console.log("๐ ".concat(e," popup navigated to onairos.uk - treating as success")),void n.close()}catch(t){r||(r=!0,console.log("๐ ".concat(e," popup navigated (cross-origin) - likely to onairos.uk")))}try{if(n.closed){clearInterval(o);const t=localStorage.getItem("onairos_".concat(e,"_success")),n=localStorage.getItem("onairos_".concat(e,"_error")),a=localStorage.getItem("onairos_".concat(e,"_timestamp")),l=a&&Date.now()-parseInt(a)<3e4;t&&l?(console.log("โ
".concat(e," OAuth completed successfully (callback page)")),localStorage.removeItem("onairos_".concat(e,"_success")),localStorage.removeItem("onairos_".concat(e,"_timestamp")),m(t=>w(w({},t),{},{[e]:!0})),h(t=>w(w({},t),{},{[e]:null}))):n&&l?(console.log("โ ".concat(e," OAuth failed:"),n),localStorage.removeItem("onairos_".concat(e,"_error")),localStorage.removeItem("onairos_".concat(e,"_timestamp")),h(t=>w(w({},t),{},{[e]:n}))):r?(console.log("โ
".concat(e," OAuth likely successful (navigated to onairos.uk)")),m(t=>w(w({},t),{},{[e]:!0})),h(t=>w(w({},t),{},{[e]:null}))):(console.log("โ ๏ธ ".concat(e," OAuth cancelled or no response")),h(t=>w(w({},t),{},{[e]:"Connection was cancelled"}))),p(!1),g(null)}}catch(e){}},1e3);return setTimeout(()=>{try{!n.closed&&n.location&&"onairos.uk"===n.location.hostname&&(console.log("๐ช Auto-closing ".concat(e," popup showing onairos.uk (not found)")),n.close())}catch(t){!n.closed&&r&&(console.log("๐ช Auto-closing ".concat(e," popup (cross-origin, likely onairos.uk)")),n.close())}},1e4),setTimeout(()=>{n.closed||(n.close(),clearInterval(o),h(t=>w(w({},t),{},{[e]:"Connection timeout"})),p(!1),g(null))},3e5),!0}}catch(t){return console.error("โ Error connecting to ".concat(e,":"),t),h(n=>w(w({},n),{},{[e]:t.message})),p(!1),g(null),!1}},O=async e=>{if(console.log("๐ฅ TOGGLE CLICKED: ".concat(e)),d&&f!==e)return void console.log("โ ๏ธ Already connecting to ".concat(f,", ignoring click on ").concat(e));u[e]?(console.log("๐ Disconnecting from ".concat(e,"...")),m(t=>w(w({},t),{},{[e]:!1})),h(t=>w(w({},t),{},{[e]:null}))):await S(e)},j=Object.values(u).filter(Boolean).length,P=Math.min(j+1,5);(()=>{if(!s)return N;const e=N.find(e=>e.name.toLowerCase()===s.toLowerCase()||e.connector.toLowerCase()===s.toLowerCase());if(!e)return N;const t=N.filter(t=>t!==e)})();return r.createElement("div",{className:"w-full h-full flex flex-col",style:{height:"90vh",minHeight:0}},r.createElement("div",{className:"px-6 pt-16 flex-1 flex flex-col",style:{minHeight:0,overflow:"hidden"}},r.createElement("div",{className:"mb-6 flex-shrink-0"},r.createElement("h1",{className:"text-2xl font-bold text-gray-900 mb-2 text-balance leading-tight"},"Connect app data"),r.createElement("p",{className:"text-gray-600 text-base"},"More connections, better personalization.")),r.createElement("div",{className:"mb-2 flex justify-center flex-shrink-0"},r.createElement("div",{className:"w-56 h-56 overflow-hidden"},r.createElement("img",{src:c[P],alt:"Persona ".concat(P),width:"256",height:"256",className:"w-full h-full object-cover",onLoad:()=>console.log("โ
Persona image loaded successfully!"),onError:e=>{console.log("โ Persona image failed to load:",c[P]),console.log("Connected count:",j),console.log("Persona number:",P),console.log("All persona URLs:",c),console.log("Current location:",window.location.href),console.log("Trying to load from:",c[P]),e.target.style.display="none",e.target.parentElement.style.background="linear-gradient(135deg, #f97316 0%, #ec4899 50%, #8b5cf6 100%)"}}))),r.createElement("div",{className:"flex-1 overflow-y-auto mt-4",style:{minHeight:0}},r.createElement("div",{className:"space-y-4 pb-4"},N.map(e=>{const t=u[e.name]||!1,n=f===e.name,o=y[e.name],a=d&&!n;(e=>{!!s&&(e.name.toLowerCase()===s.toLowerCase()||(e.connector.toLowerCase(),s.toLowerCase()))})(e);return r.createElement("div",{key:e.name,className:"flex items-start gap-4 p-4 rounded-xl hover:bg-gray-50 transition-colors",style:{backgroundColor:"#ffffff",border:"none",outline:"none",gap:"clamp(6px, 1.5vw, 10px)",padding:"clamp(6px, 1.5vw, 10px)",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",marginBottom:"clamp(3px, 0.8vw, 6px)"},onClick:()=>!a&&O(e.name)},r.createElement("div",{className:"bg-gray-50 rounded-full flex items-center justify-center flex-shrink-0 border-2 border-gray-200",style:{width:"clamp(28px, 6vw, 36px)",height:"clamp(28px, 6vw, 36px)"}},n?r.createElement("div",{className:"animate-spin h-5 w-5 border-2 border-gray-400 rounded-full border-t-transparent"}):e.icon),r.createElement("div",{className:"flex-1 min-w-0 pr-4"},r.createElement("h3",{className:"font-semibold",style:{color:"#111827",fontSize:"clamp(12px, 2.8vw, 15px)",marginBottom:"clamp(1px, 0.3vw, 3px)",lineHeight:"1.2"}},e.name),r.createElement("p",{className:"leading-tight",style:{color:"#6B7280",fontSize:"clamp(10px, 2.2vw, 12px)",lineHeight:"1.3"}},e.description),o&&r.createElement("p",{className:"text-xs text-red-600 mt-1"},o)),r.createElement("div",{className:"flex-shrink-0"},r.createElement("div",{onClick:t=>{t.stopPropagation(),a||O(e.name)},className:"relative inline-flex items-center rounded-full transition-all duration-300 ease-in-out cursor-pointer ".concat(t?"bg-blue-500":"bg-gray-300"," ").concat(a?"opacity-50 cursor-not-allowed":"cursor-pointer"),style:{height:"clamp(20px, 4vw, 26px)",width:"clamp(40px, 8vw, 52px)",boxShadow:t?"0 2px 4px rgba(59, 130, 246, 0.3)":"0 1px 2px rgba(0, 0, 0, 0.1)"}},r.createElement("span",{className:"inline-block rounded-full bg-white transition-all duration-300 ease-in-out shadow-lg ".concat(t?"translate-x-6":"translate-x-0.5"),style:{height:"clamp(16px, 3.5vw, 20px)",width:"clamp(16px, 3.5vw, 20px)"}}))))})))),r.createElement("div",{className:"flex-shrink-0",style:{padding:"clamp(8px, 2vw, 16px) clamp(16px, 4vw, 24px)",minHeight:"auto",display:"flex",flexDirection:"column",gap:"clamp(6px, 1.5vw, 10px)"}},r.createElement("div",{className:"w-full bg-blue-600 hover:bg-blue-700 text-white rounded-xl font-semibold flex items-center justify-center gap-2 cursor-pointer transition-all duration-200 shadow-lg hover:shadow-xl",style:{padding:"clamp(10px, 2.5vw, 14px)",fontSize:"clamp(13px, 3.2vw, 16px)",minHeight:"clamp(36px, 7vw, 44px)"},onClick:()=>{const e=Object.entries(u).filter(e=>{let[t,n]=e;return n}).map(e=>{let[t]=e;return t});t({connectedAccounts:e,totalConnections:e.length,healthScore:x,connectionHealth:b,sdkVersion:"2.1.7",enhancedFeatures:{healthMonitoring:C.enableHealthMonitoring,autoRefresh:C.enableAutoRefresh,connectionValidation:C.enableConnectionValidation}})}},"Update",r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}))),j>0&&r.createElement("div",{onClick:()=>t({connectedAccounts:[],totalConnections:0}),className:"w-full text-gray-500 font-medium text-center cursor-pointer hover:text-gray-700 transition-colors",style:{padding:"clamp(6px, 1.5vw, 10px)",fontSize:"clamp(12px, 3vw, 15px)",minHeight:"clamp(28px, 5vw, 36px)"}},"Skip")))}function O(e){let{onComplete:t,onBack:n,userEmail:o}=e;const[a,l]=(0,r.useState)(""),[s,i]=(0,r.useState)({length:!1,uppercase:!1,number:!1});(0,r.useEffect)(()=>{i({length:a.length>=6,uppercase:/[A-Z]/.test(a),number:/\d/.test(a)})},[a]);const c=s.length&&s.uppercase&&s.number;return r.createElement("div",{className:"w-full h-full flex flex-col",style:{height:"100%",minHeight:0}},r.createElement("div",{className:"px-6 pt-16 flex-1 flex flex-col",style:{minHeight:0,overflow:"hidden"}},r.createElement("div",{className:"mb-6 flex-shrink-0"},r.createElement("h1",{className:"text-2xl font-bold text-gray-900 mb-2"},"Create a PIN"),r.createElement("p",{className:"text-gray-600 text-base"},"A PIN so only you have the access to your data")),r.createElement("div",{className:"mb-6 flex-shrink-0"},r.createElement("input",{type:"password",value:a,onChange:e=>l(e.target.value),className:"w-full px-4 py-4 border-2 border-gray-300 rounded-xl text-center text-lg font-medium focus:border-gray-900 focus:outline-none bg-gray-50",placeholder:"Enter your PIN",maxLength:20})),r.createElement("div",{className:"flex-1 overflow-y-auto",style:{minHeight:0}},r.createElement("div",{className:"space-y-3 pb-4"},r.createElement("p",{className:"text-gray-900 font-medium mb-4"},"Your PIN must:"),r.createElement("div",{className:"space-y-3"},r.createElement("div",{className:"flex items-center gap-3"},r.createElement("div",{className:"w-5 h-5 rounded-full border-2 ".concat(s.length?"border-green-500 bg-green-500":"border-gray-300 bg-white")},s.length&&r.createElement("svg",{className:"w-3 h-3 text-white m-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))),r.createElement("span",{className:"text-gray-700"},"Be at least 6 characters in length.")),r.createElement("div",{className:"flex items-center gap-3"},r.createElement("div",{className:"w-5 h-5 rounded-full border-2 ".concat(s.uppercase?"border-green-500 bg-green-500":"border-gray-300 bg-white")},s.uppercase&&r.createElement("svg",{className:"w-3 h-3 text-white m-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))),r.createElement("span",{className:"text-gray-700"},"Contain an uppercase letter.")),r.createElement("div",{className:"flex items-center gap-3"},r.createElement("div",{className:"w-5 h-5 rounded-full border-2 ".concat(s.number?"border-green-500 bg-green-500":"border-gray-300 bg-white")},s.number&&r.createElement("svg",{className:"w-3 h-3 text-white m-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}))),r.createElement("span",{className:"text-gray-700"},"Contain a number.")))))),r.createElement("div",{className:"px-6 pb-6 pt-4 flex-shrink-0 space-y-3",style:{minHeight:"auto"}},r.createElement("div",{className:"w-full rounded-full py-4 text-base font-medium flex items-center justify-center gap-2 transition-colors ".concat(c?"bg-gray-900 hover:bg-gray-800 text-white cursor-pointer":"bg-gray-300 text-gray-500 cursor-not-allowed"),onClick:c?()=>{c&&t({pin:a,pinCreated:!0,timestamp:(new Date).toISOString()})}:void 0},"Continue",r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})))))}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach(function(t){I(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function I(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 r=n.call(e,t||"default");if("object"!=typeof r)return r;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 A(){return A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(null,arguments)}const R=[{id:"basic",name:"Basic Profile",description:"Essential profile information, account details, and basic demographics",icon:"User",required:!0,tooltip:"Includes name, email, basic profile information. This data is essential for personalization and is always included.",privacyLink:"https://onairos.uk/privacy#basic-info"},{id:"preferences",name:"User Preferences",description:"User preferences, interests, settings and personal choices",icon:"Grid3X3",required:!1,tooltip:"Your stated preferences and interests from connected platforms. Helps customize your experience.",privacyLink:"https://onairos.uk/privacy#preferences-data"},{id:"personality",name:"Personality Traits",description:"Personality traits, behavioral patterns and psychological insights",icon:"Brain",required:!1,tooltip:"AI-analyzed personality traits based on your social media activity and interactions. Used to improve content recommendations.",privacyLink:"https://onairos.uk/privacy#personality-data"}],L=e=>{let{dataType:t,isEnabled:n,onToggle:o,isLast:a}=e;return r.createElement("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50"},r.createElement("div",{className:"flex items-center gap-4"},r.createElement("div",{className:"w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center flex-shrink-0"},(e=>{const t={className:"w-4 h-4 text-gray-600"};switch(e){case"User":return r.createElement("svg",A({},t,{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"}),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"}));case"Grid3X3":return r.createElement("svg",A({},t,{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"}),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"}));case"Brain":return r.createElement("svg",A({},t,{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"}),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"}));default:return r.createElement("span",{className:"text-lg"},e)}})(t.icon)),r.createElement("div",{className:"min-w-0 flex-1"},r.createElement("span",{className:"font-medium text-gray-900 text-sm"},t.name))),r.createElement("div",{onClick:()=>{t.required||o(t.id,!n)},className:"w-5 h-5 rounded border-2 flex items-center justify-center cursor-pointer transition-colors flex-shrink-0 ".concat(n?"bg-gray-900 border-gray-900":"bg-white border-gray-300")},n&&r.createElement("svg",{className:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 20 20"},r.createElement("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"}))))},_=e=>{let{userEmail:t="user@example.com",testMode:n=!0,onComplete:o,autoFetch:a=!0,appName:l="Test App",formatResponse:s=!1,responseFormat:i="simple"}=e;const[c,u]=(0,r.useState)({basic:!0,personality:!1,preferences:!1}),[m,d]=(0,r.useState)(!1),[p,f]=(0,r.useState)(null),g=(e,t)=>{const n=R.find(t=>t.id===e);null!=n&&n.required||u(n=>P(P({},n),{},{[e]:t}))},y=Object.values(c).filter(Boolean).length;return r.createElement("div",{className:"w-full h-full flex flex-col min-h-0"},r.createElement("div",{className:"px-6 pt-16 flex-1 flex flex-col min-h-0",style:{minHeight:"calc(100vh - 200px)"}},r.createElement("div",{className:"mb-4 flex justify-center items-center gap-4 flex-shrink-0"},r.createElement("div",{className:"w-12 h-12 bg-white rounded-xl shadow-lg flex items-center justify-center border border-gray-100"},r.createElement("svg",{className:"w-6 h-6",viewBox:"0 0 24 24",fill:"none"},r.createElement("path",{d:"M12 2C13.1 2 14 2.9 14 4C14 5.1 13.1 6 12 6C10.9 6 10 5.1 10 4C10 2.9 10.9 2 12 2Z",fill:"black"}),r.createElement("path",{d:"M21 9V7L15 6.5V9C15 10.66 13.66 12 12 12C10.34 12 9 10.66 9 9V6.5L3 7V9C3 12.87 6.13 16 10 16V22H14V16C17.87 16 21 12.87 21 9Z",fill:"black"}))),r.createElement("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})),r.createElement("div",{className:"w-12 h-12 bg-white rounded-xl shadow-lg flex items-center justify-center border border-gray-100"},r.createElement("span",{className:"text-xl font-serif font-bold text-black"},"E"))),r.createElement("div",{className:"mb-4 flex-shrink-0"},r.createElement("h1",{className:"text-xl font-bold text-gray-900 mb-2 text-balance leading-tight"},"Enoch wants to personalize your experience"),r.createElement("p",{className:"text-gray-600 text-sm"},"Choose what to share:")),r.createElement("div",{className:"flex-1 overflow-y-auto min-h-0"},r.createElement("div",{className:"space-y-4 pb-4"},R.map((e,t)=>r.createElement(L,{key:e.id,dataType:e,isEnabled:c[e.id],onToggle:g,isLast:t===R.length-1}))))),r.createElement("div",{className:"px-6 pb-6 pt-3 flex-shrink-0 space-y-2 bg-white border-t border-gray-100"},r.createElement("div",{className:"w-full bg-gray-900 hover:bg-gray-800 text-white rounded-full py-3 text-sm font-medium flex items-center justify-center gap-2 cursor-pointer transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:async()=>{console.log("๐ฅ DataRequest: fetchUserData called"),console.log("๐ฅ DataRequest: onComplete function:",typeof o),console.log("๐ฅ DataRequest: selectedData:",c),console.log("๐ฅ DataRequest: selectedCount:",y),d(!0),f(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))})(t),r=Object.entries(c).filter(e=>{let[t,n]=e;return n}).map(e=>{let[t]=e;return t}),s=e=>{const t=[],n=(new Date).toISOString(),r={basic:"Medium",personality:"Large",preferences:"Traits"};return e.forEach(e=>{r[e]&&t.push({data:r[e],date:n})}),t},i=n?"https://api2.onairos.uk/inferenceTest":"https://api2.onairos.uk/getAPIurlMobile",u={userHash:e,appName:l,approvedData:r,apiUrl:i,testMode:n,timestamp:(new Date).toISOString()};if(a)if(n)console.log("๐งช Test mode: Simulating data request API call for:",r),setTimeout(()=>{const e={success:!0,message:"Data request simulated successfully",data:{personalityScores:{openness:.75,conscientiousness:.68,extraversion:.82,agreeableness:.71,neuroticism:.43},insights:["You show high creativity and openness to new experiences","Strong social tendencies with good interpersonal skills","Well-organized approach to tasks and goals"],dataProcessed:r,timestamp:(new Date).toISOString(),testMode:!0}},t=P(P({},u),{},{apiResponse:e,success:!0,simulated:!0});d(!1),console.log("๐งช Test mode: Simulated data request completed:",t),console.log("๐ฅ DataRequest: onComplete function type:",typeof o),o&&"function"==typeof o?(o(t),console.log("๐ฅ DataRequest: onComplete called successfully (test mode)")):console.error("๐ฅ DataRequest: onComplete is not a function or is undefined (test mode)")},1200);else try{const e=s(r),n={approvedData:r,userEmail:t,appName:l,confirmations:e};console.log("๐ฅ DataRequest: Making API call to:",i),console.log("๐ฅ Request body:",n);const a=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok)throw new Error("API request failed with status ".concat(a.status));const c=await a.json();console.log("๐ฅ API Response:",c);const m=P(P({},u),{},{apiResponse:c,success:!0});d(!1),console.log("๐ฅ DataRequest: Calling onComplete with result:",m),console.log("๐ฅ DataRequest: onComplete function type:",typeof o),o&&"function"==typeof o?(o(m),console.log("๐ฅ DataRequest: onComplete called successfully")):console.error("๐ฅ DataRequest: onComplete is not a function or is undefined")}catch(e){console.error("๐ฅ API Error:",e),f(e.message),d(!1);const t=P(P({},u),{},{apiResponse:null,error:e.message,success:!1});o(t)}else d(!1),console.log("๐ฅ DataRequest: Auto-fetch disabled, calling onComplete with base result"),console.log("๐ฅ DataRequest: onComplete function type:",typeof o),o&&"function"==typeof o?(o(u),console.log("๐ฅ DataRequest: onComplete called successfully (auto-fetch disabled)")):console.error("๐ฅ DataRequest: onComplete is not a function or is undefined (auto-fetch disabled)")}catch(e){console.error("๐ฅ DataRequest Error:",e),f(e.message),d(!1),o&&o({error:e.message,success:!1,userEmail:t,appName:l,testMode:n})}},disabled:m||0===y},m?"Processing...":"Accept & Continue",r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}))),r.createElement("div",{onClick:()=>o({cancelled:!0}),className:"w-full bg-gray-200 hover:bg-gray-300 text-gray-700 rounded-full py-3 text-sm font-medium text-center cursor-pointer transition-colors"},"Decline"),p&&r.createElement("div",{className:"mt-3 p-3 rounded-lg text-center bg-red-50 border border-red-200 text-red-600"},r.createElement("p",{className:"text-xs"},p))))};function D(e){var t,n,o,a,l;let{onComplete:s,userEmail:i,appName:c="App",testMode:u=!0}=e;const[d,p]=(0,r.useState)(0),[f,g]=(0,r.useState)(0),[y,h]=(0,r.useState)(!1),b=[{title:"Setting up your personal AI",description:"Initializing your secure data model",icon:"๐ค",duration:u?800:2e3},{title:"Processing your connections",description:"Analyzing your social media patterns",icon:"๐",duration:u?600:2500},{title:"Training your model",description:"Building your personalized insights",icon:"๐ง ",duration:u?700:3e3},{title:"Finalizing setup",description:"Preparing your Onairos experience",icon:"โจ",duration:u?500:2e3}];return(0,r.useEffect)(()=>{let e,t;if(d<b.length){const n=b[d].duration,r=100/b.length;e=setInterval(()=>{g(e=>{const t=e+r/(n/100);return Math.min(t,(d+1)*r)})},100),t=setTimeout(()=>{if(d<b.length-1)p(e=>e+1);else{h(!0);const e=u?400:1e3;u&&console.log("๐งช Test mode: Training simulation completed"),setTimeout(()=>{s({trainingComplete:!0,timestamp:(new Date).toISOString(),userEmail:i,appName:c,testMode:u,simulatedTraining:u})},e)}},n)}return()=>{e&&clearInterval(e),t&&clearTimeout(t)}},[d,s,i,c]),r.createElement("div",{className:"w-full flex flex-col items-center space-y-8"},r.createElement("div",{className:"text-center"},r.createElement("div",{className:"w-20 h-20 rounded-full flex items-center justify-center mx-auto mb-4",style:{background:"linear-gradient(135deg, ".concat(m.info,", #8B5CF6)")}},r.createElement("div",{className:"text-3xl"},y?"๐":null===(t=b[d])||void 0===t?void 0:t.icon)),r.createElement("h2",{className:"text-2xl font-bold mb-2",style:{color:m.textPrimary}},y?"All set!":null===(n=b[d])||void 0===n?void 0:n.title),r.createElement("p",{style:{color:m.textSecondary}},y?"Your personal AI is ready to use":null===(o=b[d])||void 0===o?void 0:o.description)),r.createElement("div",{className:"w-full"},r.createElement("div",{className:"flex justify-between text-sm mb-2",style:{color:m.textSecondary}},r.createElement("span",null,"Progress"),r.createElement("span",null,Math.round(f),"%")),r.createElement("div",{className:"w-full rounded-full h-2",style:{backgroundColor:m.borderLight}},r.createElement("div",{className:"h-2 rounded-full transition-all duration-300 ease-out",style:{width:"".concat(f,"%"),background:"linear-gradient(90deg, ".concat(m.info,", #8B5CF6)")}}))),r.createElement("div",{className:"flex justify-center space-x-2"},b.map((e,t)=>r.createElement("div",{key:t,className:"w-3 h-3 rounded-full transition-all duration-300",style:{backgroundColor:t<=d?m.info:m.border}}))),r.createElement("div",{className:"p-4 rounded-lg w-full",style:{backgroundColor:m.backgroundSecondary}},r.createElement("div",{className:"flex items-center space-x-3"},r.createElement("div",{className:"w-8 h-8 rounded-full flex items-center justify-center",style:{backgroundColor:"#DBEAFE"}},r.createElement("div",{className:"text-sm"},y?"โ
":null===(a=b[d])||void 0===a?void 0:a.icon)),r.createElement("div",null,r.createElement("h3",{className:"font-medium",style:{color:m.textPrimary}},y?"Training Complete":"Step ".concat(d+1," of ").concat(b.length)),r.createElement("p",{className:"text-sm",style:{color:m.textSecondary}},y?"Your Onairos experience is ready":null===(l=b[d])||void 0===l?void 0:l.description)))),r.createElement("div",{className:"text-center"},r.createElement("p",{className:"text-sm",style:{color:m.textSecondary}},"Setting up for ",r.createElement("span",{className:"font-medium"},c)),i&&r.createElement("p",{className:"text-xs mt-1",style:{color:m.textMuted}},i)))}function M(e){let{onComplete:t}=e;const[n,o]=(0,r.useState)(0),[a,l]=(0,r.useState)(0),s=[{message:"Validating PIN and continuing training",progress:20},{message:"Uploading model to secure storage",progress:40},{message:"Running test inference",progress:60},{message:"Storing results in databases",progress:80},{message:"Complete!",progress:100}];(0,r.useEffect)(()=>{const e=setInterval(()=>{o(e=>{const n=e+1;return n>=s.length?(setTimeout(()=>{t()},1e3),e):n})},3e3);return()=>clearInterval(e)},[s.length,t]),(0,r.useEffect)(()=>{const e=setInterval(()=>{l(e=>(e+1)%4)},500);return()=>clearInterval(e)},[]);const i=s[n];return r.createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center p-6"},r.createElement("div",{className:"bg-white rounded-3xl w-full max-w-lg mx-auto shadow-2xl overflow-hidden flex flex-col",style:{maxWidth:"500px",height:"90vh"}},r.createElement("div",{className:"px-6 pt-6 pb-4 flex-shrink-0"}),r.createElement("div",{className:"flex-1 flex flex-col justify-center items-center px-6"},r.createElement("div",{className:"text-center mb-12"},r.createElement("h1",{className:"font-bold text-gray-900 leading-tight",style:{fontSize:"clamp(16px, 4vw, 20px)",marginBottom:"clamp(24px, 6vw, 48px)"}},i.message,"Complete!"!==i.message&&r.createElement("span",{className:"inline-block w-8 text-left"},".".repeat(a))),r.createElement("div",{className:"mx-auto",style:{width:"clamp(200px, 50vw, 300px)"}},r.createElement("div",{className:"w-full h-2 bg-gray-200 rounded-full"},r.createElement("div",{className:"h-2 bg-gray-900 rounded-full transition-all duration-1000 ease-out",style:{width:"".concat(i.progress,"%")}}))))),r.createElement("div",{className:"h-20 flex-shrink-0"})))}function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(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 r=n.call(e,t||"default");if("object"!=typeof r)return r;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 T=["Analyst","Diplomat","Sentinel","Explorer","Architect","Logician","Commander","Debater","Advocate","Mediator","Protagonist","Campaigner","Logistician","Defender","Executive","Consul"],z=["Openness","Conscientiousness","Extraversion","Agreeableness","Neuroticism"];function F(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{includeDictionary:r=!0,includeArray:o=!0}=n;if(!e)return e;const a=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B(Object(n),!0).forEach(function(t){U(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},e);if(null!==(t=e.InferenceResult)&&void 0!==t&&t.traits||e.traits||e.scores){var l;const t=(null===(l=e.InferenceResult)||void 0===l?void 0:l.traits)||e.traits||e.scores;if(Array.isArray(t)&&t.length>=16){if(r){const e={};T.forEach((n,r)=>{e[n]=t[r]}),a.InferenceResult?a.InferenceResult.personalityDict=e:a.personalityDict=e}var s;if(!o)null!==(s=a.InferenceResult)&&void 0!==s&&s.traits&&delete a.InferenceResult.traits,a.traits&&delete a.traits,a.scores&&delete a.scores}}if(e.traitResult||e.traits){const t=e.traitResult||e.traits;if(Array.isArray(t)&&r){const e={};z.forEach((n,r)=>{void 0!==t[r]&&(e[n]=t[r])}),a.traitDict=e}}return a}const q=["children","title","subtitle","icon","showHeader","showCloseButton","onClose","onBack","showBackButton","className","contentClassName","centerContent","style"],W=["children","visible","onClose","onBackdropClick","backdropStyle","modalStyle"];function H(){return H=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},H.apply(null,arguments)}function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach(function(t){$(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function $(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 r=n.call(e,t||"default");if("object"!=typeof r)return r;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 Y(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}const J=e=>{let{children:t,title:n,subtitle:o,icon:a,showHeader:l=!0,showCloseButton:s=!1,onClose:i,onBack:c,showBackButton:u=!1,className:d="",contentClassName:p="",centerContent:f=!0,style:g={}}=e,y=Y(e,q);const h=G({backgroundColor:m.background,minHeight:"100%",width:"100%",display:"flex",flexDirection:"column"},g),b={position:"sticky",top:0,backgroundColor:m.background,zIndex:10,padding:"clamp(8px, 2vw, 16px) clamp(16px, 4vw, 32px) clamp(6px, 1.5vw, 12px)"},v=G({flex:1,padding:"clamp(16px, 4vw, 32px)",display:"flex",flexDirection:"column",overflow:"auto",minHeight:0},f&&{alignItems:"center",justifyContent:"flex-start"}),x={fontFamily:"Inter, system-ui, sans-serif",fontSize:"clamp(20px, 5vw, 28px)",fontWeight:"700",color:m.textPrimary,margin:"0 0 clamp(6px, 1.5vw, 12px) 0",textAlign:f?"center":"left",lineHeight:"1.2"},w={fontFamily:"Inter, system-ui, sans-serif",fontSize:"clamp(14px, 3.5vw, 18px)",fontWeight:"400",color:m.textSecondary,margin:"0 0 clamp(20px, 5vw, 40px) 0",textAlign:f?"center":"left",lineHeight:"1.5"};return r.createElement("div",H({className:"onairos-page-layout ".concat(d),style:h},y),l&&r.createElement("div",{style:b},r.createElement("div",{className:"flex items-center justify-between"},u&&c&&r.createElement("button",{onClick:c,className:"flex items-center justify-center w-8 h-8 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Go back"},r.createElement("span",{style:{fontSize:"16px",color:m.textPrimary}},"โ")),s&&i&&r.createElement("button",{onClick:i,className:"flex items-center justify-center w-8 h-8 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Close"},r.createElement("span",{style:{fontSize:"16px",color:m.textPrimary}},"ร")))),r.createElement("div",{className:"onairos-page-content ".concat(p),style:v},a&&r.createElement("div",{style:{width:"clamp(40px, 8vw, 56px)",height:"clamp(40px, 8vw, 56px)",margin:"0 auto clamp(16px, 4vw, 32px)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"clamp(20px, 5vw, 28px)"}},"string"==typeof a?r.createElement("span",null,a):a),n&&r.createElement("h1",{style:x},n),o&&r.createElement("p",{style:w},o),t))},K=e=>{let{children:t,visible:n=!0,onClose:o,onBackdropClick:a,backdropStyle:l={},modalStyle:s={}}=e,i=Y(e,W);if(!n)return null;const c=G({position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center"},l),u=G({backgroundColor:m.background,borderTopLeftRadius:"24px",borderTopRightRadius:"24px",borderBottomLeftRadius:"24px",borderBottomRightRadius:"24px",height:"90vh",width:"100%",maxWidth:"500px",boxShadow:"0 -10px 40px rgba(0, 0, 0, 0.3)",overflow:"hidden",display:"flex",flexDirection:"column"},s);return r.createElement("div",{style:c,onClick:e=>{e.target===e.currentTarget&&(a?a():o&&o())}},r.createElement("div",{style:u},r.createElement(J,H({showHeader:!0,showCloseButton:!0,onClose:o},i),t)))};function Z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function X(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(n),!0).forEach(function(t){Q(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Q(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 r=n.call(e,t||"default");if("object"!=typeof r)return r;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 ee(e){let{requestData:t,webpageName:n,inferenceData:a=null,onComplete:l=null,autoFetch:s=!0,testMode:i=!0,proofMode:c=!1,textLayout:u="below",textColor:m="white",login:d=!1,buttonType:p="pill",loginReturn:f=null,loginType:g="signIn",visualType:y="full",appIcon:h=null,enableTraining:b=!0,formatResponse:x=!0,responseFormat:w={includeDictionary:!0,includeArray:!0},priorityPlatform:E=null}=e;const[k,N]=(0,r.useState)(!1),[C,j]=(0,r.useState)("welcome"),[P,I]=(0,r.useState)(null),[A,R]=(0,r.useState)(null);(0,r.useEffect)(()=>{(()=>{if(i)return console.log("๐งช Test mode: Starting fresh flow, clearing any cached user data"),localStorage.removeItem("onairosUser"),void j("welcome");const e=localStorage.getItem("onairosUser");if(e)try{const t=JSON.parse(e);I(t),t.onboardingComplete&&t.pinCreated?j("dataRequest"):t.verified&&!t.onboardingComplete?j("onboarding"):t.onboardingComplete&&!t.pinCreated&&j("pin")}catch(e){console.error("Error parsing saved user data:",e),localStorage.removeItem("onairosUser")}})()},[i]);const L=()=>{N(!1),R(null)},B=()=>{console.log("๐ฅ Welcome screen continue clicked"),j("email")},U=e=>{console.log("๐ฅ Email auth successful:",e),console.log("๐ง User State:",{isNewUser:e.isNewUser,userState:e.userState,flowType:e.flowType,existingUser:e.existingUser,hasAccountInfo:!!e.accountInfo});const t=!0===e.isNewUser||!1===e.existingUser||"onboarding"===e.flowType||"new"===e.userState||!e.accountInfo;console.log("๐ Flow determination:",{finalDecision:t?"NEW USER โ onboarding (data connectors)":"EXISTING USER โ dataRequest (data permissions)",reasoning:{isNewUser:e.isNewUser,existingUserFalse:!1===e.existingUser,flowTypeOnboarding:"onboarding"===e.flowType,noAccountInfo:!e.accountInfo}});const n=X(X({},e),{},{verified:!0,onboardingComplete:!t,pinCreated:!t});I(n),localStorage.setItem("onairosUser",JSON.stringify(n)),t?(console.log("๐ NEW USER detected โ Starting onboarding flow (data connectors page)"),j("onboarding")):(console.log("๐ EXISTING USER detected โ Going directly to data request (data permissions page)"),j("dataRequest"))},T=e=>{console.log("Onboarding completed:",e);const t=X(X({},P),{},{onboardingComplete:!0,connectedAccounts:e.connectedAccounts||[]});I(t),localStorage.setItem("onairosUser",JSON.stringify(t)),j("pin")},z=e=>{console.log("PIN setup completed:",e);const t=X(X(X({},P),e),{},{pinCreated:!0});I(t),localStorage.setItem("onairosUser",JSON.stringify(t)),j("loading")},q=e=>{console.log("๐ Training completed:",e);const t=X(X({},P),{},{trainingCompleted:!0},e);I(t),localStorage.setItem("onairosUser",JSON.stringify(t)),j("dataRequest")},W=e=>{console.log("๐ฅ OnairosButton: Data request completed:",e);const t=X(X({},P),{},{lastDataRequest:e});I(t),localStorage.setItem("onairosUser",JSON.stringify(t)),console.log("๐ฅ Closing overlay after data request completion"),N(!1);let n=e;if(x&&null!=e&&e.apiResponse)try{var r;n=X(X({},e),{},{apiResponse:F(e.apiResponse,w)}),console.log("๐ฅ Response formatted with dictionary:",(null===(r=n.apiResponse)||void 0===r?void 0:r.personalityDict)||"No personality data")}catch(e){console.warn("๐ฅ Error formatting response:",e)}if(console.log("๐ฅ Calling onComplete callback with:",n),l)try{l(n),console.log("๐ฅ onComplete callback executed successfully")}catch(e){console.error("๐ฅ Error in onComplete callback:",e)}else console.log("๐ฅ No onComplete callback provided")},H="flex items-center justify-center font-bold rounded cursor-pointer ".concat("pill"===p?"px-4 py-2":"w-12 h-12"," bg-transparent OnairosConnect"),V={flexDirection:"below"===u?"column":"row",backgroundColor:"transparent",color:m,border:"1px solid transparent"},G={width:"20px",height:"20px",marginRight:"full"===y?"12px":"0"};return r.createElement(r.Fragment,null,r.createElement("button",{className:H,onClick:async()=>{try{console.log("๐ฅ openTerminal called"),N(!0)}catch(e){console.error("Error in openTerminal:",e)}},style:V},("full"===y||"icon"===y)&&r.createElement("img",{src:d?"https://onairos.sirv.com/Images/OnairosWhite.png":"https://onairos.sirv.com/Images/OnairosBlack.png",alt:"Onairos Logo",style:G}),"icon"!==y&&r.createElement("span",{className:"".concat("black"===m?"text-black":"text-white"," ").concat("icon"===y?"sr-only":""," ").concat("right"===u?"ml-2":"left"===u?"mr-2":"")},(()=>{switch(g){case"signUp":return"Sign Up with Onairos";case"signOut":return"Sign Out of Onairos";default:return"Sign In with Onairos"}})())),k&&r.createElement(r.Fragment,null,"email"===C?r.createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center z-50 p-6"},r.createElement("div",{className:"bg-white rounded-3xl w-full max-w-lg mx-auto shadow-2xl overflow-hidden flex flex-col",style:{maxWidth:"500px",height:"90vh"}},r.createElement("div",{className:"relative px-6 pt-6 pb-4 flex-shrink-0"},r.createElement("button",{onClick:L,className:"absolute left-4 top-4 p-2 hover:bg-gray-100 rounded-full transition-colors"},r.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})))),r.createElement("div",{className:"h-[min(85vh,700px)]"},r.createElement(v,{onSuccess:U,testMode:i})))):"onboarding"===C?r.createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center z-50 p-6"},r.createElement("div",{className:"bg-white rounded-3xl w-full max-w-lg mx-auto shadow-2xl overflow-hidden flex flex-col",style:{maxWidth:"500px",height:"90vh"}},r.createElement("div",{className:"relative px-6 pt-6 pb-4 flex-shrink-0"},r.createElement("button",{onClick:()=>j("email"),className:"absolute left-4 top-4 p-2 hover:bg-gray-100 rounded-full transition-colors"},r.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})))),r.createElement(S,{onComplete:T,onBack:()=>j("email"),appIcon:h||"https://onairos.sirv.com/Images/OnairosBlack.png",appName:n,username:(null==P?void 0:P.email)||(null==P?void 0:P.username),testMode:i,priorityPlatform:E}))):"dataRequest"===C?r.createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center z-50 p-6"},r.createElement("div",{className:"bg-white rounded-3xl w-full max-w-lg mx-auto shadow-2xl overflow-hidden flex flex-col",style:{maxWidth:"500px",height:"90vh"}},r.createElement("div",{className:"relative px-6 pt-6 pb-4 flex-shrink-0"},r.createElement("button",{onClick:()=>j("loading"),className:"absolute left-4 top-4 p-2 hover:bg-gray-100 rounded-full transition-colors"},r.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})))),r.createElement(_,{onComplete:W,userEmail:null==P?void 0:P.email,requestData:t,appName:n,autoFetch:s,testMode:i,appIcon:h,connectedAccounts:(null==P?void 0:P.connectedAccounts)||{}}))):"pin"===C?r.createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center z-50 p-6"},r.createElement("div",{className:"bg-white rounded-3xl w-full max-w-lg mx-auto shadow-2xl overflow-hidden flex flex-col",style:{maxWidth:"500px",height:"90vh"}},r.createElement("div",{className:"relative px-6 pt-6 pb-4 flex-shrink-0"},r.createElement("button",{onClick:()=>j("onboarding"),className:"absolute left-4 top-4 p-2 hover:bg-gray-100 rounded-full transition-colors"},r.createElement("svg",{className:"w-5 h-5 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})))),r.createElement("div",{className:"flex-1 min-h-0"},r.createElement(O,{onComplete:z,onBack:()=>j("onboarding"),userEmail:null==P?void 0:P.email})))):"loading"===C?r.createElement(M,{onComplete:()=>{j("dataRequest")}}):r.createElement(K,{visible:k,onClose:L,showBackButton:"training"===C,onBack:()=>{"email"===C&&j("welcome"),"onboarding"===C&&j("email"),"pin"===C&&j("onboarding"),"training"===C&&j("pin")},title:(()=>{switch(C){case"welcome":case"email":default:return"";case"onboarding":return"Connect Your Data";case"pin":return"Secure Your Account";case"training":return"Training Your Model";case"dataRequest":return"Data Request"}})(),subtitle:(()=>{switch(C){case"welcome":case"email":default:return"";case"onboarding":return"Choose which accounts to connect for a personalized experience";case"pin":return"Create a secure PIN to protect your data";case"training":return"Building your personalized insights";case"dataRequest":return"Select the data you want to share with ".concat(n)}})(),icon:(()=>{switch(C){case"welcome":case"email":default:return"";case"onboarding":return"๐";case"pin":return"๐";case"training":return"โก";case"dataRequest":return"๐"}})(),centerContent:!0},(()=>{switch(C){case"welcome":return r.createElement(o,{onContinue:B,onClose:L,webpageName:n,appIcon:h,testMode:i});case"email":return r.createElement("div",{className:"h-[min(85vh,700px)]"},r.createElement(v,{onSuccess:U,testMode:i}));case"onboarding":return r.createElement(S,{onComplete:T,onBack:()=>j("email"),appIcon:h||"https://onairos.sirv.com/Images/OnairosBlack.png",appName:n,username:(null==P?void 0:P.email)||(null==P?void 0:P.username),testMode:i,priorityPlatform:E});case"pin":return r.createElement(O,{onComplete:z,userEmail:null==P?void 0:P.email});case"training":return r.createElement(D,{onComplete:q,userEmail:null==P?void 0:P.email,appName:n,connectedAccounts:(null==P?void 0:P.connectedAccounts)||[],testMode:i});case"dataRequest":return r.createElement(_,{onComplete:W,userEmail:null==P?void 0:P.email,requestData:t,appName:n,autoFetch:s,testMode:i,appIcon:h,connectedAccounts:(null==P?void 0:P.connectedAccounts)||{}});default:return r.createElement("div",{className:"flex flex-col items-center space-y-4 p-6"},r.createElement("div",{className:"animate-spin h-8 w-8 border-2 border-blue-600 rounded-full border-t-transparent"}),r.createElement("p",{className:"text-gray-600"},"Loading..."))}})())))}},287:(e,t)=>{var n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.iterator;var f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,y={};function h(e,t,n){this.props=e,this.context=t,this.refs=y,this.updater=n||f}function b(){}function v(e,t,n){this.props=e,this.context=t,this.refs=y,this.updater=n||f}h.prototype.isReactComponent={},h.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},h.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=h.prototype;var x=v.prototype=new b;x.constructor=v,g(x,h.prototype),x.isPureReactComponent=!0;var w=Array.isArray,E=Object.prototype.hasOwnProperty,k={current:null},N={key:!0,ref:!0,__self:!0,__source:!0};function C(e,t,r){var o,a={},l=null,s=null;if(null!=t)for(o in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(l=""+t.key),t)E.call(t,o)&&!N.hasOwnProperty(o)&&(a[o]=t[o]);var i=arguments.length-2;if(1===i)a.children=r;else if(1<i){for(var c=Array(i),u=0;u<i;u++)c[u]=arguments[u+2];a.children=c}if(e&&e.defaultProps)for(o in i=e.defaultProps)void 0===a[o]&&(a[o]=i[o]);return{$$typeof:n,type:e,key:l,ref:s,props:a,_owner:k.current}}function S(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}var O=/\/+/g;function j(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function P(e,t,o,a,l){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var i=!1;if(null===e)i=!0;else switch(s){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case n:case r:i=!0}}if(i)return l=l(i=e),e=""===a?"."+j(i,0):a,w(l)?(o="",null!=e&&(o=e.replace(O,"$&/")+"/"),P(l,t,o,"",function(e){return e})):null!=l&&(S(l)&&(l=function(e,t){return{$$typeof:n,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(l,o+(!l.key||i&&i.key===l.key?"":(""+l.key).replace(O,"$&/")+"/")+e)),t.push(l)),1;if(i=0,a=""===a?".":a+":",w(e))for(var c=0;c<e.length;c++){var u=a+j(s=e[c],c);i+=P(s,t,o,u,l)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=p&&e[p]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),c=0;!(s=e.next()).done;)i+=P(s=s.value,t,o,u=a+j(s,c++),l);else if("object"===s)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return i}function I(e,t,n){if(null==e)return e;var r=[],o=0;return P(e,r,"","",function(e){return t.call(n,e,o++)}),r}function A(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var R={current:null},L={transition:null},_={ReactCurrentDispatcher:R,ReactCurrentBatchConfig:L,ReactCurrentOwner:k};function D(){throw Error("act(...) is not supported in production builds of React.")}t.Children={map:I,forEach:function(e,t,n){I(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return I(e,function(){t++}),t},toArray:function(e){return I(e,function(e){return e})||[]},only:function(e){if(!S(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=h,t.Fragment=o,t.Profiler=l,t.PureComponent=v,t.StrictMode=a,t.Suspense=u,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_,t.act=D,t.cloneElement=function(e,t,r){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o=g({},e.props),a=e.key,l=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(l=t.ref,s=k.current),void 0!==t.key&&(a=""+t.key),e.type&&e.type.defaultProps)var i=e.type.defaultProps;for(c in t)E.call(t,c)&&!N.hasOwnProperty(c)&&(o[c]=void 0===t[c]&&void 0!==i?i[c]:t[c])}var c=arguments.length-2;if(1===c)o.children=r;else if(1<c){i=Array(c);for(var u=0;u<c;u++)i[u]=arguments[u+2];o.children=i}return{$$typeof:n,type:e.type,key:a,ref:l,props:o,_owner:s}},t.createContext=function(e){return(e={$$typeof:i,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:s,_context:e},e.Consumer=e},t.createElement=C,t.createFactory=function(e){var t=C.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:c,render:e}},t.isValidElement=S,t.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:A}},t.memo=function(e,t){return{$$typeof:m,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=L.transition;L.transition={};try{e()}finally{L.transition=t}},t.unstable_act=D,t.useCallback=function(e,t){return R.current.useCallback(e,t)},t.useContext=function(e){return R.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return R.current.useDeferredValue(e)},t.useEffect=function(e,t){return R.current.useEffect(e,t)},t.useId=function(){return R.current.useId()},t.useImperativeHandle=function(e,t,n){return R.current.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return R.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return R.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return R.current.useMemo(e,t)},t.useReducer=function(e,t,n){return R.current.useReducer(e,t,n)},t.useRef=function(e){return R.current.useRef(e)},t.useState=function(e){return R.current.useState(e)},t.useSyncExternalStore=function(e,t,n){return R.current.useSyncExternalStore(e,t,n)},t.useTransition=function(){return R.current.useTransition()},t.version="18.3.1"},540:(e,t,n)=>{e.exports=n(287)}}]);
|
|
2
2
|
//# sourceMappingURL=241.js.map
|