PageSourceSearch

https://craftednba.com/_nuxt/CKnflnwO.js

js craftednba.com collected 2026-09-25 04:09:33 UTC 7,422 bytes, 1 lines download raw bytes

1import{B as R}from"./DqytqhMF.js";import{b as me,a as fe,_ as G}from"./Cvj0N87t.js";import{_ as H}from"./CRhvSmDv.js";import{_ as I,f as S,m as ge}from"./DSoPTfVt.js";import{_ as J}from"./DE4V5ooM.js";import{_ as pe}from"./B6j7NZjT.js";import{u as be}from"./BOtSYfVo.js";import{u as he,e as ye,d as U,c as ve,f as _e,g as xe}from"./DSyCuNMx.js";import{d as we,K as ke,a1 as Ce,h as $e,r as i,c as v,a as u,o,f as l,N as q,C as M,S as p,g as T,t as m,u as t,b as r,F as Q,e as W,n as Se}from"./BYqnAuL0.js";import{u as Be,a as Ne}from"./MIE6oNig.js";import"./YqDXYfx2.js";import"./BZUULpVR.js";import"./CUNx5ddX.js";import"./Cn47PXVM.js";import"./DcFRjnso.js";import"./VQPwOC_5.js";const Pe={class:"space-y-5 py-5 sm:space-y-6 sm:py-6"},Re={class:"flex flex-col gap-4"},Me={class:"wb-notch flex flex-1 gap-4 border border-maroon-light/30 bg-gradient-to-br from-maroon-med/20 to-transparent p-4"},Te={class:"wb-hex flex h-14 w-14 shrink-0 items-center justify-center border border-maroon-light/40 bg-maroon-med/15 text-maroon-light"},Oe={class:"min-w-0 flex-1"},Ee={key:0,class:"space-y-3"},Le={class:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5"},Ae=["disabled","onClick"],ze={key:1,class:"flex flex-col items-center gap-2 motion-safe:animate-[pulse_0.4s_ease]"},Fe={class:"text-xs font-semibold uppercase tracking-wider text-yellow-light"},Ve={key:0,class:"py-8 text-center text-sm text-tan-med/50"},je={key:1,class:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4"},De={class:"wb-notch-both flex w-full max-w-[170px] flex-col items-center gap-2 border border-white/[0.08] bg-white/[0.03] px-3 py-2.5"},Ke={class:"wb-ledger text-base font-bold text-yellow-light lg:text-xl"},Ge={key:0,type:"button",disabled:"",class:"wb-notch-sm min-h-[44px] w-full bg-green-med/20 px-3 py-2 font-heading text-xs font-bold uppercase tracking-wider text-green-med"},He=["disabled","onClick"],it=we({__name:"market",async setup(Ie){let _,O;ke({title:"Market — Crafted Clash",meta:[{name:"robots",content:"noindex, follow"}]});const{budget:x,owned:X,isOwned:Y,rosterFull:f,buyPlayer:Z,openCombine:ee,commitCombine:te,pendingCombine:E,ready:w,isCloud:k,ROSTER_CAP:ae,PACK_PRICE:L}=he(),{allPlayers:B}=([_,O]=Ce(()=>be()),_=await _,O(),_);$e(async()=>{var a;const e=Be(),s=Ne();await Promise.all([e.ensureLoaded(),s.ensureLoaded()]),await ie(),(a=E.value)!=null&&a.length&&(c.value=[...E.value])});const A=v(()=>xe(B.data.value||[])),se=v(()=>new Map((B.data.value||[]).map(e=>[e.slug,e])));function z(e){const s=se.value.get(e);return s?U(s,A.value):null}const C=i(!1),g=i([]),F=i([]),$=i([]),c=i([]),N=i(null),V=i(""),b=i(""),j=i("good"),D=i(""),n=i(!1),oe=v(()=>c.value.map(e=>z(e)).filter(e=>!!e)),ne=v(()=>k.value&&!w.value?"…":S(x.value)),K=v(()=>(!k.value||w.value)&&!f.value&&(c.value.length>0||x.value>=L));function h(e){return _e(e)}function P(e){return k.value&&!w.value?!0:f.value||x.value<h(e)}function le(e){return f.value?"Roster full":x.value<h(e)?"Too rich":"Buy"}function d(e,s="good"){b.value=e,j.value=s,setTimeout(()=>{b.value===e&&(b.value="")},3200)}function re(){const e=ge(),s=Math.floor(e/36e5),a=Math.floor(e%36e5/6e4);D.value=`${s}h ${a}m`}async function ie(){const e=B.data.value||[],s=ye(e);F.value=s.map(a=>U(a,A.value));try{const a=await $fetch("/api/clash/market");if($.value=a.slugs||[],g.value=$.value.map(y=>z(y)).filter(y=>!!y),!g.value.length)throw new Error("empty board")}catch{g.value=ve(e),$.value=g.value.map(a=>a.slug)}re(),C.value=!0}async function ue(e){if(!(P(e)||n.value)){n.value=!0;try{await Z(e.slug,h(e))?d(`Signed ${e.name} for ${S(h(e))}.`,"good"):f.value?d("Roster full — cut someone first.","bad"):d("Not enough budget — or they’re off today’s board.","bad")}finally{n.value=!1}}}async function de(){if(!(!C.value||!K.value||n.value)&&!c.value.length){n.value=!0;try{const e=await ee(F.value,$.value);if(!e.ok){e.reason==="full"?d("Roster full — cut someone before the Combine.","bad"):e.reason==="funds"?d("Not enough budget for the Combine.","bad"):d("No new players left to draw.","bad");return}c.value=e.offers||[],e.resumed?d("Resuming your open Combine.","info"):d("Five on the table — sign one.","good")}finally{n.value=!1}}}async function ce(e){if(!(n.value||f.value)){n.value=!0;try{const s=await te(e.slug);
1if(!s.ok){d("Couldn’t sign that player.","bad");return}N.value=e,V.value=`${s.rarity||e.rarity} — signed!`,c.value=[],d(`Signed ${e.name} from the Combine.`,"good")}finally{n.value=!1}}}return(e,s)=>(o(),u("div",Pe,[l(pe,{title:"The market",subtitle:`Seven faces today, plus the Combine when you've saved up. New board in ${t(D)||"…"}.`,kicker:"Signings desk"},{meta:p(()=>[l(H,null,{default:p(()=>[l(I,{name:"roster"}),T(" "+m(t(X).length)+"/"+m(t(ae)),1)]),_:1}),l(H,{tone:"gold"},{default:p(()=>[T(m(t(ne)),1)]),_:1})]),_:1},8,["subtitle"]),t(b)?(o(),q(J,{key:0,message:t(b),kind:t(j)},null,8,["message","kind"])):M("",!0),t(k)&&!t(w)?(o(),q(J,{key:1,message:"Syncing your budget before you spend…",kind:"info"})):M("",!0),l(me,{title:"Sync your wallet",message:"Sign in so buys, packs, and budget carry across devices.",context:"Market purchases stick to your CraftedNBA account once you sign in."}),l(G,{title:"The Combine",meta:"Reveal 5 · sign 1"},{default:p(()=>[r("div",Re,[r("div",Me,[r("span",Te,[l(I,{name:"pack",class:"text-2xl"})]),r("div",Oe,[s[0]||(s[0]=r("h3",{class:"mb-1 font-heading text-lg uppercase tracking-wider text-tan-lighter"}," Combine ",-1)),s[1]||(s[1]=r("p",{class:"mb-3 text-sm leading-relaxed text-tan-med/60"}," Pay once, see five names not on today's board, sign one. The other four walk — no s
1alvage, no junk. ",-1)),l(fe,{type:"button",disabled:!t(C)||!t(K)||t(n),onClick:de},{default:p(()=>[T(m(t(c).length?"Resume Combine":`Open · ${t(S)(t(L))}`),1)]),_:1},8,["disabled"])])]),t(c).length?(o(),u("div",Ee,[s[2]||(s[2]=r("p",{class:"text-xs font-semibold uppercase tracking-wider text-yellow-light"}," Pick one to sign ",-1)),r("div",Le,[(o(!0),u(Q,null,W(t(oe),a=>(o(),u("div",{key:a.slug,class:"flex flex-col items-center gap-2"},[l(R,{battler:a,size:100,class:"w-full max-w-[150px]"},null,8,["battler"]),r("button",{type:"button",class:"wb-notch-sm min-h-[44px] w-full max-w-[150px] bg-gradient-to-b from-maroon-light to-maroon-dark px-3 py-2 font-heading text-xs font-bold uppercase tracking-wider text-tan-lighter shadow-[0_3px_0_#442524] disabled:opacity-40",disabled:t(n)||t(f),onClick:y=>ce(a)}," Sign ",8,Ae)]))),128))])])):t(N)?(o(),u("div",ze,[l(R,{battler:t(N),size:120},null,8,["battler"]),r("span",Fe,m(t(V)),1)])):M("",!0)])]),_:1}),l(G,{title:"Today's board",meta:`${t(g).length} players · Eastern reset`},{default:p(()=>[t(C)?(o(),u("div",je,[(o(!0),u(Q,null,W(t(g),a=>(o(),u("div",{key:a.slug,class:"flex flex-col items-center gap-2"},[l(R,{battler:a,size:100,class:"w-full max-w-[170px]"},null,8,["battler"]),r("div",De,[r("div",Ke,m(t(S)(h(a))),1),t(Y)(a.slug)?(o(),u("button",Ge," Owned ")):(o(),u("button",{key:1,type:"button",class:Se(["wb-notch-sm min-h-[44px] w-full px-3 py-2 font-heading text-xs font-bold uppercase tracking-wider transition disabled:cursor-default",P(a)?"bg-white/10 text-tan-med/40":"bg-gradient-to-b from-maroon-light to-maroon-dark text-tan-lighter shadow-[0_3px_0_#442524]"]),disabled:P(a)||t(n),onClick:y=>ue(a)},m(le(a)),11,He))])]))),128))])):(o(),u("div",Ve," Stocking the market… "))]),_:1},8,["meta"])]))}});export{it as default};

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.