PageSourceSearch

https://spoki.com/_next/static/chunks/86227-e5521ddaaa732708.js

js spoki.com collected 2026-10-03 21:28:28 UTC 67,501 bytes, 19 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[86227],{3418:(e,t,i)=>{i.d(t,{F8:()=>en,eB:()=>eo});var r=i(95155),a=i(12115),n=i(20063);let o={hover:.1,text_select:.25,video_watch:.3,form_focus:.2,scroll_back:.1,tab_return:.15},s=(0,a.createContext)(null);function l(e){let{children:t,visitorId:i,sessionId:l,enabled:c=!0,onEngagementChange:u}=e,d=(0,a.useRef)([]),m=(0,a.useRef)("cold"),p=(0,a.useRef)(0),{metrics:g,trackHover:f,trackTextSelection:h,trackVideoProgress:y,trackFormFocus:v,trackScrollBack:w,isTracking:b}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{enabled:t=!0,visitorId:i,sessionId:r,onEvent:s,hoverThresholdMs:l=2e3,scrollBackThresholdPercent:c=20,debounceMs:u=500}=e,d=(0,n.usePathname)(),[m,p]=(0,a.useState)({hoverSignals:0,textSelections:0,videoWatches:0,formFocuses:0,scrollBacks:0,tabReturns:0,scrollVelocity:"medium",engagementScore:0}),[g,f]=(0,a.useState)(!1),h=(0,a.useRef)([]),y=(0,a.useRef)(0),v=(0,a.useRef)(0),w=(0,a.useRef)([]),b=(0,a.useRef)(null),x=(0,a.useRef)(null),S=(0,a.useCallback)(async e=>{if(i)try{await fetch("/api/behavioral/micro-conversion",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({visitorId:i,sessionId:r,eventType:e.type,elementId:e.elementId,elementType:e.elementType,pagePath:d,durationMs:e.durationMs,percentage:e.percentage,metadata:e.metadata}),keepalive:!0})}catch{}},[i,r,d]),k=(0,a.useCallback)(e=>{if(!t)return;let i={...e,timestamp:Date.now()};h.current.push(i),s?.(i),p(t=>{var i;let r,a={...t};switch(e.type){case"hover":a.hoverSignals++;break;case"text_select":a.textSelections++;break;case"video_watch":a.videoWatches++;break;case"form_focus":a.formFocuses++;break;case"scroll_back":a.scrollBacks++;break;case"tab_return":a.tabReturns++;break;case"scroll_velocity":a.scrollVelocity=e.metadata?.velocity||"medium"}return r=0+Math.min((i=a).hoverSignals*o.hover,.3)+Math.min(i.textSelections*o.text_select,.5)+Math.min(i.videoWatches*o.video_watch,.6)+Math.min(i.formFocuses*o.form_focus,.4)+Math.min(i.scrollBacks*o.scroll_back,.2)+Math.min(i.tabReturns*o.tab_return,.3),"slow"===i.scrollVelocity&&(r*=1.2),a.engagementScore=Math.min(Math.round(100*r),100),a}),S(i)},[t,s,S]),M=(0,a.useCallback)((e,t,i)=>{let r=Date.now()-i;r>=l&&k({type:"hover",elementId:e,elementType:t,durationMs:r})},[l,k]),C=(0,a.useCallback)(e=>{e&&!(e.length<10)&&(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{k({type:"text_select",elementType:"content",metadata:{textLength:e.length,preview:e.substring(0,100)}})},u))},[u,k]),_=(0,a.useCallback)((e,t,i)=>{t<25||k({type:"video_watch",elementId:e,elementType:"video",percentage:t,durationMs:i})},[k]),T=(0,a.useCallback)((e,t)=>{k({type:"form_focus",elementId:e,elementType:"form",metadata:{field:t}})},[k]),D=(0,a.useCallback)(e=>{e>=c&&k({type:"scroll_back",elementType:"content",percentage:e})},[c,k]);return(0,a.useEffect)(()=>{if(!t)return;f(!0);let e=()=>{let e=window.getSelection(),t=e?.toString().trim();t&&C(t)},i=()=>{let e=window.scrollY,t=document.documentElement.scrollHeight-window.innerHeight;if(w.current.push(Date.now()),w.current.length>10&&w.current.shift(),e<y.current&&y.current>0){let i=v.current-e,r=t>0?i/t*100:0;r>=c&&D(r)}if(e>v.current&&(v.current=e),y.current=e,w.current.length>=5){let i,r=w.current[w.current.length-1]-w.current[0],a=w.current.length/(r/1e3);(i=a>3?"fast":a<1?"slow":"medium")!==m.scrollVelocity&&k({type:"scroll_velocity",metadata:{velocity:i,scrollPercent:t>0?e/t*100:0}})}},r=()=>{if(document.hidden)b.current=Date.now();else if(b.current){let e=Date.now()-b.current;e>5e3&&k({type:"tab_return",durationMs:e}),b.current=null}};return document.addEventListener("mouseup",e),window.addEventListener("scroll",i,{passive:!0}),document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("mouseup",e),window.removeEventListener("scroll",i),document.removeEventListener("visibilitychange",r),x.current&&clearTimeout(x.current),f(!1)}},[t,C,D,c,m.scrollVelocity,k]),{metrics:m,trackHover:M,trackTextSelection:C,trackVideoProgress:_,trackFormFocus:T,trackScrollBack:D,isTracking:g}}({enabled:c,visitorId:i,sessionId:l,onEvent:(0,a.useCallback)(e=>{d.current.push(e),d.current.length>50&&d.current.shift()},[])}),x=(0,a.useCallback)(()=>g.engagementScore>=60?"hot":g.engagementScore>=30?"warm":"cold",[g.engagementScore]);(0,a.useEffect)(()=>{let e=x(),t=g.engagementScore;(t!==p.current||e!==m.current)&&(p.current=t,m.current=e,u?.(t,e))},[g.engagementScore,x,u,g]);let S=(0,a.useMemo)(()=>({metrics:g,engagementScore:g.engagementScore,isTracking:b,trackHover:f,trackTextSelection:h,trackVideoProgress:y,trackFormFocus:v,trackScrollBack:w,getEngagementTier:x,recentEvents:d.current}),[g,b,f,h,y,v,w,x]);return(0,r.jsx)(s.Provider,{value:S,children:t})}let c={timeOfDay:{morning:{focus:"productivity",tone:"energetic",format:"bullets",length:"short",cta:"standard",temperatureModifier:-.1,additionalContext:"User starting their day - focu
1s on getting things done efficiently."},afternoon:{focus:"efficiency",tone:"professional",format:"paragraphs",length:"medium",cta:"standard",temperatureModifier:0,additionalContext:"Peak work hours - maintain professional tone."},evening:{focus:"automation",tone:"relaxing",format:"visual",length:"medium",cta:"soft",temperatureModifier:.1,additionalContext:'End of workday - emphasize automation "while you sleep" benefits.'},night:{focus:"innovation",tone:"inspirational",format:"stories",length:"detailed",cta:"curious",temperatureModifier:.15,additionalContext:"Late browsing - user is curious and has time to explore."}},dayOfWeek:{weekday:{focus:"productivity",tone:"professional",cta:"standard",temperatureModifier:0},weekend:{focus:"innovation",tone:"casual",cta:"soft",temperatureModifier:.1,additionalContext:"Weekend browsing - likely planning or researching."}},scrollBehavior:{fast:{format:"bullets",length:"short",cta:"strong",temperatureModifier:-.1,additionalContext:"User is scanning quickly - use punchy, scannable content with clear CTAs."},medium:{format:"paragraphs",length:"medium",cta:"standard",temperatureModifier:0},slow:{format:"paragraphs",length:"detailed",cta:"soft",temperatureModifier:.1,additionalContext:"User is reading carefully - provide detailed, thoughtful content."}},sessionDepth:{firstPage:{focus:"growth",tone:"inspirational",cta:"soft",temperatureModifier:.1,additionalContext:"New to site - focus on awareness and value proposition."},exploring:{focus:"efficiency",tone:"professional",cta:"standard",temperatureModifier:0,additionalContext:"User exploring (2-4 pages) - building interest."},engaged:{focus:"competitive",tone:"professional",cta:"standard",temperatureModifier:0,additionalContext:"Engaged user (5-9 pages) - considering options."},deepSession:{focus:"reliability",tone:"analytical",format:"numbers",cta:"strong",temperatureModifier:-.1,additionalContext:"Deep engagement (10+ pages) - user is in decision mode. Provide proof points."}},returnVisit:{first:{focus:"growth",tone:"inspirational",cta:"soft",additionalContext:"First visit - introduce core value proposition."},second:{focus:"efficiency",tone:"professional",cta:"standard",additionalContext:"Second visit - user remembers you, deepen the relationship."},returning:{focus:"competitive",tone:"professional",cta:"standard",additionalContext:"Returning visitor (3-5 visits) - likely comparing options."},loyal:{focus:"automation",tone:"casual",cta:"strong",additionalContext:"Loyal visitor (6+ visits) - ready for conversion or already engaged."},dormant:{focus:"innovation",tone:"energetic",cta:"curious",additionalContext:"Returned after long absence - show what's new and re-engage."}},deviceType:{mobile:{format:"bullets",length:"short",cta:"strong",temperatureModifier:-.05,additionalContext:"Mobile user - keep content concise and tappable."},tablet:{format:"visual",length:"medium",cta:"standard",temperatureModifier:0},desktop:{format:"paragraphs",length:"detailed",cta:"standard",temperatureModifier:0,additionalContext:"Desktop user - can handle more detailed content."}},engagementTier:{cold:{focus:"growth",tone:"inspirational",cta:"soft",temperatureModifier:.1,additionalContext:"Low engagement - need to capture attention and build interest."},warm:{focus:"efficiency",tone:"professional",cta:"standard",temperatureModifier:0,additionalContext:"Warm lead - nurture with relevant content."},hot:{focus:"reliability",tone:"analytical",format:"numbers",cta:"strong",temperatureModifier:-.1,additionalContext:"High engagement - provide proof points and push for conversion."}},referralSource:{organic:{focus:"growth",tone:"professional",cta:"soft",additionalContext:"Organic search - user is researching."},paid:{focus:"cost-savings",tone:"professional",cta:"strong",temperatureModifier:-.1,additionalContext:"Paid traffic - optimize for conversion, ROI messaging."},social:{focus:"innovation",tone:"casual",cta:"curious",temperatureModifier:.1,additionalContext:"Social referral - be engaging and shareable."},email:{focus:"automation",tone:"professional",cta:"standard",additionalContext:"Email click - already engaged, continue the conversation."},direct:{focus:"reliability",tone:"professional",cta:"standard",additionalContext:"Direct visit - brand awareness exists, reinfor
1ce trust."}}},u={focus:"efficiency",tone:"professional",format:"paragraphs",length:"medium",cta:"standard",temperatureModifier:0},d="behavior_visit_count",m="behavior_last_visit",p="behavior_pages_viewed";function g(){let e=new Date;return{timeOfDay:function(e){let t=e.getHours();return t>=5&&t<12?"morning":t>=12&&t<17?"afternoon":t>=17&&t<21?"evening":"night"}(e),dayOfWeek:function(e){let t=e.getDay();return 0===t||6===t?"weekend":"weekday"}(e),scrollVelocity:"medium",pagesViewed:h(),visitCount:f(),daysSinceLastVisit:function(){if("undefined"==typeof localStorage)return 0;let e=localStorage.getItem(m);if(!e)return 0;let t=new Date(e);return Math.floor(Math.abs(new Date().getTime()-t.getTime())/864e5)}(),deviceType:function(){let e=navigator.userAgent.toLowerCase(),t=window.innerWidth;return/mobile|android|iphone|ipod|blackberry|iemobile|opera mini/i.test(e)?"mobile":/ipad|tablet/i.test(e)||t>=768&&t<1024?"tablet":"desktop"}(),engagementTier:"cold",referralSource:function(){let e=new URLSearchParams(window.location.search),t=document.referrer.toLowerCase();return e.get("gclid")||"cpc"===e.get("utm_medium")?"paid":e.get("utm_source")?.includes("email")||"email"===e.get("utm_medium")?"email":t.includes("facebook.")||t.includes("instagram.")||t.includes("linkedin.")||t.includes("twitter.")||t.includes("tiktok.")||t.includes("youtube.")?"social":t.includes("google.")||t.includes("bing.")||t.includes("yahoo.")||t.includes("duckduckgo.")?"organic":!t||t.includes(window.location.hostname)?"direct":"organic"}(),sessionDuration:0}}function f(){return"undefined"==typeof localStorage?1:parseInt(localStorage.getItem(d)||"0",10)||1}function h(){return"undefined"==typeof sessionStorage?1:parseInt(sessionStorage.getItem(p)||"1",10)}let y="user_progress",v=[{id:"viewed_homepage",name:{en:"First Visit",it:"Prima Visita"},description:{en:"Started exploring Spoki",it:"Hai iniziato a esplorare Spoki"},weight:5,category:"awareness",trigger:"page_view"},{id:"explored_features",name:{en:"Feature Explorer",it:"Esploratore di Funzionalit\xe0"},description:{en:"Checked out key features",it:"Hai scoperto le funzionalit\xe0 principali"},weight:15,category:"awareness",trigger:"page_view"},{id:"viewed_use_case",name:{en:"Use Case Viewer",it:"Caso d'Uso"},description:{en:"Explored a use case",it:"Hai esplorato un caso d'uso"},weight:15,category:"awareness",trigger:"page_view"},{id:"read_case_study",name:{en:"Case Study Reader",it:"Lettore di Case Study"},description:{en:"Read customer success story",it:"Hai letto una storia di successo"},weight:20,category:"consideration",trigger:"page_view"},{id:"viewed_pricing",name:{en:"Pricing Explorer",it:"Esploratore Prezzi"},description:{en:"Checked pricing plans",it:"Hai controllato i piani tariffari"},weight:25,category:"consideration",trigger:"page_view"},{id:"watched_demo",name:{en:"Demo Watcher",it:"Visualizzatore Demo"},description:{en:"Watched product demo",it:"Hai visto la demo del prodotto"},weight:25,category:"consideration",trigger:"action"},{id:"engaged_5_minutes",name:{en:"Engaged Visitor",it:"Visitatore Coinvolto"},description:{en:"Spent 5+ minutes exploring",it:"Hai dedicato 5+ minuti all'esplorazione"},weight:15,category:"consideration",trigger:"time"},{id:"viewed_integrations",name:{en:"Integration Explorer",it:"Esploratore Integrazioni"},description:{en:"Explored integration options",it:"Hai esplorato le opzioni di integrazione"},weight:15,category:"consideration",trigger:"page_view"},{id:"started_form",name:{en:"Getting Started",it:"Inizio Percorso"},description:{en:"Started registration process",it:"Hai iniziato la registrazione"},weight:30,category:"decision",trigger:"action"},{id:"completed_registration",name:{en:"Welcome Aboard!",it:"Benvenuto a Bordo!"},description:{en:"Completed registration",it:"Hai completato la registrazione"},weight:50,category:"decision",trigger:"action"}],w={visitor:0,engaged:15,interested:35,evaluating:55,ready:75,customer:100};function b(e){let t=new Set(e.milestonesAchieved),i=0,r=0,a=0,n=0,o=0,s=0;for(let e of v){let l=e.weight;switch(e.category){case"awareness":i+=l,t.has(e.id)&&(r+=l);break;case"consideration":a+=l,t.has(e.id)&&(n+=l);break;case"decision":o+=l,t.has(e.id)&&(s+=l)}}let l=i>0?Math.round(r/i*100):0,c=a>0?Math.round(n/a*100):0,u=o>0?Math.round(s/o*100):0,d=i+a+o,m=r+n+s,p=d>0?Math.round(m/d*100):0,g="visitor";for(let[e,t]of Object.entries(w).reverse())if(p>=t){g=e;break}let f=g!==e.currentStage,h=v.find(e=>!t.has(e.id))||null;return{...e,awarenessProgress:l,considerationProgress:c,decisionProgress:u,overallProgress:p,currentStage:g,stageEnteredAt:f?new Date:e.stageEnteredAt,nextMilestone:h}}let x="exit_intent_cooldown",S="exit_intent_triggers_session",k={enabled:!0,messages:[{id:"industry_registrations_today",type:"activity",intensity:"moderate",template:{it:"{count} aziende del settore {industry} si sono registrate oggi",en:"{count} {industry} companies registered today"},icon:"\uD83D\uDCC8",minValue:3,refreshInterval:6e4},{id:"recent_registrations",type:"activity",intensity:"subtle",template:{it:"{count} nuove aziende questa settimana",en:"{count} new companies this week"},icon:"✨",minValue:10,refreshInterval:3e5},{id:"live_visitors",type:"activity",intensity:"subtle",template:{it:"{count} persone stanno esplorando Spoki in questo momento",en:"{count} people are exploring Spoki right now"},icon:"\uD83D\uDC40",minValue:5,refreshInterval:3e4},{id:"demo_slots",type:"scarcity",intensity:"strong",template:{it:"Solo {count} slot disponibili per demo questa settimana",en:"Only {count} demo slots available this week"},icon:"\uD83D\uDCC5",maxValue:5,refreshInterval:6e5},{id:"trial_ending",type:"time",intensity:"strong",template:{it:"Offerta speciale valida ancora per {days} giorni",en:"Special offer valid for {days} more days"},icon:"⏰",maxValue:7,refreshInterval:36e5}
1,{id:"popular_feature",type:"popularity",intensity:"moderate",template:{it:"{count} aziende stanno usando questa funzionalit\xe0",en:"{count} companies are using this feature"},icon:"\uD83D\uDD25",minValue:100,refreshInterval:6e5},{id:"recent_success",type:"social_proof",intensity:"moderate",template:{it:"Un'azienda simile alla tua ha aumentato le conversioni del {percent}%",en:"A company like yours increased conversions by {percent}%"},icon:"\uD83C\uDFAF",minValue:20,refreshInterval:18e5},{id:"limited_time_discount",type:"time",intensity:"strong",template:{it:"Sconto {percent}% - scade tra {hours} ore",en:"{percent}% discount - expires in {hours} hours"},icon:"\uD83D\uDCB0",maxValue:48,refreshInterval:6e4}],defaultRefreshInterval:6e4,maxMessagesPerPage:2,showOnlyIfAboveThreshold:!0,activityThresholds:{low:5,medium:15,high:30}};var M=i(18428);let C={algorithm:"linucb",alpha:1,contextDimension:12,explorationBonus:.5,minSamplesForExploit:20,contextBuckets:[{id:"high-intent",features:{engagementTier:"hot",salesStage:"opportunity"},weight:2},{id:"researching",features:{salesStage:"lead",pagesViewed:3},weight:1.5},{id:"new-visitor",features:{returnVisitor:!1,pagesViewed:1},weight:1},{id:"mobile-quick",features:{deviceType:"mobile",scrollVelocity:"fast"},weight:1.2},{id:"evening-browser",features:{timeOfDay:"evening",scrollVelocity:"slow"},weight:1.3}],featureWeights:{persona:2,industry:1.8,salesStage:1.5,engagementTier:1.4,referralSource:1.2,deviceType:1,timeOfDay:.8,scrollVelocity:.7,returnVisitor:.6,pagesViewed:.5}},_={ceo:1,"marketing-manager":.9,"sales-manager":.85,"ecommerce-manager":.8,"customer-service-manager":.75,"it-manager":.7,cto:.65,"operations-manager":.6,"hr-manager":.55,"agency-owner":.5,default:.3},T={"shopping-retail":1,"professional-services":.9,restaurant:.85,"hotel-lodging":.8,"beauty-spa-salon":.75,automotive:.7,"medical-health":.65,"real-estate":.6,"education-learning":.55,"finance-banking":.5,default:.3},D={customer:1,opportunity:.75,lead:.5,prospect:.25},E={paid:1,email:.8,social:.6,organic:.4,direct:.2},I={desktop:1,tablet:.6,mobile:.3},A={morning:.25,afternoon:.5,evening:.75,night:1},V={slow:1,medium:.5,fast:.2},j={hot:1,warm:.6,cold:.2};function R(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:C,i=Array(t.contextDimension).fill(0);i[0]=_[e.persona||"default"]||.3,i[1]=T[e.industry||"default"]||.3,i[2]=D[e.salesStage||"prospect"]||.25,i[3]=E[e.referralSource||"direct"]||.2,i[4]=I[e.deviceType||"desktop"]||1,i[5]=A[e.timeOfDay||"afternoon"]||.5,i[6]=V[e.scrollVelocity||"medium"]||.5,i[7]=+!!e.returnVisitor,i[8]=Math.min((e.pagesViewed||1)/10,1),i[9]=Math.min((e.timeOnSite||0)/600,1),i[10]=j[e.engagementTier||"cold"]||.2,i[11]=+("weekend"===e.dayOfWeek);for(let e=0;e<i.length;e++){let r=["persona","industry","salesStage","referralSource","deviceType","timeOfDay","scrollVelocity","returnVisitor","pagesViewed","timeOnSite","engagementTier","dayOfWeek"],a=t.featureWeights[r[e]]||1;i[e]*=a}return i}function O(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:C,i=null,r=0;for(let a of t.contextBuckets){let t=0,n=0;for(let[i,r]of Object.entries(a.features)){let o=e[i];o===r?(t+=a.weight,n++):"number"==typeof r&&"number"==typeof o&&o>=r&&(t+=.5*a.weight,n++)}n>0&&t>r&&(r=t,i=a)}return i?.id||"default"}function N(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:C.contextDimension,i=[];for(let e=0;e<t;e++)i[e]=Array(t).fill(0),i[e][e]=1;return{armId:e,A:i,b:Array(t).fill(0),theta:Array(t).fill(0),pulls:0,totalReward:0}}function P(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:C.alpha,r=e.theta,a=0;for(let e=0;e<r.length;e++)a+=r[e]*t[e];let n=L(e.A),o=0;for(let e=0;e<t.length;e++){let i=0;for(let r=0;r<t.length;r++)i+=n[e][r]*t[r];o+=t[e]*i}return a+i*(o=Math.sqrt(o))}function L(e){let t=e.length,i=e.map((e,i)=>{let r=[...e];for(let e=0;e<t;e++)r.push(+(i===e));return r});for(let e=0;e<t;e++){let r=e;for(let a=e+1;a<t;a++)Math.abs(i[a][e])>Math.abs(i[r][e])&&(r=a);[i[e],i[r]]=[i[r],i[e]];let a=i[e][e];if(!(1e-10>Math.abs(a))){for(let r=0;r<2*t;r++)i[e][r]/=a;for(let r=0;r<t;r++)if(r!==e){let a=i[r][e];for(let n=0;n<2*t;n++)i[r][n]-=a*i[e][n]}}}return i.map(e=>e.slice(t))}function B(e){let[t,...i]=e.split("-"),r=i.join("-");
1return"reinforce"===t||"experiment"===t?{type:t,approach:r}:null}let z="contextual_bandit_stats";function F(){if("undefined"==typeof localStorage)return W();try{let e=localStorage.getItem(z);if(!e)return W();let t=JSON.parse(e);if(1!==t.version)return W();return t}catch{return W()}}function W(){let e={};for(let t of[...Object.keys(M.f0.reinforce).map(e=>`reinforce-${e}`),...Object.keys(M.f0.experiment).map(e=>`experiment-${e}`)])e[t]=N(t);return{version:1,arms:e,contextBucketStats:{},totalTrials:0,lastUpdated:Date.now()}}function $(e){if("undefined"!=typeof localStorage)try{e.lastUpdated=Date.now(),localStorage.setItem(z,JSON.stringify(e))}catch{}}function H(){let e,t=F(),i=Object.values(t.arms).filter(e=>e.pulls>0).map(e=>({armId:e.armId,pulls:e.pulls,avgReward:e.pulls>0?e.totalReward/e.pulls:0,strategyType:B(e.armId)?.type||"unknown"})).sort((e,t)=>t.avgReward-e.avgReward),r={};for(let[e,i]of Object.entries(t.contextBucketStats))i.bestArm&&(r[e]={armId:i.bestArm,avgReward:i.avgReward});let a=Object.values(t.arms).reduce((e,t)=>e+t.pulls,0),n=Object.values(t.arms).filter(e=>e.pulls<C.minSamplesForExploit).reduce((e,t)=>e+t.pulls,0);if(t.totalTrials<50)e=`Still in exploration phase. Need ${50-t.totalTrials} more trials for reliable insights.`;else if(i.length>0){let t=i[0],r=i.filter(e=>"reinforce"===e.strategyType).reduce((e,t)=>e+t.avgReward*t.pulls,0),a=i.filter(e=>"reinforce"===e.strategyType).reduce((e,t)=>e+t.pulls,0),n=i.filter(e=>"experiment"===e.strategyType).reduce((e,t)=>e+t.avgReward*t.pulls,0),o=i.filter(e=>"experiment"===e.strategyType).reduce((e,t)=>e+t.pulls,0),s=a>0?r/a:0,l=o>0?n/o:0;e=l>1.1*s?`Experiments outperforming! Top: ${t.armId} (${(100*t.avgReward).toFixed(1)}% reward)`:s>1.1*l?`Reinforcement winning. Best: ${t.armId}. Continue personalization focus.`:`Performance similar. Top arm: ${t.armId} with ${(100*t.avgReward).toFixed(1)}% reward.`}else e="No data yet. Start tracking to get insights.";return{totalTrials:t.totalTrials,armPerformance:i,bestArmByContext:r,explorationRate:a>0?n/a:1,recommendation:e}}let U={enabled:!0,variations:{standard:{id:"standard",weight:.7,promptModifier:"",temperatureBoost:0,examples:[]},surprising:{id:"surprising",weight:.15,promptModifier:`
2SURPRISE MODE: Create unexpected, attention-grabbing content.
3- Use a contrarian angle that challenges common assumptions
4- Lead with a surprising statistic or counterintuitive insight
5- Make the reader stop and think "I didn't expect that"
6- Example hooks: "Contrary to popular belief...", "What most people get wrong about..."
7      `.trim(),temperatureBoost:.2,examples:["Forget 'good customer service' - here's why fast beats friendly every time","The 98% open rate myth: why it might be hurting your business","Stop sending welcome messages (and do this instead)","Why your most loyal customers might be your worst ones"]},exclusive:{id:"exclusive",weight:.1,promptModifier:`
8EXCLUSIVE MODE: Create content that feels like insider knowledge.
9- Make the reader feel special for discovering this
10- Use language like "Few businesses realize...", "Hidden feature:", "Insider tip:"
11- Share "secrets" or lesser-known strategies
12- Create FOMO around the knowledge itself
13      `.trim(),temperatureBoost:.15,examples:["The hidden WhatsApp feature that 90% of businesses miss","Inside look: How top e-commerce brands recover 35%+ of abandoned carts","Few marketers know this: The 3-message sequence that converts","Exclusive: Early access to our new automation templates"]},challenge:{id:"challenge",weight:.05,promptModifier:`
14CHALLENGE MODE: Directly challenge the reader's current approach.
15- Be provocative but respectful
16- Question if their current method is really working
17- Create productive discomfort that motivates action
18- Use "What if..." and "Have you considered..." framing
19      `.trim(),temperatureBoost:.25,examples:["Is your email strategy actually working? The numbers say probably not.","You're leaving money on the table. Here's proof.","What if everything you know about customer engagement is wrong?","Still using the same approach from 2020? Your competitors aren't."]}},totalWeight:1,minSurpriseGap:3,maxConsecutiveStandard:5},q="variable_reward_state";function Y(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U;if(!e.enabled)return{type:"standard",promptModifier:"",temperatureBoost:0,reason:"Variable rewards disabled"};let t=function(){if("undefined"==typeof localStorage)return{lastVariation:"standard",consecutiveStandard:0,variationHistory:[],lastSurpriseIndex:-10};try{let e=localStorage.getItem(q);if(e)return JSON.parse(e)}catch{}return{lastVariation:"standard",consecutiveStandard:0,variationHistory:[],lastSurpriseIndex:-10}}(),i=t.variationHistory.length;if(t.consecutiveStandard>=e.maxConsecutiveStandard){let r=["surprising","exclusive","challenge"],a=r[Math.floor(Math.random()*r.length)],n=e.variations[a];return J(t,a,i),{type:a,promptModifier:n.promptModifier,temperatureBoost:n.temperatureBoost,reason:`Forced ${a} after ${e.maxConsecutiveStandard} consecutive standard`}}let r=i-t.lastSurpriseIndex;if(r<e.minSurpriseGap&&"standard"!==t.lastVariation){let a=e.variations.standard;return J(t,"standard",i),{type:"standard",promptModifier:a.promptModifier,temperatureBoost:a.temperatureBoost,reason:`Cooldown period (${r}/${e.minSurpriseGap})`}}let a=Math.random(),n=0;for(let[r,o]of Object.entries(e.variations))if(a<=(n+=o.weight))return J(t,r,i),{type:r,promptModifier:o.promptModifier,temperatureBoost:o.temperatureBoost,reason:`Random selection (${(100*a).toFixed(1)}% < ${(100*n).toFixed(1)}%)`};return J(t,"standard",i),{type:"standard",promptModifier:"",temperatureBoost:0,reason:"Fallback to standard"}}function J(e,t,i){e.lastVariation=t,e.variationHistory.push(t),"standard"===t?e.consecutiveStandard++:(e.consecutiveStandard=0,e.lastSurpriseIndex=i);if("undefined"!=typeof localStorage)try{e.variationHistory.length>20&&(e.variationHistory=e.variationHistory.slice(-20)),localStorage.setItem(q,JSON.stringify(e))}catch{}}var G=i(68329),Q=i(62874),X=i(51400),K=i(80547);let Z={offer:{en:{title:"Wait! Don't miss out",subtitle:"Exclusive offer just for you",description:"Get 20% off your first month when you sign up today. This offer expires when you leave.",ctaText:"Claim My Discount",ctaAction:"claim_discount",secondaryText:"No thanks, I'll pay full price",secondaryAction:"decline_offer"},it:{title:"Aspetta! Non perderti questa occasione",subtitle:"Offerta esclusiva solo per te",description:"Ottieni il 20% di sconto sul primo mese se ti iscrivi oggi. Questa offerta scade quando lasci la pagina.",ctaText:"Richiedi lo Sconto",ctaAction:"claim_discount",secondaryText:"No grazie, pagher\xf2 il prezzo intero",secondaryAction:"decline_offer"}},demo:{en:{title:"Still have questions?",subtitle:"Let us show you how Spoki works",description:"Book a free 15-minute demo with our team. We'll show you exactly how Spoki can help your business.",ctaText:"Book Free Demo",ctaAction:"book_demo",secondaryText:"Maybe later",secondaryAction:"dismiss"},it:{title:"Hai ancora domande?",subtitle:"Lasciaci mostrarti come funziona Spoki",description:"Prenota una demo gratuita di 15 minuti con il nostro team. Ti mostreremo esattamente come Spoki pu\xf2 aiutare la tua azienda.",ctaText:"Prenota Demo Gratuita",ctaAction:"book_demo",secondaryText:"Magari pi\xf9 tardi",secondaryAction:"dismiss"}},newsletter:{en:{title:"Stay in the loop",subtitle:"Get WhatsApp marketing tips",description:"Join 10,000+ marketers getting our weekly insights on WhatsApp marketing, automation, and customer engagement.",ctaText:"Subscribe",ctaAction:"subscribe",secondaryText:"No thanks",secondaryAction:"dismiss"},it:{title:"Resta aggiornato",subtitle:"Ricevi consigli sul WhatsApp marketing",description:"Unisciti a oltre 10.000 marketer che ricevono i nostri insight settimanali su WhatsApp marketing, automazione e customer engagement.",ctaText:"Iscriviti",ctaAction:"subscribe",secondaryText:"No grazie",secondaryAction:"dismiss"}},feedback:{en:{title:"Help us improve",subtitle:"What made you leave?",description:"Your feedback helps us create a better experience. What were you looking for that you couldn't find?",ctaText:"Share Feedback",ctaAction:"give_feedback",secondaryText:"Skip",secondaryAction:"dismiss"}
19,it:{title:"Aiutaci a migliorare",subtitle:"Cosa ti ha fatto andare via?",description:"Il tuo feedback ci aiuta a creare un'esperienza migliore. Cosa stavi cercando che non hai trovato?",ctaText:"Invia Feedback",ctaAction:"give_feedback",secondaryText:"Salta",secondaryAction:"dismiss"}}};function ee(e){let{isOpen:t,onClose:i,data:n,locale:o="en",variant:s="demo",customContent:l,onAction:c}=e,[u,d]=(0,a.useState)(""),[m,p]=(0,a.useState)(!1),g=Z[s]?.[o]||Z.demo[o],f=(0,a.useCallback)(()=>n?n.timeOnPage>60&&n.scrollDepth>50?"demo":n.timeOnPage<30?"offer":n.pagesViewed>3?"feedback":s:s,[n,s])(),h=Z[f]?.[o]||g,y=(0,a.useCallback)(e=>{c?.(e),"subscribe"===e||"claim_discount"===e?(p(!0),setTimeout(()=>{p(!1),i()},2e3)):("dismiss"===e||"decline_offer"===e)&&i()},[c,i]),v=(0,a.useCallback)(e=>{e.preventDefault(),u&&y(h.ctaAction)},[u,y,h.ctaAction]);return(0,a.useEffect)(()=>{let e=e=>{"Escape"===e.key&&i()};return t&&(document.addEventListener("keydown",e),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",e),document.body.style.overflow=""}},[t,i]),(0,r.jsx)(G.N,{children:t&&(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,r.jsx)(Q.m.div,{initial:{opacity:0}
19,animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:i}),(0,r.jsx)(Q.m.div,{initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:20},transition:{type:"spring",damping:25,stiffness:300},className:"relative bg-white rounded-2xl shadow-2xl max-w-md w-full overflow-hidden",children:l||(m?(0,r.jsxs)("div",{className:"p-8 text-center",children:[(0,r.jsx)(Q.m.div,{initial:{scale:0},animate:{scale:1},className:"w-16 h-16 mx-auto mb-4 bg-[#16D46D] rounded-full flex items-center justify-center text-white text-3xl",children:"✓"}),(0,r.jsx)("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"it"===o?"Grazie!":"Thank you!"}),(0,r.jsx)("p",{className:"text-gray-600",children:"it"===o?"Ti contatteremo presto.":"We'll be in touch soon."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:i,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors",children:(0,r.jsx)("svg",{className:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),(0,r.jsx)("div",{className:"bg-gradient-to-br from-[#16D46D]/10 to-[#25D366]/10 p-6 pb-4",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("span",{className:"text-4xl mb-3 block",children:["offer"===f&&"\uD83D\uDCB0","demo"===f&&"\uD83D\uDCF1","newsletter"===f&&"\uD83D\uDCE7","feedback"===f&&"\uD83D\uDCAC"]}),(0,r.jsx)("h2",{className:"text-2xl font-bold text-gray-900 mb-1",children:h.title}),(0,r.jsx)("p",{className:"text-[#16D46D] font-medium",children:h.subtitle})]})}),(0,r.jsxs)("div",{className:"p-6",children:[(0,r.jsx)("p",{className:"text-gray-600 mb-6 text-center",children:h.description}),("newsletter"===f||"offer"===f)&&(0,r.jsxs)("form",{onSubmit:v,className:(0,K.cn)("mb-4",X.C8.form.submit,X.C8.form.exitIntent),children:[(0,r.jsx)("input",{type:"email",value:u,onChange:e=>d(e.target.value),placeholder:"it"===o?"La tua email":"Your email",className:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-[#16D46D] focus:border-transparent outline-none mb-3",required:!0}),(0,r.jsx)("button",{type:"submit",className:"inline-flex items-center justify-center w-full h-11 leading-none px-6 bg-[#16D46D] hover:bg-[#14c062] text-white font-semibold rounded-lg transition-colors",children:h.ctaText})]}),("demo"===f||"feedback"===f)&&(0,r.jsx)("button",{onClick:()=>y(h.ctaAction),className:"inline-flex items-center justify-center w-full h-11 leading-none px-6 bg-[#16D46D] hover:bg-[#14c062] text-white font-semibold rounded-lg transition-colors mb-4",children:h.ctaText}),h.secondaryText&&(0,r.jsx)("button",{onClick:()=>y(h.secondaryAction||"dismiss"),className:"w-full py-2 text-gray-500 hover:text-gray-700 text-sm transition-colors",children:h.secondaryText})]})]}))})]})})}function et(e){let{isVisible:t,hiddenDuration:i,locale:a="en",onDismiss:n,onAction:o}=e,s=Math.floor(i/6e4),l="it"===a?`Bentornato! Sei stato via per ${s>0?`${s} minut${1===s?"o":"i"}`:"un po'"}. Continua da dove eri rimasto.`:`Welcome back! You were away for ${s>0?`${s} minute${1===s?"":"s"}`:"a while"}. Pick up where you left off.`;return(0,r.jsx)(G.N,{children:t&&(0,r.jsx)(Q.m.div,{initial:{opacity:0,y:-100},animate:{opacity:1,y:0},exit:{opacity:0,y:-100},className:"fixed top-0 left-0 right-0 z-40 bg-gradient-to-r from-[#16D46D] to-[#25D366] text-white shadow-lg",children:(0,r.jsxs)("div",{className:"mx-auto max-w-7xl px-6 lg:px-8 py-3 flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{className:"text-xl",children:"\uD83D\uDC4B"}),(0,r.jsx)("p",{className:"text-sm font-medium",children:l})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[o&&(0,r.jsx)("button",{onClick:o,className:"px-4 py-1.5 bg-white text-[#16D46D] text-sm font-semibold rounded-full hover:bg-gray-100 transition-colors",children:"it"===a?"Continua":"Continue"}),(0,r.jsx)("button",{onClick:n,className:"p-1 hover:bg-white/20 rounded-full transition-colors",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]})})})}function ei(e){let{milestone:t,locale:i="en",onClose:n,duration:o=5e3}=e;return a.useEffect(()=>{let e=setTimeout(n,o);return()=>clearTimeout(e)},[n,o]),(0,r.jsx)(G.N,{children:(0,r.jsx)(Q.m.div,{initial:{opacity:0,y:50,scale:.9}
19,animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:50,scale:.9},className:"fixed bottom-4 right-4 z-50 max-w-sm",children:(0,r.jsx)("div",{className:"bg-white rounded-xl shadow-lg border border-green-200 p-4",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"w-10 h-10 rounded-full bg-[#16D46D] flex items-center justify-center text-white text-xl",children:"\uD83C\uDFAF"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"font-semibold text-gray-900",children:"it"===i?"Traguardo Raggiunto!":"Milestone Achieved!"}),(0,r.jsx)("p",{className:"text-sm text-gray-600",children:t.name[i]}),(0,r.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:t.description[i]})]}),(0,r.jsx)("button",{onClick:n,className:"text-gray-400 hover:text-gray-600",children:"✕"})]})})})})}let er=(0,a.createContext)(null);function ea(e){let{children:t,visitorId:i,sessionId:o,industry:l,persona:w,locale:_="en",enabled:T=!0,showExitIntentModal:D=!0,showMilestoneToasts:E=!0,showTabReturnBanner:I=!0,onExitIntent:A,onMilestoneAchieved:V}=e,[j,z]=(0,a.useState)(!1),[W,U]=(0,a.useState)(null),[q,J]=(0,a.useState)(!1),G=(0,a.useContext)(s),Q=G?.engagementScore??0,X=G?.getEngagementTier()??"cold",K=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{enabled:t=!0,engagementScore:i=0,onTriggerChange:r}=e,[n,o]=(0,a.useState)(!1),[s,l]=(0,a.useState)(()=>g()),[y,v]=(0,a.useState)("medium");(0,a.useEffect)(()=>{if(!t)return;(function(){if("undefined"==typeof localStorage)return;let e="behavior_session_active";if(sessionStorage.getItem(e)){let e=parseInt(sessionStorage.getItem(p)||"1",10);sessionStorage.setItem(p,String(e+1))}else{sessionStorage.setItem(e,"true"),sessionStorage.setItem(p,"1");let t=f();localStorage.setItem(d,String(t+1)),localStorage.setItem(m,new Date().toISOString())}})(),o(!0);let e=[],i=Date.now(),r=()=>{let t=Date.now(),r=t-i;r>=500&&(e.push(window.scrollY),i=t,e.length>10&&e.shift(),e.length>=3&&v(function(e,t){if(e.length<2)return"medium";let i=0;for(let t=1;t<e.length;t++)i+=Math.abs(e[t]-e[t-1]);let r=i/(t/1e3);return r>1500?"fast":r<300?"slow":"medium"}(e,r*e.length)))},a=setInterval(()=>{l(e=>({...e,sessionDuration:e.sessionDuration+1,pagesViewed:h()}))},1e3);return window.addEventListener("scroll",r,{passive:!0}),()=>{window.removeEventListener("scroll",r),clearInterval(a)}},[t]),(0,a.useEffect)(()=>
19{l(e=>({...e,scrollVelocity:y}))},[y]),(0,a.useEffect)(()=>{let e="cold";i>=60?e="hot":i>=30&&(e="warm"),l(t=>({...t,engagementTier:e}))},[i]);let w=(0,a.useMemo)(()=>({timeOfDay:s.timeOfDay,dayOfWeek:s.dayOfWeek,scrollVelocity:s.scrollVelocity,pagesViewed:s.pagesViewed,visitCount:s.visitCount,daysSinceLastVisit:s.daysSinceLastVisit,deviceType:s.deviceType,engagementTier:s.engagementTier,referralSource:s.referralSource}),[s]),b=(0,a.useMemo)(()=>(function(e){let t={...u},i=[];if(e.timeOfDay&&c.timeOfDay[e.timeOfDay]&&i.push({source:c.timeOfDay[e.timeOfDay],weight:.8}),e.dayOfWeek&&c.dayOfWeek[e.dayOfWeek]&&i.push({source:c.dayOfWeek[e.dayOfWeek],weight:.5}),e.scrollVelocity&&c.scrollBehavior[e.scrollVelocity]&&i.push({source:c.scrollBehavior[e.scrollVelocity],weight:1.2}),void 0!==e.pagesViewed){let t;t=e.pagesViewed<=1?"firstPage":e.pagesViewed<=4?"exploring":e.pagesViewed<=9?"engaged":"deepSession",c.sessionDepth[t]&&i.push({source:c.sessionDepth[t],weight:1})}if(void 0!==e.visitCount||void 0!==e.daysSinceLastVisit){let t,r=e.visitCount||1;t=(e.daysSinceLastVisit||0)>30&&r>1?"dormant":1===r?"first":2===r?"second":r<=5?"returning":"loyal",c.returnVisit[t]&&i.push({source:c.returnVisit[t],weight:.9})}e.deviceType&&c.deviceType[e.deviceType]&&i.push({source:c.deviceType[e.deviceType],weight:1.1}),e.engagementTier&&c.engagementTier[e.engagementTier]&&i.push({source:c.engagementTier[e.engagementTier],weight:1.3}),e.referralSource&&c.referralSource[e.referralSource]&&i.push({source:c.referralSource[e.referralSource],weight:.7});let r={},a={},n={},o={},s={},l=0,d=0,m=[];for(let{source:e,weight:t}of i)e.focus&&(r[e.focus]=(r[e.focus]||0)+t),e.tone&&(a[e.tone]=(a[e.tone]||0)+t),e.format&&(n[e.format]=(n[e.format]||0)+t),e.length&&(o[e.length]=(o[e.length]||0)+t),e.cta&&(s[e.cta]=(s[e.cta]||0)+t),void 0!==e.temperatureModifier&&(l+=e.temperatureModifier*t,d+=t),e.additionalContext&&m.push(e.additionalContext);let p=e=>{let t=0,i=null;for(let[r,a]of Object.entries(e))a>t&&(t=a,i=r);return i};return t.focus=p(r)||u.focus,t.tone=p(a)||u.tone,t.format=p(n)||u.format,t.length=p(o)||u.length,t.cta=p(s)||u.cta,t.temperatureModifier=d>0?l/d:0,t.additionalContext=m.join(" "),t})(w),[w]),x=(0,a.useMemo)(()=>(function(e){let t=[];switch(t.push(`Focus on ${e.focus} benefits.`),t.push(`Use a ${e.tone} tone.`),e.format){case"bullets":t.push("Use bullet points for easy scanning.");break;case"numbers":t.push("Include specific numbers and statistics.");break;case"visual":t.push("Describe visual elements and use imagery in language.");break;case"stories":t.push("Use storytelling and scenarios.")}switch(e.length){case"short":t.push("Keep it very concise - maximum impact, minimum words.");break;case"detailed":t.push("Provide detailed, thorough content.")}switch(e.cta){case"soft":t.push("Use a soft, non-pushy call to action.");break;case"strong":t.push("Use a strong, direct call to action.");break;case"urgent":t.push("Create urgency in the call to action.");break;case"curious":t.push("Use curiosity-driving language in the CTA.")}return e.additionalContext&&t.push(`Context: ${e.additionalContext}`),t.join(" ")})(b),[b]),S=(0,a.useMemo)(()=>(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5;return Math.max(.1,Math.min(1,t+e.temperatureModifier))})(b),[b]);return(0,a.useEffect)(()=>{n&&r?.(b)},[b,n,r,s,S]),{state:s,output:b,promptModifier:x,temperature:S,isReady:n,refreshState:(0,a.useCallback)(()=>{l(g())},[])}}({enabled:T,engagementScore:Q}),Z=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{enabled:t=!0,locale:i="en",onMilestoneAchieved:r,onStageChange:o}=e,s=(0,n.usePathname)(),[l,c]=(0,a.useState)(!0),[u,d]=(0,a.useState)(()=>({currentStage:"visitor",stageEnteredAt:new Date,awarenessProgress:0,considerationProgress:0,decisionProgress:0,overallProgress:0,milestonesAchieved:[],nextMilestone:v[0],totalSessions:1,totalPagesViewed:0,totalTimeOnSite:0,daysSinceFirstVisit:0,featuresExplored:[],useCasesViewed:[]}));(0,a.useEffect)(()=>{if(!t)return;let e=function(){if("undefined"==typeof localStorage)return null;try{let e=localStorage.getItem(y);if(!e)return null;let t=JSON.parse(e);t.stageEnteredAt=new Date(t.stageEnteredAt);let i=new Date(t.firstVisit||Date.now());t.daysSinceFirstVisit=Math.floor((Date.now()-i.getTime())/864e5);let r="progress_session_active";return sessionStorage.getItem(r)||(sessionStorage.setItem(r,"true"),t.totalSessions=(t.totalSessions||0)+1),t}catch{return null}}();e&&d(e),c(!1)},[t]),(0,a.useEffect)(()=>{t&&!l&&function(e){if("undefined"!=typeof localStorage)try{let t=localStorage.getItem(y),i=t&&JSON.parse(t).firstVisit||Date.now();localStorage.setItem(y,JSON.stringify({...e,firstVisit:i}))}catch{}}(u)},[u,t,l]),(0,a.useEffect)(()=>{t&&!l&&s&&m(s)},[s,t,l]),(0,a.useEffect)(()=>
19{if(!t||l)return;let e=setInterval(()=>{d(e=>{let t=e.totalTimeOnSite+1;if(t>=300&&!e.milestonesAchieved.includes("engaged_5_minutes")){let i=v.find(e=>"engaged_5_minutes"===e.id);return i&&r?.(i),b({...e,totalTimeOnSite:t,milestonesAchieved:[...e.milestonesAchieved,"engaged_5_minutes"]})}return{...e,totalTimeOnSite:t}})},1e3);return()=>clearInterval(e)},[t,l,r]);let m=(0,a.useCallback)(e=>{let t=e.toLowerCase(),i=[];("/"===t||t.match(/^\/[a-z]{2}\/?$/))&&!u.milestonesAchieved.includes("viewed_homepage")&&i.push("viewed_homepage"),(t.includes("/features")||t.includes("/funzionalita"))&&!u.milestonesAchieved.includes("explored_features")&&i.push("explored_features"),(t.includes("/use-case")||t.includes("/caso-uso"))&&!u.milestonesAchieved.includes("viewed_use_case")&&i.push("viewed_use_case"),(t.includes("/customers")||t.includes("/clienti")||t.includes("/case-stud"))&&!u.milestonesAchieved.includes("read_case_study")&&i.push("read_case_study"),(t.includes("/pricing")||t.includes("/prezzi"))&&!u.milestonesAchieved.includes("viewed_pricing")&&i.push("viewed_pricing"),(t.includes("/integration")||t.includes("/integrazion"))&&!u.milestonesAchieved.includes("viewed_integrations")&&i.push("viewed_integrations"),i.length>0?d(e=>{let t=b({...e,totalPagesViewed:e.totalPagesViewed+1,milestonesAchieved:[...e.milestonesAchieved,...i]});for(let e of i){let t=v.find(t=>t.id===e);t&&r?.(t)}return t.currentStage!==e.currentStage&&o?.(t.currentStage,e.currentStage),t}):d(e=>({...e,totalPagesViewed:e.totalPagesViewed+1}))},[u.milestonesAchieved,r,o]),p=(0,a.useCallback)(e=>{if(u.milestonesAchieved.includes(e))return;let t=v.find(t=>t.id===e);t&&d(i=>{let a=b({...i,milestonesAchieved:[...i.milestonesAchieved,e]});return r?.(t),a.currentStage!==i.currentStage&&o?.(a.currentStage,i.currentStage),a})},[u.milestonesAchieved,r,o]),g=(0,a.useMemo)(()=>v.filter(e=>!u.milestonesAchieved.includes(e.id))[0]||null,[u.milestonesAchieved]),f=(0,a.useMemo)(()=>{if(0===u.milestonesAchieved.length)return null;let e=u.milestonesAchieved[u.milestonesAchieved.length-1];return v.find(t=>t.id===e)||null},[u.milestonesAchieved]),h=(0,a.useCallback)(()=>{let e={en:{low:`You're ${u.overallProgress}% through your Spoki journey!`,medium:`Great progress! You're ${u.overallProgress}% of the way there.`,high:`Almost there! Just ${100-u.overallProgress}% to go.`,complete:`You've completed your Spoki journey! 🎉`},it:{low:`Sei al ${u.overallProgress}% del tuo percorso Spoki!`,medium:`Ottimi progressi! Sei al ${u.overallProgress}% del percorso.`,high:`Ci sei quasi! Solo il ${100-u.overallProgress}% da completare.`,complete:`Hai completato il tuo percorso Spoki! 🎉`}}[i];return u.overallProgress>=100?e.complete:u.overallProgress>=70?e.high:u.overallProgress>=40?e.medium:e.low},[u.overallProgress,i]),w=(0,a.useCallback)(()=>{let e={en:["Don't lose your progress! You're doing great.",`You've unlocked ${u.milestonesAchieved.length} achievements.`,`Just ${g?.name.en||"a few steps"} away from the next milestone!`,"Your journey with Spoki is just beginning!"],it:["Non perdere i tuoi progressi! Stai andando alla grande.",`Hai sbloccato ${u.milestonesAchieved.length} achievement.`,`Solo ${g?.name.it||"pochi passi"} dal prossimo traguardo!`,"Il tuo viaggio con Spoki \xe8 appena iniziato!"]}[i];return e[Math.floor(Math.random()*e.length)]},[u.milestonesAchieved.length,g,i]);return{progress:u,currentMilestone:f,nextMilestone:g,milestones:v,achieveMilestone:p,getProgressMessage:h,getMotivationalMessage:w,isLoading:l}}({enabled:T,locale:_,onMilestoneAchieved:e=>{V?.(e),E&&U(e)}}),ea=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{enabled:t=!0,sensitivity:i=20,inactivityTimeout:r=3e4,onExitIntent:n,onTabReturn:o,cooldownMs:s=6e4,respectDoNotDisturb:l=!0,maxTriggersPerSession:c=2}=e,[u,d]=(0,a.useState)(!1),[m,p]=(0,a.useState)(null),[g,f]=(0,a.useState)(!1),[h,y]=(0,a.useState)(c),[v,w]=(0,a.useState)(!1),[b,k]=(0,a.useState)(0),M=(0,a.useRef)(Date.now()),C=(0,a.useRef)(Date.now()),_=(0,a.useRef)(null),T=(0,a.useRef)(0),D=(0,a.useRef)(null),E=(0,a.useRef)(null);(0,a.useEffect)(()=>
19{if("undefined"==typeof sessionStorage)return;let e=sessionStorage.getItem(S);e&&y(Math.max(0,c-parseInt(e,10)));let t=localStorage.getItem(x);if(t){let e=parseInt(t,10);Date.now()<e?(f(!0),setTimeout(()=>f(!1),e-Date.now())):localStorage.removeItem(x)}},[c]);let I=(0,a.useCallback)(e=>{if(!t||g||h<=0||u||l&&"true"===localStorage.getItem("exit_intent_dnd"))return;let i=document.documentElement.scrollHeight-window.innerHeight,r=i>0?Math.round(T.current/i*100):0,a={trigger:e,pageDepth:r,timeOnPage:Math.round((Date.now()-M.current)/1e3),scrollDepth:r,pagesViewed:"undefined"==typeof sessionStorage?1:parseInt(sessionStorage.getItem("behavior_pages_viewed")||"1",10),engagementScore:Math.min(100,Math.round(.8*r+20))};d(!0),p(a),f(!0);let o=h-1;y(o),sessionStorage.setItem(S,String(c-o)),localStorage.setItem(x,String(Date.now()+s)),setTimeout(()=>f(!1),s),n?.(a)},[t,g,h,u,l,c,s,n]),A=(0,a.useCallback)(()=>{d(!1),p(null)},[]),V=(0,a.useCallback)(()=>{f(!1),localStorage.removeItem(x)},[]);return(0,a.useEffect)(()=>{if(!t)return;let e=e=>{e.clientY<=i&&null===e.relatedTarget&&I("mouse_leave")},a=()=>{let e=window.scrollY;e>T.current&&(T.current=e),C.current=Date.now()},n=()=>{C.current=Date.now(),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{window.scrollY<100&&T.current>500?I("scroll_top"):I("inactivity")},r)},s=()=>{if(document.hidden)w(!0),_.current=Date.now(),E.current=setInterval(()=>{_.current&&k(Date.now()-_.current)},1e3);else if(w(!1),E.current&&(clearInterval(E.current),E.current=null),_.current){let e=Date.now()-_.current;k(e),e>1e4&&o?.(e),_.current=null}},l=()=>{I("back_button")};return document.addEventListener("mouseleave",e),window.addEventListener("scroll",a,{passive:!0}),window.addEventListener("mousemove",n,{passive:!0}),window.addEventListener("click",n,{passive:!0}),window.addEventListener("keydown",n,{passive:!0}),document.addEventListener("visibilitychange",s),window.addEventListener("popstate",l),n(),()=>{document.removeEventListener("mouseleave",e),window.removeEventListener("scroll",a),window.removeEventListener("mousemove",n),window.removeEventListener("click",n),window.removeEventListener("keydown",n),document.removeEventListener("visibilitychange",s),window.removeEventListener("popstate",l),D.current&&clearTimeout(D.current),E.current&&clearInterval(E.current)}},[t,i,r,I,o]),{triggered:u,triggerData:m,dismissIntent:A,resetCooldown:V,isOnCooldown:g,triggersRemaining:h,tabHidden:v,hiddenDuration:b}}({enabled:T,onExitIntent:e=>{A?.(e)},onTabReturn:e=>{I&&e>3e4&&J(!0)}}),en=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{enabled:t=!0,industry:i,persona:r,pageType:n,locale:o="en",engagementTier:s="cold",isReturningVisitor:l=!1,refreshInterval:c=k.defaultRefreshInterval}=e,[u,d]=(0,a.useState)(null),[m,p]=(0,a.useState)(!1),[g,f]=(0,a.useState)(null),[h,y]=(0,a.useState)(null),v=(0,a.useMemo)(()=>({industry:i,persona:r,pageType:n,locale:o,engagementTier:s,isReturningVisitor:l}),[i,r,n,o,s,l]),w=(0,a.useCallback)(async()=>{if(t){p(!0),f(null);try{let e=new URLSearchParams;i&&e.set("industry",i);let t=await fetch(`/api/behavioral/urgency?${e.toString()}`);if(!t.ok)throw Error("Failed to fetch activity data");let r=await t.json();d(r),y(new Date)}catch(e){f(e instanceof Error?e.message:"Unknown error"),d({activeVisitors5min:Math.floor(10*Math.random())+5,activeVisitors1hr:Math.floor(50*Math.random())+20,registrations24hr:Math.floor(20*Math.random())+10,registrations7d:Math.floor(100*Math.random())+50,demoRequests7d:Math.floor(15*Math.random())+5,industryRegistrations24hr:Math.floor(10*Math.random())+3})}finally{p(!1)}}},[t,i]);return(0,a.useEffect)(()=>{if(w(),t&&c>0){let e=setInterval(w,c);return()=>clearInterval(e)}},[w,t,c]),{messages:(0,a.useMemo)(()=>u?function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:k;if(!i.enabled)return[];let r=e.locale||"en",a=[];for(let n of i.messages){let i=function(e,t,i,r){let a,n=e.template[r];switch(e.id){case"industry_registrations_today":if(!(a=i.industryRegistrations24hr)||e.minValue&&a<e.minValue)return null;n=(n=n.replace("{count}",String(a))).replace("{industry}
19",function(e,t){let i={"shopping-retail":{it:"Retail",en:"Retail"},"professional-services":{it:"Servizi Professionali",en:"Professional Services"},restaurant:{it:"Ristorazione",en:"Restaurant"},"hotel-lodging":{it:"Hospitality",en:"Hospitality"},"beauty-spa-salon":{it:"Beauty & Wellness",en:"Beauty & Wellness"},automotive:{it:"Automotive",en:"Automotive"},"medical-health":{it:"Healthcare",en:"Healthcare"},"real-estate":{it:"Real Estate",en:"Real Estate"},"education-learning":{it:"Education",en:"Education"},"finance-banking":{it:"Finance",en:"Finance"}};return e&&i[e]?i[e][t]:"it"===t?"tuo settore":"your industry"}(t.industry,r));break;case"recent_registrations":if(!(a=i.registrations7d)||e.minValue&&a<e.minValue)return null;n=n.replace("{count}",String(a));break;case"live_visitors":if(!(a=i.activeVisitors5min)||e.minValue&&a<e.minValue)return null;n=n.replace("{count}",String(a));break;case"demo_slots":if(a=Math.max(1,10-Math.min(i.demoRequests7d||0,9)),e.maxValue&&a>e.maxValue)return null;n=n.replace("{count}",String(a));break;case"trial_ending":{let t=new Date;if(a=Math.ceil((new Date(t.getFullYear(),t.getMonth()+1,0).getTime()-t.getTime())/864e5),e.maxValue&&a>e.maxValue)return null;n=n.replace("{days}",String(a));break}case"popular_feature":if(a=2500+Math.floor(500*Math.random()),e.minValue&&a<e.minValue)return null;n=n.replace("{count}",a.toLocaleString("it"===r?"it-IT":"en-US"));break;case"recent_success":{let t=[25,30,35,40,45];if(a=t[Math.floor(Math.random()*t.length)],e.minValue&&a<e.minValue)return null;n=n.replace("{percent}",String(a));break}default:return null}return{id:e.id,type:e.type,intensity:e.intensity,text:n,icon:e.icon,value:a}}(n,e,t,r);i&&a.push(i)}return a.sort((t,i)=>{let r={strong:3,moderate:2,subtle:1};return"hot"===e.engagementTier?r[i.intensity]-r[t.intensity]:r[t.intensity]-r[i.intensity]}),a.slice(0,i.maxMessagesPerPage)}(v,u):[],[v,u]),activityData:u,isLoading:m,error:g,refresh:(0,a.useCallback)(async()=>{await w()},[w]),lastUpdated:h}}({enabled:T,industry:l,persona:w,locale:_,engagementTier:X});(0,a.useEffect)(()=>{z(!0)},[]);let eo=(0,a.useCallback)(()=>({persona:w,industry:l,salesStage:Z.progress.currentStage,referralSource:K.state.referralSource,deviceType:K.state.deviceType,timeOfDay:K.state.timeOfDay,dayOfWeek:K.state.dayOfWeek,pagesViewed:K.state.pagesViewed,timeOnSite:K.state.sessionDuration,scrollVelocity:K.state.scrollVelocity,returnVisitor:K.state.visitCount>1,engagementTier:X}),[w,l,Z.progress.currentStage,K.state,X]),es=(0,a.useCallback)(e=>(function(e){let t=F(),{armId:i,score:r,isExploration:a}=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:C,r=R(t,i),a=null,n=-1/0;for(let t of e)if(t.pulls<i.minSamplesForExploit){let e=Math.random()*i.explorationBonus,o=P(t,r,i.alpha)+e;o>n&&(n=o,a=t)}else{let e=P(t,r,i.alpha);e>n&&(n=e,a=t)}a||(a=e[Math.floor(Math.random()*e.length)],n=0);let o=a.pulls<i.minSamplesForExploit;return{armId:a.armId,score:n,isExploration:o}}(Object.values(t.arms),e,C),n=O(e),o=R(e),s=B(i),l=s?.type||"reinforce",c=s?.approach||"persona-aligned",u="";
19return"reinforce"===l&&c in M.f0.reinforce?u=M.f0.reinforce[c].promptModifier:"experiment"===l&&c in M.f0.experiment&&(u=M.f0.experiment[c].promptModifier),u=u.replace("{persona}",e.persona||"general business professional").replace("{industry}",e.industry||"various industries").replace("{stage}",e.salesStage||"prospect").replace("{stage_guidance}",M.EV[e.salesStage||"prospect"]||M.EV.prospect).replace("{preferences}","personalized content"),t.totalTrials++,$(t),{armId:i,strategyType:l,approach:c,promptModifier:u,score:r,isExploration:a,contextBucket:n,contextVector:o}})({...eo(),...e}),[eo]),el=(0,a.useCallback)((e,t)=>{!function(e,t,i){let r=F();r.arms[e]||(r.arms[e]=N(e));let a=R(t);r.arms[e]=function(e,t,i){let r=e.A.map((e,i)=>e.map((e,r)=>e+t[i]*t[r])),a=e.b.map((e,r)=>e+i*t[r]),n=L(r),o=Array(e.theta.length).fill(0);for(let e=0;e<o.length;e++)for(let t=0;t<a.length;t++)o[e]+=n[e][t]*a[t];return{...e,A:r,b:a,theta:o,pulls:e.pulls+1,totalReward:e.totalReward+i}}(r.arms[e],a,i);let n=O(t);r.contextBucketStats[n]||(r.contextBucketStats[n]={bucketId:n,trials:0,avgReward:0,bestArm:null});let o=r.contextBucketStats[n];o.trials++,o.avgReward=(o.avgReward*(o.trials-1)+i)/o.trials;let s=0,l=null;for(let[e,t]of Object.entries(r.arms))if(t.pulls>0){let i=t.totalReward/t.pulls;i>s&&(s=i,l=e)}o.bestArm=l,$(r)}(e,eo(),t)},[eo]),ec=(0,a.useCallback)(()=>{let e=es(),t=Y(),i=K.promptModifier;return e.promptModifier&&(i+="\n\n"+e.promptModifier),t.promptModifier&&(i+="\n\n"+t.promptModifier),{promptModifier:i,temperature:K.temperature+(t.temperatureBoost||0),strategyType:e.strategyType,variationType:t.type}},[K.promptModifier,K.temperature,es]),eu=(0,a.useMemo)(()=>({isReady:j,microConversions:{engagementScore:Q,engagementTier:X,isTracking:G?.isTracking??!1},behaviorTriggers:{state:K.state,output:K.output,promptModifier:K.promptModifier,temperature:K.temperature},contextualBandit:{selectStrategy:es,recordReward:el,getSummary:H},variableRewards:{selectVariation:Y},urgency:{messages:en.messages,isLoading:en.isLoading,refresh:en.refresh},progress:{overallProgress:Z.progress.overallProgress,currentStage:Z.progress.currentStage,milestonesAchieved:Z.progress.milestonesAchieved,nextMilestone:Z.nextMilestone,achieveMilestone:Z.achieveMilestone,getMotivationalMessage:Z.getMotivationalMessage},exitIntent:{triggered:ea.triggered,triggerData:ea.triggerData,dismissIntent:ea.dismissIntent,tabHidden:ea.tabHidden,hiddenDuration:ea.hiddenDuration},getFullContext:eo,getAIEnhancements:ec}),[j,Q,X,G?.isTracking,K,es,el,en,Z,ea,eo,ec]);return(0,r.jsxs)(er.Provider,{value:eu,children:[t,D&&(0,r.jsx)(ee,{isOpen:ea.triggered,onClose:ea.dismissIntent,data:ea.triggerData,locale:_}),I&&(0,r.jsx)(et,{isVisible:q,hiddenDuration:ea.hiddenDuration,locale:_,onDismiss:()=>J(!1)}),E&&W&&(0,r.jsx)(ei,{milestone:W,locale:_,onClose:()=>U(null)})]})}function en(e){let{children:t,visitorId:i,sessionId:n,...o}=e,s=(0,a.useCallback)((e,t)=>{},[]);return(0,r.jsx)(l,{visitorId:i,sessionId:n,enabled:o.enabled,onEngagementChange:s,children:(0,r.jsx)(ea,{visitorId:i,sessionId:n,...o,children:t})})}function eo(){return(0,a.useContext)(er)}},13912:(e,t,i)=>{i.d(t,{Sn:()=>r,xR:()=>a});let r={"after-hero":'[data-section="hero"], [class*="Hero"], section:first-of-type',"after-benefits":'[data-section="benefits"], [class*="Benefits"], [class*="features"]',"after-features":'[data-section="features"], [class*="Features"]',"before-pricing":'[data-section="pricing"], [class*="Pricing"]',"after-pricing":'[data-section="pricing"], [class*="Pricing"]',"before-cta":'[data-section="cta"], [class*="CallToAction"], [class*="CTA"]',"before-footer":'footer, [data-section="footer"]',"after-testimonials":'[data-section="testimonials"], [class*="Testimonial"]',"after-stats":'[data-section="stats"], [class*="Stats"], [class*="Numbers"]'};function a(e){return r[e]||"main > section:last-of-type"}},18428:(e,t,i)=>{i.d(t,{EV:()=>n,JI:()=>p,O2:()=>c,Vq:()=>d,Wt:()=>u,_o:()=>l,f0:()=>a,mg:()=>r,qp:()=>m});let r={algorithm:"adaptive",explorationRate:.2,minExplorationRate:.05,decayRate:.995,confidenceLevel:.95,minSamplesForExploit:30,rewardWeights:{click:.3,conversion:.5,engagement:.15,scroll:.05}}
19,a={reinforce:{"persona-aligned":{id:"persona-aligned",description:"Content aligned with user persona pain points and goals",promptModifier:"Focus on {persona} specific challenges and language they use."},"industry-specific":{id:"industry-specific",description:"Content using industry-specific terminology and metrics",promptModifier:"Use {industry} specific terminology, metrics, and case studies."},"stage-appropriate":{id:"stage-appropriate",description:"Content matching the sales funnel stage",promptModifier:"Tailor for {stage} stage: {stage_guidance}"},"preference-based":{id:"preference-based",description:"Content based on tracked user preferences",promptModifier:"User prefers {preferences}. Align messaging accordingly."}},experiment:{contrarian:{id:"contrarian",description:"Challenge assumptions, present unexpected angles",promptModifier:"Challenge the conventional wisdom. Present a surprising or contrarian perspective."},"emotional-appeal":{id:"emotional-appeal",description:"Focus on emotional triggers over rational arguments",promptModifier:"Lead with emotion (fear of missing out, aspiration, belonging) before logic."},"social-proof-heavy":{id:"social-proof-heavy",description:"Heavy emphasis on what others are doing",promptModifier:"Emphasize what competitors and peers are doing. Create urgency through social proof."},"direct-challenge":{id:"direct-challenge",description:"Directly challenge current approach",promptModifier:"Directly question if current approach is working. Be provocative but respectful."},"curiosity-gap":{id:"curiosity-gap",description:"Create information gaps that drive engagement",promptModifier:"Create curiosity gaps. Hint at valuable information without giving it all away."},specificity:{id:"specificity",description:"Use very specific numbers and details",promptModifier:"Be extremely specific with numbers, timeframes, and outcomes. Specificity builds trust."},storytelling:{id:"storytelling",description:"Narrative-driven content",promptModifier:"Tell a brief story or scenario. Make the user the hero of the story."},minimalist:{id:"minimalist",description:"Ultra-concise, punchy messaging",promptModifier:"Be extremely concise. Every word must earn its place. Maximum impact, minimum words."}}},n={prospect:"awareness and education, focus on problem recognition",lead:"consideration phase, compare solutions and show differentiation",opportunity:"decision phase, remove objections and provide proof points",customer:"retention and expansion, show advanced features and upsell"};function o(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;return 0===e.pulls?1/0:e.meanReward+Math.sqrt(i*Math.log(t)/e.pulls)}function s(e){if(e<1)return s(1+e)*Math.pow(Math.random(),1/e);let t=e-1/3,i=1/Math.sqrt(9*t);for(;;){let e,r;do r=1+i*(e=function(){let e=0,t=0;for(;0===e;)e=Math.random();for(;0===t;)t=Math.random();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*t)}());while(r<=0);r=r*r*r;let a=Math.random();if(a<1-e*e*.0331*(e*e)||Math.log(a)<.5*e*e+t*(1-r+Math.log(r)))return t*r}}function l(e,t){let i=0;if(void 0!==e.clicks&&e.impressions){let r=e.clicks/e.impressions;i+=t.click*r}if(void 0!==e.conversions&&e.impressions){let r=e.conversions/e.impressions;i+=t.conversion*r}if(void 0!==e.engagementTime){let r=Math.min(e.engagementTime/60,1);i+=t.engagement*r}return void 0!==e.scrollDepth&&(i+=t.scroll*(e.scrollDepth/100)),i}function c(e,t,i){let r=t.filter(e=>e.armId.startsWith("reinforce-")),a=t.filter(e=>e.armId.startsWith("experiment-")),n=null,l="";switch(e.algorithm){case"epsilon-greedy":{let t=function(e,t){let i=e.explorationRate*Math.pow(e.decayRate,t);return Math.max(e.minExplorationRate,i)}(e,i);if(Math.random()<t){let e=[...r,...a];n=e[Math.floor(Math.random()*e.length)],l=`Epsilon-greedy exploration (ε=${t.toFixed(3)})`}else n=[...r,...a].sort((e,t)=>t.meanReward-e.meanReward)[0],l=`Epsilon-greedy exploitation (best mean reward: ${n?.meanReward.toFixed(3)})`;break}case"ucb":{let e=t.reduce((e,t)=>e+t.pulls,0);n=[...r,...a].map(t=>({...t,ucbScore:o(t,e)})).sort((e,t)=>t.ucbScore-e.ucbScore)[0],l=`UCB selection (score: ${n?.ucbScore.toFixed(3)})`;break}case"thompson-sampling":{let e=[...r,...a].map(e=>({arm:e,sample:function(e,t){let i=s(e);return i/(i+s(t))}(e.thompsonAlpha,e.thompsonBeta)})).sort((e,t)=>
19t.sample-e.sample)[0];n=e.arm,l=`Thompson sampling (sampled value: ${e.sample.toFixed(3)})`;break}default:if(i<e.minSamplesForExploit){let t=[...r,...a];n=t[Math.floor(Math.random()*t.length)],l=`Adaptive: exploration phase (${i}/${e.minSamplesForExploit} samples)`}else{let e=t.reduce((e,t)=>e+t.pulls,0);n=[...r,...a].map(t=>({...t,ucbScore:o(t,e)})).sort((e,t)=>t.ucbScore-e.ucbScore)[0],l=`Adaptive: UCB exploitation (score: ${n?.ucbScore.toFixed(3)})`}}if(!n)return{type:"reinforce",approach:"persona-aligned",reason:"Fallback to default strategy"};let[c,u]=n.armId.split("-",2),d=n.armId.replace(`${c}-`,"");return{type:c,approach:d,reason:l}}function u(e){return{armId:e,pulls:0,totalReward:0,meanReward:0,variance:0,ucbScore:1/0,thompsonAlpha:1,thompsonBeta:1}}function d(e,t){let i=e.pulls+1,r=e.totalReward+t,a=r/i,n=t-e.meanReward,o=0===e.pulls?0:((e.pulls-1)*e.variance+n*(t-a))/e.pulls,s=+(t>.5),l=e.thompsonAlpha+s,c=e.thompsonBeta+(1-s);return{...e,pulls:i,totalReward:r,meanReward:a,variance:o,thompsonAlpha:l,thompsonBeta:c}}function m(){return[...Object.keys(a.reinforce).map(e=>`reinforce-${e}`),...Object.keys(a.experiment).map(e=>`experiment-${e}`)]}function p(e){let[t,...i]=e.split("-"),r=i.join("-");
19return"reinforce"===t&&r in a.reinforce?{type:"reinforce",config:a.reinforce[r]}:"experiment"===t&&r in a.experiment?{type:"experiment",config:a.experiment[r]}:null}},44509:(e,t,i)=>{i.d(t,{qK:()=>d,xl:()=>c});var r=i(95155),a=i(12115),n=i(20063),o=i(45821),s=i(13912);let l=(0,a.createContext)(void 0);function c(){return(0,a.useContext)(l)??null}let u=[{pattern:'[data-section="hero"], [class*="Hero"], section:first-of-type',type:"hero",insertionPoint:"after-hero"},{pattern:'[data-section="benefits"], [class*="Benefits"]',type:"benefits",insertionPoint:"after-benefits"},{pattern:'[data-section="features"], [class*="Features"]',type:"features",insertionPoint:"after-features"},{pattern:'[data-section="pricing"], [class*="Pricing"]',type:"pricing",insertionPoint:"before-pricing"},{pattern:'[data-section="testimonials"], [class*="Testimonial"]',type:"testimonials",insertionPoint:"after-testimonials"},{pattern:'[data-section="stats"], [class*="Stats"], [class*="Numbers"]',type:"stats",insertionPoint:"after-stats"},{pattern:'[data-section="cta"], [class*="CallToAction"], [class*="CTA"]',type:"cta",insertionPoint:"before-cta"},{pattern:'[data-section="faq"], [class*="FAQ"]',type:"faq"},{pattern:'[data-section="comparison"], [class*="Comparison"]',type:"comparison"},{pattern:'[data-section="integration"], [class*="Integration"]',type:"integration"},{pattern:'[data-section="video"], [class*="Video"]',type:"video"},{pattern:'[data-section="social-proof"], [class*="SocialProof"]',type:"social-proof"},{pattern:'[data-section="roi"], [class*="ROI"]',type:"roi"},{pattern:'[data-section="industry"], [class*="Industry"]',type:"industry"}];function d(e){let{children:t,autoScan:i=!0,scanDelay:c=200}=e,d=(0,n.usePathname)(),[m,p]=(0,a.useState)(!1),[g,f]=(0,a.useState)(null),[h,y]=(0,a.useState)([]),[v,w]=(0,a.useState)([]),[b,x]=(0,a.useState)(void 0),S=(0,a.useRef)(null),k=(0,a.useRef)(null),M=(0,a.useCallback)(()=>{if("undefined"==typeof document)return;p(!0);let e=[],t=new WeakSet;for(let{pattern:i,type:r,insertionPoint:a}of u)try{document.querySelectorAll(i).forEach((i,n)=>{if(t.has(i))return;t.add(i);let o=i.getAttribute("data-section")||i.id||`${r}-${n}`;e.push({id:o,type:r,element:i,insertionPoint:a})})}catch{}document.querySelectorAll("[data-ai-injected]").forEach(i=>{let r=i.getAttribute("data-ai-section-id");r&&!t.has(i)&&(t.add(i),e.push({id:r,type:"ai-injected",element:i}))});let i=[];for(let[e,t]of Object.entries(s.Sn))try{let r=document.querySelector(t);if(r){let t=e.startsWith("before-")?"before":"after";i.push({point:e,element:r,position:t})}}catch{}x(document.title||void 0),y(e),w(i),f(Date.now()),p(!1)},[d]),C=(0,a.useCallback)(()=>{S.current&&clearTimeout(S.current),S.current=setTimeout(M,50)},[M]);(0,a.useEffect)(()=>{if(i)return k.current!==d&&(k.current=d,y([]),w([]),f(null),S.current&&clearTimeout(S.current),S.current=setTimeout(M,c)),()=>{S.current&&clearTimeout(S.current)}},[d,i,c,M]),(0,a.useEffect)(()=>{if(!i||"undefined"==typeof MutationObserver)return;let e=new MutationObserver(e=>{let t=!1;for(let i of e){if("childList"===i.type&&i.addedNodes.length>0){for(let e of i.addedNodes)if(e instanceof Element&&("SECTION"===e.tagName||e.hasAttribute("data-section")||e.className?.includes?.("Section")||e.className?.includes?.("Hero")||e.className?.includes?.("Features"))){t=!0;break}}if(t)break}t&&C()}),t=document.querySelector("main")||document.body;return e.observe(t,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[i,C]);let _=(0,a.useCallback)(e=>{let t=v.find(t=>t.point===e);return t?.element||null},[v]),T=(0,o.V)(d||"/"),D={pathname:d||"/",pageType:T,existingSections:h.map(e=>e.id),title:b,detectedSections:h,availableInsertionPoints:v,isScanning:m,lastScannedAt:g,rescan:C,getInsertionElement:_};return(0,r.jsx)(l.Provider,{value:D,children:t})}},45821:(e,t,i)=>{i.d(t,{V:()=>r});function r(e){let t=e.toLowerCase();return t.match(/^\/[a-z]{2}\/?$/)||"/"===t?"homepage":t.includes("/pricing")||t.includes("/prezzi")||t.includes("/precios")?"pricing":t.includes("/features")||t.includes("/funzionalita")||t.includes("/caracteristicas")?"features":t.includes("/industry")||t.includes("/settore")||t.includes("/industria")?"industry":t.includes("/use-case")||t.includes("/caso-uso")?"use-case":t.includes("/integration")||t.includes("/integrazione")?"integration":t.includes("/landing")||t.includes("/registration")||t.includes("/registrazione")?"landing":t.includes("/blog")||t.includes("/article")?"blog":t.includes("/about")||t.includes("/chi-siamo")?"about":t.includes("/contact")||t.includes("/contatti")?"contact":"homepage"}},60540:(e,t,i)=>{i.d(t,{s9:()=>c,mi:()=>u});var r=i(12115),a=i(76815),n=i(95704);let o={urlParam:"dynamic_ai_page",enabledValues:["1","true","on","yes"],defaultEnabled:!1,envOverride:"NEXT_PUBLIC_AI_DYNAMIC_ENABLED",features:{personalization:!0,sectionInjection:!0,scrollInjection:!0,behavioralScience:!0,microConversions:!0}};function s(e){return!!e&&o.enabledValues.includes(e.toLowerCase())}function l(){return{...o.features}}function c(){let e=(0,a.X)();return(0,r.useMemo)(()=>{let t=e?.get(o.urlParam)??null,i=function(){if(void 0===n)return;let e=o.envOverride;if(!e)return;let t=n.env[e];if(void 0!==t&&""!==t)return s(t)}();return void 0!==i?{isEnabled:i,features:l(),paramValue:t,enabledSource:"env"}:null!==t?{isEnabled:s(t),features:l(),paramValue:t,enabledSource:"url"}:{isEnabled:o.defaultEnabled,features:l(),paramValue:t,enabledSource:"default"}},[e])}function u(e){let{isEnabled:t,features:i}=c();return t&&i[e]}}}]);

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.