1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3687],{2180:(e,t,s)=>{"use strict";s.d(t,{Bc:()=>n,ZI:()=>d,k$:()=>o,m_:()=>i});var a=s(5155);s(2115);var r=s(6852),l=s(5016);function n(e){let{delayDuration:t=0,...s}=e;return(0,a.jsx)(r.Kq,{"data-slot":"tooltip-provider",delayDuration:t,...s})}function i(e){let{...t}=e;return(0,a.jsx)(n,{children:(0,a.jsx)(r.bL,{"data-slot":"tooltip",...t})})}function o(e){let{...t}=e;return(0,a.jsx)(r.l9,{"data-slot":"tooltip-trigger",...t})}function d(e){let{className:t,sideOffset:s=0,children:n,...i}=e;return(0,a.jsx)(r.ZL,{children:(0,a.jsxs)(r.UC,{"data-slot":"tooltip-content",sideOffset:s,className:(0,l.cn)("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...i,children:[n,(0,a.jsx)(r.i3,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}},3209:(e,t,s)=>{"use strict";s.d(t,{Wu:()=>o,ZB:()=>i,Zp:()=>l,aR:()=>n});var a=s(5155);s(2115);var r=s(5016);function l(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card",className:(0,r.cn)("bg-card text-card-foreground flex flex-col gap-3 rounded-xl border shadow-sm",t),...s})}function n(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-header",className:(0,r.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6 pt-3",t),...s})}function i(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-title",className:(0,r.cn)("leading-none font-semibold",t),...s})}function o(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-content",className:(0,r.cn)("px-6",t),...s})}},4295:(e,t,s)=>{Promise.resolve().then(s.bind(s,8874))},4679:(e,t,s)=>{"use strict";s.d(t,{Cf:()=>d,L3:()=>m,c7:()=>c,lG:()=>n,rr:()=>x});var a=s(5155);s(2115);var r=s(3409),l=s(5016);function n(e){let{...t}=e;return(0,a.jsx)(r.bL,{"data-slot":"dialog",...t})}function i(e){let{...t}=e;return(0,a.jsx)(r.ZL,{"data-slot":"dialog-portal",...t})}function o(e){let{className:t,...s}=e;return(0,a.jsx)(r.hJ,{"data-slot":"dialog-overlay",className:(0,l.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...s})}function d(e){let{className:t,children:s,...n}=e;return(0,a.jsxs)(i,{"data-slot":"dialog-portal",children:[(0,a.jsx)(o,{}),(0,a.jsx)(r.UC,{"data-slot":"dialog-content",className:(0,l.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...n,children:s})]})}function c(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"dialog-header",className:(0,l.cn)("flex flex-col gap-2 text-center sm:text-left",t),...s})}function m(e){let{className:t,...s}=e;return(0,a.jsx)(r.hE,{"data-slot":"dialog-title",className:(0,l.cn)("text-lg leading-none font-semibold",t),...s})}function x(e){let{className:t,...s}=e;return(0,a.jsx)(r.VY,{"data-slot":"dialog-description",className:(0,l.cn)("text-muted-foreground text-sm",t),...s})}},5016:(e,t,s)=>{"use strict";s.d(t,{cn:()=>l});var a=s(2821),r=s(5889);function l(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,r.QP)((0,a.$)(t))}},8874:(e,t,s)=>{"use strict";s.d(t,{default:()=>S});var a=s(5155),r=s(9293),l=s(2115),n=s(8720),i=s(859),o=s(4033),d=s(2108),c=s(6132),m=s(9559),x=s(1524),u=s(3327),p=s(2529),h=s(5426),g=s(5880),f=s(2619),b=s.n(f),v=s(3209);function y(e){let{name:t,imageUrl:s,nameColor:r,condition:n,price:i,onClick:o,marketHashName:d,assetId:c,onPriceLoad:m,useCache:x=!1,disablePriceFetch:u=!1,category:p,inspectLink:h}=e,[g,f]=(0,l.useState)(i||null),[b,y]=(0,l.useState)(!1),j=r?r.startsWith("#")?r:"#".concat(r):"#ffffff",N=t.match(/\(([^)]+)\)$/),w=N?N[1]:"",A=n||w,k=w?t.replace(/\s*\([^)]+\)$/,"").trim():t,C=t.includes("StatTrakâ¢")||2===p,D=t.includes("Souvenir")||3===p,S=C?"#F
1F8C00":D?"#FFD700":j;(0,l.useEffect)(()=>{(async()=>{if(!u&&d&&c&&null===g){y(!0);try{let e=await fetch("/api/steam-price?marketHashName=".concat(encodeURIComponent(d)).concat(x?"&useCache=true":""));if(e.ok){let t=await e.json(),s=t.median_price||t.lowest_price||null;null!==s&&(f(s),m&&m(c,s))}}catch(e){console.error("Error fetching price:",e)}finally{y(!1)}}})()},[u,d,c,g,x,m]);let F=null!=g?g:i;return null!=F&&"number"==typeof F&&isNaN(F),(0,a.jsx)(v.Zp,{className:"bg-[#1b1d24] border-[#1a1a1a] hover:border-[#2d3035] transition-colors cursor-pointer overflow-hidden select-none",style:{aspectRatio:"3/4",width:"100%"},onClick:o,children:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[(0,a.jsxs)(v.Wu,{className:"p-0 flex-1 flex flex-col min-h-0",children:[(0,a.jsxs)("div",{className:"px-2 sm:px-3 pt-1 flex-shrink-0 overflow-visible",children:[(0,a.jsx)("div",{className:"font-medium text-xs sm:text-sm leading-tight truncate",style:{color:S,textShadow:C?"0 0 8px rgba(255, 140, 0, 0.8), 0 0 12px rgba(255, 140, 0, 0.4)":D?"0 0 6px rgba(255, 215, 0, 0.6)":"none",padding:C||D?"4px 8px":void 0,margin:C||D?"-4px -8px":void 0},title:t,children:k}),A&&(0,a.jsx)("div",{className:"text-gray-400 text-[10px] sm:text-xs truncate",children:A})]}),(0,a.jsx)("div",{className:"flex-1 relative min-h-0",children:(0,a.jsx)("div",{className:"w-full h-full relative",style:{background:"linear-gradient(rgba(27, 29, 36, 0) 20%, ".concat(j,"32 100%)")},children:(0,a.jsx)("img",{className:"w-full h-full object-contain p-1 sm:p-2",src:s,alt:t,onError:e=>{e.target.src="/placeholder-item.png"}})})})]}),(0,a.jsx)("div",{className:"h-1 w-full flex-shrink-0",style:{backgroundColor:j}})]})})}var j=s(4679),N=s(9857),w=s(5229);let A=["All","Rifles","Pistols","SMGs","Heavy","Knives","Gloves"],k=["Factory New","Minimal Wear","Field-Tested","Well-Worn","Battle-Scarred"],C=["Normal","StatTrakâ¢","Souvenir"];function D(e){let t,{stats:s,steamId:r}=e,[i,d]=(0,l.useState)(!1),[c,m]=(0,l.useState)("all"),[x,u]=(0,l.useState)([]),[p,h]=(0,l.useState)(!1),[g,f]=(0,l.useState)({}),[b,v]=(0,l.useState)(""),[y,D]=(0,l.useState)("All"),[S,F]=(0,l.useState)([]),[E,_]=(0,l.useState)([]),[B,L]=(0,l.useState)(!1),[R,I]=(0,l.useState)(!1),T=(0,l.useRef)(null),X=(0,l.useRef)(null);(0,l.useEffect)(()=>{let e=e=>{T.current&&!T.current.contains(e.target)&&L(!1),X.current&&!X.current.contains(e.target)&&I(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let W=e=>({all:"All Items",knives:"Knives",gloves:"Gloves",aks:"AK-47s",awps:"AWPs",m4s:"M4s"})[e],P=async(e,t)=>{e.preventDefault(),e.stopPropagation(),m(t),h(!0),d(!0),f({});try{let e=await fetch("/api/inventory?steamId=".concat(r,"&useCache=true"));if(!e.ok)throw Error("Failed to fetch full inventory");let s=await e.json(),a=s.assets.map(e=>{var t,a,r,l,n,i;let o=s.descriptions.find(t=>t.classid===e.classid&&t.instanceid===e.instanceid);return{id:e.assetid,steamItemId:e.assetid,name:(null==o?void 0:o.name)||"Unknown Item",imageUrl:(null==o?void 0:o.icon_url)?"https://community.fastly.steamstatic.com/economy/image/".concat(o.icon_url):null,nameColor:(null==o?void 0:o.name_color)||null,value:null,marketHashName:(null==o?void 0:o.market_hash_name)||null,type:(null==o?void 0:o.type)||null,rarity:(null==o||null==(a=o.tags)||null==(t=a.find(e=>"Rarity"===e.category))?void 0:t.internal_name)||null,rarityName:(null==o||null==(l=o.tags)||null==(r=l.find(e=>"Rarity"===e.category))?void 0:r.localized_tag_name)||null,rarityNumeric:null,weaponType:(null==o||null==(i=o.tags)||null==(n=i.find(e=>"Type"===e.category))?void 0:n.localized_tag_name)||null,wear:(e=>{if(!e)return null;let t=e.match(/\(([^)]+)\)$/);if(!t)return null;let s=t[1];return["Factory New","Minimal Wear","Field-Tested","Well-Worn","Battle-Scarred"].includes(s)?s:null})(null==o?void 0:o.market_hash_name)}}),l=a;if("knives"===t?l=a.filter(e=>{var t;return(null==(t=e.type)?void 0:t.toLowerCase().includes("knife"))||e.name.toLowerCase().includes("knife")||e.name.toLowerCase().includes("bayonet")||e.name.toLowerCase().includes("karambit")}):"gloves"===t?l=a.filter(e=>{var t;return(null==(t=e.type)?void 0:t.toLowerCase().includes("gloves"))||e.name.toLowerCase().includes("gloves")}):"aks"===t?l=a.filter(e=>e.name.toLowerCase().includes("ak-47")):"awps"===t?l=a.filter(e=>e.name.toLowerCase().includes("awp")):"m4s"===t&&(l=a.filter(e=>e.name.toLowerCase().includes("m4a4")||e.name.toLowerCase().includes("m4a1"))),l.filter(e=>e.marketHashName).length>0){let e=l.map(e=>
1e.marketHashName).filter(Boolean);try{let t=await fetch("/api/cs2-items/batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({marketHashNames:e})});if(t.ok){let e=await t.json(),s={};Object.entries(e.prices||{}).forEach(e=>{let[t,a]=e;a.lowestSellOrder&&(s[t]=a.lowestSellOrder)}),f(s);let a=[...l].sort((e,t)=>{let a=e.marketHashName&&s[e.marketHashName]||0;return(t.marketHashName&&s[t.marketHashName]||0)-a});u(a)}else u(l)}catch(e){console.error("Error fetching batch prices:",e),u(l)}}else u(l);h(!1)}catch(e){console.error("Error fetching category items:",e),n.o.error("Failed to load items"),h(!1)}},O=(t=[...x],b.trim()&&(t=t.filter(e=>e.name.toLowerCase().includes(b.toLowerCase()))),"All"!==y&&(t=t.filter(e=>{var t;let s=e.name.toLowerCase(),a=(null==(t=e.type)?void 0:t.toLowerCase())||"";switch(y){case"Rifles":return a.includes("rifle")||s.includes("ak-47")||s.includes("m4a")||s.includes("awp")||s.includes("ssg")||s.includes("aug")||s.includes("sg")||s.includes("famas")||s.includes("galil");case"Pistols":return a.includes("pistol")||s.includes("glock")||s.includes("usp")||s.includes("p2000")||s.includes("p250")||s.includes("deagle")||s.includes("desert eagle")||s.includes("five-seven")||s.includes("cz75")||s.includes("tec-9")||s.includes("dual berettas")||s.includes("r8 revolver");case"SMGs":return a.includes("smg")||s.includes("mp")||s.includes("ump")||s.includes("p90")||s.includes("bizon")||s.includes("mac-10");case"Heavy":return a.includes("heavy")||a.includes("shotgun")||a.includes("machinegun")||s.includes("nova")||s.includes("xm1014")||s.includes("mag-7")||s.includes("sawedoff")||s.includes("m249")||s.includes("negev");case"Knives":return a.includes("knife")||s.includes("knife")||s.includes("bayonet")||s.includes("karambit");case"Gloves":return a.includes("gloves")||s.includes("gloves");default:return!0}})),S.length>0&&(t=t.filter(e=>S.some(t=>e.wear===t))),E.length>0&&(t=t.filter(e=>!!(E.includes("StatTrakâ¢")&&e.name.includes("StatTrakâ¢")||E.includes("Souvenir")&&e.name.includes("Souvenir")||E.includes("Normal")&&!e.name.includes("StatTrakâ¢")&&!e.name.includes("Souvenir")))),t),H=O.reduce((e,t)=>e+(t.marketHashName&&g[t.marketHashName]||0),0);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-1.5 sm:gap-2",children:[(0,a.jsxs)("button",{onClick:e=>P(e,"all"),className:"bg-[#1A1A1D] hover:bg-[#2D3035] rounded px-1.5 sm:px-2 py-1 sm:py-1.5 text-center transition-colors cursor-pointer",children:[(0,a.jsx)("p",{className:"text-[10px] sm:text-xs text-[#A0A3A7]",children:"Items"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm font-semibold text-white",children:s.totalItems})]}),(0,a.jsxs)("button",{onClick:e=>P(e,"knives"),className:"bg-[#1A1A1D] hover:bg-[#2D3035] rounded px-1.5 sm:px-2 py-1 sm:py-1.5 text-center transition-colors cursor-pointer",children:[(0,a.jsx)("p",{className:"text-[10px] sm:text-xs text-[#A0A3A7]",children:"Knives"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm font-semibold text-white",children:s.knives})]}),(0,a.jsxs)("button",{onClick:e=>P(e,"gloves"),className:"bg-[#1A1A1D] hover:bg-[#2D3035] rounded px-1.5 sm:px-2 py-1 sm:py-1.5 text-center transition-colors cursor-pointer",children:[(0,a.jsx)("p",{className:"text-[10px] sm:text-xs text-[#A0A3A7]",children:"Gloves"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm font-semibold text-white",children:s.gloves})]}),(0,a.jsxs)("button",{onClick:e=>P(e,"aks"),className:"bg-[#1A1A1D] hover:bg-[#2D3035] rounded px-1.5 sm:px-2 py-1 sm:py-1.5 text-center transition-colors cursor-pointer",children:[(0,a.jsx)("p",{className:"text-[10px] sm:text-xs text-[#A0A3A7]",children:"AKs"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm font-semibold text-white",children:s.aks})]}),(0,a.jsxs)("button",{onClick:e=>P(e,"awps"),className:"bg-[#1A1A1D] hover:bg-[#2D3035] rounded px-1.5 sm:px-2 py-1 sm:py-1.5 text-center transition-colors cursor-pointer",children:[(0,a.jsx)("p",{className:"text-[10px] sm:text-xs text-[#A0A3A7]",children:"AWPs"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm font-semibold text-white",children:s.awps})]}),(0,a.jsxs)("button",{onClick:e=>P(e,"m4s"),className:"bg-[#1A1A1D] hover:bg-[#2D3035] rounded px-1.5 sm:px-2 py-1 sm:py-1.5 text-center transition-colors cursor-pointer",children:[(0,a.jsx)("p",{className:"text-[10px] sm:text-xs text-[#A0A3A7]",children:"M4s"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm font-semibold text-white",children:s.m4s})]})]}),(0,a.jsx)(j.lG,{open:i,onOpenChange:d,children:(0,a.jsxs)(j.Cf,{className:"!max-w-[95vw] sm:!max-w-[90vw] lg:!max-w-[83vw] !w-[95vw] sm:!w-[90vw] lg:!w-[83vw] !h-[90vh] sm:!h-[85vh] lg:!h-[83vh] !max-h-[90vh] sm:!max-h-[85vh] lg:!max-h-[83vh] bg-[#1A1A1D] border-[#2D3035] p-0 flex flex-col",children:[(0,a.jsx)(j.L3,{className:"sr-only",children:W(c)}),(0,a.jsxs)("div",{className:"sticky top-0 z-10 bg-[#1A1A1D] border-b border-[#2D3035] px-3 sm:px-4 md:px-6 py-3 sm:py-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2 sm:mb-4",children:[(0,a.jsx)("div",{children:(0,a.jsx)("h2",{className:"text-lg sm:text-xl md:text-2xl font-bold text-white",children:W(c)})}),(0,a.jsx)("button",{onClick:()=>d(!1),className:"p-1.5 sm:p-2 hover:bg-[#2D3035] rounded-lg transition-colors",children:(0,a.jsx)(w.A,{className:"w-5 h-5 sm:w-6 sm:h-6 text-gray-400 hover:text-white"})})]}),(0,a.jsxs)("div",{className:"flex flex-col lg:flex-row items-stretch lg:items-center gap-2 sm:gap-3",children:[(0,a.jsx)("div",{className:"bg-[#202327] border border-[#2D3035] rounded-lg px-2 sm:px-3 py-1.5 sm:py-2 flex items-center gap-1.5 sm:gap-3 overflow-x-auto",children:A.map(e=>(0,a.jsx)("button",{onClick:()=>D(e),className:"px-2 sm:px-3 py-1.5 sm:py-2 rounded-md font-medium transition-all duration-200 whitespace-nowrap text-xs sm:text-sm ".concat(y===e?"bg-[#2D3035] text-white":"bg-transparent text-[#A0A3A7] hover:bg-[#2D3035] hover:text-white"),children:e},e))}),(0,a.jsx)("input",{type:"text",placeholder:"search",value:b,onChange:e=>v(e.target.value),className:"flex-1 px-3 sm:px-4 py-2 bg-[#202327] border border-[#2D3035] rounded-lg text-white text-sm sm:text-base font-medium placeholder-[#A0A3A7] focus:outline-none focus:border-[#4A9EFF]"}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[(0,a.jsxs)("div",{className:"bg-[#202327] border border-[#2D3035] rounded-lg px-2 sm:px-3 py-1.5 sm:py-2 flex items-center gap-2 sm:gap-3",children:[(0,a.jsxs)("div",{ref:T,className:"relative",children:[(0,a.jsxs)("button",{onClick:()=>L(!B),className:"px-2 sm:px-3 py-1.5 sm:py-2 bg-transparent roun
1ded-md text-[#A0A3A7] text-xs sm:text-sm font-medium transition-all duration-200 cursor-pointer hover:bg-[#2D3035] hover:text-white focus:outline-none flex items-center gap-1 sm:gap-2",children:["Wear",(0,a.jsx)(o.A,{className:"w-3 h-3 sm:w-4 sm:h-4 transition-transform ".concat(B?"rotate-180":"")})]}),B&&(0,a.jsx)("div",{className:"absolute top-full mt-2 left-0 bg-[#202327] border border-[#2D3035] rounded-lg shadow-lg z-50 min-w-[180px]",children:(0,a.jsx)("div",{className:"p-2 space-y-1",children:k.map(e=>(0,a.jsxs)("label",{className:"flex items-center gap-2 px-3 py-2 hover:bg-[#2D3035] rounded cursor-pointer transition-colors",children:[(0,a.jsx)("input",{type:"checkbox",checked:S.includes(e),onChange:()=>{F(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},className:"w-4 h-4 rounded border-[#3D4045] bg-[#1A1A1D] text-[#4A9EFF] focus:ring-[#4A9EFF] focus:ring-offset-0 cursor-pointer"}),(0,a.jsx)("span",{className:"text-sm text-[#A0A3A7] font-medium",children:e})]},e))})})]}),(0,a.jsxs)("div",{ref:X,className:"relative",children:[(0,a.jsxs)("button",{onClick:()=>I(!R),className:"px-2 sm:px-3 py-1.5 sm:py-2 bg-transparent rounded-md text-[#A0A3A7] text-xs sm:text-sm font-medium transition-all duration-200 cursor-pointer hover:bg-[#2D3035] hover:text-white focus:outline-none flex items-center gap-1 sm:gap-2",children:["Special",(0,a.jsx)(o.A,{className:"w-3 h-3 sm:w-4 sm:h-4 transition-transform ".concat(R?"rotate-180":"")})]}),R&&(0,a.jsx)("div",{className:"absolute top-full mt-2 left-0 bg-[#202327] border border-[#2D3035] rounded-lg shadow-lg z-50 min-w-[180px]",children:(0,a.jsx)("div",{className:"p-2 space-y-1",children:C.map(e=>(0,a.jsxs)("label",{className:"flex items-center gap-2 px-3 py-2 hover:bg-[#2D3035] rounded cursor-pointer transition-colors",children:[(0,a.jsx)("input",{type:"checkbox",checked:E.includes(e),onChange:()=>{_(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},className:"w-4 h-4 rounded border-[#3D4045] bg-[#1A1A1D] text-[#4A9EFF] focus:ring-[#4A9EFF] focus:ring-offset-0 cursor-pointer"}),(0,a.jsx)("span",{className:"text-sm text-[#A0A3A7] font-medium",children:e})]},e))})})]})]}),(0,a.jsx)("div",{className:"bg-[#202327] border border-[#2D3035] rounded-lg px-2 sm:px-3 py-1.5 sm:py-2 flex items-center",children:(0,a.jsxs)("div",{className:"text-[#A0A3A7] text-xs sm:text-sm font-medium whitespace-nowrap",children:["items: ",O.length.toLocaleString()]})}),(0,a.jsx)("div",{className:"bg-[#202327] border border-[#2D3035] rounded-lg px-2 sm:px-3 py-1.5 sm:py-2 flex items-center",children:(0,a.jsxs)("div",{className:"text-[#A0A3A7] text-xs sm:text-sm font-medium whitespace-nowrap",children:["price: $",H.toFixed(2)]})})]})]})]}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto px-3 sm:px-4 md:px-6 py-3 sm:py-4",children:p?(0,a.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8 2xl:grid-cols-10 gap-2 sm:gap-3",children:[...Array(40)].map((e,t)=>(0,a.jsx)("div",{className:"aspect-[3/4] bg-[#202327] border border-[#2D3035] rounded-lg animate-pulse"},t))}):0===x.length?(0,a.jsxs)("div",{className:"text-center py-10 sm:py-20",children:[(0,a.jsx)("p",{className:"text-lg sm:text-xl text-[#A0A3A7] mb-2",children:"No items found"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-[#555]",children:"This category is empty"})]}):0===O.length?(0,a.jsxs)("div",{className:"text-center py-10 sm:py-20",children:[(0,a.jsx)("p",{className:"text-lg sm:text-xl text-[#A0A3A7] mb-2",children:"No items found"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-[#555]",children:"Try adjusting your filters"})]}):(0,a.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8 2xl:grid-cols-10 gap-2 sm:gap-3",children:O.map(e=>(0,a.jsx)(N.I,{name:e.name,imageUrl:e.imageUrl||"",nameColor:(e=>{if(e.nameColor)return e.nameColor.startsWith("#")?e.nameColor.substring(1):e.nameColor;let t={Rarity_Common_Weapon:"B0C3D9",Rarity_Uncommon_Weapon:"5E98D9",Rarity_Rare_Weapon:"4B69FF",Rarity_Mythical_Weapon:"8847FF",Rarity_Legendary_Weapon:"D32CE6",Rarity_Ancient_Weapon:"EB4B4B",Rarity_Ancient:"E4AE39",Rarity_Contraband:"F2A400","Consumer Grade":"B0C3D9","Industrial Grade":"5E98D9","Mil-Spec Grade":"4B69FF",Restricted:"8847FF",Classified:"D32CE6",Covert:"EB4B4B",Contraband:"F2A400","High Grade":"4B69FF",Remarkable:"8847FF",Exotic:"D32CE6",Extraordinary:"EB4B4B",Distinguished:"4B69FF",Exceptional:"8847FF",Superior:"D32CE6",Master:"EB4B4B"};return e.rarityName&&t[e.rarityName]?t[e.rarityName]:e.rarity&&t[e.rarity]?t[e.rarity]:"B0C3D9"})(e),marketHashName:e.marketHashName||void 0,price:e.marketHashName?g[e.marketHashName]:void 0,condition:e.wear||void 0},e.id))})})]})})]})}function S(){let{user:e,isAuthenticated:t,loading:s}=(0,r.A)(),[f,v]=(0,l.useState)("top"),[j,N]=(0,l.useState)([]),[w,A]=(0,l.useState)({}),[k,C]=(0,l.useState)(!0),[S,F]=(0,l.useState)(""),[E,_]=(0,l.useState)(!1),[B,L]=(0,l.useState)(!1),[R,I]=(0,l.useState)(null),[T,X]=(0,l.useState)(null),[W,P]=(0,l.useState)(null),[O,H]=(0,l.useState)(!0),[z,G]=(0,l.useState)(!1),[M,U]=(0,l.useState)(null),Y=async e=>{let t=e||f;C(!0);try{let e=await fetch("/api/trade?tab=".concat(t));if(e.ok){let t=await e.json();if(N(t.tradelinks),t.tradelinks.length>0){let e=t.tradelinks.map(e=>e.steamId),s=await fetch("/api/inventory-stats/batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({steamIds:e})});if(s.ok){let e=await s.json();A(e.stats)}}}else throw Error("Failed to fetch tradelinks")}catch(e){console.error("Error fetching tradelinks:",e),I("Failed to load tradelinks")}finally{C(!1)}},$=async()=>
1{if(null==e?void 0:e.id)try{let t=await fetch("/api/user/trade-settings?userId=".concat(e.id));if(t.ok){let e=await t.json();F(e.tradeLink||""),_(e.tradeLink)}}catch(e){console.error("Error fetching user trade link:",e)}};(0,l.useEffect)(()=>{Y()},[]),(0,l.useEffect)(()=>{Y(f)},[f]),(0,l.useEffect)(()=>{t&&(null==e?void 0:e.id)&&$()},[t,null==e?void 0:e.id]);let Z=async t=>{if(t.preventDefault(),!S.trim())return void n.o.error("Please enter a trade link");L(!0),I(null);try{let t=await fetch("/api/trade",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:(null==e?void 0:e.id)||null,tradeLink:S.trim()})});if(t.ok)(await t.json()).isUnclaimed?n.o.success("Trade link posted! Your inventory is being synced. Sign in with Steam to claim your account."):(null==e?void 0:e.id)?(n.o.success("Trade link saved and made public!"),_(S.trim().length>0)):n.o.success("Trade link updated successfully!"),Y();else{let e=await t.json();throw Error(e.error||"Failed to post trade link")}}catch(e){console.error("Error posting trade link:",e),I(e.message),n.o.error(e.message)}finally{L(!1)}},K=async()=>{if(null==e?void 0:e.id){L(!0),I(null);try{let t=await fetch("/api/trade",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e.id,tradeLink:""})});if(t.ok)n.o.success("Trade link removed"),_(!1),F(""),Y();else{let e=await t.json();throw Error(e.error||"Failed to remove link")}}catch(e){console.error("Error removing link:",e),I(e.message),n.o.error(e.message)}finally{L(!1)}}},J=async()=>{if(!(null==e?void 0:e.id))return void n.o.error("You must be logged in to bump");G(!0);try{let t=await fetch("/api/trade/bump",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e.id})}),s=await t.json();t.ok?(n.o.success("Trade link bumped to the top!"),Y()):s.cooldownRemaining?(U(s.cooldownRemaining),n.o.error(s.error)):n.o.error(s.error||"Failed to bump")}catch(e){console.error("Error bumping:",e),n.o.error("Failed to bump")}finally{G(!1)}};return(0,a.jsxs)("div",{className:"min-h-screen bg-[#1A1A1D] pt-20 select-none",children:[(0,a.jsxs)("div",{className:"bg-[#1A1A1D] px-4 md:px-8 py-4 md:py-6 border-b border-[#2D3035]",children:[(0,a.jsx)("h1",{className:"text-2xl md:text-3xl font-bold text-white mb-2",children:"Public Trade Links"}),(0,a.jsx)("p",{className:"text-sm md:text-base text-[#A0A3A7]",children:"Browse and post Steam trade links to connect with other traders"})]}),(0,a.jsxs)("div",{className:"px-4 md:px-8 py-4 md:py-6",children:[(0,a.jsxs)("div",{className:"bg-[#202327] border border-[#2D3035] rounded-lg mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between cursor-pointer hover:bg-[#252830] transition-colors ".concat(O?"p-3":"p-6"),onClick:()=>H(!O),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(i.A,{className:"text-gray-400 ".concat(O?"w-4 h-4":"w-5 h-5")}),(0,a.jsx)("h2",{className:"font-semibold text-white ".concat(O?"text-base":"text-xl"),children:t?"Your Trade Link":"Post Your Trade Link"})]}),O?(0,a.jsx)(o.A,{className:"w-4 h-4 text-[#A0A3A7]"}):(0,a.jsx)(d.A,{className:"w-5 h-5 text-[#A0A3A7]"})]}),!O&&(0,a.jsxs)("div",{className:"px-6 pb-6",children:[!t&&(0,a.jsxs)("div",{className:"bg-blue-500/10 border border-blue-500/30 rounded-lg px-4 py-3 mb-4 flex items-start gap-3",children:[(0,a.jsx)(c.A,{className:"w-5 h-5 text-blue-400 flex-shrink-0 mt-0.5"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-blue-300",children:"Anonymous Posting"}),(0,a.jsx)("p",{className:"text-sm text-blue-200/80",children:"You can post your trade link without logging in. Your inventory will be synced automatically. Sign in later to claim your account and manage your trade link."})]})]}),t&&E?(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm text-[#A0A3A7] mb-3",children:"Your trade link is currently public. You can remove it or update it below."}),(0,a.jsx)("div",{className:"flex items-center justify-between px-4 py-3 bg-[#1A1A1D] border border-[#2D3035] rounded-lg mb-3",children:(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-xs text-[#A0A3A7] mb-1",children:"Your Public Trade Link"}),(0,a.jsx)("p",{className:"text-white text-sm font-mono truncate select-text",children:S})]})}),(0,a.jsxs)("button",{onClick:K,disabled:B,className:"px-4 py-2 bg-red-500/10 border border-red-500/30 hover:bg-red-500/20 text-red-400 font-semibold rounded-lg transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[B&&(0,a.jsx)(m.A,{className:"w-4 h-4 animate-spin"}),"Remove Trade Link"]}),R&&(0,a.jsxs)("div",{className:"mt-3 px-4 py-3 bg-red-500/10 border border-red-500/30 rounded-lg flex items-center gap-2",children:[(0,a.jsx)(c.A,{className:"w-4 h-4 text-red-400 flex-shrink-0"}),(0,a.jsx)("p",{className:"text-sm text-red-400",children:R})]})]}):(0,a.jsx)("form",{onSubmit:Z,className:"space-y-4",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm text-[#A0A3A7] mb-3",children:"Add your Steam trade link. You can find it in your Steam inventory settings. All trade links are public."}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsx)("input",{type:"text",placeholder:"https://steamcommunity.com/tradeoffer/new/?partner=XXXXXXX&token=XXXXXXXX",value:S,onChange:e=>F(e.target.value),className:"flex-1 px-4 py-2.5 bg-[#1A1A1D] border border-[#2D3035] rounded-lg text-white placeholder-[#555] focus:outline-none focus:border-[#4A9EFF] transition-colors font-medium text-sm"}),(0,a.jsxs)("button",{type:"submit",disabled:B||!S.trim(),className:"px-6 py-2.5 bg-[#2D3035] hover:bg-[#3D4045] text-white font-semibold rounded-lg transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:[B&&(0,a.jsx)(m.A,{className:"w-4 h-4 animate-spin"}),"Post Link"]})]}),R&&(0,a.jsxs)("div",{className:"mt-3 px-4 py-3 bg-red-500/10 border border-red-500/30 rounded-lg flex items-center gap-2",children:[(0,a.jsx)(c.A,{className:"w-4 h-4 text-red-400 flex-shrink-0"}),(0,a.jsx)("p",{className:"text-sm text-red-400",children:R})]})]})})]})]}),(0,a.jsxs)("div",{className:"bg-blue-500/10 border border-blue-500/30 rounded-lg px-4 py-3 mb-6 flex items-start gap-3",children:[(0,a.jsx)(c.A,{className:"w-5 h-5 text-blue-400 flex-shrink-0 mt-0.5"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-blue-300 mb-1",children:"Looking for specific skins?"}),(0,a.jsxs)("p",{className:"text-sm text-blue-200/80",children:["Browse and search through all available skins in user inventories on the"," ",(0,a.jsx)(b(),{href:"/skins",className:"text-blue-400 hover:text-blue-300 underline font-semibold",children:"Skins page"})]})]})]}),(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 border-b border-[#2D3035]",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1 sm:gap-2 overflow-x-auto",children:[(0,a.jsx)("button",{onClick:()=>v("top"),className:"px-3 sm:px-4 py-2 sm:py-3 font-medium text-sm sm:text-base transition-all duration-200 border-b-2 whitespace-nowrap ".concat("top"===f?"border-[#4A9EFF] text-white":"border-transparent text-[#A0A3A7] hover:text-white"),children:"Top"}),(0,a.jsx)("button",{onClick:()=>v("newest"),className:"px-3 sm:px-4 py-2 sm:py-3 font-medium text-sm sm:text-base transition-all duration-200 border-b-2 whitespace-nowrap ".concat("newest"===f?"border-[#4A9EFF] text-white":"border-transparent text-[#A0A3A7] hover:text-white"),children:"Newest"}),(0,a.jsx)("button",{onClick:()=>v("most-expensive"),className:"px-3 sm:px-4 py-2 sm:py-3 font-medium text-sm sm:text-base transition-all duration-200 border-b-2 whitespace-nowrap ".concat("most-expensive"===f?"border-[#4A9EFF] text-white":"border-transparent text-[#A0A3A7] hover:text-white"),children:"Most Expensive"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[t&&E&&"top"===f&&(0,a.jsxs)("button",{onClick:J,disabled:z||null!==M,className:"px-3 py-2 bg-green-500/10 border border-green-500/30 rounded-lg text-green-400 text-sm font-medium hover:bg-green-500/20 transition-all duration-200 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed mb-[-2px]",children:[z?(0,a.jsx)(m.A,{className:"w-4 h-4 animate-spin"}):(0,a.jsx)(x.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:null!==M?"Bump (".concat(M,"m)"):"Bump"})]}),(0,a.jsxs)("button",{onClick:()=>Y(),disabled:k,className:"px-3 py-2 bg-[#202327] border border-[#2D3035] rounded-lg text-[#A0A3A7] text-sm font-medium hover:bg-[#2D3035] hover:text-white transition-all duration-200 flex items-center gap-2 disabled:opacity-50 mb-[-2px]",children:[(0,a.jsx)(m.A,{className:"w-4 h-4 ".concat(k?"animate-spin":"")}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Refresh"})]})]})]})}),"top"===f&&(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Most Recently Bumped"})}),k?(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 md:gap-4",children:[...Array(6)].map((e,t)=>(0,a.jsx)("div",{className:"bg-[#202327] border border-[#2D3035] rounded-lg p-4 animate-pulse",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-12 h-12 rounded-full bg-[#2a2a2a]"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("div",{className:"h-5 w-32 bg-[#2a2a2a] rounded mb-2"}),(0,a.jsx)("div",{className:"h-4 w-full bg-[#2a2a2a] rounded"})]})]})},t))}):0===j.length?(0,a.jsx)("div",{className:"bg-[#202327] border border-[#2D3035] rounded-lg py-12 md:py-16",children:(0,a.jsxs)("div",{className:"text-center text-[#A0A3A7]",children:[(0,a.jsx)(i.A,{className:"w-12 h-12 md:w-16 md:h-16 mx-auto mb-4 opacity-20"}),(0,a.jsx)("h3",{className:"text-base md:text-lg font-semibold text-white mb-2",children:"No Public Trade Links Yet"}),(0,a.jsx)("p",{className:"text-sm",children:"Be the first to post your trade link!"})]})}):(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 md:gap-4",children:j.map(e=>{let s=w[e.steamId],r=s&&s.totalItems>0;return(0,a.jsxs)("div",{className:"bg-[#202327] border border-[#2D3035] rounded-lg p-4 hover:border-[#3D4045] transition-all duration-200 group",children:[(0,a.jsxs)("div",{className:"flex items-start gap-2 md:gap-3 mb-3",children:[(0,a.jsx)("img",{src:e.avatar||"/default-avatar.png",alt:e.displayName,className:"w-10 h-10 md:w-12 md:h-12 rounded-full border-2 border-[#2D3035] group-hover:border-[#3D4045] transition-colors flex-shrink-0"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-1 sm:gap-2",children:[(0,a.jsx)(b(),{href:"/".concat(e.steamId),className:"text-white text-sm md:text-base font-semibold hover:text-[#A0A3A7] transition-colors inline-block truncate",children:e.displayName}),e.inventoryValue&&e.inventoryValue>0&&(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1 px-2 py-0.5 bg-green-500/10 border border-green-500/30 rounded text-green-400 text-xs font-semibold cursor-help w-fit",onMouseEnter:()=>P(e.id),onMouseLeave:()=>P(null),children:["$",e.inventoryValue.toFixed(2),(0,a.jsx)(u.A,{className:"w-3 h-3"})]}),W===e.id&&(0,a.jsx)("div",{className:"absolute bottom-full left-0 mb-2 w-48 md:w-64 p-3 bg-[#1A1A1D] border border-[#2D3035] rounded-lg shadow-xl z-10",children:(0,a.jsx)("p",{className:"text-xs text-[#A0A3A7]",children:"Prices calculated from cached Steam market data for weapon skins. Does not include all item types."})})]})]}),t?(0,a.jsx)("p",{className:"text-[#A0A3A7] text-xs truncate font-mono mt-1",children:e.tradeLink}):(0,a.jsx)("p",{className:"text-[#A0A3A7] text-xs truncate font-mono mt-1 blur-sm select-none",children:"https://steamcommunity.com/tradeoffer/new/?partner=XXXXXXXXX&token=XXXXXXXX"})]})]}),r&&(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)(D,{stats:s,steamId:e.steamId}),s.topItems&&s.topItems.length>0&&(0,a.jsxs)("div",{className:"space-y-2 mb-3",children:[(0,a.jsx)("p",{className:"text-xs text-[#A0A3A7] font-medium",children:"Top Items:"}
1),(0,a.jsx)("div",{className:"grid grid-cols-5 gap-1",children:s.topItems.map(e=>{var t;let s=(e=>{if(e.nameColor)return e.nameColor.startsWith("#")?e.nameColor.substring(1):e.nameColor;let t={Rarity_Common_Weapon:"B0C3D9",Rarity_Uncommon_Weapon:"5E98D9",Rarity_Rare_Weapon:"4B69FF",Rarity_Mythical_Weapon:"8847FF",Rarity_Legendary_Weapon:"D32CE6",Rarity_Ancient_Weapon:"EB4B4B",Rarity_Ancient:"E4AE39",Rarity_Contraband:"F2A400","Consumer Grade":"B0C3D9","Industrial Grade":"5E98D9","Mil-Spec Grade":"4B69FF",Restricted:"8847FF",Classified:"D32CE6",Covert:"EB4B4B",Contraband:"F2A400","High Grade":"4B69FF",Remarkable:"8847FF",Exotic:"D32CE6",Extraordinary:"EB4B4B",Distinguished:"4B69FF",Exceptional:"8847FF",Superior:"D32CE6",Master:"EB4B4B"};return e.rarityName&&t[e.rarityName]?t[e.rarityName]:e.rarity&&t[e.rarity]?t[e.rarity]:"B0C3D9"})(e);return(0,a.jsx)(y,{name:e.name,imageUrl:(t=e.imageUrl)?t.startsWith("http")?t:"https://community.fastly.steamstatic.com/economy/image/".concat(t):"",nameColor:s},e.id)})})]})]}),(0,a.jsx)("div",{className:"flex items-center gap-2",children:t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{onClick:()=>{var t,s;return t=e.tradeLink,s=e.id,void(navigator.clipboard.writeText(t),X(s),n.o.success("Trade link copied to clipboard!"),setTimeout(()=>X(null),2e3))},className:"flex-1 px-2 md:px-3 py-2 bg-[#1A1A1D] border border-[#2D3035] rounded-lg text-[#A0A3A7] text-xs md:text-sm font-medium hover:bg-[#2D3035] hover:text-white transition-all duration-200 flex items-center justify-center gap-1 md:gap-2",children:T===e.id?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p.A,{className:"w-4 h-4 text-green-400"}),(0,a.jsx)("span",{children:"Copied"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(h.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Copy"})]})}),(0,a.jsxs)("button",{onClick:()=>window.open(e.tradeLink,"_blank"),className:"flex-1 px-2 md:px-3 py-2 bg-[#2D3035] hover:bg-[#3D4045] text-white text-xs md:text-sm font-semibold rounded-lg transition-all duration-200 flex items-center justify-center gap-1 md:gap-2",children:[(0,a.jsx)(g.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Open"})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{disabled:!0,className:"flex-1 px-2 md:px-3 py-2 bg-[#1A1A1D] border border-[#2D3035] rounded-lg text-[#A0A3A7] text-xs md:text-sm font-medium transition-all duration-200 flex items-center justify-center gap-1 md:gap-2 cursor-not-allowed opacity-50",children:(0,a.jsx)("span",{children:"Log in"})}),(0,a.jsx)("button",{disabled:!0,className:"flex-1 px-2 md:px-3 py-2 bg-[#2D3035] text-white text-xs md:text-sm font-semibold rounded-lg transition-all duration-200 flex items-center justify-center gap-1 md:gap-2 cursor-not-allowed opacity-50",children:(0,a.jsx)("span",{children:"Log in"})})]})})]},e.id)})})]})]})}},9293:(e,t,s)=>{"use strict";s.d(t,{A:()=>i,AuthProvider:()=>n});var a=s(5155),r=s(2115);let l=(0,r.createContext)(void 0);function n(e){let{children:t}=e,[s,n]=(0,r.useState)(null),[i,o]=(0,r.useState)(!0),d=async e=>{try{let t=await fetch("/api/auth/session?token=".concat(encodeURIComponent(e)));if(t.ok){let e=await t.json();n(e.user)}else localStorage.removeItem("steam_token")}catch(e){console.error("Session check failed:",e),localStorage.removeItem("steam_token")}};return(0,r.useEffect)(()=>{(async()=>{o(!0);let e=new URLSearchParams(window.location.search),t=e.get("auth"),s=e.get("token");if("success"===t&&s){localStorage.setItem("steam_token",s),await d(s);let e=window.location.pathname;window.history.replaceState({},document.title,e)}else{let e=(e=>{var t;let s="; ".concat(document.cookie).split("; ".concat(e,"="));return 2===s.length?null==(t=s.pop())?void 0:t.split(";").shift():null})("session"),t=e||localStorage.getItem("steam_token");t&&(e&&!localStorage.getItem("steam_token")&&localStorage.setItem("steam_token",e),await d(t))}o(!1)})()},[]),(0,a.jsx)(l.Provider,{value:{user:s,loading:i,login:()=>{window.location.href="/api/auth/steam"},logout:()=>{n(null),localStorage.removeItem("steam_token"),window.location.href="/"},isAuthenticated:!!s},children:t})}function i(){let e=(0,r.useContext)(l);if(void 0===e)throw Error("useAuth must be used within an AuthProvider");return e}},9857:(e,t,s)=>{"use strict";s.d(t,{I:()=>i});var a=s(5155),r=s(3209),l=s(2180),n=s(2115);function i(e){let{name:t,imageUrl:s,nameColor:i,condition:o,price:d,onClick:c,marketHashName:m,assetId:x,onPriceLoad:u,useCache:p=!1,disablePriceFetch:h=!1,category:g,inspectLink:f}
1=e,[b,v]=(0,n.useState)(d||null),[y,j]=(0,n.useState)(!1),N=i?i.startsWith("#")?i:"#".concat(i):"#ffffff",w=t.match(/\(([^)]+)\)$/),A=w?w[1]:"",k=o||A,C=A?t.replace(/\s*\([^)]+\)$/,"").trim():t,D=t.includes("StatTrakâ¢")||2===g,S=t.includes("Souvenir")||3===g,F=D?"#FF8C00":S?"#FFD700":N;(0,n.useEffect)(()=>{(async()=>{if(!h&&m&&x&&null===b){j(!0);try{let e=await fetch("/api/steam-price?marketHashName=".concat(encodeURIComponent(m)).concat(p?"&useCache=true":""));if(e.ok){let t=await e.json(),s=t.median_price||t.lowest_price||null;null!==s&&(v(s),u&&u(x,s))}}catch(e){console.error("Error fetching price:",e)}finally{j(!1)}}})()},[h,m,x,b,p,u]);let E=null!=b?b:d,_=null!=E&&"number"==typeof E&&!isNaN(E);return(0,a.jsx)(r.Zp,{className:"bg-[#1b1d24] border-[#1a1a1a] hover:border-[#2d3035] transition-colors cursor-pointer overflow-hidden select-none",style:{aspectRatio:"3/4",width:"100%"},onClick:c,children:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[(0,a.jsxs)(r.Wu,{className:"p-0 flex-1 flex flex-col min-h-0",children:[(0,a.jsxs)("div",{className:"px-2 sm:px-3 pt-1 flex-shrink-0 overflow-visible",children:[(0,a.jsx)("div",{className:"font-medium text-xs sm:text-sm leading-tight truncate",style:{color:F,textShadow:D?"0 0 8px rgba(255, 140, 0, 0.8), 0 0 12px rgba(255, 140, 0, 0.4)":S?"0 0 6px rgba(255, 215, 0, 0.6)":"none",padding:D||S?"4px 8px":void 0,margin:D||S?"-4px -8px":void 0},title:t,children:C}),k&&(0,a.jsx)("div",{className:"text-gray-400 text-[10px] sm:text-xs truncate",children:k})]}),(0,a.jsx)("div",{className:"flex-1 relative min-h-0",children:(0,a.jsx)("div",{className:"w-full h-full relative",style:{background:"linear-gradient(rgba(27, 29, 36, 0) 20%, ".concat(N,"32 100%)")},children:(0,a.jsx)("img",{className:"w-full h-full object-contain p-1 sm:p-2",src:s,alt:t,onError:e=>{e.target.src="/placeholder-item.png"}})})})]}),(0,a.jsx)("div",{className:"h-1 w-full flex-shrink-0",style:{backgroundColor:N}}),(0,a.jsx)("div",{className:"px-2 sm:px-3 py-1.5 sm:py-2 bg-[#1b1d24] flex-shrink-0",children:y&&!_?(0,a.jsx)("div",{className:"text-[10px] sm:text-xs text-gray-400 text-center",children:"Loading price..."}):_?(0,a.jsxs)("div",{className:"flex items-center gap-1 sm:gap-2 justify-center",children:[(0,a.jsx)("img",{src:"/logos/steam.svg",alt:"Steam",className:"h-3 sm:h-4 w-auto object-contain brightness-0 invert opacity-70",onError:e=>{e.target.style.display="none"}}),(0,a.jsxs)("div",{className:"text-sm sm:text-base font-bold text-white",children:["$","number"==typeof E?E.toFixed(2):"0.00"]})]}):(0,a.jsxs)(l.m_,{children:[(0,a.jsx)(l.k$,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center gap-1 sm:gap-2 justify-center cursor-help",children:[(0,a.jsx)("img",{src:"/logos/steam.svg",alt:"Steam",className:"h-3 sm:h-4 w-auto object-contain brightness-0 invert opacity-70",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("div",{className:"text-sm sm:text-base font-bold text-gray-400",children:"-"})]})}),(0,a.jsx)(l.ZI,{className:"bg-[#2D3035] border border-[#3a3f47] text-gray-200 px-3 py-2 max-w-[250px] text-sm leading-snug",sideOffset:5,children:(0,a.jsx)("p",{children:"Ooops, It looks like we aren't tracking the price of this skin, this could be because not many are sold on the steam market!"})})]})})]})})}}},e=>{e.O(0,[9779,9288,4821,6852,8720,6385,6731,8441,1255,7358],()=>e(e.s=4295)),_N_E=e.O()}]);
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.