1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8452],{13280:(e,t,l)=>{"use strict";l.a(e,async(e,n)=>{try{l.r(t),l.d(t,{default:()=>z});var r=l(1503),s=l(95674),i=l(35676),a=l(80982),u=l(29651),o=l(52810),c=l(28532),d=l(27398),h=l(13162),g=l(74408),x=l(65640),p=l(78767),j=l(29601),f=l(1016),w=l(25036),y=l(48909),b=l(83967),m=l(38334),S=l(96103),$=l(46025),_=l(24193),C=l(24179),k=l(72223),E=e([a,u,o]);[a,u,o]=E.then?(await E)():E;let z=(0,C.PA)(()=>{let{router:e,gameId:t,location:l,drugSlug:n}=(0,o.Gu)(),[s,b]=(0,k.useState)(),[m,S]=(0,k.useState)(),[$,C]=(0,k.useState)(0),[E,z]=(0,k.useState)(0),[M,P]=(0,k.useState)(0),{account:B}=(0,_.F7)(),{game:q}=(0,o.TG)(),{toast:T}=(0,h.d)();(0,k.useEffect)(()=>{if(!q||!l||!n)return;let e=q.configStore.getDrug(q.seasonSettings.drugs_mode,n);b(e);let t=(q.markets.marketsByLocation.get(l.location)||[]).find(t=>t.drug===e?.drug);if(!t)return;let r=q.drugs.quantity>0&&q.drugs?.drug?.drug===e?.drug?q.drugs.quantity:0;z(r);let s=0===q.drugs.quantity||!q.drugs?.drug||q.drugs?.drug?.drug===e?.drug,i=r;if(s&&t){let l=Math.floor(q.player.cash/t.price)+r,n=q.items.transport.stat,s=Math.floor(n/e.weight);i=Math.min(l,s),P(i)}else P(r);let a=r;a=0===r?i:i===r?0:r,C(a),S(t)},[l,q,n]);let A=(0,k.useCallback)(async()=>{(0,d.Ak)(d.tk.Trade);try{if($===E)return void e.push(`/${t}/${l.location}`);let n=$>E,r=Math.abs($-E),i={direction:n?c.w_.Buy:c.w_.Sell,drug:s?.drug_id,quantity:r,cost:r*m.price};q?.pushCall(i)}catch(e){console.log(e)}e.push(`/${t}/${l.location}`)},[$,E,t,l,s,e,q,m]);return e.isReady&&q&&s&&m?(0,r.jsx)(a.PE,{leftPanelProps:{title:s.name,prefixTitle:"The market",imageSrc:"/images/dealer.png"},footer:(0,r.jsx)(a.wi,{children:(0,r.jsxs)(u.Zj,{children:[(0,r.jsx)(x.$,{w:["full","auto"],px:["auto","20px"],onClick:()=>e.back(),children:"Back"}),($===M&&$>E||$===E&&E>0&&M>E)&&(0,r.jsxs)(x.$,{w:["full","auto"],px:["auto","20px"],onClick:()=>{let n=M-E,r={direction:c.w_.Buy,drug:s?.drug_id,quantity:n,cost:n*m.price};q?.pushCall(r),e.push(`/${t}/${l.location}`)},children:["Buy Max (",M-E,")"]}),$!==E&&$!==M&&$>0&&(0,r.jsx)(x.$,{w:["full","auto"],px:["auto","20px"],onClick:A,children:$>E?`Buy (${$-E})`:`Sell (${E-$})`}),E>0&&!($<E&&$>0&&$!==M)&&($!==M||M!==E)&&(0,r.jsxs)(x.$,{w:["full","auto"],px:["auto","20px"],onClick:()=>{let n={direction:c.w_.Sell,drug:s?.drug_id,quantity:E,cost:E*m.price};q?.pushCall(n),e.push(`/${t}/${l.location}`)},children:["Sell All (",E,")"]})]})}),children:(0,r.jsxs)(p.a,{w:"full",margin:"auto",children:[(0,r.jsxs)(j.Z,{variant:"pixelated",p:[3,6],mb:[3,6],_hover:{},align:"center",children:[(0,r.jsx)(f._,{src:`/images/drugs/${s.drug.toLowerCase()}.svg`,alt:s.name,h:[160,300],maxH:"30vh"}),(0,r.jsxs)(w.z,{w:"100%",justifyContent:"space-between",fontSize:"16px",children:[(0,r.jsx)(w.z,{children:(0,r.jsxs)(y.E,{children:[(0,r.jsx)(i.C,{mb:1}),(0,r.jsx)("span",{children:m.weight})]})}),(0,r.jsxs)(w.z,{children:[s.icon({boxSize:"36px"}),(0,r.jsx)(y.E,{children:(0,g.nd)(m.price)})]})]})]}),(0,r.jsx)(v,{drug:s,game:q,market:m,currentInventory:E,initialQuantity:$,onChange:e=>{C(e)}})]})}):(0,r.jsx)(r.Fragment,{})}),v=(0,C.PA)(({game:e,drug:t,market:l,currentInventory:n,initialQuantity:a,onChange:u})=>{let[o,c]=(0,k.useState)(a),[d,h]=(0,k.useState)(0),[x,j]=(0,k.useState)(null),[f,_]=(0,k.useState)(!1);(0,k.useEffect)(()=>{if(!(0===e.drugs.quantity||!e.drugs?.drug||e.drugs?.drug?.drug===t?.drug)){j(`Inventory full with ${e.drugs?.drug?.name}. Sell it first to buy ${t.name}.`),h(n),f||(c(a),_(!0));return}let r=Math.floor(e.player.cash/l.price)+n,s=e.items.transport.stat,i=Math.floor(s/t.weight),u=Math.min(r,i);j(null),h(u),f||(c(a),_(!0))},[t,e,l,n,a,f]),(0,k.useEffect)(()=>{u(o)},[o,u]);let C=(0,k.useCallback)(()=>{o>0&&c(o-1)},[o]),E=(0,k.useCallback)(()=>{o<d&&c(o+1)},[o,d]),z=(0,k.useCallback)(e=>{c(e)},[]),v=Math.abs(o-n),M=o>n,P=o<n,B=M||P?v*l.weight:o*l.weight,q=M||P?v*l.price:o*l.price,T=d>0?n/d*100:0,A=d>0?o/d*100:0;return(0,r.jsx)(b.m,{label:x,isOpen:null!==x,placement:"top",hasArrow:!0,bg:"red.600",color:"white",children:(0,r.jsxs)(m.T,{w:"full",children:[(0,r.jsxs)(S.s,{w:"100%",direction:["column","row"],justifyContent:"space-between",align:"center",gap:["10px","20px"],fontSize:"13px",children:[(0,r.jsxs)(w.z,{children:[(0,r.jsxs)(y.E,{textStyle:"subheading",color:"neon.500",children:[M?"Buying":P?"Selling":"Holding",":"]}),(0,r.jsxs)(y.E,{textStyle:"subheading",children:[(0,r.jsx)(i.C,{mb:1}),(0,r.jsx)("span",{children:B})]})]}),(0,r.jsxs)(w.z,{children:[(0,r.jsxs)(y.E,{textStyle:"subheading",color:"neon.500",children:[M?"Cost":P?"Earn":"Value",":"]}),(0,r.jsx)(y.E,{textStyle:"subheading",children:q?(0,g.nd)(q):"$0"})]})]}),(0,r.jsxs)(w.z,{w:"100%",py:2,children:[(0,r.jsx)(p.a,{}),(0,r.jsxs)($.Ap,{"aria-label":"slider-quantity",w:"100%",min:0,max:d,step:1,defaultValue:1,value:o,onChange:z,children:[(0,r.jsxs)($.hB,{children:[o<n&&(0,r.jsx)(p.a,{position:"absolute",left:`${A}%`,h:"100%",w:`${T-A}%`,bg:"yellow.400",clipPath:`polygon(${(0,g.bu)(2,2)})`}),o>n&&(0,r.jsx)(p.a,{position:"absolute",left:`${T}%`,h:"100%",w:`${A-T}%`,bg:"neon.200",clipPath:`polygon(${(0,g.bu)(2,2)})`})]}),(0,r.jsx)($.OQ,{bg:o<n?"yellow.400":"neon.200"})]}),(0,r.jsxs)(w.z,{spacing:"0",children:[(0,r.jsx)(s.jX,{direction:"down",boxSize:["36px","48px"],cursor:"pointer",onClick:C,color:"neon.500",_hover:{color:"neon.300"}}),(0,r.jsx)(s.jX,{direction:"up",boxSize:["36px","48px"],cursor:"pointer",onClick:E,color:"neon.500",_hover:{color:"neon.300"}})]})]})]})})});n()}catch(e){n(e)}})},48350:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/[gameId]/[locationSlug]/[drugSlug]",function(){return l(13280)}])}},e=>{e.O(0,[636,6593,8792],()=>e(e.s=48350)),_N_E=e.O()}]); 2//# sourceMappingURL=[drugSlug]-67e0819fa61629ae.js.map
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.