PageSourceSearch

https://cravour-b79bf.web.app/assets/AIAssistant-BkDFT-g4.js

js cravour-b79bf.web.app collected 2026-10-03 12:21:07 UTC 42,327 bytes, 1 lines download raw bytes

1import{a as de}from"./rolldown-runtime-DS2seoW7.js";import{$t as pe,A as U,An as ue,En as me,Qt as he,R as Q,W as xe,Wt as fe,X as ee,Z as ge,Zt as be,ct as te,en as ne,f as ye,jn as ve,n as we,s as je,vn as ke,vt as Ne}from"./icons-5GB4hPp2.js";import{t as ae}from"./logger-DNCEJ7cP.js";import{Gn as g,W as Se,Yt as Ce,h as ie,mn as _e,pt as Ee,yn as Ae}from"./api-D6UOnPC0.js";import{r as Pe}from"./motion-vendor-RV0KhbdN.js";import{D as Ie,I as oe,d as se,f as re,v as Le}from"./index-CPBzZ974.js";import{t as Re}from"./ttsService-B3hDswBN.js";import{t as $e}from"./nanoGenerativeService-7H8LxImq.js";var d=de(ve(),1),ze=async s=>(await ie.post("/ap2/authorize",s)).data,Me=async s=>(await ie.post("/ap2/cancel",{cart_id:s})).data,F={wallet:"wealth",money:"wealth",budget:"wealth",wealth:"wealth",finance:"wealth",home:"dashboard",dashboard:"dashboard",overview:"dashboard",settings:"settings",profile:"settings",account:"settings",merchants:"merchants",shops:"merchants",shop:"merchants",finder:"merchants",scout:"merchants","price scout":"merchants","price-scout":"merchants","business finder":"merchants","merchant finder":"merchants","shop finder":"merchants",map:"merchants",ads:"ads","ad maker":"ads","ad-maker":"ads","merchant store":"ads-network",webstore:"ads-network","ads network":"ads-network",partners:"ads-network","joined shops":"ads-network",creative:"ads",studio:"ads","personal shopper":"merchant-ads","hot deals":"merchant-ads",compare:"merchant-ads",register:"merchant-registration",professional:"merchant-registration","merchant registration":"merchant-registration",pricing:"pricing",pro:"pricing",upgrade:"pricing",tiers:"pricing",subscriptions:"subscriptions-manager",routines:"ai-routines","ai routines":"ai-routines",plans:"pricing",goals:"wealth",integrations:"wealth",chat:"dashboard",savvy:"dashboard",cv:"cv-studio",resume:"cv-studio",jobs:"cv-studio",job:"cv-studio","cv studio":"cv-studio",reels:"reel",reel:"reel",video:"ads",videos:"ads",jingle:"ads",music:"ads",business:"business","how it works":"business",login:"dashboard",signup:"dashboard",admin:"admin",community:"reel",showcase:"reel",career:"cv-studio",pharmacy:"merchants",atm:"merchants",restaurant:"merchants",hotel:"merchants",hospital:"merchants"};function Oe(s){const r=s.trim().toLowerCase();let t="dashboard";if(F[r])t=F[r];else{const l=Object.keys(F).filter(m=>r.includes(m)||m.includes(r)).sort((m,k)=>k.length-m.length)[0];l&&(t=F[l])}return{type:"NAVIGATE",page:t,spokenReply:`Opening ${t.replace("-"," ")}.`}}function Te(s){const r=(s||"").trim();if(!r)return{type:"UNKNOWN",description:"",spokenReply:"I did not catch that. Try again."};const t=r.toLowerCase();if(/^(help|what can you do|commands?|voice help)\b/.test(t)||t.includes("what can you do"))return{type:"HELP",spokenReply:"Say: find cooking gas near me, make an ad, open Reels, find a job, check budget, or sign up. I run the app for you."};if(/\b(sign up|create (an? )?account|get started|register)\b/.test(t))return{type:"SIGN_UP",spokenReply:"Opening sign up. No card needed."};if(/\b(log in|login|sign in)\b/.test(t))return{type:"LOGIN",spokenReply:"Opening sign in."};if(/\b(help me|how (do|does|can) i|not working|n'?t work|can'?t|cannot|broken|error|what is cravour|what does (this|cravour)|i'?m stuck)\b/.test(t)){let i="I run Cravour by voice. Ask me to find a business nearby, make an ad, find a job, open Reels, or check your budget.";return/\b(log ?in|sign ?in|password|google)\b/.test(t)?i="Use Google or email to sign in. If it fails, try Safari or Chrome — in-app browsers often block login.":/\b(pay|wallet|fund|transfer)\b/.test(t)?i="Open wallet, fund it, then pay a verified partner. I never ask for your PIN.":/\b(ad|poster|video|jingle)\b/.test(t)?i="Opening Ad Maker. Describe the product and I will generate the asset inside your budget.":/\b(price|shop|gas|rice)\b/.test(t)&&(i="Opening the finder. Tell me the business or trade and I will map the closest matches."),{type:"HELP_SITE",spokenReply:i,page:/\b(ad|poster|video)\b/.test(t)?"ads":void 0}}const l=r.match(/^(?:type|write|enter|dictate|put|insert|set)\s+(.+?)\s+(?:in(?:to)?|on)\s+(?:the\s+)?(.+)$/i)||r.match(/^(?:fill|populate)\s+(?:the\s+)?(.+?)\s+(?:with|as)\s+(.+)$/i);if(l){const i=/^(?:fill|populate)/i.test(r),x=i?l[2].trim():l[1].trim(),h=i?l[1].trim():l[2].trim();return{type:"FILL_FIELD",field:h,text:x,spokenReply:`Typing "${x}" into the ${h} field.`}}const m=r.match(/^(?:click|select|focus|activate|go to|tap|open)\s+(?:the\s+)?(.+?)(?:\s+(?:field|box|input|textbox|area))?$/i),k=/^(?:go to|open)\s+/i.test(r)&&Object.keys({wallet:1,budget:1,dashboard:1,settings:1,merchants:1,ads:1,routines:1}).some(i=>r.toLowerCase().includes(i));if(m&&!k){const i=m[1].trim();if(/amount|name|description|date|search|message|email|note|title|expense|budget|allocation|routine|subject|body|ad|script|copy|prompt|cv|resume|summary/.test(i))return{type:"SELECT_FIELD",field:i,spokenReply:`Selected the ${i} field. Go ahead and speak your input.`}}if(/\b(balance|how much (do i|have i)|wallet (balance|total)|funds left)\b/.test(t)||t.includes("check balance")||t.includes("my balance"))return{type:"CHECK_BALANCE",spokenReply:"Checking your wallet balance."};if(/\b(budget|spending left|monthly budget|how much (can|may) i spend)\b/.test(t)||t.includes("check budget")||t.includes("budget status"))return{type:"CHECK_BUDGET",page:"wealth",spokenReply:"Opening your budget overview."};if(/\b(find|search|scout|locate|nearby|where (can|do) i (get|buy)|show me)\b.*\b(shop|merchant|store|business|vendor|deal|price|map|directions?)/.test(t)||/\b(near me|around me|close by|walking distance)\b/.test(t)||t.includes("price scout")||t.includes("business finder")||t.includes("merchant finder")||t.includes("shop finder")||t.includes("favourite vendor")||t.includes("favorite vendor")||t.includes("on the map")||t.includes("show map")||t.startsWith("find shops")||t.startsWith("find me")||t.startsWith("scout ")||/\b(where (to buy|can i buy|is the nearest))\b/.test(t)){const i=r.replace(/^(please\s+)?(find|search|scout|locate|show|get|where can i (get|buy)|where to buy|where is the nearest)\s+(me\s+)?(shops?|merchants?|stores?|map|directions?)?\s*(for|near|around|of)?\s*/i,"").replace(/\s+(near me|around me|close by|nearby|on the map|walking distance)\s*$/i,"").trim()||"local deals";return{type:"SCOUT_SHOPS",page:"merchants",query:i,spokenReply:`Opening the finder and mapping the closest businesses for ${i}.`}}if(t.includes("ad maker")||t.includes("create ad")||t.includes("generate ad")||t.includes("make an ad")||t.includes("make a poster")||t.includes("make a video")||t.includes("creative studio"))return{type:"OPEN_ADS",page:"ads",spokenReply:"Opening Creative Studio."};if(/\b(reel|community ads?|showcase|public ads?)\b/.test(t))return{type:"NAVIGATE",page:"reel",spokenReply:"Opening the creator reel."};if(/\b(partners?|professionals?|artisan|get found|list my shop)\b/.test(t)||/\b(find|search|need)\b.+\b(plumber|doctor|lawyer|tailor|barber|electrician|nurse)\b/.test(t)){const i=r.replace(/^(please\s+)?(find|search|need|show|open)\s+(me\s+)?(a\s+)?/i,"").replace(/\s+(near me|on partners|on the map)\s*$/i,"").trim();return{type:"NAVIGATE",page:"ads-network",query:i||void 0,spokenReply:i?`Opening Partners for ${i}.`:"Opening Partners."}}if(t.includes("go to")||t.includes("navigate to")||t.includes("open ")||t.startsWith("show me")){const i=r.match(/(?:go to|navigate to|open|show me)\s+(.+)/i);return Oe(i?i[1].trim().toLowerCase():"dashboard")}const u=/\b(log|spent|spend|record|add)\b/.test(t)||/\b(naira|₦|ngn)\b/.test(t),E=r.match(/(?:₦|ngn|naira)?\s*(\d[\d,]*(?:\.\d+)?)/i),y=E?parseFloat(E[1].replace(/,/g,"")):0;if(y>0&&(u||/\bfor\b|\bon\b/.test(t))){let i=r.replace(/(?:₦|ngn|naira)?\s*\d[\d,]*(?:\.\d+)?/gi," ").replace(/\b(log|spent|spend|record|add|expense|an|a|for|on|of)\b/gi," ").replace(/\s+/g," ").trim();
1return i||(i="Voice expense"),{type:"LOG_EXPENSE",amount:y,description:i,spokenReply:`Logged ₦${y.toLocaleString()} for ${i}.`}}return y>0&&t.length<80?{type:"LOG_EXPENSE",amount:y,description:r.replace(/\d[\d,]*(?:\.\d+)?/g,"").trim()||"Voice expense",spokenReply:`Logged ₦${y.toLocaleString()}.`}:{type:"UNKNOWN",description:r}}function De(s,r={}){const t=r.currencySymbol||"₦";switch(s.type){case"HELP":case"HELP_SITE":return s.page&&window.dispatchEvent(new CustomEvent("navigate-to-page",{detail:{page:s.page}})),{handled:!0,message:s.spokenReply||"Say help for commands."};case"SIGN_UP":return window.dispatchEvent(new CustomEvent("voice-open-auth",{detail:{view:"register"}})),{handled:!0,message:s.spokenReply||"Opening sign up."};case"LOGIN":return window.dispatchEvent(new CustomEvent("voice-open-auth",{detail:{view:"login"}})),{handled:!0,message:s.spokenReply||"Opening sign in."};case"CHECK_BALANCE":{const l=r.walletBalance??0;return{handled:!0,message:`Your wallet balance is ${t}${Number(l).toLocaleString()}.`}}case"CHECK_BUDGET":{const l=r.monthlyBudget??0;return window.dispatchEvent(new CustomEvent("navigate-to-page",{detail:{page:"wealth"}})),{handled:!0,message:s.spokenReply||`Your monthly budget is ${t}${Number(l).toLocaleString()}. Opening Budget & Money.`}}case"NAVIGATE":case"OPEN_ADS":case"SCOUT_SHOPS":{const l=s.page||"dashboard";return window.dispatchEvent(new CustomEvent("navigate-to-page",{detail:{page:l,query:s.query}})),{handled:!0,message:s.spokenReply||`Navigating to ${l}.`}}case"LOG_EXPENSE":return s.amount&&r.logExpense?(r.logExpense(s.amount,s.description||"Voice expense"),{handled:!0,message:s.spokenReply||`Logged ${t}${s.amount.toLocaleString()}.`}):s.amount?(window.dispatchEvent(new CustomEvent("voice-log-expense",{detail:{amount:s.amount,description:s.description}})),{handled:!0,message:s.spokenReply||`Preparing expense of ${t}${s.amount.toLocaleString()}.`}):{handled:!1,message:""};case"FILL_FIELD":return s.text&&s.field?(window.dispatchEvent(new CustomEvent("voice-add-text",{detail:{text:s.text,target:s.field}})),{handled:!0,message:s.spokenReply||`Typed "${s.text}" into the ${s.field} field.`}):{handled:!1,message:""};case"SELECT_FIELD":return s.field?(window.dispatchEvent(new CustomEvent("voice-select-textbox",{detail:{target:s.field}})),{handled:!0,message:s.spokenReply||`Selected the ${s.field} field. Go ahead and speak.`}):{handled:!1,message:""};default:return{handled:!1,message:s.description||""}}}var e=Pe(),Ge=({toolCall:s})=>{const{name:r,args:t,status:l}=s,m={pending:(0,e.jsx)("div",{className:"w-1.5 h-1.5 bg-primary animate-ping rounded-full"}),success:(0,e.jsx)(pe,{className:"text-emerald-400",size:14}),error:(0,e.jsx)(ne,{className:"text-rose-400",size:14})},k=u=>u.replace(/([A-Z])/g," $1");return(0,e.jsxs)("div",{className:"mt-6 glass-card-elite p-6 rounded-[2rem] border border-primary/20 bg-primary/5 space-y-4 relative overflow-hidden group",children:[(0,e.jsx)("div",{className:"absolute top-0 right-0 w-20 h-20 bg-primary/10 blur-2xl opacity-0 group-hover:opacity-100 transition-opacity"}),(0,e.jsxs)("div",{className:"flex items-center gap-4 relative z-10",children:[(0,e.jsx)("div",{className:"w-8 h-8 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-[0_0_15px_rgba(212,175,55,0.2)]",children:(0,e.jsx)(ue,{size:14,className:"animate-pulse"})}),(0,e.jsxs)("div",{className:"flex flex-col",children:[(0,e.jsx)("span",{className:"text-[9px] font-black uppercase tracking-[0.3em] text-on-surface",children:"AI Task"}),(0,e.jsx)("span",{className:"text-[10px] font-black text-primary/80 italic",children:r})]}),(0,e.jsx)("div",{className:"ml-auto",children:m[l]})]}),(0,e.jsx)("div",{className:"space-y-2 relative z-10",children:Object.entries(t).map(([u,E])=>(0,e.jsxs)("div",{className:"flex justify-between items-center text-[9px] bg-primary/5 px-4 py-2 rounded-xl",children:[(0,e.jsx)("span",{className:"text-on-surface/40 font-black uppercase tracking-widest",children:k(u)}),(0,e.jsx)("span",{className:"text-on-surface font-black italic",children:String(E)})]},u))})]})},Ve=({checkout:s})=>{const{amount:r,currency:t="NGN",item_label:l,cart_id:m,checkout_jwt:k,checkout_hash:u,merchant:E}=s,{refreshData:y,userProfile:i}=oe(),[x,h]=(0,d.useState)(!1),[S,C]=(0,d.useState)(!1),[b,W]=(0,d.useState)(!1),[q,K]=(0,d.useState)(!1),[v,D]=(0,d.useState)(null),[A,G]=(0,d.useState)("wallet"),[V,M]=(0,d.useState)(null),O=i?.walletBalance||0,X=O>=r,B=async()=>{h(!0),M(null);try{const f=await ze({cart_id:m,checkout_jwt:k,payment_method:A});if(f.success)D(f),W(!0),g(f.message||`Payment of ${t}
1 ${r.toLocaleString()} authorized successfully via AP2.`,"success"),await y();else throw new Error(f.message||"AP2 authorization failed")}catch(f){const _=f?.response?.data?.error||f?.message||"Failed to authorize AP2 mandate";M(_),g(_,"error")}finally{h(!1)}},Y=async()=>{C(!0);try{await Me(m),K(!0),g("AP2 payment mandate was cancelled.","info")}catch(f){g(f?.message||"Failed to cancel mandate","error")}finally{C(!1)}};return q?(0,e.jsxs)("div",{className:"mt-6 glass-card-elite p-6 rounded-[2.5rem] border border-amber-500/20 bg-amber-500/5 text-center space-y-3 animate-in zoom-in-95 duration-500",children:[(0,e.jsx)("div",{className:"w-12 h-12 rounded-full bg-amber-500/20 flex items-center justify-center text-amber-400 mx-auto border border-amber-500/30",children:(0,e.jsx)(be,{size:24})}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h4",{className:"text-[10px] font-black uppercase tracking-[0.3em] text-amber-400",children:"Mandate Cancelled"}),(0,e.jsxs)("p",{className:"text-[11px] font-medium text-on-surface/70 italic",children:["Checkout session ",m," revoked."]})]})]}):b&&v?(0,e.jsxs)("div",{className:"mt-6 glass-card-elite p-8 rounded-[2.5rem] border border-emerald-500/30 bg-linear-to-br from-emerald-500/10 to-surface-container-highest text-center space-y-5 animate-in zoom-in-95 duration-500 shadow-[0_20px_40px_rgba(16,185,129,0.15)]",children:[(0,e.jsx)("div",{className:"w-16 h-16 rounded-full bg-emerald-500/20 flex items-center justify-center text-emerald-400 mx-auto border border-emerald-500/40 shadow-[0_0_20px_rgba(16,185,129,0.3)]",children:(0,e.jsx)(Q,{size:36})}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h4",{className:"text-[11px] font-black uppercase tracking-[0.3em] text-emerald-400",children:"AP2 Payment Secured"}),(0,e.jsx)("p",{className:"text-[12px] font-bold text-on-surface italic",children:l}),(0,e.jsxs)("p",{className:"text-xl font-black text-emerald-400 italic",children:[t," ",r.toLocaleString()]})]}),(0,e.jsxs)("div",{className:"p-4 rounded-2xl bg-black/20 border border-white/10 text-left space-y-2 text-[9px] font-medium text-on-surface/80",children:[(0,e.jsxs)("div",{className:"flex justify-between items-center",children:[(0,e.jsx)("span",{className:"uppercase tracking-widest opacity-50",children:"Transaction Ref:"}),(0,e.jsx)("span",{className:"font-mono text-emerald-400 font-bold",children:v.transaction_id||m})]}),(0,e.jsxs)("div",{className:"flex justify-between items-center",children:[(0,e.jsx)("span",{className:"uppercase tracking-widest opacity-50",children:"Mandate Proof ID:"}),(0,e.jsx)("span",{className:"font-mono text-on-surface",children:v.mandate_proof?.mandate_id||"verified_mandate"})]}),(0,e.jsxs)("div",{className:"flex justify-between items-center",children:[(0,e.jsx)("span",{className:"uppercase tracking-widest opacity-50",children:"Signing Algorithm:"}),(0,e.jsx)("span",{className:"font-mono text-primary font-bold",children:"HS256 (HMAC-SHA256)"})]}),(0,e.jsxs)("div",{className:"flex justify-between items-center",children:[(0,e.jsx)("span",{className:"uppercase tracking-widest opacity-50",children:"Signature Hash:"}),(0,e.jsx)("span",{className:"font-mono text-on-surface/60 truncate max-w-37.5",children:u||"verified"})]})]}),(0,e.jsx)("div",{className:"text-[9px] font-black uppercase tracking-widest text-emerald-400/80 bg-emerald-500/10 py-2 px-4 rounded-full w-fit mx-auto border border-emerald-500/20",children:"Verified by Agent Payments Protocol (AP2 v1.0)"})]}):(0,e.jsxs)("div",{className:"mt-6 glass-card-elite p-8 rounded-[3rem] border border-primary/20 bg-linear-to-br from-primary/10 to-surface-container-highest space-y-6 relative overflow-hidden group shadow-[0_30px_60px_rgba(212,175,55,0.15)] animate-in slide-in-from-right-10 duration-700",children:[(0,e.jsx)("div",{className:"absolute top-0 right-0 w-32 h-32 bg-primary/20 blur-3xl rounded-full -mr-16 -mt-16 group-hover:scale-125 transition-transform duration-1000"}),(0,e.jsxs)("div",{className:"flex items-center justify-between relative z-10",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)("div",{className:"w-12 h-12 rounded-2xl bg-primary text-on-surface flex items-center justify-center shadow-[0_0_20px_rgba(212,175,55,0.4)] border border-white/20",children:(0,e.jsx)(U,{size:20})}),(0,e.jsxs)("div",{className:"flex flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-[9px] font-black uppercase tracking-[0.4em] text-primary",children:"AP2 Checkout"}),(0,e.jsx)("span",{className:"text-[8px] bg-primary/20 text-primary px-2 py-0.5 rounded-full font-mono font-bold",children:"v1.0"})]}),(0,e.jsx)("span",{className:"text-[12px] font-black text-on-surface italic",children:l})]})]}),(0,e.jsxs)("div",{className:"text-right",children:[(0,e.jsx)("span",{className:"text-[10px] font-black uppercase tracking-widest text-on-surface/40 block",children:"Total"}),(0,e.jsxs)("span",{className:"text-xl font-black text-primary italic leading-none",children:[t," ",r.toLocaleStr
1ing()]})]})]}),(0,e.jsxs)("div",{className:"p-5 rounded-2xl bg-surface-container-lowest/50 border border-white/5 space-y-3 relative z-10 backdrop-blur-md",children:[(0,e.jsxs)("div",{className:"flex justify-between items-center text-[8px] uppercase font-black tracking-widest opacity-60",children:[(0,e.jsx)("span",{children:"Verifiable Merchant"}),(0,e.jsxs)("span",{className:"flex items-center gap-1 text-emerald-400 font-bold",children:[(0,e.jsx)(Q,{size:10}),E?.name||"Savvy Marketplace"]})]}),(0,e.jsxs)("div",{className:"flex justify-between items-center text-[8px] uppercase font-black tracking-widest opacity-60",children:[(0,e.jsx)("span",{children:"Cryptographic Hash"}),(0,e.jsx)("span",{className:"font-mono text-on-surface/80",children:u?`${u.substring(0,12)}...`:"Signed"})]}),(0,e.jsxs)("div",{className:"flex justify-between items-center text-[8px] uppercase font-black tracking-widest opacity-60",children:[(0,e.jsx)("span",{children:"Protocol State"}),(0,e.jsx)("span",{className:"text-primary italic font-bold",children:"Awaiting User Mandate"})]})]}),(0,e.jsxs)("div",{className:"space-y-2 relative z-10",children:[(0,e.jsx)("span",{className:"text-[8px] font-black uppercase tracking-widest text-on-surface/40 block",children:"Select Payment Rail"}),(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,e.jsxs)("button",{type:"button",onClick:()=>G("wallet"),className:`p-3 rounded-2xl border text-left flex flex-col justify-between transition-all ${A==="wallet"?"bg-primary/20 border-primary text-on-surface shadow-[0_0_15px_rgba(212,175,55,0.2)]":"bg-white/5 border-white/10 text-on-surface/60 hover:bg-white/10"}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(je,{size:14,className:A==="wallet"?"text-primary":""}),(0,e.jsx)("span",{className:"text-[9px] font-black uppercase tracking-wider",children:"Cravour Wallet"})]}),(0,e.jsxs)("span",{className:"text-[9px] font-bold mt-1 opacity-70",children:["Bal: ",t," ",O.toLocaleString()]})]}),(0,e.jsxs)("button",{type:"button",onClick:()=>G("bach"),className:`p-3 rounded-2xl border text-left flex flex-col justify-between transition-all ${A==="bach"?"bg-primary/20 border-primary text-on-surface shadow-[0_0_15px_rgba(212,175,55,0.2)]":"bg-white/5 border-white/10 text-on-surface/60 hover:bg-white/10"}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(fe,{size:14,className:A==="bach"?"text-primary":""}),(0,e.jsx)("span",{className:"text-[9px] font-black uppercase tracking-wider",children:"Cards / Gateway"})]}),(0,e.jsx)("span",{className:"text-[9px] font-bold mt-1 opacity-70",children:"Bach & Flutterwave"})]})]})]}),V&&(0,e.jsxs)("div",{className:"p-3 rounded-xl bg-red-500/10 border border-red-500/20 text-red-400 text-[9px] font-medium flex items-center gap-2",children:[(0,e.jsx)(ne,{size:14,className:"shrink-0"}),(0,e.jsx)("span",{children:V})]}),(0,e.jsxs)("div",{className:"space-y-3 relative z-10",children:[(0,e.jsxs)("button",{onClick:B,disabled:x||A==="wallet"&&!X,className:"w-full h-14 bg-primary text-on-surface rounded-3xl font-black uppercase tracking-[0.2em] italic text-[11px] shadow-[0_15px_30px_rgba(212,175,55,0.3)] hover:scale-[1.02] active:scale-[0.98] transition-all relative overflow-hidden group/btn disabled:opacity-50 disabled:hover:scale-100 flex items-center justify-center gap-2",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-white/20 -translate-x-full group-hover/btn:translate-x-full transition-transform duration-1000 skew-x-12"}),x?(0,e.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,e.jsx)("div",{className:"w-2 h-2 bg-on-surface rounded-full animate-bounce [animation-delay:-0.3s]"}),(0,e.jsx)("div",{className:"w-2 h-2 bg-on-surface rounded-full animate-bounce [animation-delay:-0.15s]"}),(0,e.jsx)("div",{className:"w-2 h-2 bg-on-surface rounded-full animate-bounce"}),(0,e.jsx)("span",{children:"Verifying Mandate..."})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Ne,{size:14}),(0,e.jsx)("span",{children:"Authorize AP2 Mandate"})]})]}),(0,e.jsx)("button",{onClick:Y,disabled:S||x,className:"w-full py-2 text-[9px] font-black uppercase tracking-widest text-on-surface/40 hover:text-red-400 transition-colors",children:S?"Cancelling...":"Cancel Checkout"})]}),(0,e.jsx)("p",{className:"text-[8px] text-center font-bold text-on-surface/30 uppercase tracking-widest px-4",children:"By clicking, you authorize Savvy AI to execute a cryptographically signed AP2 payment mandate."})]})}
1,Ye=({onClose:s,transcript:r,setTranscript:t,embedded:l=!1,isLiveActive:m,onToggleLive:k})=>{const{userProfile:u,user:E,refreshData:y,isOfflineMode:i}=oe(),[x,h]=(0,d.useState)("idle"),[S,C]=(0,d.useState)(""),[b,W]=(0,d.useState)(!1),[q,K]=(0,d.useState)(!1),v=m!==void 0?m:q;(0,d.useEffect)(()=>{if(l)return;const a=n=>{n.key==="Escape"&&s?.()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[l,s]);const[D,A]=(0,d.useState)(""),[G,V]=(0,d.useState)(()=>{try{return!!localStorage.getItem("cravour_copilot_lead_subscribed")}catch{return!1}}),[M,O]=(0,d.useState)(!1),X=a=>{a.preventDefault();const n=D.trim();if(!n){g("Please enter your email or WhatsApp number","info");return}O(!0);try{const p=n.includes("@");p?se({email:n.toLowerCase()}):se({phone:n});try{localStorage.setItem("cravour_copilot_lead_subscribed","true"),localStorage.setItem("cravour_copilot_lead_contact",n)}catch{}re.cta("copilot_lead_capture"),Le("Lead",{content_name:"savvy_copilot_activation",content_category:"ai_money_copilot"},{mirrorCapi:!0,userData:p?{email:n.toLowerCase()}:{phone:n}}),V(!0),g("✨ Savvy AI Co-Pilot Activated! You will receive weekly financial digests.","success")}catch{g("Preferences saved.","success")}finally{O(!1)}},B=(0,d.useRef)(null),Y=(0,d.useRef)(null),f=(0,d.useCallback)(async a=>{if(!(!b||v))try{const n=await Re(a,u?.elevenLabsApiKey||void 0,"JBFqnCBsd6RMkjVDRZzb");if(!n||n.byteLength<200)throw new Error("ElevenLabs returned empty audio");const p=new(window.AudioContext||window.webkitAudioContext);p.state==="suspended"&&await p.resume();const $=await p.decodeAudioData(n.slice(0)),o=p.createBufferSource();o.buffer=$,o.connect(p.destination),o.start()}catch(n){if(console.error("ElevenLabs TTS error for Savvy:",n),"speechSynthesis"in window){window.speechSynthesis.cancel();const p=new SpeechSynthesisUtterance(a);window.speechSynthesis.speak(p)}}},[b,v,u]),_=!!(u?.isGuest||u?.isAnonymous||E?.isAnonymous),P=(0,d.useCallback)(async(a=S)=>{if(!a.trim()||x==="thinking")return;if(_){g("Savvy AI Co-Pilot chat is reserved for registered members. Please complete your registration.","error"),t(o=>[...o,{role:"user",text:a},{role:"model",text:"🔒 Instant Guest Pass: AI companion features, personalized budget discipline, and voice reasoning require a registered account. Please complete your 100% free registration to chat with Savvy AI."}]),C(""),window.dispatchEvent(new CustomEvent("voice-open-auth"));return}const n={role:"user",text:a};t(o=>[...o,n]),C("");const p=Te(a);if(p.type!=="UNKNOWN"){const o=De(p,{walletBalance:u?.walletBalance,monthlyBudget:u?.monthlyBudget,logExpense:async(c,N)=>{try{await Ce({amount:c,description:N,category:"Other",type:"expense",date:new Date().toISOString()}),y(),g(`Logged ₦${c.toLocaleString()}`,"success")}catch(I){console.warn("[VoiceAgent] log expense failed:",I),g("Could not save expense — try Log Expense on dashboard.","error")}}});if(o.handled){p.type==="SCOUT_SHOPS"&&p.query&&(async()=>{try{let c=6.5244,N=3.3792;try{const w=localStorage.getItem("cravour_last_known_location");if(w){const j=JSON.parse(w);typeof j?.lat=="number"&&typeof j?.lng=="number"&&(c=j.lat,N=j.lng)}}catch{}const I=await Se(p.query,c,N,{walkingDistanceOnly:!0}),T=I?.places||[],L=I?.bestWalking?.name||T[0]?.name||null,z=T.length,R=z>0?`${o.message} Found ${z} nearby option${z===1?"":"s"}${L?`. Best walk: ${L}`:""}. Check the map pins.`:`${o.message} No live pins yet — try a simpler term on the finder.`;t(w=>{const j=[...w],H=j[j.length-1];return H?.role==="model"&&H.metadata?.voiceIntent==="SCOUT_SHOPS"?(j[j.length-1]={...H,text:R,metadata:{...H.metadata,places:T.slice(0,5)}},j):[...j,{role:"model",text:R,metadata:{voiceIntent:"SCOUT_SHOPS"}}]}),b&&f(R)}catch(c){console.warn("[VoiceAgent] map scout follow-up failed:",c)}})(),t(c=>[...c,{role:"model",text:o.message,metadata:{voiceIntent:p.type}}]),b&&f(o.message),h("idle");return}}h("thinking");const $=r.filter(o=>(o.role==="user"||o.role==="model")&&o.text).map(o=>({role:o.role,text:o.text}));try{t(c=>[...c,{role:"model",text:""}]);let o="";await Ae({history:$,message:a},(c,N,I)=>{t(T=>{const L=[...T],z=L.length-1,R=L[z];if(R&&R.role==="model"){const w={...R};c&&(w.text=(w.text||"")+c,o+=c),N&&(w.toolCall={...N,status:"success"},g(`AI Link Successful: ${N.name}`,"success"),y()),I&&(w.metadata={...w.metadata,...I}),L[z]=w}return L})}),b&&o&&f(o)}catch(o){console.error("[AIAssistant] Error sending chat message:",o);let c=o.response?.data?.error||o.message||"AI Interruption Detected.";(o.response?.status===429||c.includes("exceeded")||c.includes("quota")||c.includes("RESOURCE_EXHAUSTED"))&&(c="Savvy's community AI budget has been reached for this month. To restore full, instant AI responses immediately, please go to Settings and add your own Gemini API Key."),(String(c).includes("default credentials")||String(c).includes("GCP_CREDENTIALS"))&&(c="Server auth is in Mongo-primary mode. Retry in a moment, or re-sign in if this persists."),t(N=>[...N,{role:"system",text:c}]),h("error")}finally{h("idle")}},[S,x,r,t,C,h,b,f,y,u,_]);(0,d.useEffect)(()=>{B.current?.scrollIntoView({behavior:"smooth"});let a;return r.length>2&&(a=setTimeout(async()=>{try{await _e({agent:"Cravour_AI",transcript:r.slice(-10),type:"chat_copilot"},"current_copilot_session"),ae.debug("[AI] Context synced to server.")}catch(n){ae.warn("[AI] Failed to sync context:",n)}},5e3)),()=>{a&&clearTimeout(a)}},[r]),(0,d.useEffect)(()=>{const a=n=>{n.detail?.message&&(C(n.detail.message),P(n.detail.message))};return window.addEventListener("copilot-set-message",a),()=>window.removeEventListener("copilot-set-message",a)},[P]),(0,d.useEffect)(()=>{(async()=>
1{if(u&&r.length===0)try{const n=await Ee();n&&n.length>0?t(n.map(p=>({role:p.role,text:p.content||p.text||""}))):t([{role:"model",text:`Hi ${u.displayName?.split(" ")[0]}. I run Cravour Ad Maker. Say make an ad, sell on Partners, or scout a price.`}])}catch(n){console.warn("[AIAssistant] Failed to load chat history:",n),t([{role:"model",text:`Hi ${u.displayName?.split(" ")[0]}. I run Cravour Ad Maker. Say make an ad, sell on Partners, or scout a price.`}])}})()},[u,r.length,t]);const Z=()=>{if(_){g("Voice Co-Pilot requires a registered account. Please complete your free registration.","error"),window.dispatchEvent(new CustomEvent("voice-open-auth"));return}if(window.startElevenLabsVoice?.()){K(!0),h("listening");return}const a=window.SpeechRecognition||window.webkitSpeechRecognition;if(a){const n=new a;n.lang="en-NG",n.interimResults=!1,n.onresult=p=>{const $=p.results?.[0]?.[0]?.transcript||"";$&&P($),h("idle")},n.onerror=()=>h("idle"),n.onend=()=>h("idle"),n.start(),h("listening");return}g("Voice needs Chrome, Safari, or Edge. Type to Savvy instead.","info")};(0,d.useEffect)(()=>{const a=()=>Z();return window.addEventListener("savvy-start-listen",a),()=>window.removeEventListener("savvy-start-listen",a)},[_]);const le=async()=>{if(_){g("Voice Co-Pilot requires a registered account. Please complete your free registration.","error"),window.dispatchEvent(new CustomEvent("voice-open-auth"));return}if(k){k();return}Z()};(0,d.useEffect)(()=>{m!==void 0&&requestAnimationFrame(()=>h(m?"listening":"idle"))},[m]);const ce={idle:v?"AI Channel Active":b?"Voice Module Ready":"Awaiting Command...",thinking:"Analyzing Data Vectors...",error:"Signal Distortion Detected",listening:v?"Listening to AI Stream...":"Capturing Audio Pulse...",connecting:"Establishing Link...",processing:"Processing...",speaking:"Communicating...",reconnecting:"Reconnecting..."},J=(0,e.jsxs)("div",{className:`flex flex-col h-full savvy-chat-root ${l?"is-embedded":""}`,children:[(0,e.jsxs)("div",{className:"savvy-chat-header border-b border-outline-variant/10 flex justify-between items-center relative z-10 bg-surface-container-lowest backdrop-blur-3xl",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsxs)("div",{className:"w-10 h-10 bg-primary/10 rounded-2xl flex items-center justify-center text-primary border border-primary/20 relative",children:[(0,e.jsx)(U,{className:"relative z-10",size:20}),(0,e.jsx)("div",{className:"absolute inset-0 bg-primary/30 blur-lg rounded-full animate-pulse"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)(Ie,{variant:"wordmark",height:20,className:"text-on-surface"}),(0,e.jsx)("p",{className:"text-[7px] md:text-[9px] font-black uppercase tracking-[0.3em] md:tracking-[0.5em] text-primary/40 italic whitespace-nowrap",children:"Savvy Voice Agent"})]})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-3",children:[(0,e.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[7px] font-black uppercase tracking-widest border ${b?"bg-primary/15 border-primary/30 text-primary":"bg-surface-container border-outline-variant/20 text-on-surface/50"}`,children:[(0,e.jsx)(te,{size:10})," ",b?"TTS on":"TTS off"]}),(0,e.jsxs)("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[7px] font-black uppercase tracking-widest border ${v?"bg-emerald-500/15 border-emerald-500/30 text-emerald-400":"bg-surface-container border-outline-variant/20 text-on-surface/50"}`,children:[(0,e.jsx)(ee,{size:10})," ",v?"Live":"Chat"]}),i&&(0,e.jsx)("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[7px] font-black uppercase tracking-widest bg-emerald-500/10 border border-emerald-500/20 text-emerald-400",children:"Local cache"})]})]}),s&&(0,e.jsx)("button",{className:"w-12 h-12 glass-card-elite flex items-center justify-center rounded-2xl text-on-surface/40 hover:text-primary transition-all",onClick:s,"aria-label":"Close Assistant",children:(0,e.jsx)(we,{size:20})})]}),_&&(0,e.jsxs)("div",{className:"mx-4 sm:mx-6 mt-3 p-4 rounded-2xl bg-amber-500/10 border border-amber-500/30 flex flex-col sm:flex-row sm:items-center justify-between gap-3 text-xs text-amber-400 font-bold shadow-md shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(U,{size:16,className:"text-amber-400 shrink-0"}),(0,e.jsx)("span",{children:"⚡ Instant Guest Pass: Complete free registration to unlock Savvy AI Co-Pilot chat & companion features."})]}),(0,e.jsx)("button",{onClick:()=>window.dispatchEvent(new CustomEvent("voice-open-auth")),className:"px-3.5 py-1.5 rounded-xl bg-amber-400 text-black font-black uppercase text-[10px] tracking-wider shrink-0 cursor-pointer hover:opacity-90 transition-all shadow-sm self-start sm:self-auto",children:"Complete Free Registration"})]}),(0,e.jsxs)("div",{className:"p-3.5 sm:p-4 mx-4 sm:mx-6 mt-3 rounded-[2rem] border border-primary/20 bg-linear-to-r from-amber-500/10 via-surface-container-high/80 to-primary/5 space-y-2.5 shrink-0 shadow-lg",children:[(0,e.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)("span",{className:"px-2.5 py-0.5 rounded-full bg-primary/20 text-primary text-[8px] font-black uppercase tracking-widest border border-primary/30 flex items-center gap-1",children:[(0,e.jsx)(U,{size:10})," Ad Maker Co-Pilot"]}),(0,e.jsx)("span",{className:"text-[10px] text-on-surface-variant font-medium",children:"Weekly campaign brief"})]}),(0,e.jsx)("h4",{className:"text-xs sm:text-sm font-bold text-on-surface",children:"Get Ad Maker prompts and Partner listing tips"})]}),G?(0,e.jsxs)("div",{className:"px-3.5 py-2 rounded-xl bg-emerald-500/15 border border-emerald-500/30 text-emerald-400 text-[10px] font-black uppercase tracking-wider flex items-center gap-1.5 shrink-0",children:[(0,e.jsx)(he,{size:13})," Briefs Active"]}):(0,e.jsxs)("form",{onSubmit:X,className:"flex flex-col sm:flex-row gap-2 w-full pt-1",children:[(0,e.jsx)("div",{className:"relative flex-1 min-w-0",children:(0,e.jsx)("input",{type:"text",value:D,onChange:a=>A(a.target.value),placeholder:"Email or WhatsApp (080...)",className:"w-full px-3.5 py-2 rounded-xl bg-surface-container-lowest border border-outline-variant/30 text-[11px] text-on-surface placeholder:text-on-surface-variant/50 focus:outline-none focus:border-primary transition-all shadow-inner",disabled:M})}),(0,e.jsxs)("button",{type:"submit",disabled:M,className:"px-4 py-2 rounded-xl gold-gradient-btn text-black font-black text-[10px] uppercase tracking-wider hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-1.5 shrink-0 whitespace-nowrap cursor-pointer shadow-md disabled:opacity-50",children:[(0,e.jsx)("span",{children:"Activate"}),(0,e.jsx)(me,{size:12})]})]})]}),(0,e.jsx)("div",{className:"flex flex-wrap gap-1.5 pt-1 border-t border-outline-variant/10",children:[{label:"🍚 Scout Rice & Staples",cmd:"Scout rice and grocery prices near me"},{label:"⛽ Find Cheap Fuel",cmd:"Find fuel station prices near me"},{label:"📊 Health Score",cmd:"What is my spending health score this week?"}
1,{label:"💰 Set Budget Cap",cmd:"Help me set a ₦50,000 monthly food budget"}].map(a=>(0,e.jsx)("button",{type:"button",onClick:()=>{C(a.cmd),P(a.cmd),re.cta("copilot_starter_chip")},className:"px-2.5 py-1 rounded-lg bg-surface-container-low/70 hover:bg-primary/15 border border-outline-variant/15 text-[9px] font-semibold text-on-surface-variant hover:text-primary transition-all cursor-pointer",children:a.label},a.label))})]}),(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto savvy-chat-transcript space-y-6 elite-scrollbar relative bg-surface-container-lowest",children:[r.map((a,n)=>(0,e.jsx)("div",{className:`flex ${a.role==="user"?"justify-end":"justify-start"} animate-in fade-in slide-in-from-bottom-6 duration-700 ease-[cubic-bezier(0.23,1,0.32,1)]`,children:(0,e.jsxs)("div",{className:`max-w-[90%] group relative ${a.role==="user"?"text-right":"text-left"}`,children:[(0,e.jsxs)("div",{className:`inline-block p-4 sm:p-5 rounded-[1.75rem] text-[13px] leading-relaxed transition-all duration-700 border ${a.role==="user"?"bg-linear-to-br from-primary via-primary to-primary-container text-white font-semibold rounded-tr-md shadow-[0_15px_35px_rgba(81,0,206,0.15)] border-transparent":a.role==="system"?"system-notice-card rounded-2xl border-red-500/10 shadow-md font-medium text-xs":"glass-card-elite border-outline-variant/10 text-on-surface/90 font-medium rounded-tl-md shadow-[0_30px_60px_rgba(0,0,0,0.15)] bg-surface-container-highest/2"}`,children:[a.text&&(0,e.jsx)("p",{className:"whitespace-pre-wrap",children:a.text}),a.toolCall&&(0,e.jsx)(Ge,{toolCall:a.toolCall}),a.metadata?.["ap2.checkout"]&&(0,e.jsx)(Ve,{checkout:a.metadata["ap2.checkout"]})]}),(0,e.jsxs)("div",{className:`text-[8px] uppercase font-black tracking-[0.4em] mt-5 opacity-20 flex items-center gap-4 ${a.role==="user"?"flex-row-reverse":"flex-row"}`,children:[(0,e.jsx)("div",{className:`w-8 h-8 rounded-full flex items-center justify-center border transition-all duration-700 ${a.role==="user"?"bg-primary/20 border-primary/40":"bg-primary/5 border-outline-variant/20"}`,children:a.role==="user"?(0,e.jsx)(ye,{size:12,className:"text-primary"}):(0,e.jsx)(ke,{size:12,className:"text-primary/60"})}),(0,e.jsx)("span",{children:a.role==="user"?"Master User":"AI Core Sigma"}),(0,e.jsx)("span",{className:"italic font-normal opacity-50",children:"12:00 PM"})]})]})},n)),x==="thinking"&&(0,e.jsx)("div",{className:"flex justify-start",children:(0,e.jsxs)("div",{className:"bg-surface-container-high/40 backdrop-blur-md p-6 rounded-[2rem] flex gap-3 items-center border-transparent shadow-sm",children:[(0,e.jsx)("div",{className:"w-1.5 h-1.5 bg-primary rounded-full animate-pulse [animation-delay:-0.3s]"}),(0,e.jsx)("div",{className:"w-1.5 h-1.5 bg-primary rounded-full animate-pulse [animation-delay:-0.15s]"}),(0,e.jsx)("div",{className:"w-1.5 h-1.5 bg-primary rounded-full animate-pulse"}),(0,e.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-widest ml-2 opacity-60 text-primary",children:"Processing Vectors..."})]})}),(0,e.jsx)("div",{ref:B})]}),(0,e.jsxs)("div",{className:"savvy-chat-composer space-y-3 bg-surface-container-lowest backdrop-blur-3xl shadow-[0_-15px_30px_rgba(0,0,0,0.03)] border-transparent",children:[(0,e.jsx)("div",{className:"flex flex-wrap gap-2 px-1",children:$e.generateSmartReplyChips(r[r.length-1]?.text||"").map(a=>(0,e.jsx)("button",{type:"button",onClick:()=>P(a),disabled:x==="thinking",className:"px-3 py-1.5 rounded-full text-[8px] font-black uppercase tracking-wider border border-outline-variant/20 text-on-surface/50 hover:border-primary/40 hover:text-primary transition-all disabled:opacity-40",children:a},a))}),(0,e.jsxs)("div",{className:"flex items-center gap-3 px-2",children:[(0,e.jsx)("div",{className:`w-1.5 h-1.5 rounded-full ${x==="error"?"bg-rose-500 shadow-[0_0_10px_rgba(244,63,94,0.6)]":"bg-primary breathing-indicator-elite shadow-[0_0_10px_rgba(255,215,0,0.6)]"}`}),(0,e.jsx)("span",{className:"text-[9px] font-black uppercase tracking-[0.4em] text-on-surface/40",children:ce[x]}),(0,e.jsxs)("button",{type:"button",className:`ml-auto text-[8px] font-black uppercase tracking-widest px-2 py-1 rounded-lg border transition-all ${b?"border-primary/40 text-primary":"border-outline-variant/20 text-on-surface/40"}`,onClick:()=>W(a=>!a),children:["Speak replies ",b?"ON":"OFF"]})]}),(0,e.jsxs)("div",{className:"relative group/input",children:[(0,e.jsx)("div",{className:"absolute -inset-1 bg-linear-to-r from-primary/20 to-transparent roun
1ded-[3.5rem] blur opacity-0 group-focus-within/input:opacity-100 transition duration-1000"}),(0,e.jsxs)("div",{className:"relative glass-card-elite p-3 rounded-[3.5rem] flex items-center gap-3 border border-outline-variant/10 focus-within:border-primary/40 transition-all bg-surface-container-highest/2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 pl-2",children:[(0,e.jsx)("button",{className:"w-12 h-12 rounded-2xl flex items-center justify-center transition-all hover:bg-primary/5 text-on-surface/40 hover:text-primary cursor-pointer",onClick:Z,"aria-label":"Toggle Voice",children:(0,e.jsx)(te,{size:20})}),(0,e.jsx)("button",{className:`w-12 h-12 rounded-2xl flex items-center justify-center transition-all ${v?"bg-primary text-on-surface shadow-lg shadow-primary/30":"hover:bg-primary/5 text-on-surface/40 hover:text-primary"}`,onClick:le,disabled:x==="thinking","aria-label":"Talk to Savvy",title:"Talk to Savvy (ElevenLabs)",children:v?(0,e.jsx)(ge,{size:20,className:"animate-pulse"}):(0,e.jsx)(ee,{size:20})})]}),(0,e.jsx)("label",{htmlFor:"ai-assistant-input",className:"sr-only",children:"Transmit Command"}),(0,e.jsx)("textarea",{id:"ai-assistant-input",name:"ai-assistant-input",ref:Y,rows:1,placeholder:"Transmit Command...",className:"flex-1 bg-transparent border-none text-[13px] font-medium text-on-surface placeholder:text-on-surface/20 focus:ring-0 resize-none py-4 px-2",value:S,onChange:a=>C(a.currentTarget.value),onKeyDown:a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),P(S))}}),(0,e.jsxs)("button",{className:"w-14 h-14 bg-primary text-on-surface rounded-[2rem] flex items-center justify-center hover:scale-105 active:scale-95 transition-all disabled:opacity-30 disabled:hover:scale-100 shadow-[0_15px_30px_rgba(212,175,55,0.3)] group/send overflow-hidden",onClick:()=>P(S),disabled:x!=="idle"||!S.trim(),"aria-label":"Send",children:[(0,e.jsx)("div",{className:"absolute inset-x-0 bottom-0 h-1 bg-surface-container-lowest"}),(0,e.jsx)(xe,{size:22,className:"group-hover:translate-x-1 group-hover:-translate-y-1 transition-transform"})]})]})]})]})]});return l?J:(0,e.jsx)("div",{className:"fixed inset-0 z-100 flex items-end sm:items-center justify-center p-0 sm:p-6 bg-surface-container-lowest/80 backdrop-blur-sm animate-in fade-in duration-500",onClick:s,role:"dialog","aria-modal":"true",children:(0,e.jsx)("div",{className:"savvy-chat-modal glass-card-elite overflow-hidden shadow-[0_40px_80px_rgba(0,0,0,0.7)] border border-outline-variant/10 animate-in zoom-in-95 duration-700",onClick:a=>a.stopPropagation(),children:J})})};export{Ye as default};

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.