1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[608],{299:(e,t,o)=>{o.d(t,{D:()=>r,ThemeProvider:()=>a});var i=o(5155),n=o(2115);let s=(0,n.createContext)({theme:"system",setTheme:()=>null});function a(e){let{children:t,defaultTheme:o="system",storageKey:a="amazon-ai-space-theme"}=e,[r,c]=(0,n.useState)(()=>{try{return window.localStorage.getItem(a)||o}catch(e){return console.error("Error reading theme from localStorage",e),o}});return(0,n.useEffect)(()=>{let e=window.document.documentElement;e.classList.remove("light","dark");let t=r;"system"===r&&(t=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),e.classList.add(t);try{window.localStorage.setItem(a,r)}catch(e){console.error("Error saving theme to localStorage",e)}},[r,a]),(0,n.useEffect)(()=>{let e=window.matchMedia("(prefers-color-scheme: dark)"),t=()=>{if("system"===r){let t=window.document.documentElement;t.classList.remove("light","dark"),t.classList.add(e.matches?"dark":"light")}};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[r]),(0,i.jsx)(s.Provider,{value:{theme:r,setTheme:e=>{c(e)}},children:t})}let r=()=>{let e=(0,n.useContext)(s);if(void 0===e)throw Error("useTheme must be used within a ThemeProvider");return e}},5813:(e,t,o)=>{let i,n,s;o.d(t,{Sk:()=>u,db:()=>s,gE:()=>l,j2:()=>n,nx:()=>d,pA:()=>h});var a=o(3915),r=o(3004),c=o(5317);console.log("[FirebaseConfig] Reading environment variables:"),console.log("[FirebaseConfig] NEXT_PUBLIC_FIREBASE_API_KEY: ".concat("Exists")),console.log("[FirebaseConfig] NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ".concat("Exists")),console.log("[FirebaseConfig] NEXT_PUBLIC_FIREBASE_PROJECT_ID: ".concat("Exists")),console.log("[FirebaseConfig] NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ".concat("Exists")),console.log("[FirebaseConfig] NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ".concat("Exists")),console.log("[FirebaseConfig] NEXT_PUBLIC_FIREBASE_APP_ID: ".concat("Exists"));let u={apiKey:"AIzaSyAzxTypCwCnPEjw5vA9ZFx6NkAjupgODYM",authDomain:"ai-space-9b54a.firebaseapp.com",projectId:"amazon-ai-space",storageBucket:"amazon-ai-space.firebasestorage.app",messagingSenderId:"579843975081",appId:"1:579843975081:web:69bf04d2926ed0d92306b8",measurementId:""};console.log("[FirebaseConfig] Firebase configuration object to be used:",u);let l=!0,d=[];if((!u.apiKey||u.apiKey.length<10)&&(l=!1,d.push("NEXT_PUBLIC_FIREBASE_API_KEY")),u.authDomain&&(u.authDomain.includes(".firebaseapp.com")||u.authDomain.includes(".firebaselogin.com"))||(l=!1,d.push("NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN")),(!u.projectId||u.projectId.length<3)&&(l=!1,d.push("NEXT_PUBLIC_FIREBASE_PROJECT_ID")),u.storageBucket||d.push("NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET (Recommended)"),u.messagingSenderId||d.push("NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID (Recommended)"),u.appId||d.push("NEXT_PUBLIC_FIREBASE_APP_ID (Recommended)"),l?console.log("[FirebaseConfig] All critical Firebase configuration keys appear to be present and have basic validity."):console.warn("[FirebaseConfig] CRITICAL Firebase configuration keys are MISSING or appear INVALID: ".concat(d.join(", "),'. Firebase features will be degraded or disabled. PLEASE CHECK YOUR .env.local FILE and ensure your current domain is added to "Authorized domains" in Firebase Authentication settings, THEN RESTART THE APP.')),(0,a.Dk)().length)i=(0,a.Sx)(),console.log("[FirebaseConfig] Firebase app already initialized. App name: ".concat(i.name));else if(console.log("[FirebaseConfig] No Firebase apps initialized yet. Attempting initializeApp..."),l)try{i=(0,a.Wp)(u),console.log("[FirebaseConfig] initializeApp successful. App name: ".concat(i.name))}catch(e){console.error("[FirebaseConfig] Firebase initializeApp CRITICAL ERROR with provided config:",e.message,e.code,e.stack,e),i={name:"dummy-app-init-error",options:{},automaticDataCollectionEnabled:!1},l=!1,d.push("INITIALIZATION_FAILED")}else console.warn("[FirebaseConfig] Skipping initializeApp due to missing critical configuration."),i={name:"dummy-app-missing-config",options:{},automaticDataCollectionEnabled:!1};if(i&&i.name&&!i.name.startsWith("dummy-app-")&&i.options&&(i.options.apiKey||u.apiKey)){console.log("[FirebaseConfig] Firebase app object appears valid. Attempting to get Auth and Firestore instances...");try{n=(0,r.xI)(i),console.log("[FirebaseConfig] getAuth successful.")}catch(e){console.error("[FirebaseConfig] Firebase getAuth CRITICAL ERROR:",e.message,e.code,e.stack,e),n={name:"dummy-auth-getAuth-error",onAuthStateChanged:()=>()=>{}},l=!1,d.push("GET_AUTH_FAILED")}try{s=(0,c.aU)(i),console.log("[FirebaseConfig] getFirestore successful.")}catch(e){console.error("[FirebaseConfig] Firebase getFirestore CRITICAL ERROR:",e.message,e.code,e.stack,e),s={type:"firestore-dummy-getfirestore-error"},l=!1,d.push("GET_FIRESTORE_FAILED")}}else console.warn("[FirebaseConfig] Firebase app object is a DUMMY or INVALID. Auth and Firestore will be dummy objects. This usually means initialization failed or config was incomplete."),n={n
1ame:"dummy-auth-app-invalid",onAuthStateChanged:()=>()=>{}},s={type:"firestore-dummy-app-invalid"},l&&console.error("[FirebaseConfig] CRITICAL: Firebase app object was not properly initialized despite config values appearing to be present. Auth and Firestore disabled. This could be due to an issue with initializeApp itself or network problems preventing validation.");let h=new r.HF;h.setCustomParameters({prompt:"select_account"}),console.log("[FirebaseConfig] GoogleAuthProvider configured.")},7481:(e,t,o)=>{o.d(t,{dj:()=>h});var i=o(2115);let n=0,s=new Map,a=e=>{if(s.has(e))return;let t=setTimeout(()=>{s.delete(e),l({type:"REMOVE_TOAST",toastId:e})},1e6);s.set(e,t)},r=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:o}=t;return o?a(o):e.toasts.forEach(e=>{a(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===o||void 0===o?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},c=[],u={toasts:[]};function l(e){u=r(u,e),c.forEach(e=>{e(u)})}function d(e){let{...t}=e,o=(n=(n+1)%Number.MAX_SAFE_INTEGER).toString(),i=()=>l({type:"DISMISS_TOAST",toastId:o});return l({type:"ADD_TOAST",toast:{...t,id:o,open:!0,onOpenChange:e=>{e||i()}}}),{id:o,dismiss:i,update:e=>l({type:"UPDATE_TOAST",toast:{...e,id:o}})}}function h(){let[e,t]=i.useState(u);return i.useEffect(()=>(c.push(t),()=>{let e=c.indexOf(t);e>-1&&c.splice(e,1)}),[e]),{...e,toast:d,dismiss:e=>l({type:"DISMISS_TOAST",toastId:e})}}},8437:(e,t,o)=>{o.d(t,{A:()=>l,AuthProvider:()=>u});var i=o(5155),n=o(5813),s=o(3004),a=o(2115),r=o(7481);let c=(0,a.createContext)(void 0),u=e=>{let{children:t}=e,[o,u]=(0,a.useState)(null),[l,d]=(0,a.useState)(!0),[h,g]=(0,a.useState)(n.gE),{toast:p}=(0,r.dj)();console.log("[AuthContext] Initializing. firebaseHasCompleteConfig from module: ".concat(n.gE)),console.log("[AuthContext] Auth object name from firebase-config: ".concat(n.j2?n.j2.name:"N/A")),(0,a.useEffect)(()=>{if(!n.gE){g(!1),d(!1);let e=n.nx.join(", "),t="Firebase config is INCOMPLETE or INVALID (missing/invalid keys: ".concat(e||"N/A",'). Features like Auth and Firestore will NOT work. CRITICAL: 1) Ensure all NEXT_PUBLIC_FIREBASE_ environment variables in .env.local are correct. 2) Your website domain (e.g., localhost, your .cloudworkstations.dev URL) MUST be in "Authorized domains" in Firebase Authentication settings. 3) RESTART your app after fixing.');console.error("[AuthContext] ".concat(t)),p({variant:"destructive",title:"Firebase Setup Error (Critical)",description:t,duration:3e4});return}if(g(!0),n.j2&&"function"==typeof n.j2.onAuthStateChanged&&!n.j2.name.startsWith("dummy-auth")){console.log("[AuthContext] Firebase auth object appears valid, setting up onAuthStateChanged listener.");let e=(0,s.hg)(n.j2,e=>{console.log("[AuthContext] onAuthStateChanged triggered. User: ".concat(e?e.uid:"null")),u(e),d(!1)},e=>{console.error("[AuthContext] Firebase onAuthStateChanged CRITICAL LISTENER ERROR:",e),u(null),d(!1),p({variant:"destructive",title:"Auth Listener Error",description:"Could not listen for authentication changes (Code: ".concat(e.code||"N/A",'). Auth may not work. Check console and Firebase setup. Ensure "Authorized domains" are correct in Firebase Console.'),duration:15e3})});return()=>{console.log("[AuthContext] Unsubscribing from onAuthStateChanged."),e()}}{d(!1),g(!1);let e=n.j2?n.j2.name:"null",t="Firebase Auth object is NOT correctly initialized (auth.name: ".concat(e,") despite initial config seeming OK. Authentication features disabled. Check .env.local, Firebase Console (\"Authorized domains\"), restart the app, and look for errors from 'firebase-config.ts' in console.");console.error("[AuthContext] ".concat(t)),p({variant:"destructive",title:"Authentication System Critical Error",description:t,duration:3e4})}},[p]);let m=async()=>{let e=n.j2&&!n.j2.name.startsWith("dummy-auth"),t="function"==typeof s.df;if(console.log("[AuthContext signInWithGoogle Attempt] Values being checked:\n - isFirebaseConfigured (state): ".concat(h,"\n - firebaseHasCompleteConfig (from module): ").concat(n.gE,"\n - auth object valid: ").concat(!!n.j2,"\n - auth.name: ").concat(n.j2?n.j2.name:"N/A","\n - signInWithPopup (imported) is function: ").concat(t,"\n - Using authDomain: ").concat(n.Sk.authDomain||"NOT SET")),!h||!e||!t||!n.Sk.authDomain){p({variant:"destructive",title:"Configuration Error",description:"Firebase is not configured correctly for sign-in. Please check setup (especially NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN), authorized domains in Firebase console, and restart your app. Ensure all NEXT_PUBLIC_FIREBASE_ environment variables are correct."}),console.error("[AuthContext signInWithGoogle] Pre-flight check failed. Aborting sign-in.",{isFirebaseConfigured:h,authName:null===n.j2||void 0===n.j2?void 0:n.j2.name,signInPopupType:typeof s.df,authDomain:n.Sk.authDomain});return}console.log("[AuthContext signInWithGoogle] Pre-flight checks passed. Attempting sign
1InWithPopup..."),console.log("[AuthContext signInWithGoogle] Using auth object name:",null===n.j2||void 0===n.j2?void 0:n.j2.name),console.log("[AuthContext signInWithGoogle] Using googleAuthProvider object (providerId):",null===n.pA||void 0===n.pA?void 0:n.pA.providerId),d(!0);try{var o;let e=await (0,s.df)(n.j2,n.pA);console.log("[AuthContext signInWithGoogle] signInWithPopup successful. User should be updated by onAuthStateChanged. User from result:",null==e||null==(o=e.user)?void 0:o.uid)}catch(o){console.error("[AuthContext signInWithGoogle] Full error object during signInWithPopup:",JSON.parse(JSON.stringify(o)));let e="Sign-in Failed",t="".concat(o.message||"Could not sign in with Google."," (Code: ").concat(o.code||"N/A",")");"auth/unauthorized-domain"===o.code?(e="Unauthorized Domain",t="This app's domain is not authorized for Firebase sign-in. Please ADD THE CURRENT DOMAIN to 'Authorized domains' in Firebase Console: Authentication -> Settings. Then, restart your app."):"auth/api-key-not-valid"===o.code?(e="Invalid API Key",t="The Firebase API Key is not valid. Please check your .env.local file, ensure it's correct, and restart your app. Also verify API key restrictions in Google Cloud Console."):"auth/operation-not-allowed"===o.code?(e="Sign-in Method Disabled",t="Google Sign-In is not enabled for this Firebase project. Please enable it in the Firebase console (Authentication -> Sign-in method)."):"auth/popup-closed-by-user"===o.code?(e="Google Sign-In Cancelled/Interrupted",t="The Google Sign-In popup closed before completing. This is often due to: 1) Manually closing it. 2) Browser extensions (ad-blockers, privacy tools) interfering. 3) Strict browser popup settings. 4) Network issues preventing the popup from loading or communicating. 5) Specific settings in your Cloud Workstation environment. Please: Disable extensions, check browser popup settings, and try again. If the issue persists, investigate your browser/environment for interference with popups.",console.warn("[AuthContext] Google Sign-In popup was closed or c
1ommunication was lost. This might be due to user action, browser extensions, or environment policies. Error code:",o.code,"Message:",o.message)):"auth/internal-error"===o.code&&o.message&&o.message.includes("authDomain")?(e="Auth Domain Configuration Issue",t="There seems to be an issue with the authDomain configuration ('".concat(n.Sk.authDomain,"') or how it's being used for redirects. Ensure your Firebase config has the correct 'authDomain' and it's correctly listed in your Google Cloud Console OAuth Client's 'Authorized redirect URIs' as https://").concat(n.Sk.authDomain,"/__/auth/handler. (Code: ").concat(o.code,")")):(o.message&&(o.message.toLowerCase().includes("this browser or app may not be secure")||o.message.includes("ERR_BLOCKED_BY_CLIENT")||o.message.includes("popup_closed_by_browser"))||"auth/internal-error"===o.code&&!o.message.includes("authDomain"))&&(e="Google Sign-In Blocked (Security/Config)",t="Google couldn't complete the sign-in, possibly due to security settings or configuration. Check: 1) Google Cloud OAuth consent screen (if \"testing\", is your email a test user?). 2) API key restrictions (HTTP referrers should include '".concat(window.location.origin,"'). 3) OAuth client redirect URIs (must include 'https://").concat(n.Sk.authDomain,"/__/auth/handler'). Verify these in Google Cloud Console (APIs & Services -> OAuth consent screen / Credentials). Also check for browser extension interference. (Code: ").concat(o.code||"N/A",")")),p({variant:"destructive",title:e,description:t,duration:2e4}),d(!1)}},f=async(e,t)=>{if(!h||!n.j2||n.j2.name.startsWith("dummy-auth")){p({variant:"destructive",title:"Configuration Error",description:"Firebase is not configured correctly for sign-up. Cannot proceed."}),console.error("[AuthContext signUpWithEmailPassword] Aborted due to Firebase config/auth object issue.");return}d(!0);try{await (0,s.eJ)(n.j2,e,t),p({title:"Sign Up Successful",description:"Your account has been created."})}catch(e){console.error("Error signing up:",e),p({variant:"destructive",title:"Sign Up Failed",description:e.message||"Could not create account."}),d(!1)}},A=async(e,t)=>{if(!h||!n.j2||n.j2.name.startsWith("dummy-auth")){p({variant:"destructive",title:"Configuration Error",description:"Firebase is not configured correctly for sign-in. Cannot proceed."}),console.error("[AuthContext signInWithEmailPassword] Aborted due to Firebase config/auth object issue.");return}d(!0);try{await (0,s.x9)(n.j2,e,t)}catch(e){console.error("Error signing in with email/password:",e),p({variant:"destructive",title:"Sign In Failed",description:e.message||"Could not sign in. Check email/password."}),d(!1)}},C=async()=>{let e=n.j2&&!n.j2.name.startsWith("dummy-auth"),t="function"==typeof s.CI;if(console.log("[AuthContext signOut Attempt] Values being checked:\n - isFirebaseConfigured (state): ".concat(h,"\n - auth object valid: ").concat(!!n.j2,"\n - auth.name: ").concat(n.j2?n.j2.name:"N/A","\n - firebaseSignOut (imported) is function: ").concat(t)),!h||!e||!t){p({variant:"destructive",title:"Configuration Error",description:"Firebase is not configured correctly for sign-out. Check setup and restart."}),console.error("[AuthContext signOut] Pre-flight check failed. Aborting sign-out.",{isFirebaseConfigured:h,authName:null===n.j2||void 0===n.j2?void 0:n.j2.name,firebaseSignOutType:typeof s.CI});return}try{await (0,s.CI)(n.j2),console.log("[AuthContext signOut] firebaseSignOut successful. User should be updated by onAuthStateChanged.")}catch(e){console.error("Error signing out:",e),p({variant:"destructive",title:"Sign-out Failed",description:e.message||"Could not sign out. Please try again."})}};return(0,i.jsx)(c.Provider,{value:{user:o,isLoading:l,signInWithGoogle:m,signUpWithEmailPassword:f,signInWithEmailPassword:A,signOut:C,isFirebaseConfigured:h},children:t})},l=()=>{let e=(0,a.useContext)(c);if(void 0===e)throw Error("useAuth must be used within an AuthProvider");return e}},9434:(e,t,o)=>{o.d(t,{Y:()=>a,cn:()=>s});var i=o(2596),n=o(9688);function s(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];return(0,n.QP)((0,i.$)(t))}function a(){if("undefined"==typeof navigator||!navigator.language)return"https://www.amazon.com/s";let e=navigator.language.toLowerCase();return e.startsWith("en-gb")?"https://www.amazon.co.uk/s":e.startsWith("de")?"https://www.amazon.de/s":e.startsWith("fr")&&!e.startsWith("fr-ca")?"https://www.amazon.fr/s":e.startsWith("es")?"es-mx"===e?"https://www.amazon.com.mx/s":"https://www.amazon.es/s":e.startsWith("it")?"https://www.amazon.it/s":e.startsWith("ja")?"https://www.amazon.co.jp/s":e.startsWith("en-au")?"https://www.amazon.com.au/s":e.startsWith("en-ca")||e.startsWith("fr-ca")?"https://www.amazon.ca/s":e.startsWith("pt-br")?"https://www.amazon.com.br/s":e.startsWith("nl")?"https://www.amazon.nl/s":e.startsWith("en-in")?"https://www.amazon.in/s":"https://www.amazon.com/s"}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.