PageSourceSearch

https://lmk.today/_next/static/chunks/36608-a03a44d76282e98c.js?dpl=dpl_5Dm4hPFR4YLQe5uHK7Gef5SzQbhA

js lmk.today collected 2026-09-24 12:07:21 UTC 33,594 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[36608],{17313:(e,t,a)=>{a.d(t,{Xi:()=>o,av:()=>d,j7:()=>c,tU:()=>n});var r=a(95155),s=a(12115),i=a(60704),l=a(59434);let n=i.bL,c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(i.B8,{ref:t,className:(0,l.cn)("inline-flex h-10 items-center justify-center rounded-md bg-gray-100 p-1 text-gray-600",a),...s})});c.displayName=i.B8.displayName;let o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(i.l9,{ref:t,className:(0,l.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium ring-offset-white transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-white data-[state=active]:text-primary data-[state=active]:shadow-sm",a),...s})});o.displayName=i.l9.displayName;let d=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(i.UC,{ref:t,className:(0,l.cn)("mt-2 ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",a),...s})});d.displayName=i.UC.displayName},26126:(e,t,a)=>{a.d(t,{E:()=>l});var r=a(95155),s=a(12115),i=a(59434);let l=(0,s.forwardRef)((e,t)=>{let{className:a,variant:s="default",...l}=e;return(0,r.jsx)("div",{className:(0,i.cn)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-brand focus:ring-offset-2","default"===s&&"border-transparent bg-primary text-primary-foreground hover:bg-primary/80","secondary"===s&&"border-transparent bg-brand text-brand-foreground hover:bg-brand-hover","destructive"===s&&"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80","outline"===s&&"border-gray-200 text-foreground",a),ref:t,...l})});l.displayName="Badge"},36608:(e,t,a)=>{a.d(t,{m:()=>F});var r=a(95155),s=a(12115),i=a(54165),l=a(30285),n=a(17313),c=a(18046),o=a(86318),d=a(99036),m=a(50172),u=a(11133),h=a(8376),x=a(89829),p=a(19968),g=a(56671),f=a(62523),v=a(85057),y=a(21868);function b(e){let{onDetectionStart:t,onDetectionResult:a,isDetecting:i}=e,[n,c]=(0,s.useState)(""),[d,u]=(0,s.useState)(!1),{session:h}=(0,y.A)(),p=e=>{try{return new URL(e),!0}catch(e){return!1}},g=async e=>{let r=e||n;if(!p(r)){a(null,"Please enter a valid URL");return}if(!(null==h?void 0:h.access_token)){a(null,"Please sign in to detect products");return}t();try{let e={"Content-Type":"application/json",Authorization:"Bearer ".concat(h.access_token)};h.refresh_token&&(e["X-Refresh-Token"]=h.refresh_token);let t=await fetch("/api/detect-product",{method:"POST",headers:e,body:JSON.stringify({url:r,fallback_to_preview:!0,create_product:!1})}),i=await t.json();if(i.success&&i.product_data)a(i.product_data);else{var s;let e=(null===(s=i.suggestion)||void 0===s?void 0:s.message)||i.error||"Could not detect product from this URL";a(null,e)}}catch(e){console.error("Detection error:",e),a(null,"Network error occurred. Please try again.")}},b=async()=>{if(!n)try{let e=await navigator.clipboard.readText();p(e)&&(c(e),u(!0))}catch(e){}};return h?(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),g()},className:"space-y-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(v.J,{htmlFor:"product-url",children:"Product URL"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(o.A,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),(0,r.jsx)(f.p,{id:"product-url",type:"url",placeholder:"https://www.amazon.com/product-name/dp/...",value:n,onChange:e=>{let t=e.target.value;c(t),u(p(t))},onPaste:e=>{let t=e.currentTarget;setTimeout(()=>{let e=t.value;p(e)&&g(e)},100)},onFocus:b,disabled:i,className:"pl-10"})]}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"Supports Amazon, Target, Walmart, Best Buy, and most e-commerce sites"})]}),(0,r.jsx)(l.$,{type:"submit",disabled:!d||i,className:"w-full",children:i?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(m.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Detecting Product..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(x.A,{className:"w-4 h-4 mr-2"}),"Detect Product"]})}),n&&!d&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:"Please enter a valid URL starting with http:// or https://"})]}):(0,r.jsx)("div",{className:"space-y-4 text-center p-4 bg-gray-50 rounded-lg",children:(0,r.jsx)("p",{className:"text-gray-600",children:"Please sign in to detect products from URLs."})})}var j=a(88539),w=a(88390),N=a(79311),_=a(25318),k=a(41927);let A=[{code:"USD",symbol:"$",name:"US Dollar"},{code:"EUR",symbol:"€",name:"Euro"}
1,{code:"GBP",symbol:"\xa3",name:"British Pound"},{code:"CAD",symbol:"C$",name:"Canadian Dollar"},{code:"AUD",symbol:"A$",name:"Australian Dollar"},{code:"JPY",symbol:"\xa5",name:"Japanese Yen"}],S=[{value:"physical_product",label:"Product",description:"Tangible items you can buy (electronics, clothing, books, etc.)"},{value:"digital_product",label:"Digital Item",description:"Software, apps, digital downloads, ebooks, courses"},{value:"experience",label:"Experience",description:"Vacations, concerts, dining, events, activities"},{value:"service",label:"Service",description:"Professional services, consultations, maintenance"},{value:"subscription",label:"Subscription",description:"Recurring services (streaming, software, memberships)"},{value:"financial",label:"Financial",description:"Investment products, insurance, financial services"},{value:"gift_card",label:"Gift Card",description:"Gift cards, vouchers, credits"},{value:"bundle",label:"Bundle",description:"Multiple products/services together"},{value:"business",label:"Business",description:"Business acquisitions, franchises, partnerships"},{value:"real_estate",label:"Real Estate",description:"Property, land, real estate investments"},{value:"collectible",label:"Collectible",description:"Art, antiques, rare items, trading cards"},{value:"cash_fund",label:"Cash Fund",description:"Request money via Venmo, Zelle, CashApp, or PayPal"},{value:"other",label:"Other",description:"Something else not covered above"}],U=e=>{let t=document.createElement("textarea");return t.innerHTML=e,t.value};function C(e){var t,a;let{wishlistId:i,onItemAdded:n,initialData:d,isEditing:u,personalItemId:h}=e,{session:x}=(0,y.A)(),[p,b]=(0,s.useState)({title:(null==d?void 0:d.title)?U(d.title):"",description:(null==d?void 0:d.description)?U(d.description):"",url:(null==d?void 0:d.url)||"",image_urls:(null==d?void 0:d.image_urls)||[],price:(null==d?void 0:null===(t=d.price)||void 0===t?void 0:t.toString())||"",currency_code:(null==d?void 0:d.currency_code)||"USD",category:"",requested_quantity:"1"}),[C,P]=(0,s.useState)(""),[D,E]=(0,s.useState)(!1),[I,q]=(0,s.useState)({});(0,s.useEffect)(()=>{if(d){var e;b({title:d.title?U(d.title):"",description:d.description?U(d.description):"",url:d.url||"",price:(null===(e=d.price)||void 0===e?void 0:e.toString())||"",currency_code:d.currency_code||"USD",image_urls:d.image_urls||[],category:d.category||"",requested_quantity:"1"})}},[d]);let T=()=>{let e={};return p.title.trim()?p.title.length>255&&(e.title="Title must be less than 255 characters"):e.title="Title is required",p.category||(e.category="Please select a category"),p.description&&p.description.length>1e3&&(e.description="Description must be less than 1000 characters"),p.url&&!R(p.url)&&(e.url="Please enter a valid URL"),p.price&&(isNaN(Number(p.price))||0>=Number(p.price))&&(e.price="Price must be a positive number"),(!p.requested_quantity||isNaN(Number(p.requested_quantity))||1>Number(p.requested_quantity)||Number(p.requested_quantity)>100)&&(e.requested_quantity="Quantity must be between 1 and 100"),p.image_urls.length>10&&(e.image_urls="Maximum 10 images allowed"),q(e),0===Object.keys(e).length},R=e=>{try{return new URL(e),!0}catch(e){return!1}},F=(e,t)=>{b(a=>({...a,[e]:t})),I[e]&&q(t=>({...t,[e]:""}))},L=()=>
1{if(C.trim()){if(!R(C)){q(e=>({...e,newImageUrl:"Please enter a valid image URL"}));return}if(p.image_urls.includes(C)){q(e=>({...e,newImageUrl:"This image URL is already added"}));return}if(p.image_urls.length>=10){q(e=>({...e,newImageUrl:"Maximum 10 images allowed"}));return}b(e=>({...e,image_urls:[...e.image_urls,C]})),P(""),q(e=>({...e,newImageUrl:""}))}},O=e=>{b(t=>({...t,image_urls:t.image_urls.filter((t,a)=>a!==e)}))},J=async e=>{if(e.preventDefault(),T()){if(!(null==x?void 0:x.access_token)){g.toast.error("Please sign in to add items to your wishlist");return}E(!0),q({});try{let e={"Content-Type":"application/json",Authorization:"Bearer ".concat(x.access_token)};if(x.refresh_token&&(e["X-Refresh-Token"]=x.refresh_token),u&&h){let t=await fetch("/api/personal-items/".concat(h),{method:"PUT",headers:e,body:JSON.stringify({title:p.title.trim(),description:p.description.trim()||void 0,url:p.url.trim()||void 0,image_urls:p.image_urls,price:p.price?Number(p.price):void 0,currency_code:p.currency_code,category:p.category})});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to update personal item")}let a=await t.json();g.toast.success("Item updated successfully!"),n(a.data)}else{let a,r=await fetch("/api/personal-items",{method:"POST",headers:e,body:JSON.stringify({title:p.title.trim(),description:p.description.trim()||void 0,url:p.url.trim()||void 0,image_urls:p.image_urls,price:p.price?Number(p.price):void 0,currency_code:p.currency_code,category:p.category})});if(!r.ok){let e=await r.json();throw Error(e.error||"Failed to create personal item")}let s=await r.json();await new Promise(e=>setTimeout(e,100));let l=0;for(;l<3;){var t;if((a=await fetch("/api/wishlist/add-item",{method:"POST",headers:e,body:JSON.stringify({wishlist_id:i,personal_item_id:s.data.id,notes:"Added manually",requested_quantity:Number(p.requested_quantity)})})).ok)break;let r=await a.json();if((null===(t=r.error)||void 0===t?void 0:t.includes("Personal item not found"))&&l<2){l++,await new Promise(e=>setTimeout(e,200*l));continue}throw Error(r.error||"Failed to add item to wishlist")}if(!a||!a.ok){let e=a?await a.json():{error:"Failed to add item to wishlist after retries"};throw Error(e.error||"Failed to add item to wishlist")}let c=await a.json();try{let e=p.price?Number(p.price):0;(0,k.y)("add_to_wishlist",{value:e,currency:p.currency_code||"USD"})}catch(e){console.error("Error tracking ad conversion:",e)}g.toast.success("Item added to wishlist successfully!"),n(c.data)}}catch(e){console.error("Error creating/updating manual item:",e),g.toast.error(e instanceof Error?e.message:"Failed to save item")}finally{E(!1)}}};return(A.find(e=>e.code===p.currency_code),x)?(0,r.jsxs)("form",{onSubmit:J,className:"space-y-6",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(v.J,{htmlFor:"title",children:"Title *"}),(0,r.jsx)(f.p,{id:"title",value:p.title,onChange:e=>F("title",e.target.value),placeholder:"e.g., Spa Day Package, Concert Tickets, Custom Artwork...",disabled:D,className:I.title?"border-red-500":""}),I.title&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:I.title})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(v.J,{htmlFor:"category",children:"Category *"}),(0,r.jsxs)("select",{id:"category",value:p.category,onChange:e=>F("category",e.target.value),disabled:D,className:"flex h-10 w-full rounded-md border bg-white px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 ".concat(I.category?"border-red-500":"border-gray-300"),children:[(0,r.jsx)("option",{value:"",children:"Select One"}),S.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))]}),I.category&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:I.category}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:p.category?null===(a=S.find(e=>e.value===p.category))||void 0===a?void 0:a.description:"Please select a category for your item"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(v.J,{htmlFor:"description",children:"Description"}),(0,r.jsx)(j.T,{id:"description",value:p.description,onChange:e=>F("description",e.target.value),placeholder:"Add details about this item...",rows:3,disabled:D,className:I.description?"border-red-500":""}),I.description&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:I.description}),(0,r.jsxs)("p",{className:"text-xs text-gray-500",children:[p.description.length,"/1000 characters"]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(v.J,{htmlFor:"url",children:"Website URL"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(o.A,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),(0,r.jsx)(f.p,{id:"url",type:"url",value:p.url,onChange:e=>F("url",e.target.value),placeholder:"https://example.com/item",disabled:D,className:"pl-10 ".concat(I.url?"border-red-500":"")}
1)]}),I.url&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:I.url})]}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(v.J,{htmlFor:"price",children:"Price"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(w.A,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),(0,r.jsx)(f.p,{id:"price",type:"number",step:"0.01",min:"0",value:p.price,onChange:e=>F("price",e.target.value),placeholder:"0.00",disabled:D,className:"pl-10 ".concat(I.price?"border-red-500":"")})]}),I.price&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:I.price})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(v.J,{htmlFor:"currency",children:"Currency"}),(0,r.jsx)("select",{id:"currency",value:p.currency_code,onChange:e=>F("currency_code",e.target.value),disabled:D,className:"flex h-10 w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",children:A.map(e=>(0,r.jsxs)("option",{value:e.code,children:[e.symbol," ",e.code]},e.code))})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(v.J,{htmlFor:"requested_quantity",children:"Quantity"}),(0,r.jsx)(f.p,{id:"requested_quantity",type:"number",min:"1",max:"100",value:p.requested_quantity,onChange:e=>F("requested_quantity",e.target.value),placeholder:"1",disabled:D,className:I.requested_quantity?"border-red-500":""}),I.requested_quantity&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:I.requested_quantity}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"How many you want"})]})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(v.J,{children:"Images"}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsxs)("div",{className:"flex-1 relative",children:[(0,r.jsx)(N.A,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),(0,r.jsx)(f.p,{value:C,onChange:e=>P(e.target.value),onBlur:()=>{C.trim()&&R(C.trim())&&!p.image_urls.includes(C.trim())&&L()},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),C.trim()&&R(C.trim())&&!p.image_urls.includes(C.trim())&&L())},placeholder:"Paste image URL here (will auto-add when you press Enter or click away)",disabled:D,className:"pl-10 ".concat(I.newImageUrl?"border-red-500":"")})]}),(0,r.jsxs)(l.$,{type:"button",variant:"outline",onClick:L,disabled:D||!C.trim(),className:"whitespace-nowrap",children:[(0,r.jsx)(c.A,{className:"w-4 h-4 mr-1"}),"Add Image"]})]}),I.newImageUrl&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:I.newImageUrl}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:'\uD83D\uDCA1 Tip: Paste an image URL and press Enter, or click "Add Image" to add it to your item'})]}),p.image_urls.length>0&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("p",{className:"text-sm font-medium text-gray-700",children:["Added Images (",p.image_urls.length,"):"]}),p.image_urls.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-2 p-2 bg-gray-50 rounded min-w-0",children:[(0,r.jsx)("img",{src:e,alt:"Preview ".concat(t+1),className:"w-10 h-10 object-cover rounded flex-shrink-0",onError:e=>{e.target.style.display="none"}}),(0,r.jsx)("span",{className:"flex-1 text-sm text-gray-600 truncate min-w-0",title:e,children:e}),(0,r.jsx)(l.$,{type:"button",variant:"ghost",onClick:()=>O(t),disabled:D,className:"p-1 h-auto flex-shrink-0",children:(0,r.jsx)(_.A,{className:"w-4 h-4"})})]},t))]}),I.image_urls&&(0,r.jsx)("p",{className:"text-sm text-red-600",children:I.image_urls})]}),(0,r.jsx)(l.$,{type:"submit",disabled:D||!p.title.trim(),className:"w-full",children:D?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(m.A,{className:"w-4 h-4 mr-2 animate-spin"}),u?"Updating Item...":"Adding to Wishlist..."]}):u?"Update Item":"Add to Wishlist"})]}):(0,r.jsx)("div",{className:"space-y-4 text-center p-4 bg-gray-50 rounded-lg",children:(0,r.jsx)("p",{className:"text-gray-600",children:"Please sign in to add items to your wishlist."})})}var P=a(26126),D=a(53054),E=a(30462),I=a(16962),q=a(71559);let T=e=>{let t=document.createElement("textarea");return t.innerHTML=e,t.value};function R(e){let{product:t}=e,a=T(t.title),s=t.description?T(t.description):void 0;return(0,r.jsxs)("div",{className:"border border-gray-200 rounded-lg p-4 space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-start gap-4",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:t.image_urls&&t.image_urls.length>0?(0,r.jsx)(I.SafeImage,{src:t.image_urls[0],alt:a,width:120,height:120,className:"rounded-lg object-cover"}):(0,r.jsx)("div",{className:"w-[120px] h-[120px] bg-gray-100 rounded-lg flex items-center justify-center",children:(0,r.jsx)(D.A,{className:"w-8 h-8 text-gray-400"})})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2",children:[(0,r.jsx)("h3",{className:"font-semibold text-gray-900 line-clamp-2 leading-tight min-w-0 break-words",children:a}),t.price&&(0,r.jsxs)("div",{className:"flex items-center gap-1 text-lg font-bold text-green-600 flex-shrink-0",children:[(0,r.jsx)(w.A,{className:"w-4 h-4"}),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"USD";return new Intl.NumberFormat("en-US",{style:"currency",currency:t}).format(e)}(t.price,t.currency_code)]})]}),t.brand&&(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsx)(P.E,{variant:"outline",className:"text-xs",children:T(t.brand)})}),t.rating&&(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(E.A,{className:"w-4 h-4 fill-yellow-400 text-yellow-400"}),(0,r.jsx)("span",{className:"text-sm font-medium",children:t.rating.toFixed(1)})]}),t.review_count&&(0,r.jsxs)("span",{className:"text-sm text-gray-500 whitespace-nowrap",children:["(",t.review_count.toLocaleStr
1ing()," reviews)"]})]}),s&&(0,r.jsx)("p",{className:"text-sm text-gray-600 line-clamp-3 mb-3 break-words",children:s}),(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,r.jsx)(P.E,{variant:"affiliate_com"===t.detection_method?"default":"secondary",className:"text-xs",children:"affiliate_com"===t.detection_method?"API Detection":"URL Preview"}),t.affiliate_url&&(0,r.jsx)(q.K,{product:{...t,id:t.title||"preview",slug:t.title||"preview",created_at:new Date().toISOString(),updated_at:new Date().toISOString()},className:"inline-flex items-center gap-1 text-xs text-brand hover:text-brand-hover break-all",showIcon:!0,children:(0,r.jsx)("span",{className:"truncate max-w-[100px]",children:"View Original"})})]})]})]}),t.image_urls&&t.image_urls.length>1&&(0,r.jsxs)("div",{className:"border-t pt-4",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-700 mb-2",children:"Additional Images"}),(0,r.jsxs)("div",{className:"flex gap-2 overflow-x-auto",children:[t.image_urls.slice(1,5).map((e,t)=>(0,r.jsx)(I.SafeImage,{src:e,alt:"".concat(a," - Image ").concat(t+2),width:60,height:60,className:"rounded object-cover flex-shrink-0"},t)),t.image_urls.length>5&&(0,r.jsx)("div",{className:"w-[60px] h-[60px] bg-gray-100 rounded flex items-center justify-center flex-shrink-0",children:(0,r.jsxs)("span",{className:"text-xs text-gray-500",children:["+",t.image_urls.length-5]})})]})]}),!1]})}function F(e){var t;let{isOpen:a,onClose:f,wishlistId:v,onItemAdded:j,wishlistTitle:w,onChangeWishlist:N,initialPersonalItem:_,isEditing:A}=e,{session:S}=(0,y.A)(),[U,P]=(0,s.useState)("smart"),[D,E]=(0,s.useState)(null),[I,q]=(0,s.useState)(!1),[T,F]=(0,s.useState)(null),[L,O]=(0,s.useState)(!1),[J,W]=(0,s.useState)(!1);(0,s.useEffect)(()=>{a&&!J?(P(A?"manual":"smart"),E(null),F(null),q(!1),O(!1),W(!0)):!a&&J&&W(!1)},[a,A,J]);let B=async()=>{if(D){if(!(null==S?void 0:S.access_token)){g.toast.error("Please sign in to add items to your wishlist");return}O(!0);try{var e,t,a,r,s,i,l;let n={"Content-Type":"application/json",Authorization:"Bearer ".concat(S.access_token)};S.refresh_token&&(n["X-Refresh-Token"]=S.refresh_token);let c=(null===(e=D.metadata)||void 0===e?void 0:e.augmented_with_affiliate)?"smart detection (live crawl + Affiliate.com)":"smart detection (".concat(D.detection_method||"unknown",")");if((null!==(l=null!==(i=null===(a=D.metadata)||void 0===a?void 0:null===(t=a.affiliate_data)||void 0===t?void 0:t.external_id)&&void 0!==i?i:null===(r=D.metadata)||void 0===r?void 0:r.affiliate_com_id)&&void 0!==l?!!l:!!D.external_id)&&("affiliate_com"===D.detection_method||null!==(s=D.metadata)&&void 0!==s&&s.augmented_with_affiliate)){let e=function(e){var t,a,r,s;let i=function(e){var t,a,r,s,i;let l=null!==(i=null!==(s=null===(a=e.metadata)||void 0===a?void 0:null===(t=a.affiliate_data)||void 0===t?void 0:t.external_id)&&void 0!==s?s:null===(r=e.metadata)||void 0===r?void 0:r.affiliate_com_id)&&void 0!==i?i:e.external_id;if(!l)throw Error("Missing Affiliate.com external id for catalog import");return String(l)}(e),l=e.merchant||("string"==typeof(null===(t=e.metadata)||void 0===t?void 0:t.merchant_name)?e.metadata.merchant_name:void 0);return{external_id:i,integration_type:"affiliate.com",title:e.title,description:null!==(a=e.description)&&void 0!==a?a:"",price:null!==(r=e.price)&&void 0!==r?r:0,original_price:e.original_price,currency_code:e.currency_code||"USD",image_urls:e.image_urls||[],affiliate_url:e.affiliate_url||"",direct_url:e.direct_url||e.source_url||e.affiliate_url||"",rating:e.rating,review_count:null!==(s=e.review_count)&&void 0!==s?s:0,brand:e.brand,merchant:l,metadata:{...e.metadata,merchant_name:l,wishlist_import_source:"smart_detect_affiliate_com"},on_sale:e.on_sale,sale_discount:e.sale_discount}}(D),t=await fetch("/api/products/import",{method:"POST",headers:n,body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({})),a="string"==typeof e.error?e.error:"Could not import product to catalog";throw Error(a)}let a=await t.json(),r=await fetch("/api/wishlist/add-item",{method:"POST",headers:n,body:JSON.stringify({wishlist_id:v,product_id:a.id,notes:"Added via ".concat(c)})});if(!r.ok)throw Error("Failed to add product to wishlist");let s=await r.json();try{(0,k.y)("add_to_wishlist",{value:D.price||0,currency:D.currency_code||"USD"})}catch(e){console.error("Error tracking ad conversion:",e)}g.toast.success("Product added to wishlist!"),null==j||j(s.data),f();return}let o=await fetch("/api/personal-items",{method:"POST",headers:n,body:JSON.stringify({title:D.title,de
1scription:D.description||"",url:D.affiliate_url||"",image_urls:D.image_urls||[],price:D.price,currency_code:D.currency_code||"USD"})});if(!o.ok)throw Error("Failed to create personal item");let d=await o.json(),m=await fetch("/api/wishlist/add-item",{method:"POST",headers:n,body:JSON.stringify({wishlist_id:v,personal_item_id:d.data.id,notes:"Added via ".concat(c)})});if(!m.ok)throw Error("Failed to add item to wishlist");let u=await m.json();try{(0,k.y)("add_to_wishlist",{value:D.price||0,currency:D.currency_code||"USD"})}catch(e){console.error("Error tracking ad conversion:",e)}g.toast.success("Item added to wishlist successfully!"),null==j||j(u.data),f()}catch(e){console.error("Error adding detected product:",e),g.toast.error(e instanceof Error?e.message:"Failed to add item to wishlist")}finally{O(!1)}}};return(0,r.jsx)(i.lG,{open:a,onOpenChange:f,children:(0,r.jsxs)(i.Cf,{className:"max-w-2xl max-h-[90vh] min-h-[650px] overflow-y-auto overflow-x-hidden",children:[(0,r.jsx)(i.c7,{className:"pb-6",children:(0,r.jsxs)(i.L3,{className:"flex items-center gap-2",children:[(0,r.jsx)(c.A,{className:"w-5 h-5"}),A?"Edit Item":"Add Item to Wishlist"]})}),w&&N&&!A&&(0,r.jsx)("div",{className:"mb-6 p-4 bg-brand-light border border-brand rounded-lg",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-primary",children:"Adding to:"}),(0,r.jsx)("p",{className:"text-brand font-semibold",children:w})]}),(0,r.jsx)(l.$,{variant:"outline",onClick:N,className:"text-brand border-brand hover:bg-brand-light px-3 py-1 text-sm",children:"Change Wishlist"})]})}),(0,r.jsx)("div",{className:"px-2 min-w-0",children:(0,r.jsxs)(n.tU,{value:U,onValueChange:e=>P(e),children:[(0,r.jsxs)(n.j7,{className:"grid w-full ".concat(A?"grid-cols-1":"grid-cols-2 md:grid-cols-3"," mb-6"),children:[!A&&(0,r.jsxs)(n.Xi,{value:"smart",className:"flex items-center gap-2",children:[(0,r.jsx)(o.A,{className:"w-4 h-4"}),"Smart Detection"]}),(0,r.jsxs)(n.Xi,{value:"manual",className:"flex items-center gap-2",children:[(0,r.jsx)(c.A,{className:"w-4 h-4"}),A?"Edit Item":"Manual Entry"]}),!A&&(0,r.jsxs)(n.Xi,{value:"extension",className:"hidden md:flex items-center gap-2",children:[(0,r.jsx)(d.A,{className:"w-4 h-4"}),"Extension"]})]}),(0,r.jsxs)("div",{className:"min-h-[500px]",children:[!A&&(0,r.jsxs)(n.av,{value:"smart",className:"space-y-6 mt-0",children:[(0,r.jsx)("div",{className:"text-sm text-gray-600",children:"Paste a product URL and we'll automatically detect the details for you."}),(0,r.jsx)(b,{onDetectionStart:()=>{q(!0),F(null),E(null)},onDetectionResult:(e,t)=>{E(e),F(t||null),q(!1),e&&!t&&P("manual")},isDetecting:I}),I&&(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(m.A,{className:"w-5 h-5 animate-spin"}),(0,r.jsx)("span",{className:"text-sm text-gray-600",children:"Detecting product details..."})]})}),T&&(0,r.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-brand-light border border-brand rounded-lg",children:[(0,r.jsx)(u.A,{className:"w-5 h-5 text-brand mt-0.5 flex-shrink-0"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-primary",children:"Smart Detection Not Available"}),(0,r.jsx)("p",{className:"text-sm text-brand mt-1",children:"We couldn't automatically detect details for this link, but you can still add it to your wishlist manually."}),(0,r.jsx)(l.$,{variant:"outline",className:"mt-3",onClick:()=>P("manual"),children:"Add manually instead"})]})]}),D&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-green-50 border border-green-200 rounded-lg",children:[(0,r.jsx)(h.A,{className:"w-5 h-5 text-green-500 mt-0.5 flex-shrink-0"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-green-800",children:"Product Detected!"}),(0,r.jsxs)("p",{className:"text-sm text-green-600 mt-1",children:["Found product details using"," ","affiliate_com"===D.detection_method||(null===(t=D.metadata)||void 0===t?void 0:t.augmented_with_affiliate)?"Affiliate.com API":"URL preview"]})]})]}),(0,r.jsx)(R,{product:D}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)(l.$,{onClick:B,disabled:L,className:"flex-1",children:L?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(m.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Adding to Wishlist..."]}):"Add to Wishlist"}),(0,r.jsx)(l.$,{variant:"outline",onClick:()=>P("manual"),children:"Edit Details"})]})]})]}),(0,r.jsxs)(n.av,{value:"manual",className:"space-y-6 mt-0",children:[(0,r.jsx)("div",{className:"text-sm text-gray-600",children:A?"Update your custom item details.":"Create a custom item for services, experiences, or anything else."}),(0,r.jsx)(C,{wishlistId:v,onItemAdded:e=>{null==j||j(e),f()}
1,initialData:_||(D?{title:D.title,description:D.description||"",url:D.affiliate_url||"",image_urls:D.image_urls||[],price:D.price,currency_code:D.currency_code||"USD"}:void 0),isEditing:A,personalItemId:null==_?void 0:_.id})]}),!A&&(0,r.jsxs)(n.av,{value:"extension",className:"space-y-6 mt-0",children:[(0,r.jsxs)("div",{className:"py-4",children:[(0,r.jsxs)("div",{className:"mb-8",children:[(0,r.jsx)("div",{className:"w-16 h-16 bg-brand rounded-full flex items-center justify-center mx-auto mb-4",children:(0,r.jsx)(d.A,{className:"w-8 h-8 text-white"})}),(0,r.jsx)("h3",{className:"text-xl font-semibold text-gray-900 mb-2 text-center",children:"Get the Browser Extension"}),(0,r.jsx)("p",{className:"text-gray-600 max-w-md mx-auto text-center",children:"The fastest and easiest way to add products to your wishlists. Works on any shopping site with just one click!"})]}),(0,r.jsx)("div",{className:"bg-brand-light border border-brand rounded-lg p-6 mb-8",children:(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(x.A,{className:"w-5 h-5 text-brand"}),(0,r.jsx)("span",{className:"font-medium",children:"One-click adding"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(d.A,{className:"w-5 h-5 text-green-600"}),(0,r.jsx)("span",{className:"font-medium",children:"Works everywhere"})]})]})}),(0,r.jsxs)("div",{className:"space-y-4 text-center",children:[(0,r.jsxs)(l.$,{onClick:()=>window.open("/extension","_blank"),className:"bg-brand hover:bg-brand-hover text-white px-8 py-3 text-lg font-medium",children:["Learn More About Extension",(0,r.jsx)(p.A,{className:"w-5 h-5 ml-2"})]}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"Free • Works with Chrome, Edge, and other browsers"})]})]}),(0,r.jsxs)("div",{className:"border-t pt-6",children:[(0,r.jsx)("p",{className:"text-sm text-gray-600 text-center mb-4",children:"Already have the extension or prefer other methods?"}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)(l.$,{variant:"outline",onClick:()=>P("smart"),className:"flex-1",children:"Try Smart Detection"}),(0,r.jsx)(l.$,{variant:"outline",onClick:()=>P("manual"),className:"flex-1",children:"Add Manually"})]})]})]})]})]})})]})})}},71559:(e,t,a)=>{a.d(t,{K:()=>m,W:()=>d});var r=a(95155),s=a(61840),i=a(12115),l=a(56539),n=a(62003),c=a(76766),o=a(94251);function d(e){let{product:t,children:a,className:d="",showIcon:m=!1,buttonStyle:u=!1,onClick:h,wishlistId:x,searchContext:p}=e,{trackOutboundClick:g}=(0,l.J)(),{trackingUrl:f,hoverUrl:v}=(0,i.useMemo)(()=>{if(!t)return{trackingUrl:"",hoverUrl:""};let e=t.direct_url||t.affiliate_url||"",a=t.affiliate_url;if(a&&(a.startsWith("/c/")||a.startsWith("/c?")))try{let e=new URL(a,"https://lmk.today").searchParams.get("url")||a;return{trackingUrl:a,hoverUrl:(0,n.LA)(t.direct_url||e)}}catch(t){return{trackingUrl:a,hoverUrl:(0,n.LA)(e)}}let r=(0,c.R)(t,p,x?{wishlistId:x,context:"wishlist"}:void 0);return"#"===r||r.startsWith("/product/")?{trackingUrl:"",hoverUrl:""}:{trackingUrl:r,hoverUrl:(0,n.LA)(e)}},[t,p,x]),y=v||(0,n.LA)((null==t?void 0:t.direct_url)||(null==t?void 0:t.affiliate_url)||"");if(!f){let e=d||(u?"inline-block bg-gray-400 text-white px-4 py-2 rounded-md text-center cursor-not-allowed min-h-[44px] touch-manipulation opacity-50":"text-gray-400 cursor-not-allowed touch-manipulation");return(0,r.jsxs)("span",{className:e,children:[a,m&&(0,r.jsx)(s.A,{className:"ml-1 inline-block h-4 w-4"})]})}let b=d||(u?"inline-block bg-brand text-white px-4 py-2 rounded-md text-center hover:bg-brand-hover transition-colors min-h-[44px] touch-manipulation":"hover:text-brand-hover transition-colors touch-manipulation");return(0,r.jsxs)("a",{href:f,target:"_blank",rel:"sponsored nofollow noopener noreferrer",className:b,onClick:e=>{if(null==h||h(),t&&g(t,x).catch(e=>console.warn("Failed to track outbound click:",e)),(0,o.BY)()){e.preventDefault();let t=f.startsWith("/")?new URL(f,window.location.origin).href:f;window.location.href=t}},title:y,children:[a,m&&(0,r.jsx)(s.A,{className:"ml-1 inline-block h-4 w-4"})]})}function m(e){let{product:t,children:a,className:s="",showIcon:i=!1,onClick:l,wishlistId:n,searchContext:c}=e;return(0,r.jsx)(d,{product:t,className:s,showIcon:i,buttonStyle:!0,onClick:l,wishlistId:n,searchContext:c,children:a})}},85057:(e,t,a)=>{a.d(t,{J:()=>l});var r=a(95155),s=a(12115),i=a(59434);let l=(0,s.forwardRef)((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("label",{className:(0,i.cn)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",a),ref:t,...s})});l.displayName="Label"},88539:(e,t,a)=>{a.d(t,{T:()=>l});var r=a(95155),s=a(12115),i=a(59434);let l=(0,s.forwardRef)((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("textarea",{className:(0,i.cn)("flex min-h-[80px] w-full rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-brand focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...s})});l.displayName="Textarea"}}]);

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.