PageSourceSearch

https://bestlinkhub.top/_next/static/chunks/d815835f89eb197a.js

js bestlinkhub.top collected 2026-10-08 16:01:44 UTC 8,441 bytes, 1 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,866787,e=>{"use strict";var t=e.i(599342);e.s(["Search",()=>t.default])},458903,e=>{"use strict";var t=e.i(287937),r=Object.defineProperty,s=new Map,a=new WeakMap,l=0,i=void 0;function n({threshold:e,delay:r,trackVisibility:o,rootMargin:d,root:c,triggerOnce:u,skip:h,initialInView:m,fallbackInView:g,onChange:x}={}){var b;let[p,f]=t.useState(null),v=t.useRef(x),[y,j]=t.useState({inView:!!m,entry:void 0});v.current=x,t.useEffect(()=>{let t;if(!h&&p)return t=function(e,t,r={},n=i){if(void 0===window.IntersectionObserver&&void 0!==n){let s=e.getBoundingClientRect();return t(n,{isIntersecting:n,target:e,intersectionRatio:"number"==typeof r.threshold?r.threshold:0,time:0,boundingClientRect:s,intersectionRect:s,rootBounds:s}),()=>{}}let{id:o,observer:d,elements:c}=function(e){let t=Object.keys(e).sort().filter(t=>void 0!==e[t]).map(t=>{var r;return`${t}_${"root"===t?!(r=e.root)?"0":(a.has(r)||(l+=1,a.set(r,l.toString())),a.get(r)):e[t]}`}).toString(),r=s.get(t);if(!r){let a,l=new Map,i=new IntersectionObserver(t=>{t.forEach(t=>{var r;let s=t.isIntersecting&&a.some(e=>t.intersectionRatio>=e);e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=s),null==(r=l.get(t.target))||r.forEach(e=>{e(s,t)})})},e);a=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),r={id:t,observer:i,elements:l},s.set(t,r)}return r}(r),u=c.get(e)||[];return c.has(e)||c.set(e,u),u.push(t),d.observe(e),function(){u.splice(u.indexOf(t),1),0===u.length&&(c.delete(e),d.unobserve(e)),0===c.size&&(d.disconnect(),s.delete(o))}}(p,(e,r)=>{j({inView:e,entry:r}),v.current&&v.current(e,r),r.isIntersecting&&u&&t&&(t(),t=void 0)},{root:c,rootMargin:d,threshold:e,trackVisibility:o,delay:r},g),()=>{t&&t()}},[Array.isArray(e)?e.toString():e,p,c,d,u,h,o,g,r]);let N=null==(b=y.entry)?void 0:b.target,w=t.useRef(void 0);p||!N||u||h||w.current===N||(w.current=N,j({inView:!!m,entry:void 0}));let k=[f,y.inView,y.entry];return k.ref=k[0],k.inView=k[1],k.entry=k[2],k}t.Component,e.s(["useInView",()=>n])},55558,e=>{"use strict";var t=e.i(818362),r=e.i(647163),s=e.i(147067),a=e.i(58061);function l({product:e}){var l;let i,n=(l=e.submittedAt,(i=new Date).setDate(i.getDate()-7),new Date(l)>i),o=!!e.discountCode,d=n?{text:"NEW",style:"bg-primary text-primary-foreground"}:o?{text:"DEAL",style:"bg-green-500 text-white dark:bg-green-600 dark:text-white"}:null;return(0,t.jsx)("div",{className:"relative",children:(0,t.jsx)(a.default,{href:`/product/${e.slug}`,title:e.name,className:"block h-full",children:(0,t.jsx)("div",{className:"relative pt-3 h-full",children:(0,t.jsxs)("div",{className:(0,r.cn)("bg-card rounded-xl shadow-md border border-gray-200 hover:shadow-lg dark:border-gray-800 p-3 transition-all duration-200 relative h-full flex flex-col","free"!==e.submitType?"border-2 border-primary/40 dark:border-primary/40 hover:shadow-lg hover:border-primary/50 dark:hover:border-primary/50 ":""),children:[d&&(0,t.jsx)("span",{className:(0,r.cn)("text-xs px-2 py-1 rounded-md absolute -top-3 -right-3 z-50",d.style),children:d.text}),(0,t.jsxs)("div",{className:"mb-2 flex-shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-2",children:[e.logoUrl?(0,t.jsx)(s.default,{src:e.logoUrl,alt:`${e.name} logo`,width:32,height:32,className:"rounded-lg flex-shrink-0"}):(0,t.jsx)("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0 bg-gradient-to-br from-blue-500 to-purple-600 dark:from-blue-600 dark:to-purple-700",children:(0,t.jsx)("span",{className:"text-white font-bold text-sm",children:e.name.charAt(0)})}),(0,t.jsx)("h3",{className:"font-semibold line-clamp-1 truncate text-gray-900 dark:text-gray-100 flex-1 min-w-0",children:e.name})]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 dark:text-gray-300 line-clamp-2",children:e.tagline})]}),(0,t.jsx)("div",{className:"flex-grow"})]})})})})}e.s(["LatestProductCard",()=>l])},951886,e=>{"use strict";var t=e.i(818362),r=e.i(912906),s=(0,r.createServerReference)("40b9099be754ea7a0f76e86c6ea4256d2a9202277e",r.callServer,void 0,r.findSourceMapURL,"searchProducts"),a=e.i(55558),l=e.i(167881),i=e.i(23750),n=e.i(647163),o=e.i(866787),d=e.i(734942),c=e.i(944675),u=e.i(287937),h=e.i(458903);function m({categories:e,defaultProducts:r}){let m=(0,c.useRouter)(),g=(0,c.useSearchParams)(),x=g.get("q")||"",b=g.get("category")||"",[p,f]=(0,u.useState)(x),[v,y]=(0,u.useState)(b),[j,N]=(0,u.useState)(x?[]:r),[w,k]=(0,u.useState)(0),[S,C]=(0,u.useState)(0),[R,A]=(0,u.useState)(!1),[I,P]=(0,u.useState)(!1),[V,E]=(0,u.useTransition)(),[L,O]=(0,u.useState)(!!x),{ref:T,inView:D}=(0,h.useInView)({threshold:0}),U=(0,u.useCallback)((e,t)=>{let r=new URLSearchParams;e&&r.set("q",e),t&&r.set("category",t);let s=r.toString()?`?${r.toString()}`:"/search";m.push(s,{scroll:!1})},[m]),$=(0,u.useCallback)(async(e,t,a=0)=>
1{if(!e.trim()&&!t){N(r),O(!1),A(!1);return}P(!0);try{let r=await s({query:e,categoryId:t||void 0,pageIndex:a,pageSize:24});r.success&&r.data&&(0===a?N(r.data.products):N(e=>[...e,...r.data.products]),k(r.data.count),A(0===a?r.data.products.length<r.data.count:j.length+r.data.products.length<r.data.count),C(a),O(!0))}catch(e){console.error("Search error:",e)}finally{P(!1)}},[r,j.length]),B=(0,u.useCallback)(e=>{e?.preventDefault(),U(p,v),E(()=>{$(p,v,0)})},[p,v,U,$]),M=(0,u.useCallback)(e=>{let t=e===v?"":e;y(t),U(p,t),E(()=>{$(p,t,0)})},[v,p,U,$]),z=(0,u.useCallback)(()=>{f(""),y(""),N(r),O(!1),A(!1),m.push("/search",{scroll:!1})},[r,m]),q=(0,u.useCallback)(async()=>{R&&!I&&L&&await $(p,v,S+1)},[R,I,L,p,v,S,$]);return(0,u.useEffect)(()=>{(x||b)&&$(x,b,0)},[]),(0,u.useEffect)(()=>{D&&R&&!I&&L&&q()},[D,R,I,L,q]),(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)("form",{onSubmit:B,className:"relative",children:(0,t.jsxs)("div",{className:"relative flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"relative flex-1",children:[(0,t.jsx)(o.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-5 w-5 text-muted-foreground"}),(0,t.jsx)(i.Input,{type:"text",placeholder:"Search by name, tagline, or description...",value:p,onChange:e=>f(e.target.value),className:"pl-10 pr-10 h-12 text-base"}),p&&(0,t.jsx)("button",{type:"button",onClick:()=>f(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:(0,t.jsx)(d.X,{className:"h-4 w-4"})})]}),(0,t.jsx)(l.Button,{type:"submit",size:"lg",disabled:V,children:V?"Searching...":"Search"})]})}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)("button",{onClick:()=>M(""),className:(0,n.cn)("px-3 py-1.5 text-sm rounded-full border transition-colors",v?"bg-background border-border hover:bg-accent":"bg-primary text-primary-foreground border-primary"),children:"All"}),e.map(e=>(0,t.jsx)("button",{onClick:()=>M(e.id),className:(0,n.cn)("px-3 py-1.5 text-sm rounded-full border transition-colors",v===e.id?"bg-primary text-primary-foreground border-primary":"bg-background border-border hover:bg-accent"),children:e.name},e.id)),(p||v)&&(0,t.jsxs)("button",{onClick:z,className:"px-3 py-1.5 text-sm rounded-full border border-red-300 text-red-600 hover:bg-red-50 dark:border-red-700 dark:text-red-400 dark:hover:bg-red-950 transition-colors flex items-center gap-1",children:[(0,t.jsx)(d.X,{className:"h-3 w-3"}),"Clear"]})]}),(0,t.jsxs)("div",{children:[L&&(0,t.jsxs)("p",{className:"text-sm text-muted-foreground mb-4",children:["Found ",w," ",1===w?"result":"results",p&&` for "${p}"`]}),!L&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Latest products"}),0===j.length&&L?(0,t.jsxs)("div",{className:"text-center py-12",children:[(0,t.jsx)(o.Search,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),(0,t.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"No results found"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"Try adjusting your search terms or clearing the filters"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:j.map(e=>(0,t.jsx)(a.LatestProductCard,{product:e},e.id))}),L&&R&&(0,t.jsx)("div",{ref:T,className:"text-center py-8",children:(0,t.jsx)("div",{className:"text-sm text-gray-500",children:I?"Loading More...":""})})]})]})]})}e.s(["SearchPageContent",()=>m],951886)}]);

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.