PageSourceSearch

https://spoki.com/_next/static/chunks/83304-0e48e0f9e8c3aba4.js

js spoki.com collected 2026-09-25 18:44:46 UTC 79,702 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[83304],{4880:(e,t,a)=>{a.d(t,{i:()=>s});var i=a(12115),n=a(72087),r=a(28129);function s(){let{capabilities:e,isAnyAvailable:t}=(0,i.useContext)(n.W),a=(0,i.useCallback)(async(t,a)=>"available"!==e.promptAPI?null:(0,r.YX)(t,a),[e.promptAPI]),s=(0,i.useCallback)(async(t,a)=>"available"!==e.summarizer?null:(0,r.ZK)(t,a),[e.summarizer]),o=(0,i.useCallback)(async(t,a)=>"available"!==e.languageDetector?null:(0,r.fi)(t,a),[e.languageDetector]),l=(0,i.useCallback)(async(t,a)=>"available"!==e.translator?null:(0,r.Qw)(t,a),[e.translator]);return{capabilities:e,isAnyAvailable:t,prompt:a,summarize:s,detectLanguage:o,translate:l}}},28129:(e,t,a)=>{let i;a.d(t,{tq:()=>c,Fe:()=>r,Ri:()=>b,Gg:()=>l,fi:()=>h,YX:()=>d,aL:()=>k,ZK:()=>m,Qt:()=>S,Qw:()=>f});var n=a(82466);let r=(0,n.h)("ChromeAI");function s(e){return(0,n.CR)("ChromeAI",e)}async function o(e,t){if(!t)return r.debug(`${e}: API not present in this browser`),"unavailable";try{var a;let i=await t(),n=(a=i.available,"readily"===a?"available":"after-download"===a?"downloading":"unavailable");return r.debug(`${e}: ${n}`,{raw:i.available}),n}catch(t){return r.warn(`${e}: capabilities() threw`,{error:String(t)}),"unavailable"}}async function l(){let e=s("detectCapabilities"),t=window.ai,[a,i,n,l]=await Promise.all([o("Prompt API",t?.languageModel?.capabilities.bind(t.languageModel)),o("Summarizer",t?.summarizer?.capabilities.bind(t.summarizer)),o("Translator",t?.translator?.capabilities.bind(t.translator)),o("Language Detector",t?.languageDetector?.capabilities.bind(t.languageDetector))]),c={promptAPI:a,summarizer:i,translator:n,languageDetector:l},u=e.done({capabilities:c});return r.info("Capability detection complete",{...c,durationMs:u}),c}let c={promptAPI:"unavailable",summarizer:"unavailable",translator:"unavailable",languageDetector:"unavailable"};function u(e,t,a){return new Promise((i,n)=>{let r=setTimeout(()=>n(Error(`${a} timed out after ${t}ms`)),t);e.then(e=>{clearTimeout(r),i(e)}).catch(e=>{clearTimeout(r),n(e)})})}let p=null;async function d(e,t){let a=s("prompt"),n=t?.timeoutMs??8e3;
1try{let r=window.ai;if(!r?.languageModel)return null;p&&i===t?.systemPrompt||(p?.destroy(),p=await u(r.languageModel.create({systemPrompt:t?.systemPrompt,temperature:t?.temperature,topK:t?.topK}),n,"Prompt session create"),i=t?.systemPrompt);let s=await u(p.prompt(e),n,"Prompt inference");return a.done({inputLength:e.length,outputLength:s.length}),s}catch(e){return r.warn("Prompt on-device failed, caller should use server fallback",{error:String(e)}),p?.destroy(),p=null,i=void 0,a.done({error:!0}),null}}async function m(e,t){let a=s("summarize"),i=t?.timeoutMs??8e3;try{let n=window.ai;if(!n?.summarizer)return null;let r=await u(n.summarizer.create({type:t?.type??"tl;dr",format:t?.format??"plain-text",length:t?.length??"medium"}),i,"Summarizer session create"),s=await u(r.summarize(e),i,"Summarize inference");return r.destroy(),a.done({inputLength:e.length,outputLength:s.length}),s}catch(e){return r.warn("Summarize on-device failed",{error:String(e)}),a.done({error:!0}),null}}let g=null;async function h(e,t){let a=s("detectLanguage"),i=t?.timeoutMs??8e3;
1try{let t=window.ai;if(!t?.languageDetector)return null;g||(g=await u(t.languageDetector.create(),i,"LanguageDetector session create"));let n=await u(g.detect(e),i,"Language detection");if(!n?.length)return a.done({noResult:!0}),null;let r=n[0];return a.done({detectedLanguage:r.detectedLanguage,confidence:r.confidence}),r}catch(e){return r.warn("Language detection on-device failed",{error:String(e)}),g?.destroy(),g=null,a.done({error:!0}),null}}async function f(e,t){let a=s("translate"),i=t.timeoutMs??8e3;try{let n=window.ai;if(!n?.translator)return null;let r=await u(n.translator.create({sourceLanguage:t.sourceLanguage,targetLanguage:t.targetLanguage}),i,"Translator session create"),s=await u(r.translate(e),i,"Translation inference");return r.destroy(),a.done({inputLength:e.length,outputLength:s.length,pair:`${t.sourceLanguage}→${t.targetLanguage}`}),s}catch(e){return r.warn("Translation on-device failed",{error:String(e)}),a.done({error:!0}),null}}function b(){p?.destroy(),p=null,i=void 0,g?.destroy(),g=null,r.debug("All cached sessions destroyed")}let x="chrome_ai_analytics";function y(){return{version:1,capabilities:null,events:[],counters:{onDeviceSuccess:0,onDeviceFail:0,serverFallback:0,totalPrompts:0,totalSummarizations:0,totalTranslations:0,totalDetections:0},firstSeen:Date.now(),lastUpdated:Date.now()}}function v(){if("undefined"==typeof localStorage)return y();try{let e=localStorage.getItem(x);if(!e)return y();let t=JSON.parse(e);if(1!==t.version)return y();return t}catch{return y()}}function w(e){if("undefined"!=typeof localStorage)try{e.lastUpdated=Date.now(),e.events.length>500&&(e.events=e.events.slice(-500)),localStorage.setItem(x,JSON.stringify(e))}catch{}}function k(e){let t=v();t.capabilities=e,w(t),r.debug("Capabilities recorded",{capabilities:e})}function S(e){let t=v(),a={...e,timestamp:Date.now()};t.events.push(a),"on-device"===e.source?e.success?t.counters.onDeviceSuccess++:t.counters.onDeviceFail++:t.counters.serverFallback++;let i={prompt:"totalPrompts",summarize:"totalSummarizations",translate:"totalTranslations",detectLanguage:"totalDetections"}[e.operation];i&&t.counters[i]++,w(t),r.debug("Event tracked",{operation:e.operation,source:e.source,durationMs:e.durationMs,success:e.success})}},72087:(e,t,a)=>{a.d(t,{A:()=>o,W:()=>s});var i=a(95155),n=a(12115),r=a(28129);let s=(0,n.createContext)({capabilities:r.tq,isAnyAvailable:!1});function o(e){let{children:t}
1=e,a=(0,n.useRef)(!1),[o,l]=(0,n.useState)(r.tq);(0,n.useEffect)(()=>{if(!a.current)return(a.current=!0,window.ai)?(r.Fe.info("window.ai detected — probing capabilities"),(0,r.Gg)().then(e=>{l(e),(0,r.aL)(e)}).catch(e=>{r.Fe.error("Capability detection failed",e)}),()=>{(0,r.Ri)()}):void r.Fe.debug("window.ai not present — Chrome Built-in AI unavailable")},[]);let c="available"===o.promptAPI||"available"===o.summarizer||"available"===o.translator||"available"===o.languageDetector;return(0,i.jsx)(s.Provider,{value:{capabilities:o,isAnyAvailable:c},children:t})}},83304:(e,t,a)=>{a.d(t,{A:()=>G});var i=a(95155),n=a(12115),r=a(47650),s=a(20063),o=a(76815),l=a(53350),c=a(60619),u=a(70779),p=a(73136),d=a(85786),m=a(68329),g=a(62874),h=a(79484),f=a(43569),b=a(35821),x=a(30955),y=a(39059),v=a(52704),w=a(64516),k=a(77016),S=a(41112),C=a(15239),z=a(64972),j=a(30926);let N=(0,j.createServerReference)("407220688953acf0803604c5c5ea243cf55bc8dbe5",j.callServer,void 0,j.findSourceMapURL,"generateSimpleTTS"),A=(0,j.createServerReference)("40ecbc4c7e7092d49cb61b70394cf3a48b2e50f915",j.callServer,void 0,j.findSourceMapURL,"generateExplanatoryPage");var T=a(92073),I=a(29035),q=a(25460),P=a(76393),L=a(24991);function E(e){return e.trim().toLowerCase().replace(/\s+/g," ")}Object.values({it:{pricing:"Quanto costa Spoki? Quali sono i piani disponibili?",channels:"Quali canali di comunicazione supporta Spoki?",features:"Quali sono le principali funzionalit\xe0 di Spoki?",results:"Quali risultati posso ottenere con Spoki? Ci sono case study?"},en:{pricing:"How much does Spoki cost? What plans are available?",channels:"What communication channels does Spoki support?",features:"What are the main features of Spoki?",results:"What results can I achieve with Spoki? Are there case studies?"},es:{pricing:"\xbfCu\xe1nto cuesta Spoki? \xbfQu\xe9 planes hay disponibles?",channels:"\xbfQu\xe9 canales de comunicaci\xf3n soporta Spoki?",features:"\xbfCu\xe1les son las principales funcionalidades de Spoki?",results:"\xbfQu\xe9 resultados puedo lograr con Spoki? \xbfHay casos de estudio?"},fr:{pricing:"Combien co\xfbte Spoki ? Quels sont les plans disponibles ?",channels:"Quels canaux de communication Spoki supporte-t-il ?",features:"Quelles sont les principales fonctionnalit\xe9s de Spoki ?",results:"Quels r\xe9sultats puis-je obtenir avec Spoki ? Y a-t-il des \xe9tudes de cas ?"},de:{pricing:"Was kostet Spoki? Welche Pl\xe4ne sind verf\xfcgbar?",channels:"Welche Kommunikationskan\xe4le unterst\xfctzt Spoki?",features:"Was sind die Hauptfunktionen von Spoki?",results:"Welche Ergebnisse k
1ann ich mit Spoki erzielen? Gibt es Fallstudien?"},pt:{pricing:"Quanto custa o Spoki? Quais planos est\xe3o dispon\xedveis?",channels:"Quais canais de comunica\xe7\xe3o o Spoki suporta?",features:"Quais s\xe3o os principais recursos do Spoki?",results:"Quais resultados posso alcan\xe7ar com o Spoki? Existem estudos de caso?"}}).flatMap(e=>Object.values(e).map(E));var M=a(80547),Q=a(83466),D=a(59617),W=a(22648),_=a(69972),U=a(4880),R=a(28129);let $={"/pricing":{topic:"Prezzi e piani",userIntent:"valutare costi e opzioni di abbonamento"},"/features":{topic:"Funzionalit\xe0",userIntent:"esplorare le funzionalit\xe0 del prodotto"},"/artificial-intelligence":{topic:"AI e Automazione",userIntent:"capire le capacit\xe0 AI di Spoki"},"/whatsapp":{topic:"WhatsApp Business",userIntent:"usare WhatsApp per il business"},"/sms":{topic:"SMS Marketing",userIntent:"inviare SMS ai clienti"},"/spoki-voice":{topic:"Spoki Voice",userIntent:"usare chiamate vocali AI"},"/integrations":{topic:"Integrazioni",userIntent:"collegare Spoki ad altri tool"},"/case-studies":{topic:"Case Studies",userIntent:"vedere risultati di altri clienti"},"/roi-calculator":{topic:"ROI Calculator",userIntent:"calcolare il potenziale ROI"},"/landing-registration":{topic:"Registrazione",userIntent:"iniziare la prova gratuita"},"/faq":{topic:"FAQ",userIntent:"trovare risposte a domande comuni"},"/solutions":{topic:"Soluzioni",userIntent:"vedere soluzioni per settore"},"/spoki-for-smb":{topic:"Spoki per PMI",userIntent:"soluzioni per piccole e medie imprese"},"/spoki-for-enterprise":{topic:"Spoki Enterprise",userIntent:"soluzioni enterprise"},"/blog":{topic:"Blog",userIntent:"leggere articoli e news"},"/channels":{topic:"Canali",userIntent:"esplorare i canali di comunicazione"}},B="https://firebasestorage.googleapis.com/v0/b/wazy-33.appspot.com/o/images%2Flogo_128.gif?alt=media",O="spoki_ai_tts_muted",F={Prodotto:"bg-blue-100 text-blue-700",Integrazioni:"bg-purple-100 text-purple-700",AI:"bg-green/10 text-green",Risorse:"bg-amber-100 text-amber-700",Pricing:"bg-emerald-100 text-emerald-700",Supporto:"bg-cyan-100 text-cyan-700",Partnership:"bg-pink-100 text-pink-700",Azienda:"bg-gray-100 text-gray-700"},H="spoki_ai_search_state",K={industry:"industry",department:"department",companySize:"company_size",useCase:"use_case",role:"buyer_persona",timeline:"sales_stage",feature:"feature",integration:"integration",channel:"channel"},V=["industry","department","company_size","use_case","buyer_persona","sales_stage","feature","integration","channel"],J={asap:"lead","1-month":"lead","3-months":"prospect",exploring:"prospect"};function Y(e,t,a,i){let n=new Set(["quali","quale","cosa","come","dove","quando","perche","quanto","quanti","quante","chi","che","sono","essere","fare","avere","posso","puoi","puo","vorrei","voglio","tutti","tutte","tutto","questa","questo","queste","questi","disponibili","disponibile","supportati","supportato","supporta","offre","offrono","con","per","una","uno","degli","delle","della","dello","del","what","which","where","when","why","how","who","does","can","could","would","should","are","have","has","the","for","with","about","available","supported","support","offer","offers"]),r=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s]/g," ").split(/\s+/).filter(e=>e.length>2),s=r(e),o=s.filter(e=>!n.has(e)),l=o.length>0?o:s.slice(0,1),c=r(t),u=new Set([...c,...r(a.replace(/[/-]/g," ")),...i?r(i):[]]),p={prezzo:["pricing","prezzi","costo","costi","piano","piani","abbonamento","tariffe","price","cost"],prezzi:["pricing","prezzo","costo","costi","piano","piani","abbonamento","tariffe","prices","costs"],costo:["pricing","prezzo","prezzi","costi","piano","piani","tariffe","cost","price"],costi:["pricing","prezzo","prezzi","costo","piano","piani","tariffe","costs","prices"],costa:["pricing","prezzo","prezzi","costo","piano","piani","tariffe","cost","price"],pricing:["prezzo","prezzi","costo","costi","piano","piani","price","cost","plans"],price:["pricing","prezzo","costo","piano","prices","cost","costs","piani"],prices:["pricing","prezzi","costi","piani","price","cost","costs"],cost:["pricing","costo","prezzo","price","costs","costi","piano","piani"],costs:["pricing","costi","prezzi","prices","cost","costo","piani"],plans:["pricing","piani","piano","plan","abbonamento","subscription"],plan:["pricing","piano","piani","plans","abbonamento","subscription"],piano:["pricing","piani","plan","plans","abbonamento","prezzo","costo"],piani:["pricing","piano","plans","plan","abbonamenti","prezzi","costi"],integrazione:["integration","integrazioni","integrations","connettore","collegamento"],integrazioni:["integration","integrazione","integrations","connettore"],integration:["integrazione","integrazioni","integrations"],shopify:["shopify","ecommerce","shop"],hubspot:["hubspot","crm"],woocommerce:["woocommerce","wordpress","ecommerce"],funzionalita:["features","funzioni","caratteristiche","prodotto"],funzionalta:["features","funzioni","caratteristiche","prodotto"],features:["funzionalita","funzioni","caratteristiche"],funziona:["features","funzionalita","funzioni","prodotto","come"],broadcast:["broadcast","messaggi","invio","campagne"],chatbot:["chatbot","bot","automazione","automation"],automazione:["automation","chatbot","bot","flussi","workflow"],automation:["automazione","chatbot","bot","
1workflow"],canale:["channel","canali","channels","whatsapp","sms","email","comunicazione"],canali:["channels","canale","channel","whatsapp","sms","email","comunicazione"],channels:["canali","canale","channel","whatsapp","sms","comunicazione"],channel:["canali","canale","channels","whatsapp","sms","comunicazione"],whatsapp:["whatsapp","wa","messaggi","chat","canali","channels"],sms:["sms","messaggi","testo","canali","channels"],voice:["voice","voce","chiamate","spoki"],voce:["voice","chiamate","spoki"],intelligenza:["ai","artificial","intelligence","artificiale"],artificiale:["ai","artificial","intelligence","intelligenza"],retail:["retail","ecommerce","negozio","vendita"],ecommerce:["ecommerce","retail","shop","negozio","vendita"],hospitality:["hospitality","hotel","ristorante","turismo"],healthcare:["healthcare","salute","medico","clinica"],risultati:["results","case","study","clienti","successo","studies"],results:["risultati","case","study","success","studies"],case:["case","study","risultati","clienti","customers","studies"],clienti:["customers","clients","case","risultati","studies"],faq:["faq","domande","frequenti","risposte"],domande:["faq","domande","frequenti","risposte"],team:["about","team","azienda","siamo","chi","fondatori","storia"],about:["about","team","azienda","siamo","chi","fondatori","storia","missione"],azienda:["about","team","azienda","siamo","chi","company"],siamo:["about","team","azienda","chi","siamo"],fondatori:["about","team","fondatori","founders","chi"],storia:["about","storia","history","azienda"],contatti:["contact","contatti","contattaci","supporto","assistenza"],contattaci:["contact","contatti","contattaci","supporto"],contact:["contact","contatti","contattaci","supporto"],blog:["blog","articoli","news","guide","risorse"],articoli:["blog","articoli","news","guide"]},d=0;for(let e of l){if(u.has(e)){d+=2;continue}for(let t of p[e]||[])if(u.has(t)){d+=1.5;break}for(let t of u)if(e.length>3&&t.length>3&&(t.includes(e)||e.includes(t))){d+=1;break}}return(l.length>0?d/l.length:0)>=.5}function G(e){let{className:t,lang:a="it",placeholder:j}=e,[E,G]=(0,n.useState)(!1),[Z,X]=(0,n.useState)(!1),[ee,et]=(0,n.useState)(""),[ea,ei]=(0,n.useState)(!1),[en,er]=(0,n.useState)(null),[es,eo]=(0,n.useState)([]),[el,ec]=(0,n.useState)([]),[eu,ep]=(0,n.useState)([]),[ed,em]=(0,n.use
1State)(0),[eg,eh]=(0,n.useState)(!1),[ef,eb]=(0,n.useState)(!1),[ex,ey]=(0,n.useState)(!0),[ev,ew]=(0,n.useState)(!1),[ek,eS]=(0,n.useState)(!1),[eC,ez]=(0,n.useState)(!1),[ej,eN]=(0,n.useState)(""),[eA,eT]=(0,n.useState)(0),[eI,eq]=(0,n.useState)(!1),eP=(0,l.d)(0),eL=(0,c.E)`linear-gradient(#fff, #fff), linear-gradient(64.48deg, #38e386, #d9ebe2 50%, #a5ffdb)`;(0,n.useEffect)(()=>(0,u.i)(eP,360,{duration:3,ease:"linear",repeat:1/0,repeatType:"loop"}).stop,[eP]);let eE=(0,n.useRef)(null),eM=(0,n.useRef)(new Map),eQ=(0,n.useRef)(null),eD=(0,n.useRef)(null),eW=(0,n.useRef)(null),e_=(0,n.useRef)(null),eU=(0,s.useRouter)(),eR=(0,s.usePathname)(),e$=(0,o.X)(),eB=(0,n.useMemo)(()=>e$?.get("reply_ai_page")==="1",[e$]);(0,n.useEffect)(()=>{eh(!0),eq((0,W.z8)());try{let e=localStorage.getItem(O);null!==e&&ey("true"===e)}catch{}try{let e=sessionStorage.getItem(H);if(e){let t=JSON.parse(e);Date.now()-t.timestamp<18e5&&(t.messages?.length>0||t.suggestions?.length>0)&&(G(t.isOpen),X(t.isMinimized),eo(t.messages||[]),ec(t.suggestions||[]),ep(t.qualifyingQuestions||[]))}}catch(e){console.warn("[AiSearchBar] Failed to restore state:",e)}return()=>{e_.current&&(e_.current.pause(),e_.current=null),eE.current&&(eE.current.abort(),eE.current=null)}},[]),(0,n.useEffect)(()=>{let e=()=>{G(!0),X(!1),setTimeout(()=>eQ.current?.focus(),100)};return window.addEventListener("spoki:assistant-ai:open-chat",e),()=>window.removeEventListener("spoki:assistant-ai:open-chat",e)}
1,[]),(0,n.useEffect)(()=>{if(eg&&(es.length>0||el.length>0)){let e={isOpen:E,isMinimized:Z,messages:es,suggestions:el,qualifyingQuestions:eu,timestamp:Date.now()};try{sessionStorage.setItem(H,JSON.stringify(e))}catch(e){console.warn("[AiSearchBar] Failed to auto-save state:",e)}}},[eg,E,Z,es,el,eu]),(0,n.useEffect)(()=>{if(!eg)return;let e=()=>{let e=document.querySelector('[class*="fixed"][class*="bottom-8"][class*="left-1/2"]');eb(null!==e&&e.textContent?.includes("Scrolling"))};e();let t=new MutationObserver(()=>{e()});return t.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[eg]);let{params:eO,isLoaded:eF,updateParams:eH}=(0,T.PB)(),{data:eK,urlParams:eV}=(0,P.useEnrichedUser)(),eJ=(0,q.h8)(),eY=(0,I.IQ)(),{prompt:eG,detectLanguage:eZ,translate:eX,capabilities:e0}=(0,U.i)(),[e1,e2]=(0,n.useState)(null),e5=(0,n.useRef)(null);(0,n.useEffect)(()=>{if("available"!==e0.languageDetector)return;e5.current&&clearTimeout(e5.current),e2(null);let e=ee.trim();if(!(e.length<12))return e5.current=setTimeout(async()=>{let t=await eZ(e,{timeoutMs:3e3});if(!t||t.confidence<.7)return;let i=t.detectedLanguage.slice(0,2);if(i===a||!["en","it","es","fr","de","pt"].includes(i))return;let n=(eR||"").replace(/^\/[a-z]{2}(\/|$)/,`/${i}$1`);e2({detectedLang:i,url:n||`/${i}`})},800),()=>{e5.current&&clearTimeout(e5.current)}},[ee,a,eR,e0.languageDetector,eZ]);let e7=(0,n.useMemo)(()=>{let e=eK?.email||eK?.hubspot?.email||null,t=eK?.hubspot?.phone||eK?.hubspotCompany?.phone||null;return{email:e,phone:t,hasAll:!!(e&&t)}},[eK]),e3=(0,n.useMemo)(()=>{let e=V.filter(e=>!!eO[e]).length,t=V.length,a=Math.round(e/t*100);return{collected:e,total:t,percentage:a,isComplete:e===t,missing:V.filter(e=>!eO[e])}},[eO]),e6=(0,n.useMemo)(()=>e3.isComplete&&!e7.hasAll&&!eI,[e3.isComplete,e7.hasAll,eI]),e8=(0,n.useCallback)(e=>{if(!e)return;let t={};e.industry&&!eO.industry&&(t.industry=e.industry),e.department&&!eO.department&&(t.department=e.department),e.companySize&&!eO.company_size&&(t.company_size=e.companySize),e.useCase&&!eO.use_case&&(t.use_case=e.useCase),e.role&&!eO.buyer_persona&&(t.buyer_persona=e.role),e.integration&&!eO.integration&&(t.integration=e.integration),e.channel&&!eO.channel&&(t.channel=e.channel),e.timeline&&!eO.sales_stage&&(t.sales_stage=J[e.timeline]||e.timeline),Object.keys(t).length>0&&eH(t)},[eO,eH]),e4=(0,n.useMemo)(()=>{let e={lang:a};return eR&&(e.currentPage=eR),eO.industry&&(e.industry=eO.industry),eO.department&&(e.department=eO.department),eO.buyer_persona&&(e.buyerPersona=eO.buyer_persona),eO.use_case&&(e.useCase=eO.use_case),eO.company_size&&(e.companySize=eO.company_size),eO.feature&&(e.feature=eO.feature),eO.integration&&(e.integration=eO.integration),eO.channel&&(e.channel=eO.channel),eO.sales_stage&&(e.salesStage=eO.sales_stage),eO.name&&(e.name=eO.name),eO.company_name&&(e.companyName=eO.company_name),!e.industry&&eV.industry&&(e.industry=eV.industry),!e.department&&eV.department&&(e.department=eV.department),!e.buyerPersona&&eV.buyer_persona&&(e.buyerPersona=eV.buyer_persona),!e.companySize&&eV.company_size&&(e.companySize=eV.company_size),!e.salesStage&&eV.sales_stage&&(e.salesStage=eV.sales_stage),!e.companyName&&eV.company_name&&(e.companyName=eV.company_name),eK&&(!e.name&&eK.hubspot?.firstName&&(e.name=eK.hubspot.firstName),!e.companyName&&eK.hubspotCompany?.name&&(e.companyName=eK.hubspotCompany.name),!e.jobTitle&&eK.apollo?.title&&(e.jobTitle=eK.apollo.title),!e.industry&&eK.hubspotCompany?.industry&&(e.industry=eK.hubspotCompany.industry)),!e.buyerPersona&&eY?.persona&&(e.buyerPersona=eY.persona),!e.industry&&eY?.industry&&(e.industry=eY.industry),!e.department&&eY?.department&&(e.department=eY.department),!e.companySize&&eY?.companySize&&(e.companySize=eY.companySize),e},[a,eR,eO,eV,eK,eY]),e9=function(e){let t={it:{buttonText:"Chiedi all'AI",placeholder:"Chiedi qualsiasi cosa su Spoki...",aiThinking:"L'AI sta elaborando una risposta personalizzata...",aiError:"Ops! Qualcosa \xe8 andato storto. Riprova.",searchHint:"Fai una domanda su Spoki",greeting:"Ciao",examples:'Es: "Quanto costa?" o "Come integro Shopify?"',relatedPages:"Pagine correlate",helpMeUnderstand:"Aiutami a capire meglio",navigate:"naviga",open:"apri",close:"chiudi",continueAsking:"Continua a chiedere...",send:"Invia",continueChat:"Continua chat",quickActions:"Domande frequenti",chatTitle:"Spoki AI",generatingPage:"Sto creando la tua pagina...",generatingPageSubtext:"Spoki AI sta generando una pagina esplicativa personalizzata per te."},en:{buttonText:"Ask AI",placeholder:"Ask anything about Spoki...",aiThinking:"AI is preparing a personalized answer...",aiError:"Oops! Something went wrong. Please try again.",searchHint:"Ask a question about Spoki",greeting:"Hi",examples:'E.g. "How much does it cost?" or "How do I integrate Shopify?"',relatedPages:"Related pages",helpMeUnderstand:"Help me understand better",navigate:"navigate",open:"open",close:"close",continueAsking:"Continue asking...",send:"Send",continueChat:"Continue chat",quickActions:"Quick questions",chatTitle:"Spoki AI",generatingPage:"Creating your page...",generatingPageSubtext:"Spoki AI is generating a personalized explanatory page just for you."},es:{buttonText:"Preguntar a IA",placeholder:"Pregunta cualquier cosa sobre Spoki...",aiThinking:"La IA est\xe1 preparando una respuesta personalizada...",aiError:"\xa1Ups! Algo sali\xf3 mal. Int\xe9ntalo de nuevo.",searchHint:"Haz una pregunta sobre Spoki",greeting:"Hola",examples:'Ej: "\xbfCu\xe1nto cuesta?" o "\xbfC\xf3mo integro Shopify?"',relatedPages:"P\xe1ginas relacionadas",helpMeUnderstand:"Ay\xfadame a entender mejor",navigate:"navegar",open:"abrir",close:"cerrar",continueAsking:"Contin\xfaa preguntando...",send:"Enviar",continueChat:"Continuar chat",quickActions:"Preguntas r\xe1pidas",chatTitle:"Spoki AI",generatingPage:"Creando tu p\xe1gina...",generatingPageSubtext:"Spoki AI est\xe1 generando una p\xe1gina explicativa personalizada para ti."},fr:{buttonText:"Demander \xe0 l'IA",placeholder:"Demandez n'importe quoi sur Spoki...",aiThinking:"L'IA pr\xe9pare une r\xe9ponse personnalis\xe9e...",aiError:"Oups ! Quelque chose s'est mal pass\xe9. R\xe9essayez.",searchHint:"Posez une question sur Spoki",greeting:"Bonjour",examples:'Ex: "Combien \xe7a co\xfbte ?" ou "Comment int\xe9grer Shopify ?"',relatedPages:"Pages associ\xe9es",helpMeUnderstand:"Aidez-moi \xe0 mieux comprendre",navigate:"naviguer",open:"ouvrir",close:"fermer",continueAsking:"Continuez \xe0 demander...",send:"Envoyer",continueChat:"Continuer le chat",quickActions:"Questions rapides",chatTitle:"Spoki AI",generatingPage:"Cr\xe9ation de votre page...",generatingPageSubtext:"Spoki AI g\xe9n\xe8re une page explicative personnalis\xe9e pour vous."},de:{buttonText:"KI fragen",placeholder:"Fragen Sie alles \xfcber Spoki...",aiThinking:"KI bereitet eine personalisierte Antwort vor...",aiError:"Ups! Etwas ist schief gelaufen. Bitte erneut versuchen.",searchHint:"Stellen Sie eine Frage zu Spoki",greeting:"Hallo",examples:'Z.B. "Was kostet es?" oder "Wie integriere ich Shopify?"',relatedPages:"Verwandte Seiten",helpMeUnderstand:"Helfen Sie mir, besser zu verstehe
1n",navigate:"navigieren",open:"\xf6ffnen",close:"schlie\xdfen",continueAsking:"Weiter fragen...",send:"Senden",continueChat:"Chat fortsetzen",quickActions:"Schnelle Fragen",chatTitle:"Spoki AI",generatingPage:"Erstelle deine Seite...",generatingPageSubtext:"Spoki AI generiert eine personalisierte Erkl\xe4rungsseite f\xfcr Sie."},pt:{buttonText:"Perguntar \xe0 IA",placeholder:"Pergunte qualquer coisa sobre Spoki...",aiThinking:"A IA est\xe1 preparando uma resposta personalizada...",aiError:"Ops! Algo deu errado. Tente novamente.",searchHint:"Fa\xe7a uma pergunta sobre Spoki",greeting:"Ol\xe1",examples:'Ex: "Quanto custa?" ou "Como integro o Shopify?"',relatedPages:"P\xe1ginas relacionadas",helpMeUnderstand:"Ajude-me a entender melhor",navigate:"navegar",open:"abrir",close:"fechar",continueAsking:"Continue perguntando...",send:"Enviar",continueChat:"Continuar chat",quickActions:"Perguntas r\xe1pidas",chatTitle:"Spoki AI",generatingPage:"Criando sua p\xe1gina...",generatingPageSubtext:"Spoki AI est\xe1 gerando uma p\xe1gina explicativa personalizada para voc\xea."}};return t[e]||t.en}(a),te=function(e){let t={it:{pricing:"/it/prezzi",features:"/it/funzionalita",channels:"/it/canali",results:"/it/casi-studio"},en:{pricing:"/en/pricing",features:"/en/features",channels:"/en/channels",results:"/en/case-studies"},es:{pricing:"/es/precios",features:"/es/caracteristicas",channels:"/es/canales",results:"/es/casos-de-exito"},fr:{pricing:"/fr/tarifs",features:"/fr/fonctionnalites",channels:"/fr/canaux",results:"/fr/etudes-de-cas"},de:{pricing:"/de/preise",features:"/de/funktionen",channels:"/de/kanaele",results:"/de/fallstudien"},pt:{pricing:"/pt/precos",features:"/pt/funcionalidades",channels:"/pt/canais",results:"/pt/casos-de-sucesso"}},a=t[e]||t.en,i={it:[{id:"pricing",label:"Prezzi",query:"Quanto costa Spoki? Quali sono i piani disponibili?",icon:"\uD83D\uDCB0",redirectUrl:a.pricing},{id:"channels",label:"Canali",query:"Quali canali di comunicazione supporta Spoki?",icon:"\uD83D\uDCF1",redirectUrl:a.channels},{id:"features",label:"Funzionalit\xe0",query:"Quali sono le principali funzionalit\xe0 di Spoki?",icon:"⚡",redirectUrl:a.features},{id:"results",label:"Risultati",query:"Quali risultati posso ottenere con Spoki? Ci sono case study?",icon:"\uD83D\uDCC8",redirectUrl:a.results}],en:[{id:"pricing",label:"Pricing",query:"How much does Spoki cost? What plans are available?",icon:"\uD83D\uDCB0",redirectUrl:a.pricing},{id:"channels",label:"Channels",query:"What communication channels does Spoki support?",icon:"\uD83D\uDCF1",redirectUrl:a.channels},{id:"features",label:"Features",query:"What are the main features of Spoki?",icon:"⚡",redirectUrl:a.features},{id:"results",label:"Results",query:"What results can I achieve with Spoki? Are there case studies?",icon:"\uD83D\uDCC8",redirectUrl:a.results}],es:[{id:"pricing",label:"Precios",query:"\xbfCu\xe1nto cuesta Spoki? \xbfQu\xe9 planes hay disponibles?",icon:"\uD83D\uDCB0",redirectUrl:a.pricing},{id:"channels",label:"Canales",query:"\xbfQu\xe9 canales de comunicaci\xf3n soporta Spoki?",icon:"\uD83D\uDCF1",redirectUrl:a.channels},{id:"features",label:"Funciones",query:"\xbfCu\xe1les son las principales funcionalidades de Spoki?",icon:"⚡",redirectUrl:a.features},{id:"results",label:"Resultados",query:"\xbfQu\xe9 resultados puedo lograr con Spoki? \xbfHay casos de estudio?",icon:"\uD83D\uDCC8",redirectUrl:a.results}],fr:[{id:"pricing",label:"Tarifs",query:"Combien co\xfbte Spoki ? Quels sont les plans disponibles ?",icon:"\uD83D\uDCB0",redirectUrl:a.pricing},{id:"channels",label:"Canaux",query:"Quels canaux de communication Spoki supporte-t-il ?",icon:"\uD83D\uDCF1",redirectUrl:a.channels},{id:"features",label:"Fonctionnalit\xe9s",query:"Quelles sont les principales fonctionnalit\xe9s de Spoki ?",icon:"⚡",redirectUrl:a.features},{id:"results",label:"R\xe9sultats",query:"Quels r\xe9sultats puis-je obtenir avec Spoki ? Y a-t-il des \xe9tudes de cas ?",icon:"\uD83D\uDCC8",redirectUrl:a.results}],de:[{id:"pricing",label:"Preise",query:"Was kostet Spoki? Welche Pl\xe4ne sind verf\xfcgbar?",icon:"\uD83D\uDCB0",redirectUrl:a.pricing},{id:"channels",label:"Kan\xe4le",query:"Welche Kommunikationskan\xe4le unterst\xfctzt Spoki?",icon:"\uD83D\uDCF1",redirectUrl:a.channels},{id:"features",label:"Funktionen",query:"Was sind die Hauptfunktionen von Spoki?",icon:"⚡",redirectUrl:a.features}
1,{id:"results",label:"Ergebnisse",query:"Welche Ergebnisse kann ich mit Spoki erzielen? Gibt es Fallstudien?",icon:"\uD83D\uDCC8",redirectUrl:a.results}],pt:[{id:"pricing",label:"Pre\xe7os",query:"Quanto custa o Spoki? Quais planos est\xe3o dispon\xedveis?",icon:"\uD83D\uDCB0",redirectUrl:a.pricing},{id:"channels",label:"Canais",query:"Quais canais de comunica\xe7\xe3o o Spoki suporta?",icon:"\uD83D\uDCF1",redirectUrl:a.channels},{id:"features",label:"Recursos",query:"Quais s\xe3o os principais recursos do Spoki?",icon:"⚡",redirectUrl:a.features},{id:"results",label:"Resultados",query:"Quais resultados posso alcan\xe7ar com o Spoki? Existem estudos de caso?",icon:"\uD83D\uDCC8",redirectUrl:a.results}]};return i[e]||i.en}(a),tt=(0,n.useCallback)(()=>{eW.current&&(eW.current.scrollTop=eW.current.scrollHeight)},[]),ta=(0,n.useCallback)(()=>{if(Z){X(!1),setTimeout(()=>{eQ.current?.focus(),tt()},100);return}G(!0),er(null),eo([]),ec([]),ep([]),setTimeout(()=>eQ.current?.focus(),100)},[Z]),ti=(0,n.useCallback)(()=>{X(!0);let e={isOpen:!0,isMinimized:!0,messages:es,suggestions:el,qualifyingQuestions:eu,timestamp:Date.now()};try{sessionStorage.setItem(H,JSON.stringify(e))}catch(e){console.warn("[AiSearchBar] Failed to save state on minimize:",e)}},[es,el,eu]);(0,n.useEffect)(()=>{if(E&&!Z&&es.length>0){let e=setTimeout(tt,200);return()=>clearTimeout(e)}},[E,Z,es.length]);let tn=(0,n.useCallback)(e=>{let t={industry:{id:"industry",question:"it"===a?"In che settore opera la tua azienda?":"What industry does your company operate in?",type:"single",options:[{value:"shopping-retail",label:"\uD83D\uDED2 E-commerce / Retail"},{value:"hotel-lodging",label:"it"===a?"\uD83C\uDFE8 Hotel e Alloggi":"\uD83C\uDFE8 Hotels & Lodging"},{value:"travel-transportation",label:"it"===a?"✈️ Viaggi e Trasporti":"✈️ Travel & Transportation"},{value:"real-estate",label:"it"===a?"\uD83C\uDFE0 Immobiliare":"\uD83C\uDFE0 Real Estate"},{value:"automotive",label:"\uD83D\uDE97 Automotive"},{value:"medical-health",label:"it"===a?"\uD83C\uDFE5 Sanit\xe0 e Salute":"\uD83C\uDFE5 Healthcare"},{value:"professional-services",label:"it"===a?"\uD83D\uDCBC Servizi Professionali":"\uD83D\uDCBC Professional Services"},{value:"other",label:"it"===a?"\uD83D\uDCCB Altro":"\uD83D\uDCCB Other"}],contextKey:"industry",priority:1},department:{id:"department",question:"it"===a?"Di quale area ti occupi principalmente?":"What area do you mainly work in?",type:"single",options:[{value:"marketing",label:"\uD83D\uDCE3 Marketing"},{value:"sales",label:"it"===a?"\uD83D\uDCBC Vendite":"\uD83D\uDCBC Sales"},{value:"customer",label:"\uD83C\uDFA7 Customer Service"},{value:"operations",label:"⚙️ Operations / IT"}],contextKey:"department",priority:1},companySize:{id:"companySize",question:"it"===a?"Quanto \xe8 grande la tua azienda?":"How big is your company?",type:"single",options:[{value:"1-10",label:"it"===a?"\uD83D\uDC64 1-10 dipendenti":"\uD83D\uDC64 1-10 employees"},{value:"11-50",label:"it"===a?"\uD83D\uDC65 11-50 dipendenti":"\uD83D\uDC65 11-50 employees"},{value:"51-200",label:"it"===a?"\uD83C\uDFE2 51-200 dipendenti":"\uD83C\uDFE2 51-200 employees"},{value:"201+",label:"it"===a?"\uD83C\uDFDB️ 200+ dipendenti":"\uD83C\uDFDB️ 200+ employees"}],contextKey:"companySize",priority:2},useCase:{id:"useCase",question:"it"===a?"Qual \xe8 il tuo obiettivo principale?":"What is your main goal?",type:"single",options:[{value:"lead-generation",label:"it"===a?"\uD83C\uDFAF Generare pi\xf9 lead":"\uD83C\uDFAF Generate more leads"},{value:"customer-support",label:"it"===a?"\uD83E\uDD1D Migliorare supporto clienti":"\uD83E\uDD1D Improve customer support"},{value:"marketing-automation",label:"it"===a?"\uD83D\uDCE7 Automatizzare marketing":"\uD83D\uDCE7 Automate marketing"},{value:"sales-conversion",label:"it"===a?"\uD83D\uDCB0 Aumentare conversioni":"\uD83D\uDCB0 Increase conversions"}],contextKey:"useCase",priority:1},role:{id:"role",question:"it"===a?"Qual \xe8 il tuo ruolo in azienda?":"What is your role in the company?",type:"single",options:[{value:"ceo-founder",label:"\uD83D\uDC54 CEO / Founder"},{value:"marketing-manager",label:"\uD83D\uDCCA Marketing Manager"},{value:"sales-manager",label:"\uD83D\uDCC8 Sales Manager"},{value:"customer-success",label:"\uD83C\uDF1F Customer Success"},{value:"developer",label:"\uD83D\uDCBB Developer / IT"},{value:"other",label:"it"===a?"\uD83D\uDCCB Altro":"\uD83D\uDCCB Other"}],contextKey:"role",priority:2},feature:{id:"feature",question:"it"===a?"Quale funzionalit\xe0 ti interessa di pi\xf9?":"Which feature interests you the most?",type:"single",options:[{value:"broadcast",label:"it"===a?"\uD83D\uDCE2 Broadcast / Campagne massive":"\uD83D\uDCE2 Broadcast / Mass campaigns"},{value:"chatbot",label:"it"===a?"\uD83E\uDD16 Chatbot / Automazioni":"\uD83E\uDD16 Chatbot / Automations"},{value:"ai-agents",label:"\uD83E\uDDE0 AI Agents"},{value:"live-chat",label:"it"===a?"\uD83D\uDCAC Live Chat / Supporto":"\uD83D\uDCAC Live Chat / Support"},{value:"analytics",label:"it"===a?"\uD83D\uDCC8 Analytics / Reportistica":"\uD83D\uDCC8 Analytics / Reporting"}],contextKey:"feature",priority:2},integration:{id:"integration",question:"it"===a?"Usi gi\xe0 qualche tool che vorresti integrare?":"Do you already use any tool you would like to integrate?",type:"single",options:[{value:"shopify",label:"\uD83D\uDED2 Shopify"},{value:"woocommerce",label:"\uD83D\uDECD️ WooCommerce"},{value:"hubspot",label:"\uD83D\uDD36 HubSpot"},{value:"salesforce",label:"☁️ Salesforce"},{value:"zapier",label:"⚡ Zapier"},{value:"none",label:"it"===a?"❌ Nessuno per ora":"❌ None for now"}],contextKey:"integration",priority:2},channel:{id:"channel",question:"it"===a?"Su quale canale vuoi comunicare con i clienti?":"Which channel do you want to communicate with customers?",type:"single",options:[{value:"whatsapp",label:"\uD83D\uDCAC WhatsApp"},{value:"sms",label:"\uD83D\uDCF1 SMS"},{value:"voice",label:"it"===a?"\uD83D\uDCDE Chiamate vocali":"\uD83D\uDCDE Voice calls"},{value:"multi-channel",label:"it"===a?"\uD83D\uDD04 Multi-canale":"\uD83D\uDD04 Multi-channel"}],contextKey:"channel",priority:2},timeline:{id:"timeline",question:"it"===a?"Quando pensi di implementare una soluzione?":"When do you plan to implement a solution?",type:"single",options:[{value:"asap",label:"it"===a?"⚡ Il prima possibile":"⚡ As soon as possible"},{value:"1-month",label:"it"===a?"\uD83D\uDCC5 Entro 1 mese":"\uD83D\uDCC5 Within 1 month"},{value:"3-months",label:"it"===a?"\uD83D\uDDD3️ Entro 3 mesi":"\uD83D\uDDD3️ Within 3 months"},{value:"exploring",label:"it"===a?"\uD83D\uDD0D Sto solo esplorando":"\uD83D\uDD0D Just exploring"}],contextKey:"timeline",priority:3}}
1,i={industry:"industry",department:"department",company_size:"companySize",use_case:"useCase",buyer_persona:"role",sales_stage:"timeline",feature:"feature",integration:"integration",channel:"channel"},n=[];for(let a of e3.missing){let r=i[a];if(r&&r!==e&&t[r]&&(n.push(t[r]),n.length>=2))break}ep(n)},[a,e3.missing]),tr=(0,n.useCallback)(async(e,t,i,n)=>{let r=K[e];if(r){let a=t;"timeline"===e&&(a=J[t]||t),eH({[r]:a})}let s=`user-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,o={id:s,type:"user",content:i,timestamp:Date.now(),questionContext:n,pending:!0};eo(e=>[...e,o]),ep(t=>t.filter(t=>t.contextKey!==e)),ei(!0),er(null),setTimeout(tt,50);let l="it"===a?`Ho risposto: ${i}. Continua a farmi domande per capire meglio le mie esigenze e suggeriscimi le pagine pi\xf9 rilevanti.`:"es"===a?`Mi respuesta es: ${i}. Sigue haci\xe9ndome preguntas para entender mejor mis necesidades.`:"fr"===a?`Ma r\xe9ponse est: ${i}. Continuez \xe0 me poser des questions pour mieux comprendre mes besoins.`:"de"===a?`Meine Antwort ist: ${i}. Stellen Sie mir weiterhin Fragen, um meine Bed\xfcrfnisse besser zu verstehen.`:"pt"===a?`Minha resposta \xe9: ${i}. Continue me fazendo perguntas para entender melhor minhas necessidades.`:`My answer is: ${i}. Keep asking me questions to better understand my needs.`;try{let a={...e4,["industry"===e?"industry":"department"===e?"department":"companySize"===e?"companySize":"useCase"===e?"useCase":"role"===e?"buyerPersona":"timeline"===e?"salesStage":e]:t},i=(0,z.g)(l,!1,a),n=`assistant-${Date.now()}`,r="",o=!1;await to(l,a,(e,t)=>{if(r=t,o)eo(e=>e.map(e=>e.id===n?{...e,content:t}:e));else{o=!0;let e={id:n,type:"assistant",content:t,timestamp:Date.now(),replyToMessageId:s,isStreaming:!0};eo(t=>{let a=t.map(e=>e.id===s?{...e,pending:!1}:e),i=a.findIndex(e=>e.id===s);return -1!==i?(a.splice(i+1,0,e),a):[...a,e]})}setTimeout(tt,10)},async t=>{eo(e=>e.map(e=>e.id===n?{...e,isStreaming:!1}:e)),ei(!1),i.then(t=>{if(t.success&&t.data&&(t.data.extractedContext&&e8(t.data.extractedContext),eo(e=>e.map(e=>e.id===n?{...e,proTip:t.data.proTip||null,freeTrialCta:t.data.freeTrialCta||null,suggestions:t.data.suggestions}:e)),tl(r),ec(t.data.suggestions),t.data.qualifyingQuestions&&t.data.qualifyingQuestions.length>0)){let a=t.data.qualifyingQuestions.filter(t=>{let a=K[t.contextKey],i=!!a&&!!eO[a],n=t.contextKey===e;return!i&&!n});ep(a)}}).catch(e=>{console.warn("[AiSearchBar] handleQuestionAnswer - Failed to enrich:",e)})},async t=>{console.error("[AiSearchBar] handleQuestionAnswer - Stream error:",t);try{let t=await i;if(t.success&&t.data){t.data.extractedContext&&e8(t.data.extractedContext);let a={id:n,type:"assistant",content:t.data.answer,timestamp:Date.now(),replyToMessageId:s,proTip:t.data.proTip||null,freeTrialCta:t.data.freeTrialCta||null,suggestions:t.data.suggestions};if(eo(e=>e.some(e=>e.id===n)?e.map(e=>e.id===s?{...e,pending:!1}:e.id===n?a:e):[...e.map(e=>e.id===s?{...e,pending:!1}:e),a]),tl(t.data.answer),ec(t.data.suggestions),t.data.qualifyingQuestions&&t.data.qualifyingQuestions.length>0){let a=t.data.qualifyingQuestions.filter(t=>{let a=K[t.contextKey],i=!!a&&!!eO[a],n=t.contextKey===e;return!i&&!n});ep(a)}}else eo(e=>e.map(e=>e.id===s?{...e,pending:!1}:e)),er(e9.aiError),tn(e)}catch{eo(e=>e.map(e=>e.id===s?{...e,pending:!1}:e)),er(e9.aiError),tn(e)}ei(!1)});return}catch(t){console.error("[AiSearchBar] Question answer error:",t),eo(e=>e.map(e=>e.id===s?{...e,pending:!1}:e)),er(e9.aiError),tn(e),ei(!1)}},[eH,e4,a,eO,e9.aiError,e8,tn,e3]),ts=(0,n.useCallback)(()=>{let e=!ex;ey(e);try{localStorage.setItem(O,String(e))}catch{}e&&e_.current&&(e_.current.pause(),ew(!1))},[ex]),to=(0,n.useCallback)(async(e,t,a,i,n,r)=>{try{let n=await fetch("/api/ai-navigation/stream",{method:"POST",headers:{"Content-Type":"application/json",...(0,L.$)()},body:JSON.stringify({query:e,userContext:t}),signal:r});if(!n.ok){let e=await n.json().catch(()=>({error:"Stream request failed"}));throw console.error("[AiSearchBar] Stream response not OK:",e),Error(e.error||"Stream request failed")}let s=n.body?.getReader(),o=new TextDecoder,l="";if(!s)throw console.error("[AiSearchBar] No reader available from response body"),Error("No reader available");for(;;){let{done:e,value:t}=await s.read();if(e)break;for(let e of o.decode(t,{stream:!0}).split("\n"))if(e.startsWith("data: ")&&"data: [DONE]"!==e)try{let t=JSON.parse(e.slice(6));if(t.content&&(l+=t.content,a(t.content,l)),t.error)throw Error(t.error)}catch{}}i(l)}catch(e){e instanceof Error&&"AbortError"!==e.name&&n(e)}},[]),tl=(0,n.useCallback)(async e=>{if(!ex&&e&&!(e.length<10)){e_.current&&(e_.current.pause(),e_.current=null);try{let t=await N({text:e,languageCode:a,cacheKey:`ai-response-${Date.now()}`});if(!t.success||!t.audioContent)return void console.warn("[AiSearchBar] TTS generation failed:",t.error);let i=atob(t.audioContent),n=Array(i.length);for(let e=0;e<i.length;e++)n[e]=i.charCodeAt(e);let r=new Uint8Array(n),s=new Blob([r],{type:"audio/mp3"}),o=URL.createObjectURL(s),l=new Audio(o);e_.current=l,l.addEventListener("ended",()=>{ew(!1),URL.revokeObjectURL(o),e_.current=null}),l.addEventListener("error",()=>{console.warn("[AiSearchBar] TTS playback error"),ew(!1),URL.revokeObjectURL(o),e_.current=null}),ew(!0),await l.play()}catch(e){console.error("[AiSearchBar] TTS error:",e),ew(!1)}}},[ex,a]),tc=(0,n.useCallback)(()=>{e_.current&&(e_.current.pause(),e_.current=null,ew(!1)),G(!1),X(!1),et(""),er(null),eo([]),ec([]),ep([]),em(0),eS(!1);try{sessionStorage.removeItem(H)}catch{}},[]),tu=(0,n.useCallback)(async e=>{let t=await (0,_.T)({email:e.email,phone:e.phone,lpParams:eO,lang:e.lang,source:"ai-search",pageUrl:e.pageUrl,spokiVisitorId:e.spokiVisitorId});return t.success&&eq(!0),{success:t.success,error:t.error}},[eO]),tp=(0,n.useCallback)(function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1];let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=!t;a&&X(!0),et("");let i={isOpen:!0,isMinimized:a,messages:es,suggestions:el,qualifyingQuestions:eu,timestamp:Date.now()};try{sessionStorage.setItem(H,JSON.stringify(i))}catch(e){console.warn("[AiSearchBar] Failed to save state:",e)}e.startsWith("http")?window.open(e,"_blank"):eU.push(e)},[eU,es,el,eu]),td=(0,n.useMemo)(()=>!!eR&&(eR.includes("/pricing")||eR.includes("/prezzi")),[eR]),tm=(0,n.useMemo)(()=>({pricing:["prezzo","prezzi","costo","costi","costa","quanto costa","listino","tariffe","tariffa","abbonamento","abbonamenti","piano","piani","pricing","price","prices","cost","costs","how much","plans","plan","subscription","subscriptions","fees","fee","rates","rate","precio","precios","cuanto cuesta","coste","costes","planes","suscripcion","prix","tarif","tarifs","combien","abonnement","forfait","forfaits","preis","preise","kosten","was kostet","abo","abonnement","pre\xe7o","pre\xe7os","custo","custos","quanto custa","planos","assinatura"]}),[]),tg=(0,n.useCallback)(e=>{let t=e.toLowerCase().trim();return tm.pricing.some(e=>t.includes(e)||t.split(/\s+/).some(t=>t===e))&&!td?`/${a}
1/pricing`:null},[tm,td,a]),th=(0,n.useCallback)(async(e,t)=>{let a=tg(e),i=`user-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,n=`assistant-${Date.now()}`,r="",s=!1,o={id:i,type:"user",content:e,timestamp:Date.now(),pending:!0};eo(e=>[...e,o]),et(""),ei(!0),er(null),ep([]),em(0),setTimeout(tt,50);try{let o=(0,z.g)(e.trim(),!1,e4);await to(e.trim(),e4,(e,t)=>{if(r=t,s)eo(e=>e.map(e=>e.id===n?{...e,content:t}:e));else{s=!0;let e={id:n,type:"assistant",content:t,timestamp:Date.now(),replyToMessageId:i,isStreaming:!0};eo(t=>{let a=t.map(e=>e.id===i?{...e,pending:!1}:e),n=a.findIndex(e=>e.id===i);return -1!==n?(a.splice(n+1,0,e),a):[...a,e]})}setTimeout(tt,10)},async i=>{eo(e=>e.map(e=>e.id===n?{...e,isStreaming:!1}:e)),ei(!1),o.then(i=>{if(i.success&&i.data){if(i.data.extractedContext&&e8(i.data.extractedContext),eo(e=>e.map(e=>e.id===n?{...e,proTip:i.data.proTip||null,freeTrialCta:i.data.freeTrialCta||null,suggestions:i.data.suggestions}:e)),ec(i.data.suggestions),tl(r),i.data.qualifyingQuestions&&i.data.qualifyingQuestions.length>0){let e=i.data.qualifyingQuestions.filter(e=>{let t=K[e.contextKey];return t&&!eO[t]});e.length>0&&ep(e)}if(t)setTimeout(()=>tp(t,!0,!0),800);else if(a&&!td)setTimeout(()=>tp(a,!0,!0),800);else{let t=i.data.suggestions[0],a=!!t&&Y(e,t.title,t.url,t.description);t&&t.confidence>=.92&&!td&&t.url&&a&&setTimeout(()=>tp(t.url,!0,!0),800)}}}).catch(e=>{console.warn("[AiSearchBar] handleQuickAction - Failed to enrich:",e)})},async r=>{console.error("[AiSearchBar] handleQuickAction - Stream error, falling back:",r);let s=await (0,z.g)(e.trim(),!1,e4);if(s.success&&s.data){s.data.extractedContext&&e8(s.data.extractedContext);let e={id:n,type:"assistant",content:s.data.answer,timestamp:Date.now(),replyToMessageId:i,proTip:s.data.proTip||null,freeTrialCta:s.data.freeTrialCta||null,suggestions:s.data.suggestions,isStreaming:!1};eo(t=>t.some(e=>e.id===n)?t.map(t=>t.id===i?{...t,pending:!1}:t.id===n?e:t):[...t.map(e=>e.id===i?{...e,pending:!1}:e),e]),ec(s.data.suggestions),tl(s.data.answer),t?setTimeout(()=>tp(t,!0,!0),800):a&&!td&&setTimeout(()=>tp(a,!0,!0),800)}else eo(e=>e.map(e=>e.id===i?{...e,pending:!1}:e)),er(e9.aiError),tn();ei(!1)});return}catch(e){console.error("[AiSearchBar] Quick action error:",e),eo(e=>e.map(e=>e.id===i?{...e,pending:!1}:e)),er(e9.aiError),tn(),ei(!1)}},[e4,td,tp,eO,e9.aiError,tg,e8,tn,e3]),tf=(0,n.useCallback)(async e=>{if(e.trim()&&!ek){eS(!0),er(null);try{let t=await A({query:e,lang:a,persona:e4.buyerPersona,industry:e4.industry,department:e4.department,useCase:e4.useCase,currentPage:eR||void 0});if(t.success&&t.page){let i={page:t.page,query:e,timestamp:Date.now()};sessionStorage.setItem("spoki_ai_generated_page",JSON.stringify(i)),G(!1),X(!1),eU.push(`/${a}/ai-page`)}else console.error("[AiSearchBar] Page generation failed:",t.error),er(t.error||("it"===a?"Impossibile generare la pagina. Riprova.":"Failed to generate page. Please try again.")),th(e)}catch(e){console.error("[AiSearchBar] Page generation error:",e),er("it"===a?"Errore durante la generazione. Riprova.":"Error during generation. Please try again.")}finally{eS(!1)}}},[ek,a,e4,eR,eU,th]),tb=async e=>{if(e.preventDefault(),!ee.trim()||ek)return;let t=ee.trim();if(function(e){let t=e.toLowerCase(),a=e.trim().split(/\s+/).length;
1for(let e of["spiegami","fammi una guida","tutorial","approfondisci","dimmi tutto","guida completa","guida su","come funziona nel dettaglio","confronto tra","differenza tra","migliori pratiche","come posso","come faccio","come si fa","come funziona","cosa sono","quali sono","perch\xe9 dovrei","quando usare","vantaggi di","benefici di","come integrare","come configurare","come creare","come impostare","come automatizzare","explain","give me a guide","tutorial","tell me everything","complete guide","guide on","how does it work in detail","comparison between","difference between","best practices","walk me through","help me understand","how can i","how do i","how to","what is","what are","why should i","when to use","benefits of","advantages of","how to integrate","how to set up","how to configure","how to create","how to automate","expl\xedcame","gu\xeda completa","comparaci\xf3n entre","c\xf3mo puedo","c\xf3mo funciona","qu\xe9 es","cu\xe1les son","explique-moi","guide complet","comparaison entre","comment puis-je","comment fonctionne","qu'est-ce que","erkl\xe4re mir","vollst\xe4ndige anleitung","vergleich zwischen","wie kann ich","wie funktioniert","was ist","was sind","explique-me","guia completo","compara\xe7\xe3o entre","como posso","como funciona","o que \xe9","quais s\xe3o"])if(t.includes(e))return!0;return!!(a>=8&&t.includes("?"))}(t)&&eB){et(""),tf(t);return}let i=tg(t),n=`user-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,r=new AbortController;eM.current.set(n,r);let s=`assistant-${Date.now()}`,o="",l=!1,c={id:n,type:"user",content:t,timestamp:Date.now(),pending:!0};eo(e=>[...e,c]),et(""),ei(!0),er(null),ep([]),em(0),setTimeout(tt,50);try{let e=(0,z.g)(t,!1,e4);if("available"===e0.promptAPI){let a=performance.now(),l=function(e){let t=e?.lang||"it",a="it"===t?"italiano":"en"===t?"inglese":"es"===t?"spagnolo":"fr"===t?"francese":"de"===t?"tedesco":"pt"===t?"portoghese":t,i=["Sei l'assistente AI di Spoki.com, piattaforma WhatsApp Business API (Meta Tech Partner).",`Rispondi SEMPRE in ${a}. Sii conciso (2-3 frasi). Tono amichevole e professionale.`];if(e?.name&&i.push(`Usa il nome "${e.name}" all'inizio.`),e?.currentPage){let t=function(e){if(!e)return null;let t=e.replace(/^\/[a-z]{2}\//,"/").replace(/^\/[a-z]{2}$/,"/");if($[t])return $[t];for(let[e,a]of Object.entries($))if(t.startsWith(e))return a;if(t.includes("/integrations/")){let e=t.split("/integrations/")[1]?.split("/")[0];return{topic:`Integrazione ${e}`,userIntent:`integrare Spoki con ${e}`}}if(t.includes("/industries/")||t.includes("/landing-registration/")){let e=t.split("/").pop();return{topic:`Settore ${e}`,userIntent:`usare Spoki nel settore ${e}`}}if(t.includes("/use-cases/")){let e=t.split("/use-cases/")[1]?.split("/")[0];return{topic:`Use case ${e}`,userIntent:`implementare ${e}`}}return null}(e.currentPage);t&&i.push(`L'utente sta guardando: ${t.topic}. Probabile intento: ${t.userIntent}.`)}return e?.industry&&i.push(`Settore utente: ${e.industry}. Adatta esempi al settore.`),(e?.buyerPersona||e?.jobTitle)&&i.push(`Ruolo: ${e.buyerPersona||e.jobTitle}. Adatta il linguaggio.`),i.push("Spoki offre: WhatsApp API (98% open rate), SMS, Voice AI, chatbot, integrazioni (Shopify, HubSpot, Zapier). Prova gratuita 14 giorni."),i.push("Termina con una domanda per capire meglio le esigenze dell'utente."),i.join("\n")}(e4),c=await eG(t,{systemPrompt:l,temperature:.3,timeoutMs:6e3}),u=Math.round(performance.now()-a);if(c){(0,R.Qt)({operation:"prompt",source:"on-device",durationMs:u,success:!0}),o=c;let t={id:s,type:"assistant",content:c,timestamp:Date.now(),replyToMessageId:n,isStreaming:!1};eo(e=>{let a=e.map(e=>e.id===n?{...e,pending:!1}:e),i=a.findIndex(e=>e.id===n);return -1!==i?(a.splice(i+1,0,t),a):[...a,t]}),eM.current.delete(n),ei(!1),setTimeout(tt,50),e.then(e=>{if(!r.signal.aborted&&e.success&&e.data&&(e.data.extractedContext&&e8(e.data.extractedContext),eo(t=>t.map(t=>t.id===s?{...t,proTip:e.data.proTip||null,freeTrialCta:e.data.freeTrialCta||null,suggestions:e.data.suggestions}:t)),ec(e.data.suggestions),tl(o),e.data.qualifyingQuestions?.length)){let t=e.data.qualifyingQuestions.filter(e=>{let t=K[e.contextKey];return t&&!eO[t]});t.length>0&&ep(t)}}).catch(e=>console.warn("[AiSearchBar] Enrich after Chrome AI failed:",e)),i&&setTimeout(()=>{eU.push(i)},2500);return}(0,R.Qt)({operation:"prompt",source:"server-fallback",durationMs:u,success:!1})}await to(t,e4,(e,t)=>{if(o=t,l)eo(e=>e.map(e=>e.id===s?{...e,content:t}:e));else{l=!0;
1let e={id:s,type:"assistant",content:t,timestamp:Date.now(),replyToMessageId:n,isStreaming:!0};eo(t=>{let a=t.map(e=>e.id===n?{...e,pending:!1}:e),i=a.findIndex(e=>e.id===n);return -1!==i?(a.splice(i+1,0,e),a):[...a,e]})}setTimeout(tt,10)},async t=>{eo(e=>e.map(e=>e.id===s?{...e,isStreaming:!1}:e)),eM.current.delete(n),ei(!1),"available"===e0.translator&&"available"===e0.languageDetector&&t.length>20&&eZ(t.slice(0,200),{timeoutMs:2e3}).then(async e=>{if(!e||e.confidence<.75)return;let i=e.detectedLanguage.slice(0,2);if(i===a)return;let n=await eX(t,{sourceLanguage:i,targetLanguage:a,timeoutMs:8e3});n&&(o=n,eo(e=>e.map(e=>e.id===s?{...e,content:n}:e)))}).catch(()=>{}),e.then(e=>{if(!r.signal.aborted&&e.success&&e.data&&(e.data.extractedContext&&e8(e.data.extractedContext),eo(t=>t.map(t=>t.id===s?{...t,proTip:e.data.proTip||null,freeTrialCta:e.data.freeTrialCta||null,suggestions:e.data.suggestions}:t)),ec(e.data.suggestions),tl(o),e.data.qualifyingQuestions?.length)){let t=e.data.qualifyingQuestions.filter(e=>{let t=K[e.contextKey];return t&&!eO[t]});t.length>0&&ep(t)}}).catch(e=>{console.warn("[AiSearchBar] Failed to enrich:",e)})},async e=>{console.error("[AiSearchBar] Stream error:",e);try{let e=await (0,z.g)(t,!1,e4);if(r.signal.aborted)return void ei(!1);if(e.success&&e.data){e.data.extractedContext&&e8(e.data.extractedContext);let t={id:s,type:"assistant",content:e.data.answer,timestamp:Date.now(),replyToMessageId:n,proTip:e.data.proTip||null,freeTrialCta:e.data.freeTrialCta||null,suggestions:e.data.suggestions,isStreaming:!1};eo(e=>e.some(e=>e.id===s)?e.map(e=>e.id===n?{...e,pending:!1}:e.id===s?t:e):[...e.map(e=>e.id===n?{...e,pending:!1}:e),t]),ec(e.data.suggestions),tl(e.data.answer)}else eo(e=>e.map(e=>e.id===n?{...e,pending:!1}:e)),er("it"===a?"Errore nella risposta AI":"AI response error")}catch(e){console.error("[AiSearchBar] Fallback failed:",e),eo(e=>e.map(e=>e.id===n?{...e,pending:!1}:e)),er("it"===a?"Errore nella risposta AI":"AI response error")}eM.current.delete(n),ei(!1)},r.signal);return}catch(e){console.error("[AiSearchBar] Stream setup error:",e)}try{let e=await (0,z.g)(t,!1,e4);if(r.signal.aborted)return void ei(!1);if(e.success&&e.data){e.data.extractedContext&&e8(e.data.extractedContext),eM.current.delete(n);let a={id:s,type:"assistant",content:e.data.answer,timestamp:Date.now(),replyToMessageId:n,proTip:e.data.proTip||null,freeTrialCta:e.data.freeTrialCta||null,suggestions:e.data.suggestions,isStreaming:!1};if(eo(e=>e.some(e=>e.id===s)?e.map(e=>e.id===n?{...e,pending:!1}:e.id===s?a:e):[...e.map(e=>e.id===n?{...e,pending:!1}:e),a]),ec(e.data.suggestions),tl(e.data.answer),e.data.qualifyingQuestions&&e.data.qualifyingQuestions.length>0){let t=e.data.qualifyingQuestions.filter(e=>{let t=K[e.contextKey];return!(t&&eO[t])});ep(t)}if(setTimeout(tt,50),i&&!td)return void setTimeout(()=>{tp(i,!0)},800);let r=e.data.suggestions[0],o=!!r&&Y(t,r.title,r.url,r.description);r&&r.confidence>=.92&&!td&&r.url&&o&&setTimeout(()=>{tp(r.url,!0)},800)}else eo(e=>e.map(e=>e.id===n?{...e,pending:!1}:e)),eM.current.delete(n),er(e.error||e9.aiError),tn()}catch(e){console.error("[AiSearchBar] Navigation error:",e),eo(e=>e.map(e=>e.id===n?{...e,pending:!1}:e)),eM.current.delete(n),er(e9.aiError),tn()}finally{setTimeout(()=>{eo(e=>(0===e.filter(e=>e.pending).length&&ei(!1),e))},0)}};(0,n.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),E?tc():ta()),"Escape"===e.key&&E&&tc(),E&&el.length>0&&("ArrowDown"===e.key&&(e.preventDefault(),em(e=>Math.min(e+1,el.length-1))),"ArrowUp"===e.key&&(e.preventDefault(),em(e=>Math.max(e-1,0))),"Enter"!==e.key||ea||!(el.length>0)||e.shiftKey||document.activeElement===eQ.current||(e.preventDefault(),tp(el[ed].url)))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[E,ta,tc,el,ed,ea,tp]);let tx=(0,n.useMemo)(()=>{let e={it:["Quanto costa Spoki?","Come integro Shopify?","Quali sono i vantaggi di WhatsApp Business?","Come funziona l'automazione?"],en:["How much does Spoki cost?","How do I integrate Shopify?","What are the benefits of WhatsApp Business?","How does automation work?"],es:["\xbfCu\xe1nto cuesta Spoki?","\xbfC\xf3mo integro Shopify?","\xbfCu\xe1les son los beneficios de WhatsApp Business?","\xbfC\xf3mo funciona la automatizaci\xf3n?"],fr:["Combien co\xfbte Spoki?","Comment int\xe9grer Shopify?","Quels sont les avantages de WhatsApp Business?","Comment fonctionne l'automatisation?"],de:["Was kostet Spoki?","Wie integriere ich Shopify?","Was sind die Vorteile von WhatsApp Business?","Wie funktioniert die Automatisierung?"],pt:["Quanto custa Spoki?","Como integro o Shopify?","Quais s\xe3o os benef\xedcios do WhatsApp Business?","Como funciona a automa\xe7\xe3o?"]};return e[a]||e.en},[a]);(0,n.useEffect)(()=>{let e;if(E)return;let t=0,a=!1,i=tx[eA],n=()=>{a?t>0?(t--,eN(i.substring(0,t)),e=setTimeout(n,30)):(a=!1,eT((eA+1)%tx.length)):t<=i.length?(eN(i.substring(0,t)),t++,e=setTimeout(n,50+30*Math.random())):e=setTimeout(()=>{a=!0,n()},2e3)};return n(),()=>clearTimeout(e)},[E,eA,tx]),(0,n.useEffect)(()=>{let e=e=>{!eD.current||eD.current.contains(e.target)||!E||Z||ea||ti()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[E,Z,ea,ti]),(0,n.useEffect)(()=>
1{if(E&&!Z){let e=window.scrollY,t=document.body.style.overflow,a=document.body.style.paddingRight,i=window.innerWidth-document.documentElement.clientWidth;document.body.style.overflow="hidden",i>0&&(document.body.style.paddingRight=`${i}px`);let n=e=>{if(!eD.current?.contains(e.target))return void e.preventDefault();let t=e.target;for(;t&&t!==eD.current;){let e=window.getComputedStyle(t).overflowY;if("auto"===e||"scroll"===e)break;t=t.parentElement}if(t&&t!==eD.current){let{scrollTop:a,scrollHeight:i,clientHeight:n}=t,r=0;if(e instanceof WheelEvent)r=e.deltaY;else if(e instanceof TouchEvent&&e.touches.length>0)return;let s=r>0;return r<0&&!(a>0)||s&&!(a+n<i-1)?void e.preventDefault():void 0}e.preventDefault()};return window.addEventListener("wheel",n,{passive:!1}),window.addEventListener("touchmove",n,{passive:!1}),()=>{document.body.style.overflow=t,document.body.style.paddingRight=a,window.removeEventListener("wheel",n),window.removeEventListener("touchmove",n),window.scrollY!==e&&window.scrollTo(0,e)}}},[E,Z]);let ty=(0,n.useMemo)(()=>e4.name?`${e9.greeting}, ${e4.name}!`:e9.searchHint,[e4.name,e9]),tv=es.length>0||eu.length>0||el.length>0,tw=(0,i.jsx)(p.F,{features:d.l,children:(0,i.jsx)(m.N,{children:E&&!Z&&(0,i.jsxs)(g.m.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed inset-0 z-[9999]",children:[(0,i.jsx)("div",{className:"absolute inset-0 bg-black/20",onClick:ti}),(0,i.jsx)("div",{className:"absolute inset-x-0 bottom-0 flex justify-center px-4 pb-4 sm:px-4 sm:pb-6 pointer-events-none",children:(0,i.jsxs)(g.m.div,{initial:{opacity:0,scale:.5,y:100},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.8,y:50},transition:{duration:.35,ease:[.4,0,.2,1],scale:{duration:.4}},ref:eD,className:"w-[calc(100%-16px)] max-w-[800px] lg:max-w-[900px] xl:max-w-[1000px] pointer-events-auto bg-white/95 backdrop-blur-sm rounded-[24px] sm:rounded-[28px] shadow-lg shadow-black/10 border border-gray-200 overflow-hidden flex flex-col max-h-[85vh] sm:max-h-[80vh]",onClick:e=>e.stopPropagation(),children:[(0,i.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-100 flex-shrink-0 bg-transparent",children:[(0,i.jsxs)("div",{className:"flex items-center gap-1",children:[(0,i.jsx)(C.default,{src:"/images/shared/icons/spoki-icon.svg",alt:"Spoki",width:14,height:14,className:"w-3.5 h-3.5"}),(0,i.jsx)("span",{className:"text-[11px] font-medium text-gray-600",children:e9.chatTitle||"Spoki AI"})]}),(0,i.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,i.jsx)("button",{type:"button",onClick:ti,className:"p-1 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Minimize",children:(0,i.jsx)(h.A,{className:"w-3.5 h-3.5 text-gray-400"})}),(0,i.jsx)("button",{type:"button",onClick:tc,className:"p-1 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Close search",children:(0,i.jsx)(f.A,{className:"w-3.5 h-3.5 text-gray-400"})})]})]}),ek&&(0,i.jsxs)(g.m.div,{initial:{opacity:0}
1,animate:{opacity:1},className:"flex-1 flex flex-col items-center justify-center p-8",children:[(0,i.jsx)("div",{className:"w-16 h-16 mb-4",children:(0,i.jsx)(C.default,{src:B,alt:"Generating...",width:64,height:64,className:"w-16 h-16",unoptimized:!0,priority:!0})}),(0,i.jsx)("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:e9.generatingPage||"Generating your page..."}),(0,i.jsx)("p",{className:"text-sm text-gray-500 text-center max-w-sm",children:e9.generatingPageSubtext||"Spoki AI is creating a personalized explanatory page just for you."}),(0,i.jsxs)(g.m.div,{className:"flex gap-1 mt-4",initial:{opacity:.5},animate:{opacity:1},transition:{duration:.5,repeat:1/0,repeatType:"reverse"},children:[(0,i.jsx)("span",{className:"w-2 h-2 bg-green/60 rounded-full"}),(0,i.jsx)("span",{className:"w-2 h-2 bg-green/40 rounded-full"}),(0,i.jsx)("span",{className:"w-2 h-2 bg-green/20 rounded-full"})]})]}),tv&&!ek&&(0,i.jsxs)("div",{className:"flex flex-col md:flex-row flex-1 min-h-[200px] overflow-hidden",children:[(0,i.jsxs)("div",{ref:eW,className:"flex-1 overflow-y-auto md:border-r border-gray-200 overscroll-contain min-h-0",children:[es.map((e,t)=>(0,i.jsx)(g.m.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.2,delay:.05*t},className:(0,M.cn)("px-4 py-3","user"===e.type?"bg-white":"bg-gradient-to-br from-green/5 to-green/10",t<es.length-1?"border-b border-gray-200":""),children:"user"===e.type?(0,i.jsxs)("div",{className:"space-y-2",children:[e.questionContext&&(0,i.jsxs)("div",{className:"flex items-start gap-2 text-xs text-gray-500 italic",children:[(0,i.jsx)("span",{className:"text-gray-400",children:"❓"}),(0,i.jsx)("span",{children:e.questionContext})]}),(0,i.jsx)("div",{className:"flex justify-end",children:(0,i.jsx)("div",{className:"max-w-[85%] bg-green text-white px-4 py-2.5 rounded-2xl rounded-br-md shadow-sm",children:(0,i.jsx)("p",{className:"text-sm leading-relaxed",children:e.content})})}),e.pending&&(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,i.jsx)("div",{className:"w-6 h-6 flex-shrink-0",children:(0,i.jsx)(C.default,{src:B,alt:"Loading...",width:24,height:24,className:"w-6 h-6",unoptimized:!0})}),(0,i.jsx)("span",{className:"text-xs text-green font-medium",children:e9.aiThinking}),(0,i.jsxs)(g.m.div,{className:"flex gap-0.5",initial:{opacity:.5},animate:{opacity:1},transition:{duration:.5,repeat:1/0,repeatType:"reverse"},children:[(0,i.jsx)("span",{className:"w-1 h-1 bg-green/60 rounded-full"}),(0,i.jsx)("span",{className:"w-1 h-1 bg-green/40 rounded-full"}),(0,i.jsx)("span",{className:"w-1 h-1 bg-green/20 rounded-full"})]})]})]}):(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{className:"flex items-start gap-3",children:[(0,i.jsx)("div",{className:"w-8 h-8 rounded-full bg-green/20 flex items-center justify-center flex-shrink-0",children:(0,i.jsx)(b.A,{className:"w-4 h-4 text-green"})}),(0,i.jsx)("div",{className:"flex-1 min-w-0",children:e.isStreaming&&!e.content?(0,i.jsx)("div",{className:"flex items-center gap-2",children:(0,i.jsxs)(g.m.div,{className:"flex gap-1",initial:{opacity:.5},animate:{opacity:1},transition:{duration:.5,repeat:1/0,repeatType:"reverse"},children:[(0,i.jsx)("span",{className:"w-2 h-2 bg-green/60 rounded-full"}),(0,i.jsx)("span",{className:"w-2 h-2 bg-green/40 rounded-full"}),(0,i.jsx)("span",{className:"w-2 h-2 bg-green/20 rounded-full"})]})}):(0,i.jsxs)("p",{className:"text-sm text-gray-800 leading-relaxed",children:[function(e){let t=[],a=e,n=0;for(;a.length>0;){let e=a.match(/\*\*(.+?)\*\*/),r=a.match(/(?<!\*)\*([^*]+?)\*(?!\*)/),s=null;if(e&&r?s=(e.index??1/0)<=(r.index??1/0)?{match:e,type:"bold"}:{match:r,type:"italic"}:e?s={match:e,type:"bold"}:r&&(s={match:r,type:"italic"}),s&&void 0!==s.match.index)s.match.index>0&&t.push(a.substring(0,s.match.index)),"bold"===s.type?t.push((0,i.jsx)("strong",{className:"font-semibold",children:s.match[1]},`md-${n++}`)):t.push((0,i.jsx)("em",{children:s.match[1]},`md-${n++}`)),a=a.substring(s.match.index+s.match[0].length);else{t.push(a);break}}return t}(e.content),e.isStreaming&&(0,i.jsx)(g.m.span,{className:"inline-block w-2 h-4 bg-green/60 ml-0.5",animate:{o
1pacity:[1,0]},transition:{duration:.5,repeat:1/0}})]})})]}),e.proTip&&(0,i.jsx)("div",{className:"ml-11 px-3 py-2 bg-gradient-to-r from-amber-50 to-orange-50 rounded-lg border border-amber-100",children:(0,i.jsxs)("div",{className:"flex items-start gap-2",children:[(0,i.jsx)(x.A,{className:"w-4 h-4 text-amber-600 flex-shrink-0 mt-0.5"}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"text-xs text-gray-700 leading-relaxed mb-1.5",children:e.proTip.text}),(0,i.jsxs)("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[(0,i.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-amber-700 bg-amber-100/80 px-2 py-0.5 rounded-full",children:["\uD83D\uDD25 ",e.proTip.benefit]}),(0,i.jsxs)("button",{onClick:()=>tp(e.proTip.ctaUrl),className:"inline-flex items-center gap-1 text-[10px] font-semibold text-green hover:text-green/80 transition-colors",children:[e.proTip.ctaText,(0,i.jsx)(y.A,{className:"w-3 h-3"})]})]})]})]})}),e.freeTrialCta?.show&&(0,i.jsx)("div",{className:"ml-11 mt-3",children:(0,i.jsxs)(g.m.button,{onClick:()=>tp((0,D.$Q)(a)),whileHover:{scale:1.02},whileTap:{scale:.98},className:(0,M.cn)("w-full px-4 py-3 rounded-xl","bg-gradient-to-r from-green to-green/90","text-white font-semibold text-sm","border-2 border-black","shadow-md hover:shadow-lg","transition-all duration-200","flex flex-col items-center gap-0.5"),children:[(0,i.jsxs)("span",{className:"flex items-center gap-2",children:[(0,i.jsx)(C.default,{src:"/images/shared/icons/spoki-icon.svg",alt:"Spoki",width:16,height:16,className:"w-4 h-4 invert"}),e.freeTrialCta.text,(0,i.jsx)(y.A,{className:"w-4 h-4"})]}),e.freeTrialCta.subtext&&(0,i.jsx)("span",{className:"text-[10px] font-normal text-white/80",children:e.freeTrialCta.subtext})]})})]})},e.id)),(0,i.jsx)(m.N,{children:en&&!ea&&(0,i.jsx)(g.m.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"px-4 py-3 bg-gradient-to-br from-red-50 to-orange-50",children:(0,i.jsxs)("div",{className:"flex items-start gap-3",children:[(0,i.jsx)("div",{className:"w-8 h-8 rounded-full bg-red-100 flex items-center justify-center flex-shrink-0",children:(0,i.jsx)(b.A,{className:"w-4 h-4 text-red-500"})}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"text-sm text-red-700 leading-relaxed",children:en}),(0,i.jsx)("p",{className:"text-xs text-red-500 mt-1",children:"it"===a?"Prova a riformulare la domanda o riprova tra poco.":"Try rephrasing your question or try again in a moment."})]})]})})}),(0,i.jsxs)(g.m.div,{initial:{opacity:0}
1,animate:{opacity:1},className:(0,M.cn)("px-4 py-3 border-t-2",e3.isComplete?"bg-gradient-to-r from-green/10 to-emerald-50 border-green/30":"bg-gradient-to-br from-amber-50 via-orange-50 to-yellow-50 border-amber-200"),children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,i.jsx)("div",{className:(0,M.cn)("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",e3.isComplete?"bg-green/20":"bg-amber-100"),children:e3.isComplete?(0,i.jsx)("span",{className:"text-base",children:"\uD83C\uDF89"}):(0,i.jsx)("svg",{className:"w-4 h-4 text-amber-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,i.jsx)("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"})})}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsxs)("div",{className:"flex items-center justify-between",children:[(0,i.jsx)("p",{className:(0,M.cn)("text-[11px] font-semibold",e3.isComplete?"text-green":"text-amber-700"),children:e3.isComplete?"it"===a?"Profilo completato!":"Profile complete!":"it"===a?"Il tuo profilo":"Your Profile"}),(0,i.jsxs)("span",{className:(0,M.cn)("text-[11px] font-bold",e3.isComplete?"text-green":"text-amber-600"),children:[e3.percentage,"%"]})]}),(0,i.jsx)("p",{className:"text-[9px] text-gray-500 mt-0.5",children:e3.isComplete?"it"===a?"Ora posso darti suggerimenti super personalizzati":"Now I can give you super personalized suggestions":"it"===a?"Rispondi alle domande per suggerimenti migliori":"Answer questions for better suggestions"})]})]}),(0,i.jsx)("div",{className:"w-full bg-white/60 rounded-full h-2 shadow-inner",children:(0,i.jsx)(g.m.div,{className:(0,M.cn)("h-2 rounded-full transition-all shadow-sm",e3.isComplete?"bg-gradient-to-r from-green to-emerald-400":"bg-gradient-to-r from-amber-400 via-orange-400 to-yellow-400"),initial:{width:0},animate:{width:`${e3.percentage}%`},transition:{duration:.5,ease:"easeOut"}})})]}),(0,i.jsx)(m.N,{children:e6&&(0,i.jsx)(W.Ve,{lang:a,existingEmail:e7.email,existingPhone:e7.phone,lpParams:eO,source:"ai-search",spokiVisitorId:eJ.marketingId||void 0,onSubmit:tu,onSuccess:()=>eq(!0)})}),(0,i.jsx)(m.N,{children:eu.length>0&&!ea&&(0,i.jsxs)(g.m.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.2,delay:.15},className:"px-4 py-3 bg-gradient-to-r from-blue-50 to-indigo-50 border-t border-blue-100",children:[(0,i.jsx)("p",{className:"text-[10px] font-medium text-blue-600 uppercase tracking-wide mb-2",children:e9.helpMeUnderstand}),(0,i.jsx)("div",{className:"space-y-3",children:eu.map(e=>(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"text-xs text-gray-700 mb-2",children:e.question}),e.options&&e.options.length>0&&(0,i.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.options.map(t=>(0,i.jsx)("button",{onClick:()=>tr(e.contextKey,t.value,t.label,e.question),disabled:ea,className:(0,M.cn)("px-2.5 py-1.5 text-[11px] rounded-full transition-all duration-150","bg-white border border-blue-200 text-gray-700","hover:bg-blue-100 hover:border-blue-300 hover:text-blue-800","active:scale-95","disabled:opacity-50 disabled:cursor-not-allowed"),children:t.label},t.value))})]},e.id))})]})})]}),(0,i.jsxs)("div",{className:"w-full md:w-[280px] lg:w-[320px] flex-shrink-0 flex flex-col bg-gray-50 max-h-[120px] md:max-h-none border-t md:border-t-0 border-gray-200",children:[(0,i.jsx)(m.N,{children:el.length>0&&(0,i.jsx)(g.m.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"px-4 py-2 bg-gray-100 border-b border-gray-200 flex-shrink-0",children:(0,i.jsx)("p",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide",children:e9.relatedPages})})}),(0,i.jsx)(m.N,{children:el.length>0&&(0,i.jsx)(g.m.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 overflow-y-auto overscroll-contain",children:el.map((e,t)=>(0,i.jsx)(g.m.button,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},transition:{delay:.05*t},onClick:()=>tp(e.url),onMouseEnter:()=>em(t),className:(0,M.cn)("w-full px-4 py-2.5 text-left transition-colors duration-150 border-b border-gray-200 last:border-0",ed===t?"bg-green/10":"hover:bg-white"),children:(0,i.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("div",{className:"flex items-center gap-2",children:(0,i.jsx)("h4",{className:"text-sm font-medium text-gray-900 truncate",children:e.title})}),e.category&&(0,i.jsx)("span",{className:(0,M.cn)("inline-block px-1.5 py-0.5 text-[9px] font-medium rounded-full mt-1",F[e.category]||"bg-gray-100 text-gray-600"),children:e.category}),(0,i.jsx)("p",{className:"text-[10px] text-gray-400 truncate mt-0.5",children:e.url})]}),(0,i.jsx)(v.A,{className:(0,M.cn)("w-4 h-4 flex-shrink-0 transition-colors",ed===t?"text-green":"text-gray-300")})]})},e.url))})})]})]}),!ea&&!ek&&!en&&0===es.length&&0===el.length&&(0,i.jsxs)("div",{className:"px-4 py-6 text-center",children:[(0,i.jsx)("div",{className:"w-12 h-12 rounded-full bg-green/10 flex items-center justify-center mx-auto mb-3",children:(0,i.jsx)(C.default,{src:"/images/shared/icons/spoki-icon.svg",alt:"Spoki",width:24,height:24,className:"w-6 h-6"})}),(0,i.jsx)("p",{className:"text-sm text-gray-700 font-medium mb-1",children:ty}),(0,i.jsx)("p",{className:"text-xs text-gray-400 mb-5",children:e9.examples}),(0,i.jsx)("div",{className:"flex flex-wrap justify-center gap-2",children:te.map(e=>(0,i.jsxs)(g.m.button,{onClick:()=>th(e.query,e.redirectUrl),whileHover:{scale:1.03},whileTap:{scale:.97},className:(0,M.cn)("inline-flex items-center gap-2 px-4 py-2.5 rounded-full","bg-white border-2 border-gray-200 hover:border-green/50","text-sm font-medium text-gray-700 hover:text-green","transition-colors duration-200","shadow-sm hover:shadow-md"),children:[(0,i.jsx)("span",{children:e.icon}),(0,i.jsx)("span",{children:e.label})]},e.id))})]}),e1&&(0,i.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 py-2 bg-amber-50 border-t border-amber-200 text-xs text-amber-800",children:[(0,i.jsxs)("span",{children:["it"===a?"Sembra che stai scrivendo in":"It looks like you're writing in"," ",(0,i.jsx)("strong",{children:e1.detectedLang.toUpperCase()}),"."," ",(0,i.jsxs)("button",{type:"button",onClick:()=>{eU.push(e1.url),e2(null)},className:"underline font-medium hover:text-amber-900",children:["it"===a?"Passa alla versione":"Switch to"," ",e1.detectedLang.toUpperCase()]})]}),(0,i.jsx)("button",{type:"button",onClick:()=>e2(null),className:"text-amber-500 hover:text-amber-700","aria-label":"Dismiss",children:"✕"})]}),!ek&&(0,i.jsx)("form",{onSubmit:tb,className:"flex-shrink-0 border-t border-gray-100 relative z-50 pointer-events-auto",children:(0,i.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 bg-white/80 backdrop-blur-sm pointer-events-auto",children:[(0,i.jsx)(C.default,{src:"/images/shared/icons/spoki-icon.svg",alt:"Spoki",width:20,height:20,className:"w-5 h-5 flex-shrink-0"}),(0,i.jsx)("input",{ref:eQ,type:"text",value:ee,onChange:e=>et(e.target.value),maxLength:500,onClick:e=>e.currentTarget.focus(),placeholder:es.length>0?e9.continueAsking||j||e9.placeholder:j||e9.placeholder,autoComplete:"off",autoFocus:!1,className:(0,M.cn)("flex-1 bg-transparent text-base text-gray-900 placeholder-gray-400","focus:outline-none cursor-text pointer-events-auto select-text"),style:{WebkitUserSelect:"text",userSelect:"text"}}),(0,i.jsx)("button",{type:"button",onClick:ts,className:(0,M.cn)("p-2 rounded-lg transition-colors",ex?"text-gray-500 hover:text-green hover:bg-green/10":"text-green hover:bg-green/10",ev&&!ex&&"animate-pulse"),"aria-label":ex?"Attiva audio":"Disattiva audio",title:ex?"Attiva lettura vocale":"Disattiva lettura vocale",children:ex?(0,i.jsx)(w.A,{className:"w-5 h-5"}):(0,i.jsx)(k.A,{className:"w-5 h-5"})}),(0,i.jsx)("button",{type:"button",onClick:()=>{X(!0),ez(!0)},className:"p-2 text-gray-500 hover:text-green hover:bg-green/10 rounded-lg transition-colors",title:"it"===a?"Parla con Spoki":"Talk to Spoki",children:(0,i.jsx)(S.A,{className:"w-5 h-5"})}),(0,i.jsx)("button",{type:"submit",disabled:!ee.trim(),className:"w-10 h-10 rounded-full bg-[#191919] flex items-center justify-center hover:bg-[#2a2a2a] transition-colors disabled:opacity-50","aria-label":e9.send||"Invia",children:(0,i.jsxs)("svg",{className:"w-5 h-5",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M18.0595 26.9486C18.1067 27.0663 18.1888 27.1667 18.2947 27.2364C18.4007 27.3061 18.5254 27.3417 18.6521 27.3384C18.7789 27.3352 18.9016 27.2932 19.0038 27.2182C19.106 27.1432 19.1829 27.0387 19.224 26.9188L27.302 3.30628C27.3417 3.19617 27.3493 3.077 27.3238 2.96273C27.2984 2.84845 27.2409 2.7438 27.1581 2.66101C27.
10753 2.57822 26.9706 2.52073 26.8564 2.49524C26.7421 2.46976 26.6229 2.47735 26.5128 2.51713L2.90028 10.5951C2.78035 10.6362 2.67587 10.7131 2.60086 10.8153C2.52586 10.9175 2.48392 11.0402 2.48067 11.167C2.47743 11.2937 2.51303 11.4184 2.5827 11.5243C2.65238 11.6303 2.75279 11.7124 2.87045 11.7596L12.7256 15.7116C13.0371 15.8363 13.3202 16.0228 13.5577 16.2599C13.7952 16.497 13.9822 16.7797 14.1075 17.091L18.0595 26.9486Z",stroke:"white",strokeWidth:"2.486",strokeLinecap:"round",strokeLinejoin:"round"}),(0,i.jsx)("path",{d:"M27.1623 2.66797L13.5664 16.2626",stroke:"white",strokeWidth:"2.486",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})})]})})]},"search-panel")})});return eC?(0,i.jsx)(Q.Li,{isOpen:eC,onClose:()=>{ez(!1),X(!1)},lang:a,initialMessage:ee.trim()||void 0}):(0,i.jsxs)(p.F,{features:d.l,children:[(0,i.jsxs)(m.N,{mode:"wait",children:[!E&&(0,i.jsxs)(g.m.button,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},whileHover:{scale:1.05},whileTap:{scale:.95},transition:{duration:.2,ease:"easeOut"},onClick:ta,className:(0,M.cn)("flex items-center gap-3 pl-5 pr-2 py-2 lg:pl-6 lg:pr-3 lg:py-2.5 rounded-full","backdrop-blur-sm","text-gray-500 font-normal text-sm lg:text-base","shadow-lg shadow-black/10 hover:shadow-xl hover:shadow-black/15","transition-all duration-200","border-[2.6px] border-transparent","w-[360px] lg:w-[600px]",t),style:{backgroundImage:eL,backgroundOrigin:"padding-box, border-box",backgroundClip:"padding-box, border-box"},"aria-label":"Open AI search",children:[(0,i.jsxs)("span",{className:"flex-1 text-left truncate",children:[ej,(0,i.jsx)("span",{className:"animate-pulse",children:"|"})]}),(0,i.jsx)("span",{className:"flex-shrink-0 w-9 h-9 lg:w-10 lg:h-10 rounded-full bg-[#191919] flex items-center justify-center",children:(0,i.jsxs)("svg",{className:"w-4 h-4 lg:w-5 lg:h-5",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M18.0595 26.9486C18.1067 27.0663 18.1888 27.1667 18.2947 27.2364C18.4007 27.3061 18.5254 27.3417 18.6521 27.3384C18.7789 27.3352 18.9016 27.2932 19.0038 27.2182C19.106 27.1432 19.1829 27.0387 19.224 26.9188L27.302 3.30628C27.3417 3.19617 27.3493 3.077 27.3238 2.96273C27.2984 2.84845 27.2409 2.7438 27.1581 2.66101C27.0753 2.57822 26.9706 2.52073 26.8564 2.49524C26.7421 2.46976 26.6229 2.47735 26.5128 2.51713L2.90028 10.5951C2.78035 10.6362 2.67587 10.7131 2.60086 10.8153C2.52586 10.9175 2.48392 11.0402 2.48067 11.167C2.47743 11.2937 2.51303 11.4184 2.5827 11.5243C2.65238 11.6303 2.75279 11.7124 2.87045 11.7596L12.7256 15.7116C13.0371 15.8363 13.3202 16.0228 13.5577 16.2599C13.7952 16.497 13.9822 16.7797 14.1075 17.091L18.0595 26.9486Z",stroke:"white",strokeWidth:"2.486",strokeLinecap:"round",strokeLinejoin:"round"}),(0,i.jsx)("path",{d:"M27.1623 2.66797L13.5664 16.2626",stroke:"white",strokeWidth:"2.486",strokeLinecap:"round",strokeLinejoin:"round"})]})})]},"search-fab"),E&&Z&&(0,i.jsxs)(g.m.button,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},whileHover:{scale:1.05},whileTap:{scale:.95},transition:{duration:.2,ease:"easeOut"},onClick:ta,className:(0,M.cn)("flex items-center gap-3 pl-5 pr-2 py-2 lg:pl-6 lg:pr-3 lg:py-2.5 rounded-full","bg-white/95 backdrop-blur-sm","text-gray-500 font-normal text-sm lg:text-base","shadow-lg shadow-black/10 hover:shadow-xl hover:shadow-black/15","transition-all duration-200","border border-gray-200","w-[360px] lg:w-[600px]",t),"aria-label":"Restore AI search",children:[(0,i.jsxs)("span",{className:"flex-1 text-left truncate flex items-center gap-2",children:[(0,i.jsx)("span",{children:e9.continueChat||"Continua chat"}),es.length>0&&(0,i.jsx)("span",{className:"w-2 h-2 bg-green rounded-full animate-pulse"})]}),(0,i.jsx)("span",{className:"flex-shrink-0 w-9 h-9 lg:w-10 lg:h-10 rounded-full bg-[#191919] flex items-center justify-center",children:(0,i.jsxs)("svg",{className:"w-4 h-4 lg:w-5 lg:h-5",viewBox:"0 0 30 30",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M18.0595 26.9486C18.1067 27.0663 18.1888 27.1667 18.2947 27.2364C18.4007 27.3061 18.5254 27.3417 18.6521 27.3384C18.7789 27.3352 18.9016 27.2932 19.0038 27.2182C19.106 27.1432 19.1829 27.0387 19.224 26.9188L27.302 3.30628C27.3417 3.19617 27.3493 3.077 27.3238 2.96273C27.2984 2.84845 27.2409 2.7438 27.1581 2.66101C27.
10753 2.57822 26.9706 2.52073 26.8564 2.49524C26.7421 2.46976 26.6229 2.47735 26.5128 2.51713L2.90028 10.5951C2.78035 10.6362 2.67587 10.7131 2.60086 10.8153C2.52586 10.9175 2.48392 11.0402 2.48067 11.167C2.47743 11.2937 2.51303 11.4184 2.5827 11.5243C2.65238 11.6303 2.75279 11.7124 2.87045 11.7596L12.7256 15.7116C13.0371 15.8363 13.3202 16.0228 13.5577 16.2599C13.7952 16.497 13.9822 16.7797 14.1075 17.091L18.0595 26.9486Z",stroke:"white",strokeWidth:"2.486",strokeLinecap:"round",strokeLinejoin:"round"}),(0,i.jsx)("path",{d:"M27.1623 2.66797L13.5664 16.2626",stroke:"white",strokeWidth:"2.486",strokeLinecap:"round",strokeLinejoin:"round"})]})})]},"minimized-fab")]}),eg&&(0,r.createPortal)(tw,document.body)]})}}}]);

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.