PageSourceSearch

https://copees.com/assets/useProductVariants--42ockx6.js

js copees.com collected 2026-10-05 21:41:19 UTC 2,853 bytes, 1 lines download raw bytes

1import{aP as _,ak as l}from"./index-D5YpCUvm.js";const w=e=>_({queryKey:["product-variants",e],queryFn:async()=>{if(!e)return[];const{data:r,error:t}=await l.from("product_variants").select("*").eq("product_id",e).eq("is_active",!0).order("sort_order");if(t)throw t;return r},enabled:!!e}),x=["85x55","55x55","65x65","70x28","90x50","A6","A5","A4","DL","Carré 14x14cm","A6-pellicule","A5-pellicule","A4-pellicule","DL-pellicule","A4 (21x29.7cm)","A3 (29.7x42cm)","A2 (42x59.4cm)","A1 (59.4x84.1cm)","A0 (84.1x118.9cm)"],S=["130-140g","135g","150-200g","170g","200-220g","200-250g","240-300g","240g","250g","250g-texture","300g","300g-feutre","320g","330-360g","400g"],A=["recto","recto-verso"],y=["mat","brillant","soft-touch"],T=e=>{const r=new Set,t=new Set,a=new Set,p=new Set,n=new Set,s=new Set,g=new Set;e.forEach(i=>{i.format&&r.add(i.format),i.paper_type&&t.add(i.paper_type),i.paper_weight&&a.add(i.paper_weight),i.finish&&p.add(i.finish),i.print_zone&&n.add(i.print_zone),i.print_side&&s.add(i.print_side),i.variant_type&&g.add(i.variant_type)});const f=(i,m)=>i.sort((u,h)=>{const o=m.indexOf(u),c=m.indexOf(h);return o===-1&&c===-1?u.localeCompare(h):o===-1?1:c===-1?-1:o-c});return{formats:f(Array.from(r),x),paperTypes:Array.from(t),paperWeights:f(Array.from(a),S),finishes:f(Array.from(p),y),printZones:Array.from(n),printSides:f(Array.from(s),A),variantTypes:Array.from(g)}},d=(e,r)=>e.find(t=>{const a=[];return r.format&&t.format&&a.push(t.format===r.format),r.paperType&&t.paper_type&&a.push(t.paper_type===r.paperType),r.paperWeight&&t.paper_weight&&a.push(t.paper_weight===r.paperWeight),r.finish&&t.finish&&a.push(t.finish===r.finish),r.printZone&&t.print_zone&&a.push(t.print_zone===r.printZone),r.printSide&&t.print_side&&a.push(t.print_side===r.printSide),r.variantType&&t.variant_type&&a.push(t.variant_type===r.variantType),a.length===0||a.every(Boolean)})||e[0]||null,R=(e,r)=>{const t=Object.keys(e).map(n=>parseInt(n)).filter(n=>!isNaN(n)).sort((n,s)=>n-s);if(t.length===0)return 0;if(e[String(r)]!==void 0)return e[String(r)];const a=t[0],p=t[t.length-1];if(r<=a)return e[String(a)];if(r>p){const n=e[String(p)]/p;return r*n}for(let n=0;n<t.length-1;n++){const s=t[n],g=t[n+1];if(r>s&&r<g){const f=e[String(s)],i=e[String(g)],m=(r-s)/(g-s);return f+(i-f)*m}}
1return e[String(p)]},E=(e,r)=>{const t=Object.keys(e).map(o=>parseInt(o)).filter(o=>!isNaN(o)).sort((o,c)=>o-c);if(t.length===0)return 0;const a=t[0],p=t[t.length-1];if(r<a){const c=e[a.toString()]/a;return r*c}if(r>=p){const c=e[p.toString()]/p;return r*c}let n=a,s=p;for(let o=0;o<t.length-1;o++)if(r>=t[o]&&r<t[o+1]){n=t[o],s=t[o+1];break}const g=e[n.toString()],f=e[s.toString()],i=g/n,m=f/s,u=(r-n)/(s-n),h=i+(m-i)*u;return r*h},N=e=>Object.keys(e).map(r=>parseInt(r)).filter(r=>!isNaN(r)).sort((r,t)=>r-t);export{R as a,E as b,T as e,d as f,N as g,w as u};

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.