1import{j as e}from"./query-DLf6jQ7_.js";import{a as i}from"./vendor-B-xW6FxA.js";import{l as c,d as w,X as h}from"./index-Dl_m57S2.js";import{u as x}from"./bannerCoordinator-Ccdt9qL5.js";import{C as g}from"./circle-check-big-DgwbXNy9.js";import{C as S}from"./copy-C5ddMmf_.js";import"./ui-GpmADA3y.js";const d="sr_first_visit_ts",u="sr_welcome_dismissed",l="sr_welcome_shown",_="sr_checkout_completed",f="WELCOME10",E=15e3,C=30;function I(){try{if(localStorage.getItem(_))return!1;const t=localStorage.getItem(u);if(t){const n=parseInt(t,10);if(Date.now()-n<C*24*60*60*1e3)return!1}const o=localStorage.getItem(l);if(o&&(parseInt(o,10)||0)>=3)return!1;const s=localStorage.getItem(d);return s?Date.now()-parseInt(s,10)<10080*60*1e3:(localStorage.setItem(d,Date.now().toString()),!0)}catch{return!1}}function T(){const[m,t]=i.useState(!1),[o,s]=i.useState(!1),a=x("welcome_discount",m);i.useEffect(()=>{const r=setTimeout(()=>{I()&&t(!0)},E);return()=>clearTimeout(r)},[]),i.useEffect(()=>{if(a){c("welcome_banner_shown");try{const r=parseInt(localStorage.getItem(l)||"0",10);localStorage.setItem(l,(r+1).toString())}catch{}}},[a]);const n=()=>{t(!1);try{localStorage.setItem(u,Date.now().toString())}catch{}c("welcome_banner_dismissed")},p=()=>{navigator.clipboard.writeText(f).catch(()=>{}),s(!0),c("welcome_banner_code_copied"),setTimeout(()=>s(!1),2e3)};return a?e.jsx("div",{className:"fixed top-0 left-0 right-0 z-50 animate-in slide-in-from-top-5 duration-500","data-testid":"banner-welcome-discount",children:e.jsx("div",{className:"bg-gradient-to-r from-emerald-600 via-teal-600 to-cyan-600 shadow-lg",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-4 py-2.5 flex items-center justify-center gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{className:"h-4 w-4 text-yellow-300"}),e.jsxs("span",{className:"text-white text-sm font-medium",children:["Welcome! Get ",e.jsx("span",{className:"font-bold",children:"10% off"})," your first purchase â use code"]})]}),e.jsxs("button",{onClick:p,className:"inline-flex items-center gap-1.5 bg-white/20 hover:bg-white/30 rounded-md px-3 py-1 transition-colors","data-testid":"button-copy-welcome-code",children:[e.jsx("span",{className:"font-mono font-bold text-white text-sm tracking-wider",children:f}),o?e.jsx(g,{className:"h-3.5 w-3.5 text-yellow-300"}):e.jsx(S,{className:"h-3.5 w-3.5 text-white/70"})]}),e.jsx("button",{onClick:n,className:"text-white/60 hover:text-white transition-colors ml-2","data-testid":"button-dismiss-welcome-banner","aria-label":"Dismiss",children:e.jsx(h,{className:"h-4 w-4"})})]})})}):null}export{T 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.