PageSourceSearch

https://veribite.ai/assets/MenuScan-CZqNuIUi.js

js veribite.ai collected 2026-10-05 13:14:35 UTC 6,941 bytes, 5 lines download raw bytes

1import{r as x,j as e,m,A as j}from"./vendor-motion-9qIbWfdh.js";import{h as F,bH as N,u as k,j as C,a7 as v,y as S,k as _,bS as E,D as P,Z as M,C as z,N as A,bJ as y,H as g,q as I}from"./index-RER_5nha.js";import"./vendor-react-C0Dkio3Y.js";import"./vendor-query-CrasLRbE.js";import"./vendor-charts-JEUKlbbs.js";const K=["grilled","chicken","salmon","tuna","steak","eggs","shrimp","turkey","tofu","fish","lean","baked","broiled"],O=["fried","crispy","battered","cream","alfredo","nachos","loaded","fries","deep-fried","breaded","smothered","cheesy","double","triple"],R=["bacon","soy","teriyaki","bbq","ranch","pickled","cured","salted"],D=["glazed","honey","sweet","caramel","syrup","candied","sugar"],U=["nuggets","hot dog","corn dog","processed","patty"],q=["fried","deep-fried","crispy","battered","tempura"];function T(l){const n=l.toLowerCase().trim();let a=50;const t=[];K.forEach(s=>{n.includes(s)&&(a+=15)}),O.forEach(s=>{n.includes(s)&&(a-=12,t.push("UPF risk"))}),R.forEach(s=>{n.includes(s)&&(a-=5,t.includes("high sodium")||t.push("high sodium"))}),D.forEach(s=>{n.includes(s)&&(a-=8,t.includes("high sugar")||t.push("high sugar"))}),U.forEach(s=>{n.includes(s)&&(t.includes("UPF risk")||t.push("UPF risk"))}),q.forEach(s=>{n.includes(s)&&(t.includes("seed oils")||t.push("seed oils"))});const c=[...new Set(t)].slice(0,2),o=a>=60?"best":a>=40?"okay":"avoid";return{name:l.trim(),score:Math.max(0,Math.min(100,a)),tags:c,tier:o}}function W(l){const a=l.split(/\n/).map(i=>i.trim()).filter(i=>i.length>2&&i.length<200).map(T).sort((i,h)=>h.score-i.score),t=a.filter(i=>i.tier==="best"),c=a.filter(i=>i.tier==="okay"),o=a.filter(i=>i.tier==="avoid"),s=t[0]||c[0]||null,u=t[1]||c[0]||c[1]||null,d=o.length>0?o[o.length-1]:c[c.length-1]||null;return{items:a,topPicks:{best:s,balanced:u,treat:d}}}function Q(){const[,l]=F(),{data:n}=N(),{toast:a}=k(),[t,c]=x.useState(""),[o,s]=x.useState(!1),[u,d]=x.useState(!1),i=n&&n.menuGuidanceModeSet===0,h=async()=>{if(!t.trim()){a({title:"No menu text",description:"Paste or type menu items to analyze.",variant:"destructive"});return}if(i){s(!0);return}b(n?.menuGuidanceMode||"quick")},p=async r=>{s(!1),d(!0);try{await y({menu_guidance_mode:r,menu_guidance_mode_set:1}),g("menu_guidance_mode_selected",{mode:r})}catch{}b(r)},b=async r=>{const f=W(t),w=n?.menuScanCount||0;try{await y({menu_scan_count:w+1}),I.invalidateQueries({queryKey:["/api/user-state"]})}catch{}g("menu_scan_completed",{mode:r,items_count:f.items.length}),sessionStorage.setItem("menu_scan_result",JSON.stringify(f)),sessionStorage.setItem("menu_scan_mode",r),d(!1),l("/menu-scan/result")};return e.jsxs("div",{className:"min-h-screen bg-[#0A0E14] pb-32 max-w-lg lg:max-w-2xl mx-auto",children:[e.jsx("div",{className:"bg-[#0A0E14] px-6 pb-4 sticky top-0 z-10 border-b border-white/5",style:{paddingTop:"calc(env(safe-area-inset-top, 0px) + 8px)"},children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(C,{"data-testid":"button-back-menu-scan"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h1",{className:"text-xl font-bold text-white","data-testid":"text-menu-scan-title",children:"Menu Scan"}),e.jsx("p",{className:"text-xs text-white/40",children:"Pre-scan a menu to choose smarter"})]})]})}),e.jsxs("div",{className:"px-6 py-6 space-y-5",children:[e.jsx(m.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:e.jsxs(v,{className:"p-4 space-y-4 bg-[#151A21] border-white/5","data-testid":"card-menu-input",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-white/50 mb-2 block",children:"Paste menu items (one per line)"}),e.jsx("textarea",{value:t,onChange:r=>c(r.target.value),placeholder:`Grilled Chicken Caesar Salad
2Fried Mozzarella Sticks
3Salmon Bowl with Quinoa
4Loaded Nachos Supreme
5Grilled Shrimp Tacos`,className:"w-full h-40 px-3 py-2.5 border border-[#00FFC3]/[0.18] rounded-lg bg-white/[0.04] text-white text-sm resize-none placeholder:text-white/40 focus:outline-none focus:border-[#00FFC3]/30 shadow-[0_0_8px_rgba(0,255,195,0.03)]","data-testid":"input-menu-text"})]}),e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-[#00FFC3]/5 border border-[#00FFC3]/10",children:[e.jsx(S,{className:"w-4 h-4 text-[#00FFC3]/50 shrink-0"}),e.jsx("span",{className:"text-[10px] text-white/40",children:"Photo upload coming soon — paste text for now"})]}),e.jsxs(_,{className:"w-full bg-[#00FFC3]/10 hover:bg-[#00FFC3]/20 text-[#00FFC3] border border-[#00FFC3]/20",onClick:h,disabled:u||!t.trim(),"data-testid":"button-analyze-menu",children:[e.jsx(E,{className:"w-4 h-4 mr-2"}),"Find the Best Choice"]})]})}),e.jsx(m.div,{initial:{opacity:0,y:10}
5,animate:{opacity:1,y:0},transition:{delay:.1},children:e.jsxs("div",{className:"text-center space-y-2 py-4",children:[e.jsx("p",{className:"text-xs text-white/25",children:"Paste a restaurant menu, cafeteria list, or delivery app items."}),e.jsx("p",{className:"text-xs text-white/25",children:"Kosmo will help you pick the best option."})]})})]}),e.jsx(j,{children:o&&e.jsx(m.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 px-6","data-testid":"modal-mode-picker",children:e.jsxs(m.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.9,opacity:0},className:"w-full max-w-sm bg-[#151A21] rounded-2xl border border-white/10 p-6 space-y-5",children:[e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx(P,{className:"w-8 h-8 text-[#00FFC3] mx-auto"}),e.jsx("h2",{className:"text-lg font-bold text-white","data-testid":"text-mode-picker-title",children:"How do you want help right now?"}),e.jsx("p",{className:"text-xs text-white/40",children:"Choose how Kosmo analyzes menus for you"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{onClick:()=>p("quick"),className:"w-full p-4 rounded-xl bg-[#00FFC3]/5 border border-[#00FFC3]/20 hover:bg-[#00FFC3]/10 transition-colors text-left","data-testid":"button-mode-quick",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(M,{className:"w-5 h-5 text-[#00FFC3]"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-white",children:"Quick Pick"}),e.jsx("p",{className:"text-[11px] text-white/40 mt-0.5",children:"Top 3 choices — best, balanced, treat"})]})]})}),e.jsx("button",{onClick:()=>p("analysis"),className:"w-full p-4 rounded-xl bg-[#00FFC3]/5 border border-[#00FFC3]/20 hover:bg-[#00FFC3]/10 transition-colors text-left","data-testid":"button-mode-analysis",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(z,{className:"w-5 h-5 text-[#00FFC3]"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-white",children:"Full Breakdown"}),e.jsx("p",{className:"text-[11px] text-white/40 mt-0.5",children:"Every item ranked with health tags"})]})]})})]})]})})}),e.jsx(A,{})]})}export{Q 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.