2 lines
9.3 KiB
JavaScript
2 lines
9.3 KiB
JavaScript
import{d as j,u as ne,o as ae,a as Q,b as t,c as a,e as s,n as I,F as V,r as O,f as B,g as y,h as R,i as D,_ as G,t as M,j as oe,k as ie,l as re,w as ce,m as e,p as ue,q as i,I as A,s as de,v as Y,x as le,y as _e,z as ve,A as me,K as Z,B as he,C as x,D as ge,E as ee,G as pe,H as U,L as J,J as fe}from"./index-B4LM4kNa.js";import{R as ye}from"./RateStrip-DuN8ppz1.js";import{S as te}from"./SectionHead-DjY6eM3F.js";import{u as ke}from"./filtersStore-D-YivLpz.js";import{u as be}from"./useReveal-CskzQzOa.js";import{u as we}from"./catalogStore-DV_ylhrZ.js";import{P as $e}from"./index-ChsncZLy.js";import"./filters-C-5kUIoJ.js";const Se={key:0,class:"showcase"},Ce=["src"],Pe={key:0,class:"showcase__dots"},xe=["aria-label","onClick"],se=.18,Ie=6,Re=j({__name:"ShowcaseSlider",props:{slides:{}},setup(o){const u=o,l=R(0);let k;const P=ne();function m(n){l.value=n,d()}function d(){k&&clearInterval(k),u.slides.length>1&&!P.isReducedMotion&&(k=setInterval(()=>{l.value=(l.value+1)%u.slides.length},6e3))}ae(d),Q(()=>{k&&clearInterval(k)});const b=R(null),p=R(!1),h=R(0);let v=null,w=0,C=0,g=0,$=!1;function X(n){var f;if(u.slides.length<2||v!==null)return;const r=b.value;r&&(v=n.pointerId,w=n.clientX,C=n.clientY,g=r.getBoundingClientRect().width||1,h.value=0,p.value=!0,$=!1,(f=r.setPointerCapture)==null||f.call(r,n.pointerId))}function E(n){if(!p.value||n.pointerId!==v)return;const r=n.clientX-w,f=n.clientY-C;!$&&Math.abs(r)>Math.abs(f)&&Math.abs(r)>Ie&&($=!0),$&&(h.value=r)}function q(){if(!p.value)return;const r=h.value/g;p.value=!1,v=null,h.value=0,r<=-se&&l.value<u.slides.length-1?l.value++:r>=se&&l.value>0&&l.value--,$&&d(),$=!1}function H(n){n.pointerId===v&&q()}function F(n){n.pointerId===v&&(p.value=!1,v=null,h.value=0,$=!1)}const T=D(()=>{const n=-l.value*100,r=g?h.value/g*100:0;return{transform:`translate3d(${n+r}%, 0, 0)`,transition:p.value?"none":void 0}});return Q(()=>{if(v!==null&&b.value)try{b.value.releasePointerCapture(v)}catch{}}),(n,r)=>o.slides.length?(t(),a("section",Se,[s("div",{ref_key:"root",ref:b,class:B(["showcase__frame",{"is-dragging":p.value}]),onPointerdown:X,onPointermove:E,onPointerup:H,onPointercancel:F},[s("div",{class:"showcase__track",style:I(T.value)},[(t(!0),a(V,null,O(o.slides,(f,z)=>(t(),a("article",{key:f.key,class:B(["showcase__slide",{"is-active":z===l.value}])},[f.image?(t(),a("img",{key:0,src:f.image,alt:"",class:"showcase__art",draggable:"false"},null,8,Ce)):y("",!0)],2))),128))],4)],34),o.slides.length>1?(t(),a("div",Pe,[(t(!0),a(V,null,O(o.slides,(f,z)=>(t(),a("button",{key:f.key,type:"button",class:B(["showcase__dot",{"is-active":z===l.value}]),"aria-label":`اسلاید ${z+1}`,onClick:K=>m(z)},null,10,xe))),128))])):y("",!0)])):y("",!0)}}),ze=G(Re,[["__scopeId","data-v-cfb03dfd"]]),Ae={class:"rail no-scrollbar"},De=["onClick"],Be={class:"rail__mark","aria-hidden":"true"},Me=["src"],Fe={class:"rail__title"},Le=j({__name:"CategoryRail",props:{categories:{},activeId:{}},emits:["select"],setup(o,{emit:u}){const l=u;return(k,P)=>(t(),a("div",Ae,[(t(!0),a(V,null,O(o.categories,m=>{var d;return t(),a("button",{key:m.id,type:"button",class:B(["rail__chip",{"is-active":m.id===o.activeId}]),onClick:b=>l("select",m)},[s("span",Be,[(d=m.icon)!=null&&d.image?(t(),a("img",{key:0,src:m.icon.image,alt:""},null,8,Me)):y("",!0)]),s("span",Fe,M(m.title),1)],10,De)}),128))]))}}),Ve=G(Le,[["__scopeId","data-v-b38bbeb0"]]),Oe={class:"card__art"},Xe=["alt"],Ee={key:0,class:"card__badge"},qe={class:"card__body"},He={class:"card__title"},Ne={class:"card__meta"},Ue={class:"card__weight"},Ye={key:0,class:"card__wage"},je=j({__name:"ShowcaseCard",props:{value:{},wide:{type:Boolean},badge:{}},emits:["open"],setup(o,{emit:u}){const l=o,k=u,P=oe(),{image:m,id:d,title:b,min_gram:p,wage:h}=ie(l.value),v=D(()=>{const w=h.value;return w==null?"":w%1===0?String(w):w.toFixed(2)});return(w,C)=>{const g=re("lazy");return t(),a("article",{class:B(["card",{"card--wide":o.wide}]),"data-product-origin":"",onClick:C[1]||(C[1]=$=>k("open",o.value))},[s("div",Oe,[ce(s("img",{alt:e(b)},null,8,Xe),[[g,e(m)]]),s("button",{type:"button",c
|