PageSourceSearch

https://filamentstock-mc3d-34d.pages.dev/assets/CatalogExportModal-BgTRwGew.js

js filamentstock-mc3d-34d.pages.dev collected 2026-10-03 05:13:46 UTC 12,206 bytes, 1 lines download raw bytes

1import{r as m,j as t}from"./vendor-BOlm8uCX.js";import{h as P}from"./pdf-utils-D1GMVauG.js";import{R as B}from"./index-BJHcYcEs.js";import"./firebase-DSvNk5OE.js";function z(n){const p=n.replace("#","").padEnd(6,"0");return{r:parseInt(p.slice(0,2),16),g:parseInt(p.slice(2,4),16),b:parseInt(p.slice(4,6),16)}}function D(n,p,d,f){const b=n.data;for(let u=0;u<b.length;u+=4){if(b[u+3]<10)continue;const y=b[u]/255;b[u]=Math.round(p*y),b[u+1]=Math.round(d*y),b[u+2]=Math.round(f*y)}}const O={};function G(n){return O[n]?Promise.resolve(O[n]):new Promise((p,d)=>{const f=new Image;f.crossOrigin="anonymous",f.onload=()=>{O[n]=f,p(f)},f.onerror=d,f.src=n})}function L({color:n,coloresEspeciales:p,acabadoEfecto:d="Normal",size:f=80}){const b=m.useRef(null),u=3;return m.useEffect(()=>{const y=b.current;if(!y)return;const a=y.getContext("2d");if(!a)return;const i=f*u,l=f*u;y.width=i,y.height=l;const M=d==="Transparente",C=d==="Translúcido",E=d==="Rainbow";G("/spool.png").then(x=>{if(a.clearRect(0,0,i,l),M||C){const r=document.createElement("canvas");r.width=i,r.height=l;const w=r.getContext("2d"),h=10;for(let c=0;c<l;c+=h)for(let e=0;e<i;e+=h)w.fillStyle=(e/h+c/h)%2===0?"#cccccc":"#ffffff",w.fillRect(e,c,h,h);if(w.globalCompositeOperation="destination-in",w.drawImage(x,0,0,i,l),a.drawImage(r,0,0),C){const c=document.createElement("canvas");c.width=i,c.height=l;const e=c.getContext("2d");e.filter="grayscale(1) brightness(1.3) contrast(1.1)",e.drawImage(x,0,0,i,l),e.filter="none";const o=e.getImageData(0,0,i,l),g=z(n);D(o,g.r,g.g,g.b),e.putImageData(o,0,0),a.globalAlpha=.5,a.drawImage(c,0,0),a.globalAlpha=1}return}const S=document.createElement("canvas");S.width=i,S.height=l;const j=S.getContext("2d");j.filter="grayscale(1) brightness(1.3) contrast(1.1)",j.drawImage(x,0,0,i,l),j.filter="none";const N=j.getImageData(0,0,i,l);let T,I,R;if(E){const r=a.createLinearGradient(0,0,i,l);r.addColorStop(0,"#ff0000"),r.addColorStop(.17,"#ff7700"),r.addColorStop(.33,"#ffee00"),r.addColorStop(.5,"#00cc44"),r.addColorStop(.67,"#0066ff"),r.addColorStop(.83,"#8b5cf6"),r.addColorStop(1,"#ff0000"),a.drawImage(x,0,0,i,l),a.globalCompositeOperation="source-in",a.fillStyle=r,a.fillRect(0,0,i,l),a.globalCompositeOperation="multiply",a.drawImage(S,0,0),a.globalCompositeOperation="source-over";return}if(p&&p.length>0){const r=[n,...p],w=r.length,h=document.createElement("canvas");h.width=i,h.height=l;const c=h.getContext("2d"),e=c.createLinearGradient(0,0,i,l);r.forEach((s,v)=>{const W=v/w,A=(v+1)/w;e.addColorStop(W,s),e.addColorStop(Math.max(W,A-.04),s)}),c.fillStyle=e,c.fillRect(0,0,i,l);const o=c.getImageData(0,0,i,l),g=N.data,k=o.data;for(let s=0;s<g.length;s+=4){if(g[s+3]<10)continue;const v=g[s]/255;g[s]=Math.round(k[s]*v),g[s+1]=Math.round(k[s+1]*v),g[s+2]=Math.round(k[s+2]*v)}}else{const r=z(n);T=r.r,I=r.g,R=r.b,D(N,T,I,R)}if(a.putImageData(N,0,0),d==="Silk"||d==="Silk dual"||d==="Shiny/Metal"){const r=a.createLinearGradient(0,0,i,l);r.addColorStop(0,"rgba(255,255,255,0)"),r.addColorStop(.35,"rgba(255,255,255,0)"),r.addColorStop(.5,"rgba(255,255,255,0.45)"),r.addColorStop(.65,"rgba(255,255,255,0)"),r.addColorStop(1,"rgba(255,255,255,0)"),a.globalCompositeOperation="source-atop",a.fillStyle=r,a.fillRect(0,0,i,l),a.globalCompositeOperation="source-over"}d==="Glitter"&&(a.globalCompositeOperation="source-atop",[[.15,.15],[.7,.2],[.5,.55],[.82,.65],[.22,.72],[.6,.38],[.1,.45],[.88,.35],[.4,.82],[.35,.28]].forEach(([w,h])=>{const c=w*i,e=h*l,o=3*u;a.strokeStyle="rgba(255,255,255,0.9)",a.lineWidth=1.5*u,a.beginPath(),a.moveTo(c,e-o),a.lineTo(c,e+o),a.stroke(),a.beginPath(),a.moveTo(c-o,e),a.lineTo(c+o,e),a.stroke(),a.fillStyle="white",a.beginPath(),a.arc(c,e,o*.4,0,Math.PI*2),a.fill()}),a.globalCompositeOperation="source-over")}).catch(x=>console.warn("SpoolCanvas: no se pudo cargar spool.png",x))},[n,p,d,f]),t.jsx("canvas",{ref:b,style:{width:f,height:f,imageRendering:"auto"}})}function $({b:n}){return t.jsxs("div",{style:{marginTop:8,backgroundColor:"#1e293b",borderRadius:10,padding:"8px 6px",width:"100%",textAlign:"center",border:"1px solid rgba(255,255,255,0.08)"},children:[t.jsxs("p",{style:{fontSize:9,color:"#94a3b8",fontWeight:700,textTransform:"uppercase",letterSpacing:1,margin:0,lineHeight:1.3,wordBreak:"break-word"},children:[n.material," - ",n.marca]}),t.jsx("p",{style:{fontSize:11,color:"#f1f5f9",fontWeight:700,margin:"4px 0 0",lineHeight:1.2,wordBreak:"break-word"},children:n.acabadoEfecto||"Normal"}
1),n.colorName&&t.jsx("p",{style:{fontSize:10,color:"#cbd5e1",fontWeight:600,margin:"2px 0 0",lineHeight:1.2,wordBreak:"break-word"},children:n.colorName}),n.coloresEspeciales&&n.coloresEspeciales.length>0&&t.jsxs("div",{style:{display:"flex",gap:4,justifyContent:"center",marginTop:4},children:[t.jsx("div",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:n.color}}),n.coloresEspeciales.map((p,d)=>t.jsx("div",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:p}},d))]})]})}function V({bobinas:n,onClose:p}){const[d,f]=m.useState("Catálogo de Colores"),[b,u]=m.useState(!1),y=m.useRef(null);m.useEffect(()=>{const e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[]);const a=m.useMemo(()=>n.filter(e=>(e.quantityMode==="grams"?e.quantity-(e.usado||0):100-(e.usado||0))>0),[n]),i=m.useMemo(()=>Array.from(new Set(a.map(e=>e.material))).sort(),[a]),[l,M]=m.useState(new Set(a.map(e=>e.id))),[C,E]=m.useState(new Set(i)),x=m.useMemo(()=>a.reduce((e,o)=>(C.has(o.material)&&(e[o.material]||(e[o.material]=[]),e[o.material].push(o)),e),{}),[a,C]),S=m.useMemo(()=>Object.keys(x).sort(),[x]);m.useMemo(()=>{S.forEach(e=>{x[e].sort((o,g)=>(o.color||"").localeCompare(g.color||""))})},[x,S]);const j=e=>{const o=new Set(l);o.has(e)?o.delete(e):o.add(e),M(o)},N=e=>{const o=new Set(C);o.has(e)?o.delete(e):o.add(e),E(o)},T=()=>M(new Set(a.map(e=>e.id))),I=()=>M(new Set),R=()=>/Mobi|Android/i.test(navigator.userAgent)||window.innerWidth<768,r=()=>/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,w=async()=>{if(!y.current)return null;u(!0);const e=R()?3:5;try{return(await P(y.current,{scale:e,useCORS:!0,backgroundColor:"#0f172a",logging:!1,imageTimeout:3e4})).toDataURL("image/png")}catch(o){return console.error(o),alert("Error generando la imagen."),null}finally{u(!1)}},h=async()=>{const e=await w();if(e)if(r()){const o=window.open();o&&(o.document.write(`<img src="${e}" style="max-width:100%" />`),o.document.title=d,setTimeout(()=>o.alert("Mantén pulsada la imagen y guarda en tu carrete."),500))}else{const o=document.createElement("a");o.download=`catalogo_${Date.now()}.png`,o.href=e,o.click()}},c=(e,o)=>S.map(g=>{const k=o?x[g].filter(s=>l.has(s.id)):x[g];return k.length===0?null:t.jsxs("div",{style:{marginBottom:40,backgroundColor:"rgba(30,41,59,0.6)",borderRadius:20,padding:32,border:"1px solid rgba(255,255,255,0.06)"},children:[t.jsx("h2",{style:{fontSize:28,fontWeight:800,color:"#fb923c",marginBottom:28,paddingBottom:12,borderBottom:"2px solid #334155",textTransform:"uppercase",letterSpacing:2},children:g}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"16px 12px"},children:k.map(s=>{const v=l.has(s.id);return t.jsxs("div",{className:`relative flex flex-col items-center transition-opacity ${!v&&!o?"opacity-30":""}`,onClick:()=>!o&&j(s.id),style:{cursor:o?"default":"pointer"},children:[!o&&t.jsx("div",{className:`absolute top-0 right-0 z-10 w-5 h-5 rounded-full flex items-center justify-center border-2 border-white shadow-lg ${v?"bg-emerald-500":"bg-slate-700"}`,children:v&&t.jsx("span",{className:"text-white text-[10px] font-bold",children:"✓"})}),e?t.jsx(L,{color:s.color,coloresEspeciales:s.coloresEspeciales,acabadoEfecto:s.acabadoEfecto,size:100}):t.jsx(B,{color:s.color,coloresEspeciales:s.coloresEspeciales,acabadoEfecto:s.acabadoEfecto,className:"w-24 h-24"}),t.jsx($,{b:s})]},s.id)})})]},g)});return t.jsxs("div",{className:"fixed inset-0 z-[9999] flex flex-col bg-slate-900 overflow-hidden",children:[t.jsx("div",{className:"bg-slate-800 border-b border-slate-700 p-4 shadow-xl z-20 flex-shrink-0",children:t.jsxs("div",{className:"max-w-7xl mx-auto space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"text",value:d,onChange:e=>f(e.target.value),className:"bg-slate-700 text-white font-bold px-4 py-2 rounded-xl border border-slate-600 focus:outline-none focus:ring-2 focus:ring-orange-500 
1w-64 shadow-inner",placeholder:"Título del catálogo..."}),t.jsxs("div",{className:"hidden sm:flex gap-1",children:[t.jsx("button",{onClick:T,className:"text-[10px] font-bold text-blue-400 hover:text-blue-300 px-2 py-1 bg-blue-400/10 rounded ml-2",children:"Marcar todo"}),t.jsx("button",{onClick:I,className:"text-[10px] font-bold text-slate-400 hover:text-slate-300 px-2 py-1 bg-slate-400/10 rounded",children:"Limpiar"})]})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{onClick:p,className:"px-5 py-2 rounded-xl font-bold text-slate-300 hover:bg-slate-700 transition",children:"Cerrar"}),t.jsx("button",{onClick:h,disabled:b,className:"px-6 py-2 rounded-xl font-black bg-blue-600 hover:bg-blue-700 text-white shadow-lg shadow-blue-900/40 disabled:opacity-50 transition-all active:scale-95 flex items-center gap-2",children:b?"⏳ Procesando...":"📥 Exportar catálogo"})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[t.jsx("span",{className:"text-[10px] font-black text-slate-500 uppercase tracking-widest mr-2",children:"Incluir materiales:"}),i.map(e=>t.jsx("button",{onClick:()=>N(e),className:`px-3 py-1 rounded-full text-xs font-bold transition-all ${C.has(e)?"bg-orange-500 text-white shadow-lg shadow-orange-950/20":"bg-slate-700 text-slate-500 hover:bg-slate-600"}`,children:e},e))]})]})}),t.jsxs("div",{className:"flex-1 overflow-auto bg-slate-900/50 p-4 sm:p-8 custom-scrollbar",children:[t.jsx("div",{className:"max-w-[1400px] mx-auto text-center mb-6",children:t.jsx("p",{className:"text-sm text-slate-400",children:"Haz clic en las bobinas para incluirlas o quitarlas del catálogo exportado."})}),t.jsx("div",{className:"max-w-[1400px] mx-auto",children:t.jsxs("div",{style:{backgroundColor:"#0f172a",padding:"64px 48px",borderRadius:32,fontFamily:"system-ui, sans-serif"},children:[t.jsx("h1",{style:{fontSize:48,fontWeight:900,color:"#ffffff",textAlign:"center",marginBottom:48,letterSpacing:"-1px"},children:d}),S.length===0&&t.jsx("p",{className:"text-slate-600 text-center py-20 text-xl font-bold italic",children:"Selecciona materiales para mostrar..."}),c(!1,!1),t.jsxs("div",{style:{marginTop:48,paddingTop:32,borderTop:"2px solid #1e293b",textAlign:"center"},children:[t.jsxs("div",{style:{display:"inline-flex",gap:2,opacity:.8},children:[t.jsx("span",{style:{fontSize:24,fontWeight:800,color:"#ef4444"},children:"Filament"}),t.jsx("span",{style:{fontSize:24,fontWeight:800,color:"#f97316"},children:"Stock"})]}),t.jsx("p",{style:{color:"#334155",fontSize:12,marginTop:8,fontWeight:800,letterSpacing:2,textTransform:"uppercase"},children:"Gestionado con tecnología MC3D"})]})]})})]}),t.jsx("div",{style:{position:"fixed",top:5e3,left:0,width:0,height:0,overflow:"hidden",opacity:0,pointerEvents:"none"},children:t.jsxs("div",{ref:y,style:{backgroundColor:"#0f172a",padding:64,width:1400,fontFamily:"system-ui, sans-serif"},children:[t.jsx("h1",{style:{fontSize:64,fontWeight:900,color:"#ffffff",textAlign:"center",marginBottom:64,letterSpacing:"-2px"},children:d}),c(!0,!0),t.jsxs("div",{style:{marginTop:64,paddingTop:48,borderTop:"4px solid #1e293b",textAlign:"center"},children:[t.jsxs("div",{style:{display:"inline-flex",gap:4},children:[t.jsx("span",{style:{fontSize:42,fontWeight:900,color:"#ef4444"},children:"Filament"}),t.jsx("span",{style:{fontSize:42,fontWeight:900,color:"#f97316"},children:"Stock"})]}),t.jsx("p",{style:{color:"#334155",fontSize:18,marginTop:12,fontWeight:800,letterSpacing:4,textTransform:"uppercase"},children:"Gestionado con tecnología MC3D"})]})]})})]})}export{V 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.