import{an as M,J as w,ao as z,d as H,o as s,c as o,K as j,g as u,L as B,h as p,a as n,n as A,t as c,p as N,z as P,r as L,G as E,W as F,l as V,u as b,R as I,m as T,e as k,k as q,X as D,b as Z,F as Q,f as O}from"./index-DjHCcdXI.js";import{I as K}from"./PhClock.vue-BkinjMty.js";function R(e=""){if(!M())throw new Error("vue-query hooks can only be used inside setup() function or functions that support injection context.");const a=z(e),t=w(a);if(!t)throw new Error("No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library.");return t}const W=["width","height","fill","transform"],G={key:0},U=n("path",{d:"M208,52H182.42L170,33.34A12,12,0,0,0,160,28H96a12,12,0,0,0-10,5.34L73.57,52H48A28,28,0,0,0,20,80V192a28,28,0,0,0,28,28H208a28,28,0,0,0,28-28V80A28,28,0,0,0,208,52Zm4,140a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4H80a12,12,0,0,0,10-5.34L102.42,52h51.15L166,70.66A12,12,0,0,0,176,76h32a4,4,0,0,1,4,4ZM128,84a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,84Zm0,72a24,24,0,1,1,24-24A24,24,0,0,1,128,156Z"},null,-1),J=[U],X={key:1},Y=n("path",{d:"M208,64H176L160,40H96L80,64H48A16,16,0,0,0,32,80V192a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V80A16,16,0,0,0,208,64ZM128,168a36,36,0,1,1,36-36A36,36,0,0,1,128,168Z",opacity:"0.2"},null,-1),_=n("path",{d:"M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H80a8,8,0,0,0,6.66-3.56L100.28,48h55.43l13.63,20.44A8,8,0,0,0,176,72h32a8,8,0,0,1,8,8ZM128,88a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,88Zm0,72a28,28,0,1,1,28-28A28,28,0,0,1,128,160Z"},null,-1),ee=[Y,_],te={key:2},ae=n("path",{d:"M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm-44,76a36,36,0,1,1-36-36A36,36,0,0,1,164,132Z"},null,-1),se=[ae],ne={key:3},oe=n("path",{d:"M208,58H179.21L165,36.67A6,6,0,0,0,160,34H96a6,6,0,0,0-5,2.67L76.78,58H48A22,22,0,0,0,26,80V192a22,22,0,0,0,22,22H208a22,22,0,0,0,22-22V80A22,22,0,0,0,208,58Zm10,134a10,10,0,0,1-10,10H48a10,10,0,0,1-10-10V80A10,10,0,0,1,48,70H80a6,6,0,0,0,5-2.67L99.21,46h57.57L171,67.33A6,6,0,0,0,176,70h32a10,10,0,0,1,10,10ZM128,90a42,42,0,1,0,42,42A42,42,0,0,0,128,90Zm0,72a30,30,0,1,1,30-30A30,30,0,0,1,128,162Z"},null,-1),ie=[oe],le={key:4},re=n("path",{d:"M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H80a8,8,0,0,0,6.66-3.56L100.28,48h55.43l13.63,20.44A8,8,0,0,0,176,72h32a8,8,0,0,1,8,8ZM128,88a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,88Zm0,72a28,28,0,1,1,28-28A28,28,0,0,1,128,160Z"},null,-1),ce=[re],ue={key:5},de=n("path",{d:"M208,60H178.13L163.32,37.78A4,4,0,0,0,160,36H96a4,4,0,0,0-3.32,1.78L77.85,60H48A20,20,0,0,0,28,80V192a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V80A20,20,0,0,0,208,60Zm12,132a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V80A12,12,0,0,1,48,68H80a4,4,0,0,0,3.33-1.78L98.13,44h59.72l14.82,22.22A4,4,0,0,0,176,68h32a12,12,0,0,1,12,12ZM128,92a40,40,0,1,0,40,40A40,40,0,0,0,128,92Zm0,72a32,32,0,1,1,32-32A32,32,0,0,1,128,164Z"},null,-1),me=[de],fe={name:"PhCamera"},he=H({...fe,props:{weight:{type:String},size:{type:[String,Number]},color:{type:String},mirrored:{type:Boolean}},setup(e){const a=e,t=w("weight","regular"),r=w("size","1em"),m=w("color","currentColor"),i=w("mirrored",!1),l=p(()=>a.weight??t),g=p(()=>a.size??r),h=p(()=>a.color??m),d=p(()=>a.mirrored!==void 0?a.mirrored?"scale(-1, 1)":void 0:i?"scale(-1, 1)":void 0);return(v,x)=>(s(),o("svg",B({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",width:g.value,height:g.value,fill:h.value,transform:d.value},v.$attrs),[j(v.$slots,"default"),l.value==="bold"?(s(),o("g",G,J)):l.value==="duotone"?(s(),o("g",X,ee)):l.value==="fill"?(s(),o("g",te,se)):l.value==="light"?(s(),o("g",ne,ie)):l.value==="regular"?(s(),o("g",le,ce)):l.value==="thin"?(s(),o("g",ue,me)):u("",!0)],16,W))}}),S=H({__name:"StatusBadge",props:{kind:{},label:{}},setup(e){const a={sale:"bg-white/[.94] text-fg",auction:"bg-amber text-white",new:"bg-primary text-white",reduced:"bg-primary text-white",ending:"bg-danger text-white",dark:"bg-fg text-white"};return(t,r)=>(s(),o("span",{class:A(["inline-flex h-6 items-center gap-1.5 rounded-[6px] px-[9px] text-[11px] font-semibold uppercase tracking-[.04em]",a[e.kind]])},c(e.label),3))}}),ge={class:"relative block h-full w-full"},xe={key:0,class:"absolute inset-0 animate-pulse bg-black/[.06]"},pe=["src","loading"],ve=H({__name:"LoadImg",props:{src:{},eager:{type:Boolean},imgClass:{}},emits:["error"],setup(e,{emit:a}){const t=e,r=a,m=L(null),i=L(!1),l=L(!1),g=()=>{var h;return i.value=!!((h=m.value)!=null&&h.complete)&&m.value.naturalWidth>0};return N(g),P(()=>t.src,()=>{i.value=!1,l.value=!1,E(g)}),(h,d)=>(s(),o("span",ge,[!i.value&&!l.value?(s(),o("span",xe)):u("",!0),n("img",{ref_key:"el",ref:m,src:e.src,alt:"",loading:e.eager?"eager":"lazy",decoding:"async",referrerpolicy:"no-referrer",draggable:"false",class:A(["transition-opacity duration-300",[e.imgClass??"block h-full w-full object-cover",i.value?"opacity-100":"opacity-0"]]),onLoad:d[0]||(d[0]=v=>i.value=!0),onError:d[1]||(d[1]=v=>{l.value=!0,r("error")})},null,42,pe)]))}});async function f(e,a){const t=a?"?"+new URLSearchParams(a).toString():"",r=await fetch(`/api${e}${t}`,{headers:{Accept:"application/json"}});if(!r.ok)throw new Error(`${r.status} ${e}`);return r.json()}const Ge=e=>f("/auctions",e),Ue=e=>f("/auctions/facets",e),ye=e=>f(`/auctions/${e}`),Je=()=>f("/stats/overview"),Xe=e=>f("/sales",e),Ye=e=>f("/sales/facets",e),be=e=>f(`/sales/${e}`),_e=()=>f("/sales/overview"),et=e=>f("/sales/stats",e),$=new Set;function we(e,a="low"){if(!e||$.has(e))return;$.add(e);const t=new Image;t.referrerPolicy="no-referrer",t.fetchPriority=a,t.decoding="async",t.src=e}function ke(e,a="low"){for(const t of e)we(t,a)}function Ae(e,a,t){const r=[a,t];(a==="sale"?e.prefetchQuery({queryKey:r,queryFn:()=>be(t),staleTime:6e4}):e.prefetchQuery({queryKey:r,queryFn:()=>ye(t),staleTime:6e4})).then(()=>{var l;const i=e.getQueryData(r);ke(((l=i==null?void 0:i.images)==null?void 0:l.slice(0,3))??[],"high")})}const He={class:"relative aspect-[4/3] overflow-hidden bg-[#DCE3DF]"},Le={class:"absolute left-2.5 top-2.5 flex gap-1.5"},Ve=["aria-label","aria-pressed"],Ze={key:1,class:"absolute bottom-2 right-2 inline-flex h-[22px] items-center gap-[5px] rounded-[5px] bg-fg/70 px-2 text-[11px] font-medium text-white"},Se={class:"flex flex-1 flex-col gap-2.5 px-4 pb-3 pt-3.5"},$e={class:"flex flex-col gap-[3px]"},Ce={class:"line-clamp-2 text-[15px] font-semibold leading-[1.35] tracking-[-.005em]"},Me={class:"truncate text-[13px] text-fg-muted"},ze={class:"flex flex-wrap items-baseline justify-between gap-2.5"},je={class:"flex flex-wrap items-baseline gap-2"},Be={class:"tnum text-[20px] font-extrabold tracking-[-.01em]"},Ne={key:0,class:"rounded-[5px] bg-primary-soft px-[7px] py-0.5 text-[12px] font-semibold text-primary"},Pe={key:0,class:"tnum text-[12px] text-fg-muted"},Ee={key:0,class:"flex flex-wrap gap-1.5 text-[12.5px] text-fg-muted"},Fe={key:0,class:"h-[3px] w-[3px] rounded-full bg-border-strong"},Ie={key:1,class:"flex items-center justify-between gap-2 rounded-[7px] bg-amber-soft px-2.5 py-2 text-[12.5px] font-medium text-amber-fg"},Te={class:"inline-flex min-w-0 items-center gap-1.5"},qe={class:"truncate"},De={key:0,class:"flex-none text-amber-fg-2"},Qe={class:"mt-auto flex justify-between gap-3 border-t border-border-soft pt-2.5 text-[11.5px] text-fg-subtle"},Oe={class:"truncate"},Ke={key:0,class:"truncate"},tt=H({__name:"PropertyCard",props:{item:{},compact:{type:Boolean},selected:{type:Boolean}},emits:["hover"],setup(e,{emit:a}){const t=e,r=a,m=F(),i=p(()=>m.isSaved(t.item.kind,t.item.id)),l=p(()=>t.item.kind==="auction"),g=R();let h=!1;function d(){h||(h=!0,Ae(g,t.item.kind,t.item.id))}return(v,x)=>(s(),V(b(I),{to:e.item.href,class:A(["group flex flex-col overflow-hidden rounded-[18px] border bg-surface text-fg no-underline shadow-card transition-shadow duration-150 hover:text-fg hover:shadow-card-hover",e.selected?"border-primary ring-2 ring-primary/25":"border-border-soft"]),onMouseenter:x[1]||(x[1]=y=>{r("hover",e.item.id),d()}),onTouchstartPassive:d,onFocus:d,onMouseleave:x[2]||(x[2]=y=>r("hover",null))},{default:T(()=>[n("div",He,[e.item.image?(s(),V(ve,{key:0,src:e.item.image,eager:""},null,8,["src"])):u("",!0),n("div",Le,[k(S,{kind:e.item.badge,label:e.item.status},null,8,["kind","label"]),e.item.second&&!e.compact?(s(),V(S,{key:0,kind:"dark",label:e.item.second},null,8,["label"])):u("",!0)]),n("button",{type:"button","aria-label":i.value?"Odebrat z uložených":"Uložit","aria-pressed":i.value,class:A(["absolute right-2 top-2 grid h-8 w-8 place-items-center rounded-full bg-white/[.92] transition-colors hover:text-danger",i.value?"text-danger":"text-fg"]),onClick:x[0]||(x[0]=q(y=>b(m).toggle(e.item),["prevent","stop"]))},[k(b(D),{size:16,weight:i.value?"fill":"regular"},null,8,["weight"])],10,Ve),e.item.photos>0?(s(),o("span",Ze,[k(b(he),{size:12}),Z(c(e.item.photos),1)])):u("",!0)]),n("div",Se,[n("div",$e,[n("div",Ce,c(e.item.title),1),n("div",Me,c(e.item.location),1)]),n("div",ze,[n("div",je,[n("span",Be,c(e.item.price),1),l.value&&e.item.discount?(s(),o("span",Ne,c(e.item.discount),1)):u("",!0)]),e.item.priceNote&&!e.compact?(s(),o("span",Pe,c(e.item.priceNote),1)):u("",!0)]),e.item.meta.length?(s(),o("div",Ee,[(s(!0),o(Q,null,O(e.item.meta,(y,C)=>(s(),o("span",{key:y,class:"inline-flex items-center gap-1.5"},[C>0?(s(),o("span",Fe)):u("",!0),Z(c(y),1)]))),128))])):u("",!0),l.value?(s(),o("div",Ie,[n("span",Te,[k(b(K),{size:13,class:"flex-none"}),n("span",qe,c(e.item.auctionDate),1)]),e.item.auctionTail?(s(),o("span",De,c(e.item.auctionTail),1)):u("",!0)])):u("",!0),n("div",Qe,[n("span",Oe,c(e.item.source),1),e.item.seller&&!e.compact?(s(),o("span",Ke,c(e.item.seller),1)):u("",!0)])])]),_:1},8,["to","class"]))}});export{he as G,tt as _,_e as a,Ye as b,Ue as c,Ge as d,Xe as e,Je as f,et as g,ve as h,be as i,ye as j,we as k,ke as p,R as u};