PageSourceSearch

https://lmk.today/_next/static/chunks/62395-691a9a8ff9de3038.js?dpl=dpl_5Dm4hPFR4YLQe5uHK7Gef5SzQbhA

js lmk.today collected 2026-09-24 12:07:36 UTC 61,556 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[62395],{800:(e,t,a)=>{a.d(t,{EP:()=>n});let r=["web_product_click"],s=["email_product_click","email_link_click","anonymous_email_click"],l=["extension_product_click"];function n(e){return e.toLowerCase().replace(/^https?:\/\//,"").replace(/^www\./,"").replace(/\.(com|net|org|co|io|us|shop|store)(\.[a-z]{2})?$/i,"").replace(/[^a-z0-9]/g,"")}[...r,...s,...l]},5445:(e,t,a)=>{a.r(t),a.d(t,{MerchantLogo:()=>m});var r=a(95155),s=a(12115),l=a(66766),n=a(59434);let i=[{keyword:"amazon",backgroundColor:"#000000",textColor:"#ffffff"},{keyword:"walmart",backgroundColor:"#0071ce",textColor:"#ffffff"},{keyword:"nike",backgroundColor:"#111111",textColor:"#ffffff"},{keyword:"apple",backgroundColor:"#0a0a0a",textColor:"#ffffff"},{keyword:"etsy",backgroundColor:"#f1641e",textColor:"#ffffff"},{keyword:"adidas",backgroundColor:"#000000",textColor:"#ffffff"},{keyword:"redbubble",backgroundColor:"#e4134d",textColor:"#ffffff"},{keyword:"bestbuy",backgroundColor:"#0046be",textColor:"#ffffff"},{keyword:"best-buy",backgroundColor:"#0046be",textColor:"#ffffff"},{keyword:"ikea",backgroundColor:"#0058a3",textColor:"#ffffff"},{keyword:"target",backgroundColor:"#cc0000",textColor:"#ffffff"}],o=["amazon","walmart","nike","apple","etsy","adidas","redbubble","red bubble","ikea","target","sephora","lululemon","glossier","alo","alo yoga","h&m","allbirds","carhartt","rei","patagonia","north face","the north face","uniqlo","skims","warby parker","everlane","madewell","j.crew","jcrew","gap","old navy","banana republic","athleta"];function c(e,t){let a=t.toLowerCase();return[e.slug,e.name,e.domain].filter(Boolean).map(e=>{var t;return null!==(t=null==e?void 0:e.toLowerCase())&&void 0!==t?t:""}).some(e=>e.includes(a))}let d={sm:{wrapper:"w-8 h-8",letter:"text-xs",size:"32px",padding:"p-1"},md:{wrapper:"w-10 h-10",letter:"text-sm",size:"40px",padding:"p-1.5"},lg:{wrapper:"w-12 h-12",letter:"text-base",size:"48px",padding:"p-2"},xl:{wrapper:"w-16 h-16",letter:"text-lg",size:"64px",padding:"p-3"}};function m(e){var t,a;let{imageUrl:m,fallbackImageUrl:u,name:h,slug:x,domain:p,alt:f,size:g="md",className:b,border:y=!0,rounded:v="lg",fallbackInitial:w,backgroundClassName:N}=e,[j,_]=(0,s.useState)(!1),{wrapper:k,letter:C,size:S,padding:I}=d[g],A=function(e){let t=i.find(t=>c(e,t.keyword));if(t){var a;return{backgroundColor:t.backgroundColor,textColor:null!==(a=t.textColor)&&void 0!==a?a:"#ffffff",matchedKeyword:t.keyword,needsBackground:!0}}return o.some(t=>c(e,t))?{backgroundColor:"#d4d4d8",textColor:"#111827",matchedKeyword:null,needsBackground:!0}:{backgroundColor:void 0,textColor:void 0,matchedKeyword:null,needsBackground:!1}}({name:h,slug:x,domain:p}),P=w||(null==h?void 0:null===(t=h.charAt(0))||void 0===t?void 0:t.toUpperCase())||"?",L=f||(h?"".concat(h," logo"):"Merchant logo"),M=(0,n.o6)(m),z=(0,n.o6)(u),T=M||z,U=T&&!j,F=A.needsBackground||!U&&A.backgroundColor;return(0,r.jsx)("div",{className:(0,n.cn)("relative overflow-hidden flex items-center justify-center",!F&&"bg-gray-50",y&&"border border-gray-200","full"===v?"rounded-full":"lg"===v?"rounded-lg":"rounded-md",k,b,N),style:F?{backgroundColor:A.backgroundColor}:void 0,children:U?(0,r.jsx)(l.default,{src:T,alt:L,fill:!0,sizes:S,className:(0,n.cn)("object-contain",I),onError:()=>_(!0)}):(0,r.jsx)("span",{className:(0,n.cn)("font-semibold",C),style:{color:null!==(a=A.textColor)&&void 0!==a?a:A.backgroundColor?"#ffffff"
1:"#6b7280"},children:P})})}},14934:(e,t,a)=>{a.d(t,{r:()=>d});var r=a(95155),s=a(12115),l=a(61840),n=a(56539),i=a(76766),o=a(62003),c=a(94251);function d(e){let{href:t,children:a,className:d="",showIcon:m=!1,product:u=null,onClick:h,searchContext:x,wishlistId:p,forceNewTab:f=!1}=e,{trackOutboundClick:g}=(0,n.J)(),b=(0,s.useMemo)(()=>{let e=p?{wishlistId:p,context:"wishlist"}:void 0;if(u)return(0,i.R)(u,x,e);if(!t)return"#";let a=new URLSearchParams({url:(0,o.LA)(t)});return p&&(a.set("wishlist_id",p),a.set("context","wishlist")),"/c/?".concat(a.toString())},[t,u,x,p]);return(0,r.jsxs)("a",{href:b,target:f?"_blank":void 0,rel:"sponsored nofollow noopener noreferrer",className:d,onClick:e=>{e.preventDefault(),null==h||h();let t=b.startsWith("/")?new URL(b,window.location.origin).href:b;(0,c.EH)(t,u?async()=>{await g(u,p)}:void 0)},children:[a,m&&(0,r.jsx)(l.A,{className:"ml-1 inline-block h-4 w-4"})]})}},25601:(e,t,a)=>{a.d(t,{BL:()=>m,Eg:()=>i,K6:()=>c,NJ:()=>n,Xi:()=>u,sp:()=>d});var r=a(800),s=a(62003);let l={kohls:"Kohl's",macys:"Macy's",lowes:"Lowe's",bestbuy:"Best Buy",homedepot:"Home Depot",bedbathbeyond:"Bed Bath & Beyond",officedepot:"Office Depot",oldnavy:"Old Navy",bananarepublic:"Banana Republic"};function n(e){return(0,r.EP)(e||"")}function i(e){let t=n(e);return t&&l[t]||e}let o={amazon:"amazon.com",walmart:"walmart.com",target:"target.com","best buy":"bestbuy.com",bestbuy:"bestbuy.com",kohls:"kohls.com","kohl's":"kohls.com","home depot":"homedepot.com",costco:"costco.com",macys:"macys.com","macy's":"macys.com",lowes:"lowes.com","lowe's":"lowes.com",nordstrom:"nordstrom.com",cvs:"cvs.com",walgreens:"walgreens.com",staples:"staples.com",petco:"petco.com",chewy:"chewy.com",wayfair:"wayfair.com",newegg:"newegg.com",adorama:"adorama.com",sephora:"sephora.com",nike:"nike.com",adidas:"adidas.com",zappos:"zappos.com",jcpenney:"jcpenney.com",gamestop:"gamestop.com","office depot":"officedepot.com","bed bath & beyond":"bedbathandbeyond.com",gap:"gap.com","old navy":"oldnavy.com","banana republic":"bananarepublic.com",athleta:"athleta.com",farfetch:"farfetch.com",aritzia:"aritzia.com"};function c(e,t){var a;if(e)return e;let r=(t||"").toLowerCase().trim();if(!r)return;let s=n(t),l=o[r]||(s?o[s]:void 0)||(null===(a=Object.entries(o).find(e=>{let[t]=e;return n(t)===s||r.includes(t)||t.includes(r)}))||void 0===a?void 0:a[1]);return l?"https://i.v2i8b.com/".concat(l):void 0}function d(e,t,a,r,l){let n=(0,s.LA)(e),i=new URLSearchParams;return i.set("url",n),r&&r!==n&&i.set("aff_url",r),i.set("product_id",t),a&&i.set("merchant",a),(null==l?void 0:l.wishlistId)?(i.set("wishlist_id",l.wishlistId),i.set("context",l.context||"wishlist")):(null==l?void 0:l.context)&&i.set("context",l.context),"/c/?".concat(i.toString())}function m(e,t,a,r){let l=e.url||(0,s.LA)(e.wrappedUrl);return l?d(l,t,a,void 0,r):null}function u(e,t,a){let r=new Set,s=[],l=e=>{let t=n(e.merchantName);!t||r.has(t)||(r.add(t),s.push({...e,merchantName:i(e.merchantName)}))};for(let t of e)l(t);for(let e of t)l(e);return a&&l(a),s.sort((e,t)=>{let a=e.price>0?e.price:Number.POSITIVE_INFINITY,r=t.price>0?t.price:Number.POSITIVE_INFINITY;return a!==r?a-r:e.merchantName.localeCompare(t.merchantName)})}},46102:(e,t,a)=>{a.d(t,{m:()=>l});var r=a(95155),s=a(12115);function l(e){let{content:t,children:a,className:l="",preferredPosition:n="bottom"}=e,[i,o]=(0,s.useState)(!1),[c,d]=(0,s.useState)(n),m=(0,s.useRef)(null),u=(0,s.useRef)(null);return(0,s.useEffect)(()=>{if(!i||!m.current||!u.current)return;if("right"===n){d("right");return}let e=m.current.getBoundingClientRect(),t=u.current.offsetHeight,a=e.top,r=window.innerHeight-e.bottom;"bottom"===n?r<t+8&&a>t+8?d("top"):d("bottom"):a<t+8&&r>t+8?d("bottom"):d("top")},[i,n]),(0,r.jsxs)("div",{className:"relative inline-block ".concat(l),ref:m,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onFocus:()=>o(!0),onBlur:()=>o(!1),tabIndex:0,children:[a,i&&(0,r.jsx)("div",{ref:u,className:"absolute z-[60] bg-white rounded-lg shadow-lg border border-gray-200 p-2 text-sm text-gray-700 max-w-sm min-w-[180px] ".concat("top"===c?"bottom-full mb-2":"right"===c?"left-full ml-2":"top-full mt-2"),style:"right"===c?{top:"50%",transform:"translateY(-50%)"}:{left:"50%",transform:"translateX(-50%)"},role:"tooltip",children:t})]})}},47262:(e,t,a)=>{a.d(t,{S:()=>o});var r=a(95155),s=a(12115),l=a(76981),n=a(10518),i=a(59434);let o=s.forwardRef((e,t)=>
1{let{className:a,...s}=e;return(0,r.jsx)(l.bL,{ref:t,className:(0,i.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",a),...s,children:(0,r.jsx)(l.C1,{className:(0,i.cn)("flex items-center justify-center text-current"),children:(0,r.jsx)(n.A,{className:"h-4 w-4"})})})});o.displayName=l.bL.displayName},62395:(e,t,a)=>{a.d(t,{ProductCard:()=>K});var r=a(95155),s=a(93223),l=a(78061),n=a(61840),i=a(12115),o=a(82158),c=a(20782),d=a(21868),m=a(16962),u=a(60268),h=a(79992),x=a(59434),p=a(54165),f=a(30285),g=a(965),b=a(73158),y=a(50172),v=a(19968),w=a(68098),N=a(7390),j=a(25318),_=a(47650),k=a(5445),C=a(82549),S=a(62003),I=a(94251),A=a(56539),P=a(62523),L=a(88539),M=a(47262),z=a(10518),T=a(2160),U=a(83662),F=a(56671),B=a(52643);function O(e){var t;let{context:a,variant:s="modal",defaultMerchant:l="other",className:n}=e,{user:o}=(0,d.A)(),c=a.requestedQuantity||1,m=a.claimedQuantity||0,u=Math.max(0,c-m),h=m>=c&&c>0||a.isTaken,g=a.claimPermissions,b="anyone"===g||"invite_only"===g,[v,w]=(0,i.useState)(!1),[N,j]=(0,i.useState)(!1),[_,k]=(0,i.useState)(!1),[C,S]=(0,i.useState)(null),[I,A]=(0,i.useState)(!1),[O,q]=(0,i.useState)({claimer_name:"",claimer_email:"",quantity_claimed:1,purchase_store:"other",order_number:"",gift_message:"",keep_surprise:!1});if((0,i.useEffect)(()=>{o&&q(e=>{var t;return{...e,claimer_name:e.claimer_name||(null===(t=o.user_metadata)||void 0===t?void 0:t.display_name)||"",claimer_email:e.claimer_email||o.email||""}})},[o]),!(g&&"disabled"!==g)||"card"===s&&!h)return null;let D=()=>{if(!o){let e=encodeURIComponent(window.location.href);window.location.href="/auth/login?next=".concat(e);return}q(e=>({...e,quantity_claimed:Math.min(e.quantity_claimed||1,Math.max(1,u)),purchase_store:l.toLowerCase().includes("amazon")?"amazon":l.toLowerCase().includes("target")?"target":l.toLowerCase().includes("walmart")?"walmart":"other"})),w(!0)},E=async()=>{var e,t;if(!o){F.toast.error("Please sign in to claim items");return}if(!(null===(e=O.claimer_name)||void 0===e?void 0:e.trim())){F.toast.error("Name is required");return}j(!0);try{let e=(0,B.createClient)(),{data:{session:r}}=await e.auth.getSession();if(!(null==r?void 0:r.access_token)){F.toast.error("Please sign in to claim items");return}let s={"Content-Type":"application/json",Authorization:"Bearer ".concat(r.access_token)};r.refresh_token&&(s["X-Refresh-Token"]=r.refresh_token);let l=O.quantity_claimed||1,n=await fetch("/api/wishlist/claims",{method:"POST",headers:s,body:JSON.stringify({wishlist_product_id:a.wishlistItemId,...O,quantity_claimed:l})}),i=await n.json();i.success?(F.toast.success("Item claimed successfully!"),null===(t=a.onClaimChange)||void 0===t||t.call(a,!0,l),w(!1)):F.toast.error(i.error||"Failed to claim item")}catch(e){console.error("Error claiming item:",e),F.toast.error("Network error occurred")}finally{j(!1)}},Q=async()=>{if(!o){F.toast.error("Please sign in to request shipping address");return}k(!0);try{let t=(0,B.createClient)(),{data:{session:r}}=await t.auth.getSession();if(!(null==r?void 0:r.access_token)){F.toast.error("Please sign in to request address");return}let s={"Content-Type":"application/json",Authorization:"Bearer ".concat(r.access_token)};r.refresh_token&&(s["X-Refresh-Token"]=r.refresh_token);let l=await fetch("/api/wishlist/shipping-address",{method:"POST",headers:s,body:JSON.stringify({wishlist_id:a.wishlistId})}),n=await l.json();if(l.ok&&n.shipping_address)S(n.shipping_address),A(!0);else if(confirm("The wishlist owner hasn't shared their shipping address yet. Would you like to send them a request to share it?")){var e;let t=await fetch("/api/wishlist/request-address",{method:"POST",headers:s,body:JSON.stringify({wishlist_id:a.wishlistId,requester_email:o.email,requester_name:(null===(e=o.user_metadata)||void 0===e?void 0:e.display_name)||o.email})}),r=await t.json();t.ok?F.toast.success("Address request sent to the wishlist owner!"):F.toast.error(r.error||"Failed to send address request")}}catch(e){console.error("Error requesting address:",e),F.toast.error("Failed to request shipping address")}finally{k(!1)}},R=a.showClaimerNames&&a.claimerName?"Claimed by ".concat(a.claimerName.length>18?"".concat(a.claimerName.slice(0,18),"…"):a.claimerName):"Claimed",$=h?"Qty ".concat(c," — all claimed"):m>0?"".concat(u," of ").concat(c," still needed"):"Qty requested: ".concat(c);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:(0,x.cn)("modal"===s?"space-y-3"
1:"space-y-1.5",n),children:["modal"===s&&$&&(0,r.jsx)("p",{className:"text-sm font-medium text-brand",children:$}),h?(0,r.jsxs)("div",{className:(0,x.cn)("flex items-center gap-2 rounded-lg border border-green-200 bg-green-50 text-green-800","modal"===s?"px-3 py-2.5 text-sm font-medium":"px-2 py-1.5 text-xs font-semibold justify-center"),children:[(0,r.jsx)(z.A,{className:"w-4 h-4 flex-shrink-0"}),R]}):(0,r.jsxs)(f.$,{type:"button",variant:"modal"===s?"outline":"default",onClick:e=>{e.stopPropagation(),D()},className:(0,x.cn)("w-full font-semibold","modal"===s?"h-10 text-sm rounded-xl border-gray-300 text-gray-700":"h-9 text-xs bg-green-600 hover:bg-green-700 text-white"),children:[(0,r.jsx)(T.A,{className:"w-4 h-4 mr-1.5"}),o?"Claim this gift":"Sign in to claim"]}),"modal"===s&&!h&&b&&(0,r.jsx)(f.$,{type:"button",variant:"outline",onClick:Q,disabled:_||!o,className:"w-full text-sm rounded-xl",children:_?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Checking..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(U.A,{className:"w-4 h-4 mr-2"}),"Need shipping address?"]})})]}),(0,r.jsx)(p.lG,{open:v,onOpenChange:w,children:(0,r.jsxs)(p.Cf,{className:"max-w-lg z-[12000]",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)(p.c7,{children:(0,r.jsx)(p.L3,{children:"Claim this gift"})}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("p",{className:"text-sm text-gray-600",children:"Mark this item so others know you're getting it. You can add purchase details optionally."}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Your name *"}),(0,r.jsx)(P.p,{value:O.claimer_name||"",onChange:e=>q(t=>({...t,claimer_name:e.target.value})),placeholder:"Enter your name",required:!0})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Email (optional)"}),(0,r.jsx)(P.p,{type:"email",value:O.claimer_email||"",onChange:e=>q(t=>({...t,claimer_email:e.target.value})),placeholder:"[email protected]"})]})]}),c>1&&u>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["Quantity (",m," of ",c," already claimed)"]}),(0,r.jsx)(P.p,{type:"number",min:1,max:u,value:O.quantity_claimed||1,onChange:e=>{let t=Math.max(1,Math.min(u,parseInt(e.target.value,10)||1));q(e=>({...e,quantity_claimed:t}))}}),(0,r.jsxs)("p",{className:"text-xs text-gray-500 mt-1",children:[u," still needed"]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Gift message (optional)"}),(0,r.jsx)(L.T,{value:O.gift_message||"",onChange:e=>q(t=>({...t,gift_message:e.target.value})),placeholder:"Add a personal message...",className:"text-sm",rows:2})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(M.S,{id:"keep-surprise-registry",checked:O.keep_surprise||!1,onCheckedChange:e=>q(t=>({...t,keep_surprise:e}))}),(0,r.jsx)("label",{htmlFor:"keep-surprise-registry",className:"text-sm text-gray-700",children:"Keep this gift a surprise"})]}),b&&(0,r.jsx)("div",{className:"border-t pt-4",children:(0,r.jsx)(f.$,{variant:"outline",onClick:Q,disabled:_,className:"w-full text-sm",children:_?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Checking..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(U.A,{className:"w-4 h-4 mr-2"}),"Need shipping address?"]})})}),(0,r.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,r.jsx)(f.$,{onClick:E,disabled:N||!(null===(t=O.claimer_name)||void 0===t?void 0:t.trim()),className:"flex-1 bg-green-600 hover:bg-green-700",children:N?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Claiming..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(z.A,{className:"w-4 h-4 mr-2"}),"Claim item"]})}),(0,r.jsx)(f.$,{variant:"outline",onClick:()=>w(!1),disabled:N,children:"Cancel"})]})]})]})}),(0,r.jsx)(p.lG,{open:I,onOpenChange:A,children:(0,r.jsxs)(p.Cf,{className:"max-w-md z-[12000]",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)(p.c7,{children:(0,r.jsx)(p.L3,{children:"Shipping Address"})}),(0,r.jsxs)("div",{className:"space-y-4",children:[C?(0,r.jsxs)("div",{className:"bg-gray-50 p-4 rounded-lg space-y-1 text-sm",children:[(0,r.jsx)("p",{className:"font-medium",children:C.name}),(0,r.jsx)("p",{className:"text-gray-600",children:C.street_line_1}),C.street_line_2&&(0,r.jsx)("p",{className:"text-gray-600",children:C.street_line_2}),(0,r.jsxs)("p",{className:"text-gray-600",children:[C.city,", ",C.state," ",C.zip]}),(0,r.jsx)("p",{className:"text-gray-600",children:C.country}),C.phone&&(0,r.jsxs)("p",{className:"text-gray-600",children:["Phone: ",C.phone]})]}):(0,r.jsx)("p",{className:"text-sm text-gray-600",children:"No shipping address available."}),(0,r.jsx)(f.$,{variant:"outline",onClick:()=>A(!1),className:"w-full",children:"Close"})]})]})})]})}var q=a(25601),D=a(62945);let E="outline-none focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset focus-visible:ring-offset-0";function Q(e){var t,a,s;let{isOpen:l,onClose:c,product:d,onWishlist:j,searchContext:C,initialAlternatives:P,openLinksInNewTab:L=!1,emphasizeBuyingOptions:M=!1,wishlistContext:z}=e,[T,U]=(0,i.useState)(0),[F,B]=(0,i.useState)([]),[Q,$]=(0,i.useState)(null),[W,K]=(0,i.useState)(!1),[Y,J]=(0,i.useState)(!1),[H,G]=(0,i.useState)(!1),[V,X]=(0,i.useState)(!1),[Z,ee]=(0,i.useState)(!1),et=(0,i.useRef)(null),ea=(0,i.useRef)(null),{trackOutboundClick:er}=(0,A.J)(),es=(null===(t=d.image_urls)||void 0===t?void 0:t.filter(Boolean))||[],el=d.currency_code||"USD",en=(0,o.MJ)({affiliate_url:d.affiliate_url,direct_url:d.direct_url,metadata:d.metadata,integration_type:d.integration_type,merchant_id:d.merchant_id,brand:d.brand}),ei=null!=d.rating&&Number(d.rating)>0?Number(d.rating):null,eo=null!=d.review_count&&Number(d.review_count)>0?Number(d.review_count):null,ec=()=>{var e;let t=(null===(e=d.metadata)||void 0===e?void 0:e.source_integration)||"",a="80239aea-1182-4daa-947a-2a09d880ffab"===d.merchant_id;return"pa_api"===t||"rainforest"===t||a},ed=(e,t)=>new Intl.NumberFormat("en-US",{style:"currency",currency:t||el}).format(e),em=null!=d.original_price&&d.original_price>d.price,eu=d.on_sale&&null!=d.sale_discount&&Number(d.sale_discount)>0,eh=em||eu,ex=ec()&&d.price>0&&(eh||!0===d.on_sale),ep=(0,i.useCallback)(async()=>{var e,t;if(!Y){if(null===(e=d.detailPagePath)||void 0===e?void 0:e.startsWith("/items/")){J(!0);return}if(d.slug){K(!0);try{let e=await fetch("/api/products/".concat(d.slug,"/buying-options"));if(e.ok){let a=await e.json();a.success&&((null===(t=a.options)||void 0===t?void 0:t.length)>0&&B(a.options),a.productUrl&&"string"==typeof a.productUrl&&$(a.productUrl))}}catch(e){}finally{K(!1),J(!0)}}}},[d.slug,d.detailPagePath,Y]);(0,i.useEffect)(()=>{l&&(U(0),B([]),$(null),J(!1),K(!1),G(!1),ee(!1))},[l,d.id]),(0,i.useEffect)(()=>{l&&!Y&&ep()},[l,Y,ep]);let ef=d.affiliate_url||d.direct_url||Q||(0,o.QZ)(d)||null,eg=ef?{id:"primary-".concat(d.id),merchantName:en||"Buy Now",merchantId:0,price:d.price||0,currency:el,url:(0,S.LA)(ef),wrappedUrl:(0,q.sp)(ef,d.id,en||void 0,d.affiliate_url||void 0),availability:"InStock",provider:"primary"}:null,eb=(P||[]).map((e,t)=>({id:"alt-".concat(t,"-").concat(e.merchantName),merchantName:e.merchantName,merchantId:parseInt(e.merchantId||"0"),price:e.price,currency:el,url:e.directUrl||(0,S.LA)(e.affiliateUrl),wrappedUrl:e.affiliateUrl,availability:e.availability||"InStock",provider:e.integrationType})),ey=(0,i.useMemo)(()=>(0,q.Xi)(F,eb,eg),[F,eb,eg]),ev=Math.max(0,ey.length-4),ew=Z||ey.length<=4?ey:ey.slice(0,4),eN=null!==(s=null!=eg?eg:ey[0])&&void 0!==s?s:null,ej=ey.filter(e=>e.price>0).length>1?Math.min(...ey.filter(e=>e.price>0).map(e=>e.price)):null,e_=e=>{let t=(0,q.BL)(e,d.id,e.merchantName,(null==z?void 0:z.wishlistId)?{wishlistId:z.wishlistId,context:"wishlist"}:void 0);t&&(L?window.open(t,"_blank","noopener,noreferrer"):(0,I.BY)()?window.location.href=t:window.open(t,"_blank","noopener,noreferrer"),er(d,null==z?void 0:z.wishlistId).catch(()=>{}),(null==C?void 0:C.query)&&fetch("/api/search/track-click",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({searchQuery:C.query,searchQueryId:C.queryId,productId:d.id,position:C.position,clickType:"merchant_click"})}).catch(()=>{}))},ek=function(e){let t=window.location.origin;return e.detailPagePath?"".concat(t).concat(e.detailPagePath):e.slug?"".concat(t,"/product/").concat(e.slug):t}(d);(0,i.useEffect)(()=>
1{if(!H)return;let e=e=>{ea.current&&!ea.current.contains(e.target)&&et.current&&!et.current.contains(e.target)&&G(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[H]);let eC=e=>{let t="/product/".concat(e);L?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t},eS=async()=>{if(d.detailPagePath){c();let e=d.detailPagePath;L?window.open(e,"_blank","noopener,noreferrer"):window.location.href=e;return}if(d.slug){c(),eC(d.slug);return}if(!d.title)return;X(!0);let e=!1;try{let a=await fetch("/api/products/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({external_id:d.external_id||d.id,integration_type:d.integration_type||"affiliate.com",title:d.title,description:d.description,price:d.price,original_price:d.original_price,currency_code:d.currency_code||"USD",image_urls:d.image_urls,rating:d.rating,review_count:d.review_count,brand:d.brand,merchant:d.merchant,affiliate_url:d.affiliate_url,direct_url:d.direct_url,on_sale:d.on_sale,sale_discount:d.sale_discount,category:d.category,metadata:d.metadata})});if(a.ok){var t;let r=await a.json(),s=r.slug||(null===(t=r.product)||void 0===t?void 0:t.slug);if(s){L?(window.open("/product/".concat(s),"_blank","noopener,noreferrer"),c()):(e=!0,window.location.href="/product/".concat(s));return}}(d.direct_url||d.affiliate_url)&&window.open(d.direct_url||d.affiliate_url,"_blank","noopener,noreferrer")}catch(e){(d.direct_url||d.affiliate_url)&&window.open(d.direct_url||d.affiliate_url,"_blank","noopener,noreferrer")}finally{e||X(!1)}},eI=()=>{c(),setTimeout(()=>j(),150)};return(0,r.jsxs)(p.lG,{open:l,onOpenChange:e=>!e&&c(),children:[(0,r.jsxs)(p.Cf,{className:"max-w-[850px] w-[95vw] md:w-full p-0 gap-0 overflow-hidden max-h-[90vh] md:max-h-[85vh] flex flex-col","aria-describedby":void 0,children:[(0,r.jsx)(p.L3,{className:"sr-only",children:d.title}),(0,r.jsxs)("div",{className:"flex flex-col md:flex-row flex-1 overflow-hidden min-h-0",children:[(0,r.jsxs)("div",{className:"relative w-full md:w-[45%] bg-white flex-shrink-0 md:border-r border-gray-100 max-md:border-b",children:[(0,r.jsxs)("div",{className:"relative w-full max-md:h-[min(22vh,188px)] md:aspect-square md:min-h-0",children:[es.length>0?(0,r.jsx)(m.SafeImage,{src:es[T],alt:d.title,fill:!0,className:"object-contain p-4 max-md:p-3 md:p-8",sizes:"(max-width: 768px) 95vw, 380px"}):(0,r.jsx)(u.z,{title:d.title}),eu&&(0,r.jsxs)("div",{className:"absolute top-3 left-3 z-20 bg-red-500 text-white text-xs font-bold px-2 py-1 rounded-full shadow-sm",children:[Math.floor(Number(d.sale_discount)),"% OFF"]}),es.length>1&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:()=>U(e=>0===e?es.length-1:e-1),className:"absolute left-3 top-1/2 -translate-y-1/2 w-9 h-9 rounded-full bg-white/90 shadow-md flex items-center justify-center hover:bg-white transition-colors","aria-label":"Previous image",children:(0,r.jsx)(g.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{onClick:()=>U(e=>e===es.length-1?0:e+1),className:"absolute right-3 top-1/2 -translate-y-1/2 w-9 h-9 rounded-full bg-white/90 shadow-md flex items-center justify-center hover:bg-white transition-colors","aria-label":"Next image",children:(0,r.jsx)(b.A,{className:"w-4 h-4"})})]})]}),es.length>1&&(0,r.jsx)("div",{className:"flex justify-center gap-1.5 px-4 pb-1 max-md:pb-1.5",children:es.map((e,t)=>(0,r.jsx)("button",{onClick:()=>U(t),className:(0,x.cn)("w-2 h-2 rounded-full transition-colors",t===T?"bg-gray-800":"bg-gray-300"),"aria-label":"Image ".concat(t+1)},t))})]}),(0,r.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto overscroll-contain p-4 pb-3 md:p-8 flex flex-col touch-pan-y",children:[(0,r.jsx)("h2",{className:"text-lg md:text-2xl font-bold text-gray-900 leading-snug mb-2 md:mb-3 line-clamp-1 md:line-clamp-none",children:d.title}),ei&&(0,r.jsxs)("div",{className:"hidden md:flex items-center gap-2 mb-1.5",children:[(0,r.jsx)("div",{className:"flex items-center",children:[1,2,3,4,5].map(e=>(0,r.jsx)("span",{className:(0,x.cn)("text-sm",e<=Math.round(ei)?"text-yellow-400":"text-gray-200"),children:"★"},e))}),(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700",children:ei.toFixed(1)}),eo&&(0,r.jsxs)("span",{className:"text-sm text-gray-500",children:["(",eo.toLocaleStr
1ing()," reviews)"]})]}),d.brand&&(0,r.jsx)("p",{className:"hidden md:block text-sm text-brand hover:underline cursor-default mb-3",children:d.brand}),eh&&!ec()&&d.price>0&&(0,r.jsxs)("div",{className:"hidden md:flex flex-wrap items-baseline gap-2 mb-4",children:[(0,r.jsx)("span",{className:"text-2xl font-bold text-gray-900",children:ed(d.price)}),em&&(0,r.jsx)("span",{className:"text-base text-gray-500 line-through",children:ed(d.original_price)}),eu&&(0,r.jsxs)("span",{className:"text-sm font-semibold text-red-600",children:[Math.floor(Number(d.sale_discount)),"% off"]})]}),ex&&(0,r.jsx)("div",{className:"hidden md:block mb-4",children:(0,r.jsx)(h.Y,{price:d.price,originalPrice:d.original_price||void 0,lastSync:(null===(a=d.metadata)||void 0===a?void 0:a.last_sync)||new Date().toISOString(),currencyCode:el})}),(0,r.jsx)("div",{className:"hidden md:block border-t border-gray-200 mb-5"}),(0,r.jsxs)("div",{className:"mb-5",children:[d.slug&&(0,r.jsx)(D.f,{productSlug:d.slug,currency:el,surface:"quick_view",listedOffers:ey,listedOffersReady:Y&&!W}),(0,r.jsx)("h3",{className:"text-xs md:text-sm font-semibold text-gray-900 uppercase tracking-wider mb-2 md:mb-3",children:"Buying Options"}),(0,r.jsxs)("div",{className:"rounded-xl border border-gray-200 overflow-hidden divide-y divide-gray-100",children:[W&&0===ey.length&&(0,r.jsxs)("div",{className:"flex items-center justify-center py-8 text-gray-400",children:[(0,r.jsx)(y.A,{className:"w-4 h-4 animate-spin mr-2"}),(0,r.jsx)("span",{className:"text-sm",children:"Finding best prices..."})]}),ew.map(e=>{let t=null!==ej&&e.price===ej&&e.price>0;return(0,r.jsxs)("button",{type:"button",onClick:()=>e_(e),className:(0,x.cn)(E,"w-full flex items-center gap-3 px-4 py-3.5 text-left transition-colors group",t?"bg-green-50/70 hover:bg-green-50 border-l-[3px] border-l-green-500":"hover:bg-gray-50 border-l-[3px] border-l-transparent"),children:[(0,r.jsx)(k.MerchantLogo,{imageUrl:(0,q.K6)(e.logo,e.merchantName),name:e.merchantName,size:"sm",border:!0,className:"flex-shrink-0"}),(0,r.jsx)("span",{className:"flex-1 text-sm font-medium text-gray-800",children:e.merchantName}),t&&(0,r.jsx)("span",{className:"text-[10px] font-bold text-green-700 bg-green-100 px-2 py-0.5 rounded-full uppercase tracking-wide flex-shrink-0",children:"Best Price"}),(0,r.jsx)("span",{className:"text-base font-bold text-gray-900 flex-shrink-0",children:e.price>0?ed(e.price,e.currency):"See Price"}),(0,r.jsx)(n.A,{className:"w-3.5 h-3.5 text-gray-300 group-hover:text-gray-500 flex-shrink-0 transition-colors"})]},e.id)}),!Z&&ev>0&&(0,r.jsxs)("button",{type:"button",onClick:()=>ee(!0),className:(0,x.cn)(E,"w-full px-4 py-3 text-sm font-medium text-brand hover:bg-gray-50 text-center border-t border-gray-100"),children:["Show more (",ev," more ",1===ev?"store":"stores",")"]}),!W&&0===ey.length&&(ef?(0,r.jsxs)("button",{type:"button",onClick:()=>e_({id:"fallback-".concat(d.id),merchantName:en||"Buy Now",merchantId:0,price:d.price||0,currency:el,url:(0,S.LA)(ef),wrappedUrl:(0,q.sp)(ef,d.id,en||void 0,d.affiliate_url||void 0),availability:"InStock",provider:"primary"}),className:(0,x.cn)(E,"w-full flex items-center gap-3 px-4 py-3.5 text-left transition-colors group hover:bg-gray-50"),children:[(0,r.jsx)(k.MerchantLogo,{imageUrl:(0,q.K6)(void 0,en||"Buy Now"),name:en||"Buy Now",size:"sm",border:!0,className:"flex-shrink-0"}),(0,r.jsx)("span",{className:"flex-1 text-sm font-medium text-gray-800",children:en||"Buy Now"}),(0,r.jsx)("span",{className:"text-base font-bold text-gray-900 flex-shrink-0",children:d.price>0?ed(d.price):"See Price"}),(0,r.jsx)(n.A,{className:"w-3.5 h-3.5 text-gray-300 group-hover:text-gray-500 flex-shrink-0 transition-colors"})]}):(0,r.jsxs)("button",{type:"button",onClick:eS,disabled:V,className:(0,x.cn)(E,"w-full flex items-center gap-3 px-4 py-3.5 text-left transition-colors group hover:bg-gray-50 disabled:opacity-60"),children:[(0,r.jsx)(k.MerchantLogo,{imageUrl:(0,q.K6)(void 0,en||"Buy Now"),name:en||"Buy Now",size:"sm",border:!0,className:"flex-shrink-0"}),(0,r.jsx)("span",{className:"flex-1 text-sm font-medium text-gray-800",children:en||"Buy Now"}),(0,r.jsx)("span",{className:"text-base font-bold text-gray-900 flex-shrink-0",children:d.price>0?ed(d.price):"See Price"}),V?(0,r.jsx)(y.A,{className:"w-3.5 h-3.5 text-gray-400 animate-spin flex-shrink-0"}):(0,r.jsx)(v.A,{className:"w-3.5 h-3.5 text-gray-300 group-hover:text-gray-500 flex-shrink-0 transition-colors"})]}))]})]}),z&&(0,r.jsx)("div",{className:"pt-3 border-t border-gray-100",children:(0,r.jsx)(O,{context:z,variant:"modal",defaultMerchant:en||void 0})}),(0,r.jsx)("div",{className:"hidden md:block flex-1 min-h-4"}),(0,r.jsxs)("div",{className:"hidden md:flex flex-col gap-2.5 pt-2",children:[!z&&(0,r.jsxs)(f.$,{onClick:eI,className:(0,x.cn)("w-full font-semibold h-12 text-base rounded-xl",M?"border border-gray-300 hover:border-gray-400 bg-white text-gray-700 hover:bg-gray-50":"bg-brand hover:bg-brand-hover text-white"),children:[(0,r.jsx)(w.A,{className:"w-4 h-4 mr-2"}),"Wishlist This"]}),(0,r.jsx)(f.$,{variant:"outline",onClick:eS,disabled:V,className:"w-full font-semibold h-12 text-base rounded-xl border-gray-300 hover:border-gray-400",children:V?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y.A,{className:"w-4 h-4 mr-2 animate-spin"})," Loading..."]}):(0,r.jsxs)(r.Fragment,{children:["More Details ",(0,r.jsx)(v.A,{className:"w-4 h-4 ml-2"})]})})]})]})]}),(0,r.jsxs)("div",{className:"md:hidden border-t border-gray-200 bg-white px-3 py-2.5 flex items-center gap-2 flex-shrink-0",children:[(0,r.jsx)("button",{ref:e=>{(null==e?void 0:e.offsetParent)&&(et.current=e)},type:"button",onClick:()=>G(!H),className:(0,x.cn)("h-11 w-11 shrink-0 rounded-xl border flex items-center justify-center transition-colors",H?"border-brand text-brand bg-brand/5":"border-gray-200 text-gray-500"),"aria-label":"Share",children:(0,r.jsx)(N.A,{className:"w-4 h-4"})}),z&&eN&&(0,r.jsx)(f.$,{onClick:()=>e_(eN),className:"flex-1 min-w-0 font-semibold h-11 rounded-xl bg-brand hover:bg-brand-hover text-white",children:(0,r.jsxs)("span",{className:"truncate",children:["Buy Now",eN.price>0?" \xb7 ".concat(ed(eN.price,eN.currency)):""]})}),!z&&(0,r.jsxs)(f.$,{onClick:eI,className:(0,x.cn)("flex-1 font-semibold h-11 rounded-xl",M?"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50":"bg-brand hover:bg-brand-hover text-white"),children:[(0,r.jsx)(w.A,{className:"w-4 h-4 mr-1.5"}),"Wishlist This"]}),(0,r.jsx)(f.$,{variant:"outline",onClick:eS,disabled:V,className:"shrink-0 font-semibold h-11 px-3 rounded-xl border-gray-300",children:V?(0,r.jsx)(y.A,{className:"w-4 h-4 animate-spin"}):"Details"})]}),(0,r.jsx)("div",{className:"hidden md:flex items-center justify-start border-t border-gray-100 bg-white px-4 py-2.5 flex-shrink-0",children:(0,r.jsxs)("button",{ref:e=>{(null==e?void 0:e.offsetParent)&&(et.current=e)},type:"button",onClick:()=>G(!H),className:(0,x.cn)("flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium border transition-colors",H?"border-brand text-brand bg-brand/5":"border-gray-200 text-gray-500 hover:text-gray-800 hover:border-gray-300"),children:[(0,r.jsx)(N.A,{className:"w-3.5 h-3.5"}),"Share"]})})]}),H&&"undefined"!=typeof document&&(0,_.createPortal)((0,r.jsx)("div",{className:"fixed inset-0 z-[11002]",onClick:()=>G(!1),children:(0,r.jsx)(R,{ref:ea,anchorRef:et,title:d.title,imageUrl:es[0],url:ek,onClose:()=>G(!1)})}),document.body)]})}let R=(0,i.forwardRef)(function(e,t){let{anchorRef:a,title:s,imageUrl:l,url:n,onClose:o}=e,[c,d]=(0,i.useState)(null);return((0,i.useEffect)(()=>
1{if(!a.current)return;let e=a.current.getBoundingClientRect();d({top:e.top-8,left:Math.max(8,e.left)});let t=()=>{if(!a.current)return;let e=a.current.getBoundingClientRect();d({top:e.top-8,left:Math.max(8,Math.min(e.left,window.innerWidth-280-8))})};return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[a]),c)?(0,r.jsx)("div",{ref:t,onClick:e=>e.stopPropagation(),className:"fixed animate-in fade-in slide-in-from-bottom-2 duration-200 z-[11003]",style:{bottom:"".concat(window.innerHeight-c.top,"px"),left:"".concat(c.left,"px")},children:(0,r.jsxs)("div",{className:"bg-white rounded-xl shadow-xl border border-gray-200 p-4 w-[280px]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-gray-800",children:"Share this product"}),(0,r.jsx)("button",{onClick:o,className:"w-6 h-6 flex items-center justify-center rounded-full hover:bg-gray-100 text-gray-400 hover:text-gray-600 transition-colors",children:(0,r.jsx)(j.A,{className:"w-3.5 h-3.5"})})]}),(0,r.jsx)(C.R,{title:s,imageUrl:l,url:n,showQRCode:!1})]})}):null});var $=a(14934);function W(e,t,a,r,s,l,n){let i=n.affiliateUrl;return{id:e,title:t,slug:a||"",created_at:r||new Date().toISOString(),updated_at:s||new Date().toISOString(),price:n.price,affiliate_url:i,direct_url:i?(0,S.LA)(i):void 0,metadata:{...l,merchant_name:n.merchantName}}}function K(e){var t,a,p;let{id:f,title:g,description:b,price:y,original_price:v,currency_code:w="USD",image_urls:N,rating:j,category:_,affiliate_url:k,direct_url:C,integration_type:S,external_id:I,brand:A,merchant:P,status:L="published",on_sale:M,sale_discount:z,review_count:T,slug:U,merchant_id:F,metadata:B,created_at:D,last_sync:E,last_price_check:R,collection_id:K,collection_title:Y,isSelected:J,onSelect:H,className:G,customLink:V,detailPagePath:X,showBottomActions:Z,disableWishlistChecks:ee=!1,hideAddToWishlist:et=!1,wishlistContext:ea,productLink:er,onViewDeal:es,buyingOptions:el,searchContext:en,openLinksInNewTab:ei=!1,multiStoreSummaryOnly:eo=!1,onCardClick:ec}=e,[ed,em]=(0,i.useState)(0),[eu,eh]=(0,i.useState)(!1),{user:ex}=(0,d.A)(),ep=(0,i.useRef)(null),ef=(null==N?void 0:N.filter(Boolean))||[],eg=A||(null==B?void 0:B.brand)||void 0,eb=null!=j&&Number(j)>0?Number(j):null,ey=null!=T&&Number(T)>0?Number(T):null,ev=(0,o.MJ)({affiliate_url:k,direct_url:C,metadata:B,integration_type:S,merchant_id:F,brand:A}),ew=(0,i.useMemo)(()=>(function(e,t,a,r){let s=[];for(let l of(s.push({merchantName:e||"Visit Store",price:t,affiliateUrl:a}),r||[]))s.push({merchantName:l.merchantName,price:l.price,affiliateUrl:l.affiliateUrl});let l=new Map;for(let e of s){let t=(0,q.NJ)(e.merchantName);if(!t)continue;let a=l.get(t);(!a||e.price<a.price)&&l.set(t,{...e,merchantName:(0,q.Eg)(e.merchantName)})}return Array.from(l.values()).sort((e,t)=>e.price-t.price)})(ev||"",y,k||C||"",null==el?void 0:el.alternatives),[ev,y,k,C,null==el?void 0:el.alternatives]),eN=el&&el.totalOffers>1||ew.length>1,ej=ew.length>1,e_=Math.max(ew.length,null!==(t=null==el?void 0:el.totalOffers)&&void 0!==t?t:0)||1,ek=ew.length>0?Math.min(...ew.map(e=>e.price)):null!==(a=null==el?void 0:el.lowestPrice)&&void 0!==a?a:y,eC=(0,i.useCallback)(e=>{(null==en?void 0:en.query)&&fetch("/api/search/track-click",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({searchQuery:en.query,searchQueryId:en.queryId,productId:f,position:en.position,sessionId:(null==ex?void 0:ex.id)||"anonymous",userId:null==ex?void 0:ex.id,clickType:e})}).catch(()=>{})},[en,f,null==ex?void 0:ex.id]);(0,i.useEffect)(()=>{em(0)},[f]);let eS=w||"USD",eI=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:eS}).format(e),eA="number"==typeof y&&y>0,eP=(null!==(p=null==el?void 0:el.lowestPrice)&&void 0!==p?p:0)>0||((null==el?void 0:el.alternatives)||[]).some(e=>e.price>0),eL={id:f,title:g,description:b,price:y,original_price:v,currency_code:w,image_urls:N||ef,rating:j,review_count:T,brand:A,merchant:P,merchant_id:F,affiliate_url:k,direct_url:C,slug:U,on_sale:M,sale_discount:z,integration_type:S,external_id:I,metadata:B,category:_,detailPagePath:X};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{onClick:e=>{if(!(e.target.closest("[data-wishlist-trigger]")||e.target.closest("[data-select-trigger]"))){if(e.preventDefault(),e.stopPropagation(),ec){ec(eL);return}eh(!0)}},className:(0,x.cn)("group relative bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden transition-all duration-200 hover:shadow-md hover:border-gray-300 flex flex-col cursor-pointer touch-manipulation",J&&"ring-2 ring-brand",G),children:[H&&(0,r.jsx)("button",{"data-select-trigger":!0,onClick:e=>{e.stopPropagation(),H(f)},className:"absolute top-2 left-2 z-20 p-1 rounded-md bg-white shadow-sm hover:bg-gray-50 min-h-[44px] min-w-[44px] touch-manipulation",children:J?(0,r.jsx)(s.A,{className:"h-5 w-5 text-brand"}):(0,r.jsx)(l.A,{className:"h-5 w-5 text-gray-400"})}),!et&&(0,r.jsx)("div",{className:"absolute top-2 right-2 z-10","data-wishlist-trigger":!0,children:(0,r.jsx)(c.A,{ref:ep,productId:f,compact:!0,hideCount:ee||!!ea,title:g,description:b,price:y,original_price:v,currency_code:w,image_urls:ef,rating:eb,category:_,affiliate_url:k,integration_type:S,external_id:I,brand:eg,on_sale:M,sale_discount:z,review_count:ey,slug:U,merchant_id:F,merchant:P,direct_url:C,metadata:B,onAdded:()=>eC("wishlist_add")})}),(0,r.jsxs)("div",{className:"relative aspect-square overflow-hidden bg-white p-4",children:[ea&&(()=>{let e=ea.requestedQuantity||1,t=ea.claimedQuantity||0;return t>=e?(0,r.jsx)("div",{className:"absolute bottom-0 left-0 right-0 bg-green-600 text-white text-xs font-bold py-2 text-center pointer-events-none z-40 shadow-lg",children:"CLAIMED"}):t>0?(0,r.jsx)("div",{className:"absolute bottom-0 left-0 right-0 bg-orange-500 text-white text-xs font-bold py-2 text-center pointer-events-none z-40 shadow-lg",children:"PARTIALLY CLAIMED"}):null})(),ef.length>0?(0,r.jsx)(m.SafeImage,{src:ef[ed],alt:g,fill:!0,className:"object-contain transition-transform duration-300 group-hover:scale-105",sizes:"(max-width: 768px) 50vw, (max-width: 1200px) 33vw, 25vw"}):(0,r.jsx)(u.z,{title:g}),ef.length>1&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),em(e=>0===e?ef.length-1:e-1)},className:"absolute left-1 top-1/2 -translate-y-1/2 w-8 h-8 rounded-full bg-white shadow-md flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity touch-manipulation","aria-label":"Previous image",children:(0,r.jsx)("svg",{className:"w-4 h-4 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),em(e=>e===ef.length-1?0:e+1)},className:"absolute right-1 top-1/2 -translate-y-1/2 w-8 h-8 rounded-full bg-white shadow-md flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity touch-manipulation","aria-label":"Next image",children:(0,r.jsx)("svg",{className:"w-4 h-4 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]}),M&&z&&(0,r.jsxs)("div",{className:"absolute top-2 left-2 bg-red-500 text-white text-xs font-bold px-2 py-1 rounded-full",children:[Math.floor(z),"% OFF"]})]}),(0,r.jsxs)("div",{className:"p-4 flex-1 flex flex-col",children:[(0,r.jsx)("div",{className:"mb-1.5",children:eA||eP?(()=>{let e=(null==B?void 0:B.source_integration)||"",t="80239aea-1182-4daa-947a-2a09d880ffab"===F,a=(null==B?void 0:B.merchant_name)||"";return"pa_api"===e||"rainforest"===e||t&&(!a||a.toLowerCase().includes("amazon"))}
1)()?(0,r.jsx)(h.Y,{price:y,originalPrice:v||void 0,lastSync:E||R||(null==B?void 0:B.last_sync)||D,currencyCode:w,className:"text-sm",compact:!0}):(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-lg font-bold text-gray-900",children:eI(y)}),v&&v>y&&(0,r.jsx)("span",{className:"text-sm text-gray-500 line-through",children:eI(v)})]}):(0,r.jsx)("span",{className:"text-sm font-semibold text-brand",children:"Click for price"})}),(0,r.jsxs)("h3",{className:"font-medium text-gray-900 text-sm line-clamp-2 mb-2 leading-snug",children:[(0,o.kj)({title:g,metadata:B,brand:A}),U&&(0,r.jsx)("a",{href:X||"/product/".concat(U),tabIndex:-1,"aria-hidden":!0,className:"sr-only pointer-events-none",children:g})]}),(null==ea?void 0:ea.claimPermissions)&&"disabled"!==ea.claimPermissions&&(ea.requestedQuantity||1)>=1&&(0,r.jsx)("div",{className:"mb-1.5",children:(0,r.jsx)("div",{className:"text-xs text-brand font-medium",children:(()=>{let e=ea.requestedQuantity||1,t=ea.claimedQuantity||0;return t>=e?"Qty: ".concat(e," (All claimed)"):t>0?"Qty: ".concat(e-t," more of ").concat(e):"Qty requested: ".concat(e)})()})}),(null==ea?void 0:ea.claimPermissions)&&"disabled"!==ea.claimPermissions&&(0,r.jsx)("div",{className:"mb-1.5",onClick:e=>e.stopPropagation(),children:(0,r.jsx)(O,{context:{wishlistItemId:ea.wishlistItemId,wishlistId:ea.wishlistId,wishlistSlug:ea.wishlistSlug,isTaken:ea.isTaken,requestedQuantity:ea.requestedQuantity,claimedQuantity:ea.claimedQuantity,isWishlistOwner:ea.isWishlistOwner,showClaimerNames:ea.showClaimerNames,claimerName:ea.claimerName,claimPermissions:ea.claimPermissions,onClaimChange:ea.onClaimChange},variant:"card",defaultMerchant:ev||void 0})}),eN&&(0,r.jsxs)("div",{className:"mb-1.5 inline-flex flex-wrap items-center gap-1 text-xs font-medium text-brand",children:[(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"})}),"Available at ",e_," stores",ek<y&&(0,r.jsxs)("span",{className:"text-green-600",children:["• From ",eI(ek)]})]}),(0,r.jsxs)("div",{className:"mt-auto flex items-start justify-between gap-2 pt-1",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-0.5 min-w-0 flex-1",children:[ej&&eo?null:ej?(0,r.jsxs)(r.Fragment,{children:[ew.slice(0,4).map((e,t)=>(0,r.jsx)("span",{onClick:e=>e.stopPropagation(),className:"flex items-center min-w-0",children:e.affiliateUrl?(0,r.jsxs)($.r,{href:e.affiliateUrl,product:W(f,g,U,D,E,B,e),searchContext:en,wishlistId:null==ea?void 0:ea.wishlistId,forceNewTab:ei,className:"text-xs text-gray-500 flex items-center min-w-0 hover:text-brand",showIcon:!0,children:[(0,r.jsx)("span",{className:"truncate",children:e.merchantName}),(0,r.jsx)("span",{className:"text-gray-400 ml-1 flex-shrink-0 tabular-nums",children:eI(e.price)})]}):(0,r.jsxs)("span",{className:"text-xs text-gray-500 flex items-center truncate",children:[(0,r.jsx)(n.A,{className:"w-3 h-3 mr-1 flex-shrink-0"}),e.merchantName,(0,r.jsx)("span",{className:"text-gray-400 ml-1",children:eI(e.price)})]})},"".concat(e.merchantName,"-").concat(t))),ew.length>4&&(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),eh(!0)},className:"text-xs font-medium text-brand text-left pt-0.5",children:"Show more"})]}):ev&&(k||C?(0,r.jsx)("span",{onClick:e=>e.stopPropagation(),className:"flex items-center min-w-0",children:(0,r.jsx)($.r,{href:k||C,product:W(f,g,U,D,E,B,{merchantName:ev,price:y,affiliateUrl:k||C}),searchContext:en,wishlistId:null==ea?void 0:ea.wishlistId,forceNewTab:ei,className:"text-xs text-gray-500 flex items-center min-w-0 hover:text-brand",showIcon:!0,children:(0,r.jsx)("span",{className:"truncate",children:ev})})}):(0,r.jsxs)("span",{className:"text-xs text-gray-500 flex items-center truncate",children:[(0,r.jsx)(n.A,{className:"w-3 h-3 mr-1 flex-shrink-0"}),(0,r.jsx)("span",{className:"truncate",children:ev})]})),es&&(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),es()},className:(0,x.cn)(ea?"mt-2 w-full h-8 rounded-lg bg-brand hover:bg-brand-hover text-white text-xs font-semibold":"mt-1.5 text-xs font-semibold text-brand hover:text-brand-hover text-left"),children:ea?"Buy Now":"View Deal"})]}),(0,r.jsx)("div",{className:"flex items-center gap-1 flex-shrink-0",children:eb&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-yellow-400 text-sm",children:"★"}),(0,r.jsx)("span",{className:"text-sm text-gray-600",children:eb.toFixed(1)}),ey&&(0,r.jsxs)("span",{className:"text-xs text-gray-500 whitespace-nowrap",children:["(",ey,")"]})]})})]})]})]}),!ec&&(0,r.jsx)(Q,{isOpen:eu,onClose:()=>eh(!1),product:eL,onWishlist:()=>{var e;null===(e=ep.current)||void 0===e||e.openModal()},searchContext:en,initialAlternatives:null==el?void 0:el.alternatives,openLinksInNewTab:ei,emphasizeBuyingOptions:!!ea,wishlistContext:ea?{wishlistItemId:ea.wishlistItemId,wishlistId:ea.wishlistId,wishlistSlug:ea.wishlistSlug,isTaken:ea.isTaken,requestedQuantity:ea.requestedQuantity,claimedQuantity:ea.claimedQuantity,isWishlistOwner:ea.isWishlistOwner,showClaimerNames:ea.showClaimerNames,claimerName:ea.claimerName,claimPermissions:ea.claimPermissions,onClaimChange:ea.onClaimChange}:void 0})]})}},62945:(e,t,a)=>{a.d(t,{f:()=>L});var r=a(95155),s=a(12115),l=a(58527),n=a(61840),i=a(42628),o=a(93504),c=a(96025),d=a(16238),m=a(27086),u=a(64683),h=a(70919),x=a(13279),p=a(86438),f=a(80659),g=a(77070),b=a(36848);function y(e){return new Date(e.includes("T")?e:"".concat(e,"T12:00:00Z")).toLocaleDateString("en-US",{month:"short",day:"numeric"})}function v(e){return e?new Date(e.includes("T")?e:"".concat(e,"T12:00:00Z")).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):""}function w(e){return"$".concat(Math.round(e))}function N(e){let{active:t,payload:a,currency:s,merchantLabel:l}=e;if(!t||!(null==a?void 0:a.length))return null;let n=a[0].payload;return n?(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg shadow-md p-3 text-sm",children:[(0,r.jsx)("p",{className:"text-gray-500 mb-1.5",children:v(n.dateRaw||"")}),null!=n.this_merchant&&(0,r.jsxs)("p",{className:"font-semibold text-gray-900",children:[l,": ",(0,b.$g)(n.this_merchant,s)]}),null!=n.other_merchants&&(0,r.jsxs)("p",{className:"text-gray-600",children:["Other merchants: ",(0,b.$g)(n.other_merchants,s)]})]}):null}function j(e){let{active:t,payload:a,currency:s}=e;if(!t||!(null==a?void 0:a.length))return null;let l=a[0].payload;return l&&null!=l.price?(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg shadow-md p-3",children:[(0,r.jsx)("p",{className:"text-sm text-gray-500",children:v(l.recorded_at||"")}),(0,r.jsx)("p",{className:"text-lg font-semibold text-gray-900",children:(0,b.$g)(l.price,s)})]}):null}function _(e){let{priceChange:t,daysTracked:a}=e;if(!(a>0))return null;let s=t>0,l=0===t;return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs font-medium ".concat(l?"text-gray-500":s?"text-red-600":"text-emerald-600"),children:[l?(0,r.jsx)(p.A,{className:"w-3.5 h-3.5"}):s?(0,r.jsx)(f.A,{className:"w-3.5 h-3.5"}):(0,r.jsx)(g.A,{className:"w-3.5 h-3.5"}),(0,r.jsxs)("span",{children:[s?"+":"",t,"% \xb7 ",a,"d"]})]})}function k(e){var t,a,s;
1let{data:l,currency:n="USD",tip:p,className:f="",chartHeightClass:g="h-56 sm:h-72"}=e;if(!l.hasData)return null;let k="affiliate_com"===l.source,C=k&&l.dual_series?l.dual_series.map(e=>({date:y(e.date),dateRaw:e.date,this_merchant:e.this_merchant,other_merchants:e.other_merchants})):[],S=l.history.map(e=>({...e,date:y(e.recorded_at)})),I=k&&C.length>=2,A=!!(null===(t=l.dual_series)||void 0===t?void 0:t.some(e=>null!=e.other_merchants))&&(null!==(s=null===(a=l.other_merchants)||void 0===a?void 0:a.merchantCount)&&void 0!==s?s:0)>0,P=I?C:S,L=l.stats,M=l.merchant_name?"At ".concat(l.merchant_name):"At this merchant",z=I?C.flatMap(e=>[e.this_merchant,e.other_merchants].filter(e=>null!=e)):S.map(e=>e.price),T=z.length?Math.min(...z):0,U=z.length?Math.max(...z):0,F=Math.max((U-T)*.08,2);return(0,r.jsxs)("div",{className:f,children:[p&&(0,r.jsx)("p",{className:"text-sm text-gray-600 leading-relaxed mb-5",children:p}),L&&(0,r.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-5",children:[(0,r.jsxs)("div",{className:"rounded-xl bg-gray-50 px-3 py-3",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Current"}),(0,r.jsx)("p",{className:"mt-1 text-xl font-semibold tabular-nums text-gray-900",children:(0,b.$g)(L.current,n)}),(0,r.jsx)("div",{className:"mt-1",children:(0,r.jsx)(_,{priceChange:L.priceChange,daysTracked:L.daysTracked})})]}),(0,r.jsxs)("div",{className:"rounded-xl bg-gray-50 px-3 py-3",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Lowest"}),(0,r.jsx)("p",{className:"mt-1 text-xl font-semibold tabular-nums text-emerald-700",children:(0,b.$g)(L.lowest,n)}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-400",children:v(L.lowestDate)})]}),(0,r.jsxs)("div",{className:"rounded-xl bg-gray-50 px-3 py-3",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Highest"}),(0,r.jsx)("p",{className:"mt-1 text-xl font-semibold tabular-nums text-orange-700",children:(0,b.$g)(L.highest,n)}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-400",children:v(L.highestDate)})]}),(0,r.jsxs)("div",{className:"rounded-xl bg-gray-50 px-3 py-3",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Average"}),(0,r.jsx)("p",{className:"mt-1 text-xl font-semibold tabular-nums text-gray-800",children:(0,b.$g)(L.average,n)}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-400",children:"In this window"})]})]}),(0,r.jsx)("div",{className:"rounded-xl border border-gray-100 bg-white px-1 pt-2 pb-1 ".concat(g),children:(0,r.jsx)(i.u,{width:"100%",height:"100%",children:(0,r.jsxs)(o.b,{data:P,margin:{top:8,right:12,bottom:4,left:0},children:[(0,r.jsx)(c.W,{dataKey:"date",tick:{fontSize:11,fill:"#9ca3af"},tickLine:!1,axisLine:!1,interval:"preserveStartEnd"}),(0,r.jsx)(d.h,{domain:[Math.floor(T-F),Math.ceil(U+F)],tick:{fontSize:11,fill:"#9ca3af"},tickFormatter:w,tickLine:!1,axisLine:!1,width:40,allowDecimals:!1}),I?(0,r.jsx)(m.m,{content:(0,r.jsx)(N,{currency:n,merchantLabel:M})}):(0,r.jsx)(m.m,{content:(0,r.jsx)(j,{currency:n})}),I&&A&&(0,r.jsx)(u.s,{verticalAlign:"top",height:28,iconType:"plainline",wrapperStyle:{fontSize:12}}),L&&(0,r.jsx)(h.e_,{y:L.lowest,stroke:"#059669",strokeDasharray:"4 4",strokeOpacity:.35}),I&&A?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(x.N1,{type:"monotone",dataKey:"this_merchant",name:M,stroke:"#ea580c",strokeWidth:2.25,dot:!1,connectNulls:!1,activeDot:{r:5,fill:"#ea580c"}}),(0,r.jsx)(x.N1,{type:"monotone",dataKey:"other_merchants",name:"At other merchants",stroke:"#9ca3af",strokeWidth:2,strokeDasharray:"5 4",dot:!1,connectNulls:!1,activeDot:{r:4,fill:"#9ca3af"}})]}):I?(0,r.jsx)(x.N1,{type:"monotone",dataKey:"this_merchant",name:M,stroke:"#ea580c",strokeWidth:2.25,dot:!1,connectNulls:!1,activeDot:{r:5,fill:"#ea580c"}}):(0,r.jsx)(x.N1,{type:"monotone",dataKey:"price",stroke:"#ea580c",strokeWidth:2.25,dot:!1,activeDot:{r:5,fill:"#ea580c"}})]})})}),k&&(0,r.jsxs)("p",{className:"mt-3 text-center text-[11px] text-gray-400",children:["Daily prices via Affiliate.com",A&&l.other_merchants?" \xb7 other merchants = daily low across ".concat(l.other_merchants.merchantCount," stores"):""]})]})}var C=a(14934),S=a(54165),I=a(30440),A=a(25601);function P(e,t){let a=t?(0,A.NJ)(t):"";if(!a)return null;let r=e.filter(e=>e.price>0),s=r.find(e=>(0,A.NJ)(e.merchantName)===a);if(!s)return null;let l=Math.min(...r.map(e=>e.price));return s.price<=1.01*l?s.price:null}function L(e){var t,a;let{productSlug:i,currency:o="USD",surface:c="pdp",listedOffers:d,listedOffersReady:m=!0}
1=e,[u,h]=(0,s.useState)(!1),[x,p]=(0,s.useState)(!1),[f,g]=(0,s.useState)(null),y=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(!i)return;let e=!1;return g(null),p(!1),y.current=null,(async()=>{try{let t=await fetch("/api/products/".concat(i,"/price-history?days=90"));if(!t.ok)return;let a=await t.json();e||g(a)}catch(e){}})(),()=>{e=!0}},[i]);let v=null==f?void 0:f.buy_timing,w=(null==v?void 0:v.sentiment)==="elsewhere"?v.elsewhereMerchantName:null==f?void 0:f.merchant_name,N=!!(null==v?void 0:v.show)&&!!v.label&&!!v.sentiment&&m&&null!=P(d,w),j=!!(null==f?void 0:f.hasData)&&(null!==(a=null===(t=f.history)||void 0===t?void 0:t.length)&&void 0!==a?a:0)>=2,_=!N&&j,A=N||_;(0,s.useEffect)(()=>{var e,t,a,r,s,l,n,o,d,m;if(!A||!f)return;let u=N?(null==v?void 0:v.sentiment)||"banner":"quiet_link",h="".concat(i,":").concat(c,":").concat(u);y.current!==h&&(y.current=h,(0,I.c)(I.l.BUY_TIMING_SHOWN,{product_slug:i,surface:c,variant:u,sentiment:null!==(r=null==v?void 0:v.sentiment)&&void 0!==r?r:null,label:null!==(s=null==v?void 0:v.label)&&void 0!==s?s:null,source:null!==(l=f.source)&&void 0!==l?l:null,merchant_name:null!==(n=f.merchant_name)&&void 0!==n?n:null,days_tracked:null!==(o=null===(e=f.stats)||void 0===e?void 0:e.daysTracked)&&void 0!==o?o:null,best_buy_merchant:null!==(d=null===(t=f.best_buy)||void 0===t?void 0:t.merchantName)&&void 0!==d?d:null,best_buy_price:null!==(m=null===(a=f.best_buy)||void 0===a?void 0:a.price)&&void 0!==m?m:null}))},[A,f,N,null==v?void 0:v.sentiment,null==v?void 0:v.label,i,c]),(0,s.useEffect)(()=>{if(!N){p(!1);return}let e=requestAnimationFrame(()=>p(!0));return()=>cancelAnimationFrame(e)},[N,i,null==v?void 0:v.sentiment]);let L=()=>{var e,t,a,r,s,l,n,o,d,m;return{product_slug:i,surface:c,variant:N?(null==v?void 0:v.sentiment)||"banner":"quiet_link",sentiment:null!==(r=null==v?void 0:v.sentiment)&&void 0!==r?r:null,label:null!==(s=null==v?void 0:v.label)&&void 0!==s?s:null,source:null!==(l=null==f?void 0:f.source)&&void 0!==l?l:null,merchant_name:null!==(n=null==f?void 0:f.merchant_name)&&void 0!==n?n:null,days_tracked:null!==(o=null==f?void 0:null===(e=f.stats)||void 0===e?void 0:e.daysTracked)&&void 0!==o?o:null,best_buy_merchant:null!==(d=null==f?void 0:null===(t=f.best_buy)||void 0===t?void 0:t.merchantName)&&void 0!==d?d:null,best_buy_price:null!==(m=null==f?void 0:null===(a=f.best_buy)||void 0===a?void 0:a.price)&&void 0!==m?m:null}},M=e=>{e&&!u?(0,I.c)(I.l.BUY_TIMING_OPENED,L()):!e&&u&&(0,I.c)(I.l.BUY_TIMING_CLOSED,L()),h(e)},z=()=>M(!0);if(!A||!f)return null;let T=(null==v?void 0:v.sentiment)==="great"||(null==v?void 0:v.sentiment)==="elsewhere",U=f.best_buy&&null!=P(d,f.best_buy.merchantName)?f.best_buy:null,F=N&&v?v.label:"Price History",B=d.filter(e=>e.price>0).length,O=N&&v?B>1?"".concat(v.tip," It's also the cheapest of the ").concat(B," stores listed."):v.tip:null,q=!!U&&(U.isThisMerchant||!!f.merchant_name&&U.merchantName.trim().toLowerCase()===f.merchant_name.trim().toLowerCase());return(0,r.jsxs)(r.Fragment,{children:[N&&v?(0,r.jsx)("div",{className:"mb-2 transition-all duration-500 ease-out ".concat(x?"translate-y-0 opacity-100":"translate-y-3 opacity-0"),children:(0,r.jsxs)("button",{type:"button",onClick:z,className:"group w-full flex items-center justify-between gap-3 rounded-lg px-3.5 py-2.5 text-sm font-semibold touch-manipulation shadow-sm ".concat("bg-emerald-800 text-white hover:bg-emerald-900"),"aria-haspopup":"dialog","aria-expanded":u,children:[(0,r.jsx)("span",{className:"text-left",children:v.label}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-2 shrink-0 opacity-90 group-hover:opacity-100",title:"View price history",children:[(0,r.jsx)(l.A,{className:"h-4 w-4","aria-hidden":!0}),(0,r.jsx)(n.A,{className:"h-3.5 w-3.5 opacity-80","aria-hidden":!0})]})]})}):(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsxs)("button",{type:"button",onClick:z,className:"inline-flex items-center gap-1.5 text-xs text-gray-500 hover:text-gray-800 touch-manipulation","aria-haspopup":"dialog","aria-expanded":u,children:[(0,r.jsx)(l.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Price history",(0,r.jsx)(n.A,{className:"h-3 w-3 opacity-70","aria-hidden":!0})]})}),(0,r.jsx)(S.lG,{open:u,onOpenChange:M,children:(0,r.jsxs)(S.Cf,{overlayClassName:"z-[12000] bg-black/45 backdrop-blur-[2px]",className:"z-[12001] max-w-xl max-h-[92vh] overflow-y-auto p-0 gap-0 border-0 sm:rounded-2xl shadow-2xl ring-1 ring-black/5",children:[(0,r.jsx)(S.L3,{className:"sr-only",children:F}),(0,r.jsxs)("div",{className:"px-5 pt-5 pb-4 sm:px-6 sm:pt-6 border-b border-gray-100 pr-12 ".concat(T?"bg-gradient-to-br from-emerald-50 to-white":"bg-gradient-to-br from-gray-50 to-white"),children:[(0,r.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-gray-500",children:"Price History"}),(0,r.jsx)("h2",{className:"mt-1 text-xl font-bold tracking-tight ".concat(T?"text-emerald-900":"text-stone-900"),children:F})]}),(0,r.jsxs)("div",{className:"px-5 py-5 sm:px-6 sm:pb-6",children:[j?(0,r.jsx)(k,{data:f,currency:o,tip:O,chartHeight
1Class:"h-56 sm:h-72"}):O&&(0,r.jsx)("p",{className:"text-sm text-gray-600 leading-relaxed",children:O}),(null==U?void 0:U.directUrl)&&(0,r.jsxs)("div",{className:"mt-5 pt-4 border-t border-gray-100",children:[(0,r.jsxs)(C.r,{href:U.directUrl,forceNewTab:!0,onClick:()=>{var e,t,a,r,s,l;(0,I.c)(I.l.BUY_TIMING_BUY_CLICKED,{...L(),buy_merchant:null!==(r=null==f?void 0:null===(e=f.best_buy)||void 0===e?void 0:e.merchantName)&&void 0!==r?r:null,buy_price:null!==(s=null==f?void 0:null===(t=f.best_buy)||void 0===t?void 0:t.price)&&void 0!==s?s:null,buy_is_this_merchant:null!==(l=null==f?void 0:null===(a=f.best_buy)||void 0===a?void 0:a.isThisMerchant)&&void 0!==l?l:null})},className:"flex w-full items-center justify-center gap-2 rounded-xl bg-brand px-4 py-3 text-sm font-semibold text-white hover:bg-brand/90 touch-manipulation",children:["Buy at ",U.merchantName,(0,r.jsxs)("span",{className:"tabular-nums opacity-90",children:["\xb7 ",(0,b.$g)(U.price,o)]})]}),!q&&f.merchant_name&&(0,r.jsxs)("p",{className:"mt-2 text-center text-xs text-gray-500",children:["Cheapest we found across merchants (vs ",f.merchant_name,")"]})]})]})]})})]})}},79992:(e,t,a)=>{a.d(t,{Y:()=>n});var r=a(95155),s=a(46102),l=a(50594);function n(e){let{price:t,originalPrice:a,currencyCode:n="USD",className:i="",compact:o=!1}=e,c=new Intl.NumberFormat("en-US",{style:"currency",currency:n}).format(t),d=a?new Intl.NumberFormat("en-US",{style:"currency",currency:n}).format(a):null,m=a&&a>t,u=m?Math.round(100*(a-t)/a):0;return o?(0,r.jsxs)("div",{className:"flex items-center gap-1.5 ".concat(i),children:[(0,r.jsx)("span",{className:"text-sm font-bold text-[#FF9900]",children:c}),m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-xs text-gray-500 line-through",children:d}),(0,r.jsxs)("span",{className:"text-xs font-medium bg-red-100 text-red-800 px-1 py-0.5 rounded",children:["-",u,"%"]})]}),(0,r.jsx)(s.m,{content:(0,r.jsx)("div",{className:"max-w-xs p-2 text-sm",children:(0,r.jsx)("p",{className:"text-xs text-gray-300",children:"Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply to the purchase of this product."})}),preferredPosition:"top",children:(0,r.jsx)(l.A,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})})]}):(0,r.jsxs)("div",{className:"flex items-baseline gap-2 flex-wrap ".concat(i),children:[(0,r.jsx)("span",{className:"text-lg font-bold text-[#FF9900]",children:c}),m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-sm text-gray-500 line-through",children:d}),(0,r.jsxs)("span",{className:"text-xs font-medium bg-red-100 text-red-800 px-1.5 py-0.5 rounded hidden sm:inline",children:[u,"% OFF"]})]}),(0,r.jsx)(s.m,{content:(0,r.jsx)("div",{className:"max-w-xs p-2 text-sm",children:(0,r.jsx)("p",{className:"text-xs text-gray-300",children:"Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply to the purchase of this product."})}),preferredPosition:"top",children:(0,r.jsx)(l.A,{className:"w-4 h-4 text-gray-400"})})]})}}}]);

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.