1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4285],{4285:(e,t,a)=>{a.r(t),a.d(t,{default:()=>N});var n=a(95155),s=a(12115),i=a(17951),r=a(3998),l=a(86948),o=a(20063),c=a(82021),d=a(62890),g=a(5917),u=a(75426),m=a(18514),h=a(95740),p=a(90368),f=a(27937),x=a(18085),y=a(51834),b=a(48612);function N(e){var t;let{user:a}=e,N=(0,o.useRouter)(),{toast:v}=(0,c.dj)(),[w,T]=(0,s.useState)(!0),[j,E]=(0,s.useState)(!1),[S,_]=(0,s.useState)(!0),[C,A]=(0,s.useState)(!1),[I,k]=(0,s.useState)(!1);(0,s.useRef)(!0);let[R,O]=(0,s.useState)(null),[D,L]=(0,s.useState)(""),[P,M]=(0,s.useState)(null),[U,F]=(0,s.useState)(!1),[q,B]=(0,s.useState)(null);(0,s.useRef)(null);let[G,Y]=(0,s.useState)(!1),[z,J]=(0,s.useState)(null),[H,X]=(0,s.useState)(""),[$,W]=(0,s.useState)("Hi! I can help you refine this Tagline. What would you like to change about it? For example, you could tell me to make it more specific, change the tone, focus on different benefits, or adjust the language."),[V,K]=(0,s.useState)(""),[Z,Q]=(0,s.useState)([]),[ee,et]=(0,s.useState)(0),[ea,en]=(0,s.useState)(()=>{{let e=localStorage.getItem("tagline_brand_dna_collapsed");return!e||!0===JSON.parse(e)}}),[es,ei]=(0,s.useState)([]),[er,el]=(0,s.useState)({businessName:"",industry:"",productsServices:"",idealClient:"",painPoints:"",differentiator:""}),[eo,ec]=(0,s.useState)({}),[ed,eg]=(0,s.useState)({}
1),[eu,em]=(0,s.useState)([]),[eh,ep]=(0,s.useState)(!1),[ef,ex]=(0,s.useState)(!1),[ey,eb]=(0,s.useState)(""),[eN,ev]=(0,s.useState)(!1),ew=()=>{if(a)try{let e={taglines:es,selectedId:null==R?void 0:R.id,customContent:D,isSelected:!!R};localStorage.setItem("tagline_data_".concat(a.id),JSON.stringify(e)),console.log("Cached Tagline data to localStorage")}catch(e){console.error("Error caching Tagline data:",e)}};(0,s.useEffect)(()=>{if(!a)return;let e=!0;return(async()=>{console.log("Initializing taglines for user:",a.id);try{let{data:t,error:n}=await d.N.from("user_taglines").select("*").eq("user_id",a.id).order("created_at",{ascending:!1});if(!n&&t&&t.length>0&&e){console.log("Found existing taglines in database, loading them");let e=t.map(e=>({id:"tagline-".concat(e.id),label:e.label||"Custom Tagline",strategy:e.strategy||"CUSTOM",description:e.description||"",content:e.content,is_selected:e.is_selected||!1,db_id:e.id}));ei(e);let n=t.find(e=>!0===e.is_selected);if(n){let t=e.find(e=>e.db_id===n.id);t&&(console.log("Restoring selected tagline:",t.content),O(t),L(t.content))}else console.log("No tagline selected in database"),O(null),L("");T(!1),A(!0);let s="taglines_".concat(a.id);localStorage.setItem(s,JSON.stringify(e)),console.log("Successfully loaded taglines from database");return}}catch(e){console.log("Database check failed, falling back to localStorage:",e)}let t="taglines_".concat(a.id),n=localStorage.getItem(t);if(n&&e)try{let e=JSON.parse(n);if(console.log("Found cached taglines, loading immediately"),ei(e.taglines||e),e.selectedId&&e.isSelected&&e.taglines){let t=e.taglines.find(t=>t.id===e.selectedId);t&&(console.log("Restoring selected tagline from cache:",t.content),O(t),L(e.customContent||""))}else O(null),L("");T(!1),A(!0);return}catch(e){console.error("Error parsing cached taglines:",e)}e&&!j&&(console.log("No existing taglines found, generating new ones"),await eT())})(),()=>{e=!1}},[a]);let eT=async()=>{if(!j){if(es.length>0){console.log("Taglines already loaded, skipping generation"),T(!1),E(!1);return}E(!0),T(!0);try{let{data:e}=await d.N.from("brand_attribute_selections").select("*").eq("user_id",a.id),t={};null==e||e.forEach(e=>{e.number1&&(t[e.category]=e.number1)}),ec(t);let{data:n}=await d.N.from("brand_profiles").select("*").eq("user_id",a.id).single(),s={businessName:(null==n?void 0:n.business_name)||"",industry:(null==n?void 0:n.industry)||"",productsServices:(null==n?void 0:n.products_services)||"",idealClient:(null==n?void 0:n.ideal_client)||"",painPoints:(null==n?void 0:n.pain_points)||"",differentiator:(null==n?void 0:n.differentiator)||""};el(s);let{data:i}=await d.N.from("archetypes").select("*").eq("user_id",a.id).limit(2);em(i||[]),await ej(t,s,i||[])}catch(e){console.error("Error loading user data:",e),E(!1),T(!1)}}},ej=async(e,t,n)=>{let s=n.length?n.map(e=>"".concat(e.is_primary?"Primary":"Secondary"," Archetype: ").concat(e.archetype_name)).join("\n"):"No archetypes defined",i="Generate 8 unique taglines for a brand with the following information:\n\nBUSINESS CONTEXT:\nBusiness Name: ".concat(t.businessName,"\nIndustry: ").concat(t.industry,"\nProducts/Services: ").concat(t.productsServices,"\nIdeal Client: ").concat(t.idealClient,"\nCustomer Pain Points: ").concat(t.painPoints,"\nKey Differentiator: ").concat(t.differentiator,"\n\nBRAND ARCHETYPES:\n").concat(s,"\n\nEach Tagline should be concise, emotionally resonant, and aligned with the brand's tone and target audience.\nFormat the response as a JSON array of objects with id, label, strategy, description, and content fields.");try{var r;let e=await fetch("/api/transform",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:i,type:"tagline_list"})}),t=(null==(r=(await e.json()).result)?void 0:r.map(e=>({id:e.id||"tagline-".concat(Date.now(),"-").concat(Math.random().toString(36).substring(2,9)),label:e.label||e.strategy||"Custom Tagline",strategy:e.strategy||"CUSTOM",description:e.description||"",content:e.content||"Generated tagline"})))||[];if(t.length>0){console.log("Generated taglines successfully:",t),ei(t),O(null),L("");let e="taglines_".concat(a.id);localStorage.setItem(e,JSON.stringify(t)),await eE(t),A(!0),T(!1),E(!1),v({title:"Taglines Generated",description:"Unique taglines have been created based on your brand profile.",className:"bg-white"})}}catch(e){console.error("Error generating taglines:",e),E(!1),T(!1)}},eE=async e=>{if(a)try{console.log("Saving taglines to database...");let{error:t}=await d.N.from("user_taglines").delete().eq("user_id",a.id);t&&console.log("Delete error (may be expected if no existing records):",t);let n=e.map(e=>({user_id:a.id,content:e.content,strategy:e.strategy,label:e.label,description:e.description,updated_at:new Date().toISOString()})),{error:s}=await d.N.from("user_taglines").insert(n);if(s)return void console.error("Error inserting taglines:",s);console.log("Successfully saved all taglines to database")}catch(e){console.error("Error saving taglines to database:",e)}};(0,s.useEffect)(()=>{let e=e=>{if("use_tagline"===e.detail.action){L(e.detail.tagline);let t=es.find(t=>t.content===e.detail.tagline);if(t)O(t);else if(q){let t=es.map(t=>
1t.id===q?{...t,content:e.detail.tagline}:t);ei(t);let a=t.find(e=>e.id===q);a&&O(a)}else O(null);B(null),R&&eR({...R,content:e.detail.tagline}),v({title:"Tagline Updated",description:"Your tagline has been updated with the AI-refined version.",className:"bg-white"})}};return window.addEventListener("synapse_tagline_update",e),()=>{window.removeEventListener("synapse_tagline_update",e)}},[es,q,v]),(0,s.useEffect)(()=>{if(!w&&a){_(!0);try{let e=localStorage.getItem("tagline_data_".concat(a.id));if(e){let{taglines:t,selectedId:a,customContent:n}=JSON.parse(e);if(console.log("Found cached Tagline data in localStorage"),t&&Array.isArray(t)){if(ei(t),a){let e=t.find(e=>e.id===a);e&&O(e)}n&&L(n),T(!1)}}}catch(e){console.error("Error loading cached Tagline data:",e)}}},[a,w]),(0,s.useEffect)(()=>{if(!w&&C){let e=()=>{if("hidden"===document.visibilityState)k(!0),ew();else if("visible"===document.visibilityState&&I){if(k(!1),a)try{let e=localStorage.getItem("tagline_data_".concat(a.id));if(e){let t=JSON.parse(e);if(console.log("Restoring Tagline state from cache after tab visibility change"),t.taglines&&Array.isArray(t.taglines)){if(ei(t.taglines),t.selectedId){let e=t.taglines.find(e=>e.id===t.selectedId);e&&O(e)}t.customContent&&L(t.customContent)}}}catch(e){console.error("Error restoring cached Tagline data:",e)}T(!1),E(!1)}};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}}},[w,C,a,I]),(0,s.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState?(console.log("[TaglineGenerator] Tab became visible again, checking for Taglines in database"),a&&(async()=>{try{let{data:e,count:t,error:n}=await d.N.from("user_taglines").select("*",{count:"exact"}).eq("user_id",a.id).limit(1);e&&e.length>0?(console.log("[TaglineGenerator] Found existing Taglines in database, stopping loading states"),T(!1),E(!1),A(!0)):(n||!e||0===e.length)&&(console.log("[TaglineGenerator] No Taglines found in database, might need to generate"),_(!0))}catch(e){console.error("[TaglineGenerator] Error checking Taglines in database:",e),_(!0)}})()):a&&C&&ew()};return document.addEventListener("visibilitychange",e),e(),()=>{document.removeEventListener("visibilitychange",e)}},[a,C]),(0,s.useEffect)(()=>{a||N.push("/login")},[a,N]),(0,s.useEffect)(()=>{if(!w){if(!a)return void N.push("/login");if(C&&!I&&!S){console.log("Skipping Tagline reload - already loaded or returning from tab change"),T(!1);return}I&&k(!1),(async()=>{if(!a){w||N.push("/login");return}_(!1);try{console.log("Loading user data for Tagline generation...");let e={},t={},n={businessName:"",industry:"",productsServices:"",idealClient:"",painPoints:"",differentiator:""},s=[],{data:i,error:r}=await d.N.from("brand_attribute_selections").select("*").eq("user_id",a.id);if(r)throw r;i&&i.length>0&&(i.forEach(a=>{a.number1&&(e[a.category]=a.number1),a.top5&&Array.isArray(a.top5)&&a.top5.length>0&&(t[a.category]=a.top5)}),ec(t=>({...t,...e})),eg(e=>({...e,...t})),console.log("Loaded brand DNA and top 5 data:",{dna:e,top5:t}));let{data:l,error:o}=await d.N.from("brand_profiles").select("*").eq("user_id",a.id).single();!o&&l&&(n={businessName:l.business_name||"",industry:l.industry||"",productsServices:l.products_services||"",idealClient:l.ideal_client||"",painPoints:l.pain_points||"",differentiator:l.differentiator||""},el(n),console.log("Loaded business info:",n));let{data:c,error:g}=await d.N.from("archetypes").select("*").eq("user_id",a.id).order("selected_at",{ascending:!1}).limit(2);if(!g&&c&&c.length>0){console.log("Fetched archetypes for Tagline Generator:",c);let e=c.find(e=>!0===e.is_primary),t=c.find(e=>!1===e.is_primary),a=[];e&&a.push(e),t&&a.push(t),console.log("Filtered archetypes for Tagline Generator:",a),s=a,em(s)}try{await d.N.rpc("exec_sql",{sql:"\n CREATE TABLE IF NOT EXISTS public.user_taglines (\n id SERIAL PRIMARY KEY,\n user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE,\n content TEXT NOT NULL,\n strategy TEXT,\n created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,\n UNIQUE (user_id, content)\n );\n "})}catch(e){console.log("Table creation attempt result:",e)}console.log("Checking for existing Taglines...");let{data:u,error:m,count:h}=await d.N.from("user_taglines").select("*",{count:"exact"}).eq("user_id",a.id).order("created_at",{ascending:!1});console.log("Tagline check result:",{count:h||(null==u?void 0:u.length)||0,hasError:!!m,errorCode:null==m?void 0:m.code,errorMessage:null==m?void 0:m.message,existingTaglineCount:(null==u?void 0:u.length)||0}),u&&u.length>0||j?(console.log("Database taglines found but handled by new loading logic"),T(!1)):(console.log("No existing taglines found, generating new ones"),setTimeout(async()=>{try{await eS({dnaData:e,top5Data:t,businessInfo:n,archetypes:s})}catch(e){console.error("Error during initial Tagline generation:",e),E(!1),T(!1)}},100))}catch(e){console.error("Error loading user data:",e),T(!1)}})()}},[a,w,N,j,v,S,C,I]),(0,s.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&(console.log("Page became visible - triggering refresh"),k(!0),_(!0))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[]);let eS=async e=>{if(console.log("Starting Tagline generation..."),E(!0),j)return void console.log("Already generating, skipping...");try{let t=(null==e?void 0:e.dnaData)||eo,n=(null==e?void 0:e.top5Data)||ed,s=(null==e?void 0:e.businessInfo)||er,i=(null==e?void 0:e.archetypes)||eu;console.log("Tagline generation using data:",{businessName:s.businessName,archetypes:i.map(e=>
1"".concat(e.archetype_name," (").concat(e.is_primary?"primary":"secondary",")")),dna:t}),0!==Object.keys(t).length&&s.businessName||console.warn("Missing critical data for Tagline generation!");let r=i.length>0?i.filter(e=>!0===e.is_primary||!1===e.is_primary).map(e=>"".concat(e.is_primary?"Primary":"Secondary"," Archetype: ").concat(e.archetype_name)).join("\n"):"No archetypes defined",l="Generate 8 unique taglines for a brand with the following information:\n\nBUSINESS CONTEXT:\nBusiness Name: ".concat(s.businessName||"Not specified","\nIndustry: ").concat(s.industry||"Not specified","\nProducts/Services: ").concat(s.productsServices||"Not specified","\nIdeal Client: ").concat(s.idealClient||"Not specified","\nCustomer Pain Points: ").concat(s.painPoints||"Not specified","\nKey Differentiator: ").concat(s.differentiator||"Not specified","\n\nBRAND ARCHETYPES:\n").concat(r,"\n\nBRAND DNA ATTRIBUTES:\nCulture: ").concat(t.culture||"Experienced","\n").concat(n.culture?"Culture Top 5: ".concat(n.culture.join(", ")):"","\n\nCustomers: ").concat(t.customers||"Genuinely want to help others","\n").concat(n.customers?"Customers Top 5: ".concat(n.customers.join(", ")):"","\n\nVoice: ").concat(t.voice||"Dynamic"," \n").concat(n.voice?"Voice Top 5: ".concat(n.voice.join(", ")):"","\n\nFeeling: ").concat(t.feeling||"Clear","\n").concat(n.feeling?"Feeling Top 5: ".concat(n.feeling.join(", ")):"","\n\nImpact: ").concat(t.impact||"Clear Direction","\n").concat(n.impact?"Impact Top 5: ".concat(n.impact.join(", ")):"","\n\nX-Factor: ").concat(t.x_factor||"Left Brain, Right Brain","\n").concat(n.x_factor?"X-Factor Top 5: ".concat(n.x_factor.join(", ")):"","\n \nEach Tagline should:\n1. Follow a different strategy structure (e.g., Problem-Solution, Benefit-Focused, etc.)\n2. Be highly conversational and powerful - like something you'd say in an elevator pitch\n3. Be memorable and impactful enough to feature prominently on a homepage\n4. Use natural, compelling language that resonates emotionally with the target audience\n5. Reflect the brand archetype personality\n6. Address the customer pain points directly and empathetically\n7. Emphasize the key differentiator in a way that feels authentic, not boastful\n8. Maintain the brand voice and feeling\n9. Create an immediate connection with the audience\n \nFormat the response as a JSON array of objects with id, label, strategy, description, and content fields.");console.log("Sending API request to generate Taglines...");let o=Date.now(),c=new AbortController,g=setTimeout(()=>c.abort(),3e4),u=await fetch("/api/transform",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:l,type:"tagline_list"}),signal:c.signal});clearTimeout(g);let m=Date.now()-o;if(console.log("API request completed in ".concat(m,"ms")),!u.ok){let e=await u.text();throw console.error("API error response:",e),Error("API error: ".concat(u.status," - ").concat(e))}console.log("Received API response, parsing data...");let h=await u.json();if(console.log("API response parsed successfully:",h),!Array.isArray(h.result)||0===h.result.length)throw console.error("Invalid API response format or empty results:",h),Error("Invalid response format or no Taglines were generated");console.log("Setting ".concat(h.result.length," Taglines to state..."));let p=h.result.map(e=>({id:e.id||"tagline-".concat(Date.now(),"-").concat(Math.random().toString(36).substring(2,9)),label:e.label||e.strategy||"Custom Tagline",strategy:e.strategy||"CUSTOM",description:e.description||"",content:e.content||"Please regenerate this Tagline."}));if(console.log("Setting taglines state with:",p),ei(p),console.log("Taglines loaded, waiting for user selection"),O(null),L(""),A(!0),T(!1),a)try{console.log("Saving all Taglines to database...");try{await d.N.rpc("exec_sql",{sql:"\n CREATE TABLE IF NOT EXISTS public.user_taglines (\n id SERIAL PRIMARY KEY,\n user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE,\n content TEXT NOT NULL,\n strategy TEXT,\n created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,\n UNIQUE (user_id, content)\n );\n "})}catch(e){console.error("Error creating user_taglines table:",e)}try{await d.N.from("user_taglines").delete().eq("user_id",a.id),console.log("Deleted any existing Taglines for this user")}catch(e){console.warn("Error deleting existing Taglines:",e)}for(let e=0;e<p.length;e++){let t=p[e],n=new Date(Date.now()-10*e).toISOString(),{error:s}=await d.N.from("user_taglines").upsert({user_id:a.id,content:t.content,strategy:t.strategy,created_at:n});s&&console.error("Error saving Tagline ".concat(e+1,":"),s)}console.log("All Taglines saved to database")}catch(e){console.error("Error saving Taglines:",e)}v({title:"Taglines Generated",description:"Unique taglines have been created based on your brand profile.",className:"bg-white"});try{if(a){let e={taglines:p,selectedId:null,customContent:"",timestamp:new Date().toISOString()};localStorage.setItem("tagline_data_".concat(a.id),JSON.stringify(e)),console.log("Newly generated Tagline data cached to localStorage")}}catch(e){console.error("Error caching Tagline data after generation:",e)}}catch(e){console.error("Error generating initial Taglines:",e),ei(e=>e.map(e=>({...e,content:"Error generating Tagline. Please try regenerating.",description:""}))),v({title:"Generation failed",description:"There was a problem generating taglines. Please try again.",variant:"destructive"})}finally{console.log("Tagline generation process completed"),E(!1),T(!1)}},e_=async e=>{if((null==R?void 0:R.id)===e.id){if(O(null),L(""),a)try{let{error:e}=await d.N.from("user_taglines").update({is_selected:!1}).eq("user_id",a.id);e?console.log("Could not update is_selected (column may not exist):",e.message):console.log("Successfully unselected all taglines"),await (0,b.Fe)(a.id,5,"in_progress"),console.log("Toolkit progress updated: step 5 (Tagline Generator) marked as in_progress after deselection.")}catch(e){console.error("Error updating toolkit progress on deselection:",e)}return}if(O(e),L(e.content),a)try{let{error:t}=await d.N.from("user_taglines").update({is_selected:!1}).eq("user_id",a.id);t&&console.log("Could not unselect existing taglines:",t.message);let{data:n,error:s}=await d.N.from("user_taglines").select("*").eq("user_id",a.id).eq("content",e.content).limit(1).single();if(!s&&n){let{error:e}=await d.N.from("user_taglines").update({is_selected:!0}).eq("id",n.id);e?console.log("Could not mark tagline as selected:",e.message):console.log("Successfully marked tagline as selected")}else console.log("Could not find tagline in database to mark as
1selected");await (0,b.Fe)(a.id,5,"completed"),console.log("Toolkit progress updated: step 5 (Tagline Generator) completed.")}catch(e){console.error("Error updating tagline selection:",e)}await eR(e)},eC=()=>{Y(!1),B(null),K(""),X(""),W("Hi! I can help you refine this Tagline. What would you like to change about it? For example, you could tell me to make it more specific, change the tone, focus on different benefits, or adjust the language."),Q([]),et(0)},eA=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Text copied to clipboard";try{return await navigator.clipboard.writeText(e),v({title:"Copied!",description:t,className:"bg-white"}),!0}catch(e){return console.error("Failed to copy:",e),v({title:"Copy failed",description:"Could not copy to clipboard.",variant:"destructive"}),!1}},eI=async()=>{if(V.trim()&&z)try{K(""),X("Thinking...");let e=eu.length>0?eu.filter(e=>!0===e.is_primary||!1===e.is_primary).map(e=>"".concat(e.is_primary?"Primary":"Secondary"," Archetype: ").concat(e.archetype_name)).join("\n"):"No archetypes defined",t=await fetch("/api/transform",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:"Refine this tagline based on the user's request:\n \nOriginal Tagline: \"".concat(z.content,'"\nTagline Strategy: ').concat(z.strategy,'\nUser Request: "').concat(V,'"\n\nBUSINESS CONTEXT:\nBusiness Name: ').concat(er.businessName||"Not specified","\nIndustry: ").concat(er.industry||"Not specified","\nProducts/Services: ").concat(er.productsServices||"Not specified","\nIdeal Client: ").concat(er.idealClient||"Not specified","\nCustomer Pain Points: ").concat(er.painPoints||"Not specified","\nKey Differentiator: ").concat(er.differentiator||"Not specified","\n\nBRAND ARCHETYPES:\n").concat(e,"\n\nThe Tagline should:\n1. Address the user's specific feedback and requests\n2. Be conversational and powerful - like something you'd say in an elevator pitch\n3. Be memorable and impactful enough to feature prominently on a homepage\n4. Use natural, compelling language that resonates emotionally with the target audience\n5. Reflect the brand archetype personality\n6. Maintain the ").concat(z.strategy," structure when appropriate\n\nIMPORTANT: Respond with ONLY two paragraphs:\nParagraph 1: A brief explanation of the changes you made (1-2 sentences)\nParagraph 2: ONLY the refined Tagline text with no numbering, quotes, or other formatting."),type:"tagline"})});if(!t.ok)throw Error("API error: ".concat(t.status));let a=(await t.json()).result;Q(e=>{if(e.length>0&&e[e.length-1]===a)return e;let t=[...e,a];return et(t.length-1),t}),X(a)}catch(e){console.error("Error refining Tagline:",e),X("Sorry, I encountered an error while refining your Tagline. Please try again.")}},ek=async()=>{if(z&&H)try{let e=H,t=H.split("\n\n");if(t.length>1&&(e=t[t.length-1]),e=e.replace(/^\d+\.\s*/,"").replace(/^["']|["']$/g,"").trim(),console.log("Applying refined Tagline:",e),ei(t=>t.map(t=>t.id===z.id?{...t,content:e}:t)),R&&R.id===z.id){L(e);let t=es.find(e=>e.id===z.id);t&&O(t)}try{console.log("Attempting to save Tagline to database"),await eR({...z,content:e}),console.log("Tagline saved successfully");let t=es.map(t=>t.id===z.id?{...t,content:e}:t);ei(t);let n="taglines_".concat(a.id);localStorage.setItem(n,JSON.stringify(t))}catch(e){console.error("Error saving refined tagline:",e)}}catch(e){console.error("Error applying refined Tagline:",e),v({title:"Error",description:"There was a problem applying the refined Tagline.",variant:"destructive"})}};(0,s.useEffect)(()=>{!C||w||j||ew()},[es,R,D,C,w,j]);let eR=async e=>{if(!a)return void v({title:"Error",description:"You must be logged in to save taglines.",variant:"destructive",className:"bg-white"});try{console.log("Saving selected tagline:",e);let{error:t}=await d.N.from("user_taglines").update({is_selected:!1}).eq("user_id",a.id);t?console.log("Could not unselect existing taglines (is_selected column may not exist):",t.message):console.log("Successfully unselected all existing taglines");let{error:n}=await d.N.from("user_taglines").delete().eq("user_id",a.id).eq("strategy",e.strategy);n&&console.log("Delete error (may be expected if no existing record):",n);let s={user_id:a.id,content:e.content,strategy:e.strategy,label:e.label,description:e.description,updated_at:new Date().toISOString()};s.is_selected=!0;let{error:i}=await d.N.from("user_taglines").insert(s);if(i){console.error("Error saving tagline:",i),v({title:"Save failed",description:"There was a problem saving your tagline.",variant:"destructive",className:"bg-white"});return}await (0,b.Fe)(a.id,5,"completed"),v({title:"Tagline saved!",description:"Your selected tagline has been saved successfully.",className:"bg-white"}),console.log("Tagline saved successfully")}catch(e){console.error("Error in handleSaveTagline:",e),v({title:"Save failed",description:"There was a problem saving your tagline.",variant:"destructive",className:"bg-white"})}},eO=async()=>{eS()}
1,[eD,eL]=(0,s.useState)(!1);if((0,s.useEffect)(()=>{if(w&&!eD){let e=setTimeout(()=>{console.log("[TaglineGenerator] Loading timeout reached, forcing display"),T(!1),eL(!0),a&&(async()=>{try{let{data:e,error:t}=await d.N.from("user_taglines").select("*").eq("user_id",a.id).order("created_at",{ascending:!1});if(!t&&e&&e.length>0){console.log("[TaglineGenerator] Found ".concat(e.length," Taglines in database after timeout"));let t=new Map;e.forEach(e=>{e.strategy&&t.set(e.strategy,e)});let a=es.map(e=>{let a=t.get(e.strategy);return a?{...e,content:a.content}:e});ei(a);let n=e[0];L(n.content);let s=a.find(e=>e.strategy===n.strategy);s&&O(s),A(!0)}else{console.log("[TaglineGenerator] No Taglines found in database after timeout, trying localStorage");try{let e=localStorage.getItem("tagline_data_".concat(a.id));if(e){let t=JSON.parse(e);if(t.taglines&&Array.isArray(t.taglines)){if(ei(t.taglines),t.selectedId){let e=t.taglines.find(e=>e.id===t.selectedId);e&&O(e)}t.customContent&&L(t.customContent),A(!0)}}}catch(e){console.error("[TaglineGenerator] Error loading from cache during timeout:",e)}}}catch(e){console.error("[TaglineGenerator] Error checking database during timeout:",e)}})()},5e3);return()=>clearTimeout(e)}},[w,C,a,es]),w&&!eD&&!(null==(t=document)?void 0:t.visibilityState))return(0,n.jsx)("div",{className:"min-h-screen flex flex-col",children:(0,n.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("div",{className:"w-16 h-16 border-4 border-t-[#112248] border-r-[#112248] border-b-[#a7c140] border-l-[#a7c140] rounded-full animate-spin mx-auto mb-4"}),(0,n.jsx)("p",{className:"text-gray-600",children:"Loading tagline generator..."})]})})});let eP=async()=>{if(ey.trim()&&R)try{let e=es.map(e=>e.id===R.id?{...e,content:ey.trim()}:e);ei(e),L(ey.trim());let t=e.find(e=>e.id===R.id);t&&O(t),await eR({...R,content:ey.trim()}),v({title:"Tagline Updated",description:"Your tagline has been updated successfully.",className:"bg-white"}),ex(!1),eb("")}catch(e){console.error("Error saving manual edit:",e),v({title:"Error",description:"There was a problem updating the tagline.",variant:"destructive"})}},[eM,eU]=(0,s.useState)(!1),[eF,eq]=(0,s.useState)(null),eB={magician:{id:"magician",name:"The Magician",description:"Transformative, visionary, and powerful",characteristics:["Visionary","Transformative","Charismatic"],examples:["Apple","Tesla","Disney"]},hero:{id:"hero",name:"The Hero",description:"Courageous, determined, and inspiring",characteristics:["Courageous","Determined","Inspiring"],examples:["Nike","FedEx","BMW"]}};return(0,n.jsxs)("div",{className:"min-h-screen bg-white flex flex-col",children:[(0,n.jsxs)("main",{className:"flex-1",children:[(0,n.jsx)("div",{className:"bg-[#112248] py-12 px-6",children:(0,n.jsx)("div",{className:"max-w-4xl mx-auto text-center text-white",children:(0,n.jsxs)(i.P.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},children:[(0,n.jsx)("h1",{className:"text-4xl font-heading mb-4 text-white",children:"Elevate Your Tagline"}),(0,n.jsx)("p",{className:"text-white/80 max-w-2xl mx-auto mb-4",children:"Your tagline captures the essence of your brand in a single, powerful line. Drawing from your brand attributes, this step helps you craft concise statements that communicate your promise, energy, and point of view with clarity and impact."})]})})}),(0,n.jsxs)("div",{className:"max-w-4xl mx-auto py-12 px-6",children:[(0,n.jsxs)("div",{className:"bg-white rounded-xl shadow-lg mb-10",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between p-6 cursor-pointer",onClick:()=>{en(e=>(localStorage.setItem("tagline_brand_dna_collapsed",JSON.stringify(!e)),!e))},children:[(0,n.jsx)("h2",{className:"text-xl font-heading text-[#112248]",children:"Your Brand Advantage CheatSheet"}),(0,n.jsx)("button",{className:"text-gray-500",children:(0,n.jsx)("svg",{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",className:"transform transition-transform ".concat(ea?"":"rotate-180"),children:(0,n.jsx)("path",{d:"m6 9 6 6 6-6"})})})]}),!ea&&(0,n.jsxs)("div",{className:"p-6 pt-0",children:[er.businessName&&(0,n.jsxs)("div",{className:"mb-6 p-4 bg-gray-50 rounded-lg",children:[(0,n.jsx)("h3",{className:"text-md font-semibold text-[#112248] mb-2",children:"Business Context"}),(0,n.jsxs)("div",{className:"text-sm text-gray-600",children:[(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"font-medium",children:"Business:"})," ",er.businessName]}),(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"font-medium",children:"Industry:"})," ",er.industry]}),er.differentiator&&(0,n.jsxs)("p",{children:[(0,n.jsx)("span",{className:"font-medium",children:"Key Differentiator:"})," ",er.differentiator]})]})]}),eu.length>0&&(0,n.jsxs)("div",{className:"mb-6 p-4 bg-gray-50 rounded-lg",children:[(0,n.jsx)("h3",{className:"text-md font-semibold text-[#112248] mb-2",children:"Brand Archetypes"}),(0,n.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:eu.filter(e=>!0===e.is_primary||!1===e.is_primary).slice(0,2).sort((e,t)=>
1e.is_primary&&!t.is_primary?-1:!e.is_primary&&t.is_primary?1:0).map(e=>{let t=e.archetype_id.toLowerCase().replace(/^the\s+/i,""),a=eB[t];if(!a){let n=e.archetype_name.toLowerCase().replace(/^the\s+/i,""),s=Object.values(eB).find(e=>e.id.toLowerCase()===t||e.id.toLowerCase()===n||e.name.toLowerCase().replace(/^the\s+/i,"")===t||e.name.toLowerCase().replace(/^the\s+/i,"")===n);s&&(a=s)}let s=(null==a?void 0:a.image)||"/images/archetypes/".concat(e.archetype_name.replace(/^the\s+/i,""),".jpg");return(0,n.jsxs)("div",{className:"bg-white rounded-xl p-4 shadow flex flex-col gap-3 cursor-pointer hover:shadow-lg transition-shadow duration-200",onClick:()=>(e=>{let t=eu.find(t=>t.archetype_name===e);if(t){let e=t.archetype_id.toLowerCase().replace(/^the\s+/i,""),a=eB[e];if(!a){let n=t.archetype_name.toLowerCase().replace(/^the\s+/i,""),s=Object.values(eB).find(t=>t.id.toLowerCase()===e||t.id.toLowerCase()===n||t.name.toLowerCase().replace(/^the\s+/i,"")===e||t.name.toLowerCase().replace(/^the\s+/i,"")===n);s&&(a=s)}a?(eq({...a,is_primary:t.is_primary}),eU(!0)):(console.error("No detailed archetype found for:",e),v({title:"Archetype Not Found",description:"Could not find details for archetype: ".concat(t.archetype_name),variant:"destructive"}))}})(e.archetype_name),children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"w-12 h-12 rounded-full overflow-hidden shadow-lg flex-shrink-0",style:{borderWidth:"3px",borderStyle:"solid",borderColor:(null==a?void 0:a.color)||(e.is_primary?"#112248":"#a7c140")},children:(0,n.jsx)("img",{src:s,alt:e.archetype_name,className:"w-full h-full object-cover",onError:e=>{e.currentTarget.src="/images/archetypes/Magician.jpg"}})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{className:"font-heading text-md font-bold text-[#112248]",children:e.archetype_name}),(0,n.jsx)("span",{className:"inline-block text-white px-3 py-0.5 rounded-full text-xs font-semibold",style:{backgroundColor:(null==a?void 0:a.color)||(e.is_primary?"#112248":"#a7c140")},children:e.is_primary?"Primary":"Secondary"})]})]}),a&&(0,n.jsx)("p",{className:"text-xs text-gray-600",children:a.description})]},e.id)})})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[(0,n.jsxs)("div",{className:"bg-[#a7c140]/20 p-4 rounded-lg",children:[(0,n.jsx)("h3",{className:"font-medium text-[#a7c140]",children:"CULTURE"}),(0,n.jsx)("p",{className:"text-[#112248] font-semibold uppercase",children:eo.culture||"EXPERIENCED"})]}),(0,n.jsxs)("div",{className:"bg-[#a7c140]/20 p-4 rounded-lg",children:[(0,n.jsx)("h3",{className:"font-medium text-[#a7c140]",children:"CUSTOMERS"}),(0,n.jsx)("p",{className:"text-[#112248] font-semibold uppercase",children:eo.customers||"GENUINELY WANT TO HELP OTHERS"})]}),(0,n.jsxs)("div",{className:"bg-[#a7c140]/20 p-4 rounded-lg",children:[(0,n.jsx)("h3",{className:"font-medium text-[#a7c140]",children:"VOICE"}),(0,n.jsx)("p",{className:"text-[#112248] font-semibold uppercase",children:eo.voice||"DYNAMIC"})]}),(0,n.jsxs)("div",{className:"bg-[#a7c140]/20 p-4 rounded-lg",children:[(0,n.jsx)("h3",{className:"font-medium text-[#a7c140]",children:"FEELING"}),(0,n.jsx)("p",{className:"text-[#112248] font-semibold uppercase",children:eo.feeling||"CLEAR"})]}),(0,n.jsxs)("div",{className:"bg-[#a7c140]/20 p-4 rounded-lg",children:[(0,n.jsx)("h3",{className:"font-medium text-[#a7c140]",children:"IMPACT"}),(0,n.jsx)("p",{className:"text-[#112248] font-semibold uppercase",children:eo.impact||"CLEAR DIRECTION"})]}),(0,n.jsxs)("div",{className:"bg-[#a7c140]/20 p-4 rounded-lg",children:[(0,n.jsx)("h3",{className:"font-medium text-[#a7c140]",children:"X-FACTOR"}),(0,n.jsx)("p",{className:"text-[#112248] font-semibold uppercase",children:eo.x_factor||"LEFT BRAIN, RIGHT BRAIN"})]})]})]})]}),(0,n.jsxs)("div",{className:"bg-white rounded-xl shadow-lg p-8 mb-10",children:[(0,n.jsxs)("div",{className:"text-center mb-6",children:[(0,n.jsx)("h2",{className:"text-2xl font-heading text-[#112248] mb-2",children:"Unique Taglines"}),(0,n.jsx)("p",{className:"text-gray-600",children:"Click on any Tagline card to select it as your chosen tagline."})]}),(0,n.jsx)("div",{className:"mb-6",children:(0,n.jsx)(r.$,{onClick:()=>
1ep(!0),className:"bg-[#a7c140] hover:bg-[#a7c140]/90 text-white w-full py-6",disabled:j||w,children:j||w?(0,n.jsxs)("span",{className:"flex items-center justify-center",children:[(0,n.jsxs)("svg",{className:"animate-spin -ml-1 mr-2 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"GENERATING Taglines..."]}):"REGENERATE Taglines"})}),w||j?(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,n.jsx)("div",{className:"w-16 h-16 border-4 border-t-[#112248] border-r-[#112248] border-b-[#a7c140] border-l-[#a7c140] rounded-full animate-spin mb-6"}),(0,n.jsx)("p",{className:"text-lg text-gray-600 mb-2 font-medium",children:"Crafting Your Unique Taglines"}),(0,n.jsx)("p",{className:"text-sm text-gray-500 max-w-md text-center",children:"We're analyzing your brand DNA, archetypes, and business profile to generate compelling taglines that resonate with your audience."})]}):(0,n.jsx)("div",{className:"space-y-4",children:es.map(e=>(0,n.jsx)(l.Zp,{className:"p-4 cursor-pointer transition-all ".concat((null==R?void 0:R.id)===e.id?"border-[#a7c140] border-2 bg-[#a7c140]/10":"hover:shadow-md border border-gray-200"),onClick:()=>e_(e),children:(0,n.jsxs)("div",{className:"flex flex-col space-y-2",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-[#a7c140]",children:e.strategy}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("button",{className:"p-2 rounded-full hover:bg-gray-100 transition-colors",onClick:t=>{t.stopPropagation(),navigator.clipboard.writeText(e.content).then(()=>{M(e.id),v({title:"Copied!",description:"Tagline copied to clipboard.",className:"bg-white"}),setTimeout(()=>{M(null)},2e3)}).catch(e=>{console.error("Failed to copy:",e),v({title:"Copy failed",description:"Could not copy to clipboard.",variant:"destructive"})})},title:"Copy to clipboard",children:P===e.id?(0,n.jsx)(g.A,{className:"h-4 w-4 text-green-500"}):(0,n.jsx)(u.A,{className:"h-4 w-4 text-gray-500"})}),(0,n.jsx)("button",{className:"p-2 rounded-full hover:bg-gray-100 transition-colors",onClick:t=>{t.stopPropagation(),eb(e.content),O(e),ex(!0)},title:"Edit manually",children:(0,n.jsx)(m.A,{className:"h-4 w-4 text-gray-500"})}),(0,n.jsx)("button",{className:"p-2 rounded-full hover:bg-gray-100 transition-colors",onClick:t=>{t.stopPropagation(),B(e.id),J(e),Y(!0)},title:"Refine with Synapse AI",children:(0,n.jsx)("div",{className:"w-4 h-4 bg-[#112248] rounded-full flex items-center justify-center",children:(0,n.jsx)(h.A,{className:"h-3 w-3 text-white"})})})]})]}),(0,n.jsx)("p",{className:"text-[#112248] text-lg",children:e.content})]})},e.id))}),R&&(0,n.jsx)("div",{className:"mt-8 bg-[#112248] rounded-xl p-6 text-white shadow-lg",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("h3",{className:"text-xl font-heading mb-3",children:"Next Step: Bring Your Brand to Life"}),(0,n.jsxs)("p",{className:"text-white/90 mb-4 max-w-2xl mx-auto",children:["Your tagline is just the beginning.",(0,n.jsx)("br",{}),"Head to your Brand Advantage Library to build a dynamic brand guide",(0,n.jsx)("br",{}),"that captures your voice, vision, and visual styleâ",(0,n.jsx)("br",{}),"ready to share with the world."]}),(0,n.jsx)(r.$,{onClick:()=>N.push("/library"),className:"bg-white text-[#112248] hover:bg-white/90 py-3 px-6 text-lg font-semibold",children:"See Your Library"})]})})]})]})]}),(0,n.jsx)(y.lG,{open:G,onOpenChange:e=>!e&&eC(),children:(0,n.jsxs)(y.Cf,{className:"sm:max-w-[500px] bg-white",children:[(0,n.jsx)(y.c7,{children:(0,n.jsx)(y.L3,{className:"font-heading text-[#112248]",children:"Refine Your Tagline"})}),(0,n.jsxs)("div",{className:"flex flex-col space-y-4 mt-2",children:[(0,n.jsxs)("div",{className:"bg-gray-100 p-4 rounded-lg",children:[(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("p",{className:"font-semibold mb-1",children:"Current Tagline:"}),(0,n.jsx)(r.$,{variant:"ghost",size:"sm",onClick:()=>
1z&&eA(z.content,"Original tagline copied to clipboard"),className:"text-xs h-6 px-2",children:(0,n.jsx)(u.A,{className:"h-3 w-3"})})]}),(0,n.jsx)("p",{className:"text-sm",children:null==z?void 0:z.content})]}),H&&"Thinking..."!==H&&(0,n.jsxs)("div",{className:"bg-gray-100 p-4 rounded-lg",children:[(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("p",{className:"font-semibold mb-1",children:"AI Response:"}),Z.length>1&&(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(r.$,{variant:"ghost",size:"sm",onClick:()=>{if(ee>0){let e=ee-1;et(e),X(Z[e])}},disabled:0===ee,className:"text-xs h-6 px-2",children:(0,n.jsx)(p.A,{className:"h-3 w-3"})}),(0,n.jsxs)("span",{className:"text-xs",children:[ee+1,"/",Z.length]}),(0,n.jsx)(r.$,{variant:"ghost",size:"sm",onClick:()=>{if(ee<Z.length-1){let e=ee+1;et(e),X(Z[e])}},disabled:ee===Z.length-1,className:"text-xs h-6 px-2",children:(0,n.jsx)(f.A,{className:"h-3 w-3"})})]})]}),(0,n.jsx)("div",{className:"mt-2",children:H?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"text-sm whitespace-pre-wrap mb-4",children:H.split("\n\n")[0]}),H.split("\n\n").length>1&&(0,n.jsx)("p",{className:"text-sm whitespace-pre-wrap border-l-4 border-[#a7c140] pl-4 py-2 font-semibold",children:H.split("\n\n")[1]}),(0,n.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,n.jsxs)(r.$,{variant:"ghost",size:"sm",onClick:()=>eA(H,"AI response copied to clipboard"),className:"text-xs mr-2",children:[(0,n.jsx)(u.A,{className:"h-3 w-3 mr-1"})," Copy"]}),(0,n.jsxs)(r.$,{size:"sm",onClick:ek,className:"text-xs bg-[#a7c140] text-white hover:opacity-90 font-semibold",children:[(0,n.jsx)(g.A,{className:"h-3 w-3 mr-1"})," Use This Tagline"]})]})]}):(0,n.jsx)("p",{className:"text-sm italic text-gray-500",children:$})})]}),(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsx)("label",{htmlFor:"message",className:"font-semibold text-gray-700 mb-1",children:"Tell AI how you'd like to improve this tagline:"}),(0,n.jsx)("textarea",{id:"message",className:"border border-gray-300 rounded-lg p-3 h-24 focus:outline-none focus:ring-2 focus:ring-[#112248] resize-none",placeholder:"e.g., Make it more concise, focus on benefits more, make it sound more confident...",value:V,onChange:e=>K(e.target.value)})]}),(0,n.jsxs)("div",{className:"flex justify-end space-x-2 pt-2",children:[(0,n.jsx)(r.$,{variant:"outline",onClick:eC,children:"Cancel"}),(0,n.jsx)(r.$,{onClick:eI,disabled:!V.trim()||"Thinking..."===H,className:"".concat(V.trim()&&"Thinking..."!==H?"bg-[#112248] text-white hover:opacity-90 font-semibold":"bg-gray-300 cursor-not-allowed"),children:"Thinking..."===H?(0,n.jsxs)("span",{className:"flex items-center",children:[(0,n.jsxs)("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Thinking..."]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(x.A,{className:"h-4 w-4 mr-1"})," Generate"]})})]})]})]})}),(0,n.jsx)(y.lG,{open:ef,onOpenChange:e=>!e&&ex(!1),children:(0,n.jsxs)(y.Cf,{className:"sm:max-w-[500px] bg-white",children:[(0,n.jsx)(y.c7,{children:(0,n.jsx)(y.L3,{className:"text-[#112248]",children:"Edit Tagline"})}),(0,n.jsx)("div",{className:"space-y-4",children:(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Tagline Text:"}),(0,n.jsx)("textarea",{value:ey,onChange:e=>eb(e.target.value),placeholder:"Enter your tagline...",className:"w-full p-3 border border-gray-300 rounded-lg resize-none",rows:4})]})}),(0,n.jsxs)(y.Es,{children:[(0,n.jsx)(r.$,{onClick:eP,disabled:!ey.trim(),className:"bg-[#112248] hover:bg-[#112248]/90 text-white",children:"Save Changes"}),(0,n.jsx)(r.$,{variant:"outline",onClick:()=>ex(!1),children:"Cancel"})]})]})}),(0,n.jsx)(y.lG,{open:eh,onOpenChange:ep,children:(0,n.jsxs)(y.Cf,{className:"sm:max-w-[400px] bg-white",children:[(0,n.jsx)(y.c7,{children:(0,n.jsx)(y.L3,{className:"text-[#112248]",children:"Regenerate Taglines?"})}),(0,n.jsx)("p",{className:"text-gray-600",children:"This will replace all your current taglines with new ones. Are you sure you want to continue?"}),(0,n.jsxs)(y.Es,{children:[(0,n.jsx)(r.$,{onClick:()=>{ep(!1),eO()}
1,className:"bg-[#a7c140] hover:bg-[#a7c140]/90 text-white",children:"Yes, Regenerate"}),(0,n.jsx)(r.$,{variant:"outline",onClick:()=>ep(!1),children:"Cancel"})]})]})})]})}},51834:(e,t,a)=>{a.d(t,{Cf:()=>u,Es:()=>h,L3:()=>p,c7:()=>m,lG:()=>o,zM:()=>c});var n=a(95155),s=a(12115),i=a(89511),r=a(65229),l=a(64269);let o=s.forwardRef((e,t)=>{let{...a}=e;return(0,n.jsx)(i.bL,{"data-slot":"dialog",...a})});o.displayName="Dialog";let c=s.forwardRef((e,t)=>{let{...a}=e;return(0,n.jsx)(i.l9,{"data-slot":"dialog-trigger",ref:t,...a})});c.displayName="DialogTrigger";let d=s.forwardRef((e,t)=>{let{...a}=e;return(0,n.jsx)(i.ZL,{"data-slot":"dialog-portal",...a})});d.displayName="DialogPortal",s.forwardRef((e,t)=>{let{...a}=e;return(0,n.jsx)(i.bm,{"data-slot":"dialog-close",ref:t,...a})}).displayName="DialogClose";let g=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(i.hJ,{"data-slot":"dialog-overlay",ref:t,className:(0,l.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",a),...s})});g.displayName="DialogOverlay";let u=s.forwardRef((e,t)=>{let{className:a,children:s,showCloseButton:o=!0,...c}=e;return(0,n.jsxs)(d,{"data-slot":"dialog-portal",children:[(0,n.jsx)(g,{}),(0,n.jsxs)(i.UC,{"data-slot":"dialog-content",ref:t,className:(0,l.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",a),...c,children:[s,o&&(0,n.jsxs)(i.bm,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,n.jsx)(r.A,{}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});u.displayName="DialogContent";let m=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("div",{"data-slot":"dialog-header",ref:t,className:(0,l.cn)("flex flex-col gap-2 text-center sm:text-left",a),...s})});m.displayName="DialogHeader";let h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("div",{"data-slot":"dialog-footer",ref:t,className:(0,l.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",a),...s})});h.displayName="DialogFooter";let p=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(i.hE,{"data-slot":"dialog-title",ref:t,className:(0,l.cn)("text-lg leading-none font-semibold",a),...s})});p.displayName="DialogTitle",s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(i.VY,{"data-slot":"dialog-description",ref:t,className:(0,l.cn)("text-muted-foreground text-sm",a),...s})}).displayName="DialogDescription"},82021:(e,t,a)=>{a.d(t,{dj:()=>g,oR:()=>d});var n=a(12115);let s=0,i=new Map,r=e=>{if(i.has(e))return;let t=setTimeout(()=>{i.delete(e),c({type:"REMOVE_TOAST",toastId:e})},1e6);i.set(e,t)},l=[],o={toasts:[]};function c(e){o=((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:a}=t;return a?r(a):e.toasts.forEach(e=>{r(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===a||void 0===a?{...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)}}})(o,e),l.forEach(e=>{e(o)})}function d(e){let{...t}=e,a=(s=(s+1)%Number.MAX_VALUE).toString(),n=()=>c({type:"DISMISS_TOAST",toastId:a});return c({type:"ADD_TOAST",toast:{...t,id:a,open:!0,onOpenChange:e=>{e||n()}}}),{id:a,dismiss:n,update:e=>c({type:"UPDATE_TOAST",toast:{...e,id:a}})}}function g(){let[e,t]=n.useState(o);return n.useEffect(()=>(l.push(t),()=>{let e=l.indexOf(t);e>-1&&l.splice(e,1)}),[e]),{...e,toast:d,dismiss:e=>c({type:"DISMISS_TOAST",toastId:e})}}},86948:(e,t,a)=>{a.d(t,{BT:()=>c,Wu:()=>d,ZB:()=>o,Zp:()=>r,aR:()=>l,wL:()=>g});var n=a(95155),s=a(12115),i=a(64269);let r=s.forwardRef((e,t)=>
1{let{className:a,...s}=e;return(0,n.jsx)("div",{ref:t,className:(0,i.cn)("rounded-lg border bg-card text-card-foreground shadow-xl",a),...s})});r.displayName="Card";let l=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("div",{ref:t,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",a),...s})});l.displayName="CardHeader";let o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("h3",{ref:t,className:(0,i.cn)("text-2xl font-semibold leading-none tracking-tight",a),...s})});o.displayName="CardTitle";let c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("p",{ref:t,className:(0,i.cn)("text-sm text-muted-foreground",a),...s})});c.displayName="CardDescription";let d=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("div",{ref:t,className:(0,i.cn)("p-6 pt-0",a),...s})});d.displayName="CardContent";let g=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("div",{ref:t,className:(0,i.cn)("flex items-center p-6 pt-0",a),...s})});g.displayName="CardFooter"}}]);
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.