PageSourceSearch

https://crm.bodezy.com/_next/static/chunks/352.a57a1d69708d5b1d.js

js bodezy.com collected 2026-10-02 01:25:05 UTC 23,620 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[352],{10352:function(e,t,a){a.r(t),a.d(t,{default:function(){return R}});var l=a(57437),i=a(2265),n=a(53121),r=a(79205);let o=(0,r.Z)("MousePointer2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]);var s=a(75277);let c=(0,r.Z)("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]),d=(0,r.Z)("Highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]);var h=a(87769);let u=(0,r.Z)("Stamp",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M19.27 13.73A2.5 2.5 0 0 0 17.5 13h-11A2.5 2.5 0 0 0 4 15.5V17a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-1.5c0-.66-.26-1.3-.73-1.77Z",key:"1sy9ra"}],["path",{d:"M14 13V8.5C14 7 15 7 15 5a3 3 0 0 0-3-3c-1.66 0-3 1-3 3s1 2 1 3.5V13",key:"cnxgux"}]]);var x=a(14064);let p=(0,r.Z)("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);var m=a(18930),f=a(51817),g=a(44743),w=a(92735),y=a(32489),b=a(92451),v=a(10407);let j=(0,r.Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);var k=a(30401),N=a(76865);let C=["#111827","#dc2626","#2563eb","#16a34a","#f59e0b"],M=["#fde047","#86efac","#93c5fd","#fca5a5"],P=()=>Math.random().toString(36).slice(2,10);function S(e){let t=e.replace("#","");return{r:parseInt(t.slice(0,2),16)/255,g:parseInt(t.slice(2,4),16)/255,b:parseInt(t.slice(4,6),16)/255}}function R(e){var t;let{src:r,name:R,conversationId:E,onClose:D,onEnviado:L}=e,[A,T]=(0,i.useState)(null),[U,I]=(0,i.useState)(null),[B,H]=(0,i.useState)(!0),[F,V]=(0,i.useState)(null),[_,W]=(0,i.useState)([]),[O,X]=(0,i.useState)({}),[Y,q]=(0,i.useState)(0),[G,J]=(0,i.useState)([]),[K,Q]=(0,i.useState)([]),[$,ee]=(0,i.useState)([]),[et,ea]=(0,i.useState)(null),[el,ei]=(0,i.useState)(null),[en,er]=(0,i.useState)("mover"),[eo,es]=(0,i.useState)(C[0]),[ec,ed]=(0,i.useState)(M[0]),[eh,eu]=(0,i.useState)(14),[ex,ep]=(0,i.useState)(2.5),[em,ef]=(0,i.useState)(!1),[eg,ew]=(0,i.useState)(null),[ey,eb]=(0,i.useState)(null),[ev,ej]=(0,i.useState)(null),[ek,eN]=(0,i.useState)({w:0,h:0}),[eC,eM]=(0,i.useState)(1),eP=(0,i.useRef)(null),eS=(0,i.useRef)(null),eR=(0,i.useRef)(null),ez=(0,i.useRef)(null),eZ=(0,i.useRef)(null),eE=(0,i.useRef)(null),eD=null!==(t=_[Y])&&void 0!==t?t:0,eL=(0,i.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return((t+(O[e]||0))%360+360)%360},[O]);(0,i.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await Promise.all([a.e(5651),a.e(2957),a.e(1770)]).then(a.t.bind(a,43194,23));t.GlobalWorkerOptions.workerSrc="/pdf.worker.min.js",ez.current=t;let l=await fetch(r);if(!l.ok)throw Error("No se pudo descargar el archivo");let i=await l.arrayBuffer();if(!e)return;let n=new Uint8Array(i);T(n);let o=await t.getDocument({data:n.slice()}).promise;if(!e)return;I(o),W(Array.from({length:o.numPages},(e,t)=>t)),H(!1)}catch(t){e&&(V((null==t?void 0:t.message)||"No se pudo abrir el PDF"),H(!1))}})(),()=>{e=!1}},[r]);let eA=(0,i.useCallback)(async()=>{let e=eS.current,t=eP.current;if(!U||!e||!t||0===_.length)return;let a=_[Math.min(Y,_.length-1)],l=await U.getPage(a+1),i=eL(a,l.rotate||0),n=l.getViewport({scale:1,rotation:i}),r=t.getBoundingClientRect(),o=Math.max(.15,Math.min((r.width-32)/n.width,(r.height-32)/n.height,2.5)),s=Math.min(window.devicePixelRatio||1,2),c=l.getViewport({scale:o*s,rotation:i});e.width=Math.floor(c.width),e.height=Math.floor(c.height),e.style.width="".concat(n.width*o,"px"),e.style.height="".concat(n.height*o,"px");let d=e.getContext("2d");d&&(d.clearRect(0,0,e.width,e.height),await l.render({canvasContext:d,viewport:c}).promise,eN({w:n.width,h:n.height}),eM(o))},[U,_,Y,eL]);(0,i.useEffect)(()=>{eA()},[eA]),(0,i.useEffect)(()=>{let e=()=>eA();return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[eA]),(0,i.useEffect)(()=>{let e=e=>{let t=e.target;!(t&&/INPUT|TEXTAREA/.test(t.tagName))&&("Escape"===e.key?D():("Delete"===e.key||"Backspace"===e.key)&&et&&eU())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[D,et]);let eT=(0,i.useCallback)(e=>{Q(e=>[...e.slice(-40),G]),ee([]),J(e)},[G]);function eU(){et&&(eT(G.filter(e=>e.id!==et)),ea(null))}let eI=(0,i.useCallback)((e,t)=>{var a;let l=null===(a=eR.current)||void 0===a?void 0:a.getBoundingClientRect();return l&&l.width?{x:(e-l.left)/l.width*ek.w,y:(t-l.top)/l.height*ek.h}:{x:0,y:0}},[ek.w,ek.h]);function eB(){if(eE.current){eE.current=null,Q(e=>[...e.slice(-40),G]);return}let e=eZ.current;eZ.current=null,e&&(J(t=>t.filter(t=>t.id!==e.id||("trazo"===t.tipo?t.pts.length>1:"resalte"!==t.tipo&&"tapar"!==t.tipo||t.w>6&&t.h>5))),Q(e=>[...e.slice(-40),G]))}function eH(e,t,a){var l,i;if("mover"!==en)return;e.stopPropagation();let n=eI(e.clientX,e.clientY);ea(t.id);let r="trazo"===t.tipo?0:t.x,o="trazo"===t.tipo?0:t.y;
1eE.current={id:t.id,x:n.x,y:n.y,ox:r,oy:o,modo:a},null===(l=(i=e.target).setPointerCapture)||void 0===l||l.call(i,e.pointerId)}function eF(e){let t=Y+e;t<0||t>=_.length||(W(e=>{let a=[...e];return[a[Y],a[t]]=[a[t],a[Y]],a}),q(t))}let eV=(0,i.useCallback)(async e=>{let t=G.filter(t=>t.pag===e);if(t.some(e=>"tapar"===e.tipo))return!0;if(!t.length)return!1;let a=await U.getPage(e+1);return 0!==eL(e,a.rotate||0)},[G,U,eL]);async function e_(e){return new Promise((t,a)=>{let l=new Image;l.onload=()=>t(l),l.onerror=a,l.src=e})}async function eW(){let{PDFDocument:e,StandardFonts:t,rgb:l,degrees:i}=await a.e(3323).then(a.bind(a,3323));if(!A)throw Error("sin archivo");let n=await e.load(A.slice(),{ignoreEncryption:!0}),r=await e.create(),o=await r.embedFont(t.Helvetica);for(let e=0;e<_.length;e++){let t=_[e],a=await U.getPage(t+1),s=eL(t,a.rotate||0),c=a.getViewport({scale:1,rotation:s});if(await eV(t)){let e=a.getViewport({scale:2,rotation:s}),l=document.createElement("canvas");l.width=Math.floor(e.width),l.height=Math.floor(e.height);let i=l.getContext("2d");for(let n of(i.fillStyle="#fff",i.fillRect(0,0,l.width,l.height),await a.render({canvasContext:i,viewport:e}).promise,!function(e,t,a){for(let l of G.filter(e=>e.pag===t))"resalte"===l.tipo?(e.save(),e.globalAlpha=.35,e.fillStyle=l.color,e.fillRect(2*l.x,2*l.y,2*l.w,l.h*a),e.restore()):"tapar"===l.tipo?(e.save(),e.fillStyle="#000",e.fillRect(l.x*a,l.y*a,l.w*a,l.h*a),e.restore()):"trazo"===l.tipo?(e.save(),e.strokeStyle=l.color,e.lineWidth=l.grosor*a,e.lineJoin="round",e.lineCap="round",e.beginPath(),l.pts.forEac
1h((t,l)=>{let[i,n]=t;return l?e.lineTo(i*a,n*a):e.moveTo(i*a,n*a)}),e.stroke(),e.restore()):"texto"===l.tipo&&(e.save(),e.fillStyle=l.color,e.font="".concat(l.size*a,"px Helvetica, Arial, sans-serif"),e.textBaseline="top",e.fillText(l.texto,l.x*a,l.y*a),e.restore())}(i,t,2),G.filter(e=>e.pag===t&&"sello"===e.tipo))){let e=await e_(n.data);i.drawImage(e,2*n.x,2*n.y,2*n.w,2*n.h)}let n=await r.embedPng(l.toDataURL("image/png"));r.addPage([c.width,c.height]).drawImage(n,{x:0,y:0,width:c.width,height:c.height});continue}let[d]=await r.copyPages(n,[t]),h=r.addPage(d);s&&h.setRotation(i(s));let u=c.height;for(let e of G.filter(e=>e.pag===t))if("resalte"===e.tipo){let t=S(e.color);h.drawRectangle({x:e.x,y:u-e.y-e.h,width:e.w,height:e.h,color:l(t.r,t.g,t.b),opacity:.35})}else if("trazo"===e.tipo){let t=S(e.color);for(let a=1;a<e.pts.length;a++){let[i,n]=e.pts[a-1],[r,o]=e.pts[a];h.drawLine({start:{x:i,y:u-n},end:{x:r,y:u-o},thickness:e.grosor,color:l(t.r,t.g,t.b)})}}else if("texto"===e.tipo){let t=e.texto.replace(/[^\x20-\x7E -ÿ¿¡áéíóúÁÉÍÓÚñÑüÜ€–—“”‘’…·]/g,"");if(!t)continue;let a=S(e.color);h.drawText(t,{x:e.x,y:u-e.y-.82*e.size,size:e.size,font:o,color:l(a.r,a.g,a.b)})}else if("sello"===e.tipo){let t=await r.embedPng(e.data);h.drawImage(t,{x:e.x,y:u-e.y-e.h,width:e.w,height:e.h})}}return await r.save()}function eO(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),new Blob([t],{type:"application/pdf"})}let eX=()=>{let e=(R||"documento").replace(/\.pdf$/i,"").slice(0,60);return"".concat(e,"-editado.pdf")};async function eY(){eb("descargar"),ej(null);try{let e=await eW(),t=URL.createObjectURL(eO(e)),a=document.createElement("a");a.href=t,a.download=eX(),a.click(),setTimeout(()=>URL.revokeObjectURL(t),4e3)}catch(e){ej((null==e?void 0:e.message)||"No se pudo generar el PDF")}finally{eb(null)}}async function eq(){if(E){eb("enviar"),ej(null);try{let e=await eW(),t=new FormData;t.append("file",eO(e),eX());let a=await fetch("/api/conversations/".concat(E,"/media"),{method:"POST",body:t});if(!a.ok){let e=await a.json().catch(()=>null);throw Error((null==e?void 0:e.error)||"No se pudo enviar")}null==L||L(),D()}catch(e){ej((null==e?void 0:e.message)||"No se pudo enviar el PDF")}finally{eb(null)}}}let eG=G.filter(e=>e.pag===eD),eJ=G.some(e=>"tapar"===e.tipo),eK=G.find(e=>e.id===et)||null,eQ=null!==ey;return(0,l.jsxs)("div",{className:"fixed inset-0 z-[80] flex flex-col bg-slate-900/95",onClick:e=>e.stopPropagation(),children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 border-b border-white/10 bg-slate-900 px-3 py-2 text-white",children:[(0,l.jsx)(n.Z,{className:"h-4 w-4 flex-shrink-0 text-sky-400"}),(0,l.jsx)("span",{className:"mr-2 max-w-[26ch] truncate text-sm font-semibold",children:R||"Documento"}),(0,l.jsx)(z,{on:"mover"===en,onClick:()=>er("mover"),title:"Seleccionar y mover",children:(0,l.jsx)(o,{className:"h-4 w-4"})}),(0,l.jsx)(z,{on:"texto"===en,onClick:()=>er("texto"),title:"Escribir texto",children:(0,l.jsx)(s.Z,{className:"h-4 w-4"})}),(0,l.jsx)(z,{on:"trazo"===en,onClick:()=>er("trazo"),title:"Dibujar",children:(0,l.jsx)(c,{className:"h-4 w-4"})}),(0,l.jsx)(z,{on:"resalte"===en,onClick:()=>er("resalte"),title:"Resaltar",children:(0,l.jsx)(d,{className:"h-4 w-4"})}),(0,l.jsx)(z,{on:"tapar"===en,onClick:()=>er("tapar"),title:"Tapar datos (se borran de verdad)",children:(0,l.jsx)(h.Z,{className:"h-4 w-4"})}),(0,l.jsx)(z,{on:"sello"===en,onClick:()=>{er("sello"),eg||ef(!0)},title:"Firma o sello",children:(0,l.jsx)(u,{className:"h-4 w-4"})}),(0,l.jsx)("span",{className:"mx-1 h-5 w-px bg-white/15"}),("texto"===en||"trazo"===en||eK&&"resalte"!==eK.tipo&&"tapar"!==eK.tipo)&&(0,l.jsx)("div",{className:"flex items-center gap-1",children:C.map(e=>(0,l.jsx)("button",{onClick:()=>{es(e),et&&J(t=>t.map(t=>t.id===et&&("texto"===t.tipo||"trazo"===t.tipo)?{...t,color:e}:t))},className:"h-5 w-5 rounded-full ring-2 ".concat(eo===e?"ring-white":"ring-transparent"),style:{background:e},title:"Color"},e))}),"resalte"===en&&(0,l.jsx)("div",{className:"flex items-center gap-1",children:M.map(e=>(0,l.jsx)("button",{onClick:()=>ed(e),className:"h-5 w-5 rounded-full ring-2 ".concat(ec===e?"ring-white":"ring-transparent"),style:{background:e},title:"Color"},e))}),"texto"===en&&(0,l.jsx)("input",{type:"range",min:8,max:40,value:eh,onChange:e=>eu(+e.target.value),className:"w-20 accent-sky-400",title:"Tama\xf1o del texto"}),"trazo"===en&&(0,l.jsx)("input",{type:"range",min:1,max:10,step:.5,value:ex,onChange:e=>ep(+e.target.value),className:"w-20 accent-sky-400",title:"Grosor"}),(0,l.jsx)("span",{className:"mx-1 h-5 w-px bg-white/15"}),(0,l.jsx)(z,{onClick:function(){Q(e=>e.length?(ee(e=>[G,...e]),J(e[e.length-1]),e.slice(0,-1)):e)},disabled:!K.length,title:"Deshacer",children:(0,l.jsx)(x.Z,{className:"h-4 w-4"})}),(0,l.jsx)(z,{onClick:function(){ee(e=>e.length?(Q(e=>[...e,G]),J(e[0]),e.slice(1)):e)},disabled:!$.length,title:"Rehacer",children:(0,l.jsx)(p,{className:"h-4 w-4"})}),(0,l.jsx)(z,{onClick:eU,disabled:!et,title:"Borrar lo seleccionado",children:(0,l.jsx)(m.Z,{className:"h-4 w-4"})}),(0,l.jsxs)("div",{className:"ml-auto flex items-center gap-1.5",children:[E&&(0,l.jsxs)("button",{onClick:eq,disabled:eQ,className:"inline-flex items-center gap-1.5 rounded-lg bg-sky-500 px-3 py-1.5 text-sm font-semibold text-white hover:bg-sky-400 disabled:opacity-60",children:["enviar"===ey?(0,l.jsx)(f.Z,{className:"h-4 w-4 animate-spin"}):(0,l.jsx)(g.Z,{className:"h-4 w-4"}),"Enviar al cliente"]}),(0,l.jsxs)("button",{onClick:eY,disabled:eQ,className:"inline-flex items-center gap-1.5 rounded-lg bg-white/10 px-3 py-1.5 text-sm font-semibold text-white hover:bg-white/20 disabled:opacity-60",children:["descargar"===ey?(0,l.jsx)(f.Z,{className:"h-4 w-4 animate-spin"}):(0,l.jsx)(w.Z,{className:"h-4 w-4"}),"Descargar"]}),(0,l.jsx)("button",{onClick:D,className:"rounded-lg p-1.5 text-white/70 hover:bg-white/10 hover:text-white",title:"Cerrar (Esc)",children:(0,l.jsx)(y.Z,{className:"h-5 w-5"})})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5 border-b border-white/10 bg-slate-900/70 px-3 py-1.5 text-xs text-white/80",children:[(0,l.jsx)(z,{onClick:()=>q(e=>Math.max(0,e-1)),disabled:0===Y,title:"Hoja anterior",children:(0,l.jsx)(b.Z,{className:"h-4 w-4"})}),(0,l.jsxs)("span",{className:"min-w-[92px] text-center",children:["Hoja ",Y+1," de ",_.length]}),(0,l.jsx)(z,{onClick:()=>q(e=>Math.min(_.length-1,e+1)),disabled:Y>=_.length-1,title:"Hoja siguiente",children:(0,l.jsx)(v.Z,{className:"h-4 w-4"})}),(0,l.jsx)("span",{className:"mx-1 h-4 w-px bg-white/15"}),(0,l.jsx)(z,{onClick:function(){X(e=>({...e,[eD]:((e[eD]||0)+90)%360}))},title:"Girar la hoja",children:(0,l.jsx)(j,{className:"h-4 w-4"})}),(0,l.jsx)(z,{onClick:()=>eF(-1),disabled:0===Y,title:"Mover la hoja antes",children:"↑"}),(0,l.jsx)(z,{onClick:()=>eF(1),disabled:Y>=_.length-1,title:"Mover la hoja despu\xe9s",children:"↓"}),(0,l.jsx)(z,{onClick:function(){if(_.length<=1){ej("El PDF se quedar\xeda sin hojas.");return}W(e=>e.filter((e,t)=>
1t!==Y)),q(e=>Math.max(0,Math.min(e,_.length-2)))},disabled:_.length<=1,title:"Quitar esta hoja",children:(0,l.jsx)(m.Z,{className:"h-4 w-4"})}),eJ&&(0,l.jsxs)("span",{className:"ml-2 inline-flex items-center gap-1 rounded bg-amber-400/15 px-2 py-0.5 text-[11px] text-amber-200",children:[(0,l.jsx)(k.Z,{className:"h-3 w-3"})," Lo tapado se borra de verdad (esa hoja se aplana)"]}),ev&&(0,l.jsxs)("span",{className:"ml-2 inline-flex items-center gap-1 rounded bg-rose-500/20 px-2 py-0.5 text-[11px] text-rose-100",children:[(0,l.jsx)(N.Z,{className:"h-3 w-3"})," ",ev]})]}),(0,l.jsxs)("div",{ref:eP,className:"relative flex flex-1 items-center justify-center overflow-auto p-4",children:[B&&(0,l.jsx)(f.Z,{className:"h-6 w-6 animate-spin text-white/70"}),F&&(0,l.jsx)("p",{className:"rounded-lg bg-white px-4 py-3 text-sm text-rose-600",children:F}),!B&&!F&&(0,l.jsxs)("div",{className:"relative shadow-2xl",style:{width:ek.w*eC,height:ek.h*eC},children:[(0,l.jsx)("canvas",{ref:eS,className:"block rounded-sm bg-white"}),(0,l.jsxs)("svg",{ref:eR,viewBox:"0 0 ".concat(ek.w||1," ").concat(ek.h||1),className:"absolute inset-0 h-full w-full",style:{cursor:"mover"===en?"default":"crosshair",touchAction:"none"},onPointerDown:function(e){var t,a;if(el)return;let l=eI(e.clientX,e.clientY);if("mover"===en){ea(null);return}if(null===(t=(a=e.target).setPointerCapture)||void 0===t||t.call(a,e.pointerId),"texto"===en){let e={id:P(),pag:eD,tipo:"texto",x:l.x,y:l.y,texto:"",size:eh,color:eo};eT([...G,e]),ea(e.id),er("mover"),setTimeout(()=>ei(e.id),0);return}if("sello"===en){if(!eg){ef(!0);return}let e=Math.min(180,.35*ek.w),t={id:P(),pag:eD,tipo:"sello",x:l.x-e/2,y:l.y-.4*e/2,w:e,h:.4*e,data:eg};eT([...G,t]),ea(t.id),er("mover");return}if("trazo"===en){eZ.current={id:P(),pag:eD,tipo:"trazo",pts:[[l.x,l.y]],color:eo,grosor:ex},J(e=>[...e,eZ.current]);return}eZ.current="resalte"===en?{id:P(),pag:eD,tipo:"resalte",x:l.x,y:l.y,w:0,h:0,color:ec}:{id:P(),pag:eD,tipo:"tapar",x:l.x,y:l.y,w:0,h:0},eZ.current._ox=l.x,eZ.current._oy=l.y,J(e=>[...e,eZ.current])},onPointerMove:function(e){let t=eI(e.clientX,e.clientY);if(eE.current){let e=eE.current;J(a=>a.map(a=>{if(a.id!==e.id)return a;if("mover"===e.modo){let l=t.x-e.x,i=t.y-e.y;return"trazo"===a.tipo?{...a,pts:a.pts.map(e=>{let[t,a]=e;return[t+l,a+i]})}:{...a,x:e.ox+l,y:e.oy+i}}return"sello"===a.tipo||"resalte"===a.tipo||"tapar"===a.tipo?{...a,w:Math.max(12,t.x-a.x),h:Math.max(10,t.y-a.y)}:a})),"mover"===e.modo&&(eE.current={...e,x:t.x,y:t.y,ox:e.ox+(t.x-e.x),oy:e.oy+(t.y-e.y)});return}let a=eZ.current;if(a){if("trazo"===a.tipo){let e=[...a.pts,[t.x,t.y]];eZ.current={...a,pts:e},J(t=>t.map(t=>t.id===a.id?{...t,pts:e}:t))}else if("resalte"===a.tipo||"tapar"===a.tipo){let e=a._ox,l=a._oy,i=Math.min(e,t.x),n=Math.min(l,t.y),r=Math.abs(t.x-e),o=Math.abs(t.y-l);J(e=>e.map(e=>e.id===a.id?{...e,x:i,y:n,w:r,h:o}:e))}}},onPointerUp:eB,onPointerCancel:eB,children:[eG.map(e=>{let t=e.id===et;return"resalte"===e.tipo?(0,l.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.color,opacity:.35,stroke:t?"#0ea5e9":"none",strokeWidth:1,onPointerDown:t=>eH(t,e,"mover")},e.id):"tapar"===e.tipo?(0,l.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"#000",stroke:t?"#0ea5e9":"none",strokeWidth:1,onPointerDown:t=>eH(t,e,"mover")},e.id):"trazo"===e.tipo?(0,l.jsx)("polyline",{points:e.pts.map(e=>{let[t,a]=e;return"".concat(t,",").concat(a)}).join(" "),fill:"none",stroke:e.color,strokeWidth:e.grosor,strokeLinecap:"round",strokeLinejoin:"round",opacity:t?.75:1,onPointerDown:t=>eH(t,e,"mover")},e.id):"texto"===e.tipo?(0,l.jsx)("text",{x:e.x,y:e.y,fontSize:e.size,fill:e.color,fontFamily:"Helvetica, Arial, sans-serif",dominantBaseline:"text-before-edge",style:{cursor:"move"},onPointerDown:t=>eH(t,e,"mover"),onDoubleClick:()=>setTimeout(()=>ei(e.id),0),children:e.texto||"…"},e.id):(0,l.jsxs)("g",{children:[(0,l.jsx)("image",{href:e.data,x:e.x,y:e.y,width:e.w,height:e.h,preserveAspectRatio:"none",onPointerDown:t=>eH(t,e,"mover")}),t&&(0,l.jsx)("rect",{x:e.x+e.w-7,y:e.y+e.h-7,width:14,height:14,fill:"#0ea5e9",style:{cursor:"nwse-resize"},onPointerDown:t=>eH(t,e,"tam")})]},e.id)}),eK&&eK.pag===eD&&("resalte"===eK.tipo||"tapar"===eK.tipo)&&(0,l.jsx)("rect",{x:eK.x+eK.w-7,y:eK.y+eK.h-7,width:14,height:14,fill:"#0ea5e9",style:{cursor:"nwse-resize"},onPointerDown:e=>eH(e,eK,"tam")})]}),el&&(()=>{let e=G.find(e=>e.id===el);return e&&"texto"===e.tipo?(0,l.jsx)("input",{autoFocus:!0,value:e.texto,onChange:t=>J(a=>a.map(a=>a.id===e.id?{...a,texto:t.target.value}:a)),onBlur:()=>{ei(null),J(t=>t.filter(t=>!(t.id===e.id&&"texto"===t.tipo&&!t.texto.trim())))},onKeyDown:e=>{("Enter"===e.key||"Escape"===e.key)&&e.target.blur()},placeholder:"Escribe…",className:"absolute rounded border-2 border-sky-500 bg-white px-1 text-slate-900 outline-none",style:{left:e.x*eC,top:e.y*eC,fontSize:Math.max(11,e.size*eC),minWidth:120}}):null})()]})]}),em&&(0,l.jsx)(Z,{onCerrar:()=>ef(!1),onListo:e=>{ew(e),ef(!1),er("sello"),ej("Ahora toca el documento donde quieras ponerla.")}})]})}function z(e){let{children:t,onClick:a,on:i,disabled:n,title:r}=e;return(0,l.jsx)("button",{onClick:a,disabled:n,title:r,className:"flex h-8 min-w-8 items-center justify-center rounded-lg px-2 text-sm transition disabled:opacity-35 ".concat(i?"bg-sky-500 text-white":"text-white/80 hover:bg-white/10"),children:t})}function Z(e){let{onCerrar:t,onListo:a}=e,n=(0,i.useRef)(null),r=(0,i.useRef)(!1),[o,s]=(0,i.useState)(!0);(0,i.useEffect)(()=>{let e=n.current;if(!e)return;let t=Math.min(window.devicePixelRatio||1,2);e.width=560*t,e.height=200*t;let a=e.getContext("2d");a.scale(t,t),a.lineWidth=2.6,a.lineCap="round",a.lineJoin="round",a.strokeStyle="#0f172a"},[]);let c=e=>{let t=n.current.getBoundingClientRect();return{x:(e.clientX-t.left)/t.width*560,y:(e.clientY-t.top)/t.height*200}};return(0,l.jsx)("div",{className:"fixed inset-0 z-[90] flex items-center justify-center bg-black/60 p-4",onClick:t,children:(0,l.jsxs)("div",{className:"w-full max-w-xl rounded-2xl bg-white p-5 shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,l.jsx)("h3",{className:"text-base font-bold text-slate-900",children:"Tu firma o sello"}),(0,l.jsx)("p",{className:"mt-0.5 text-sm text-slate-500",children:"Dib\xfajala con el dedo o el rat\xf3n, o sube tu logo."}),(0,l.jsx)("canvas",{ref:n,style:{touchAction:"none"},className:"mt-3 h-[200px] w-full cursor-crosshair rounded-xl border-2 border-dashed border-slate-300 bg-slate-50",onPointerDown:e=>{var t,a;r.current=!0;let l=n.current.getContext("2d"),i=c(e);l.beginPath(),l.moveTo(i.x,i.y),null===(t=(a=e.target).setPointerCapture)||void 0===t||t.call(a,e.pointerId)},onPointerMove:e=>{if(!r.current)return;let t=n.current.getContext("2d"),a=c(e);t.lineTo(a.x,a.y),t.stroke(),s(!1)},onPointerUp:()=>r.current=!1,onPointerCancel:()=>r.current=!1}),(0,l.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,l.jsx)("button",{onClick:()=>{let e=n.current;e.getContext("2d").clearRect(0,0,e.width,e.height),s(!0)},className:"rounded-lg border border-slate-300 px-3 py-1.5 text-sm font-medium text-slate-700 hover:bg-slate-50",children:"Limpiar"}),(0,l.jsxs)("label",{className:"cursor-pointer rounded-lg border border-slate-300 px-3 py-1.5 text-sm font-medium text-slate-700 hover:bg-slate-50",children:["Subir logo",(0,l.jsx)("input",{type:"file",accept:"image/png,image/jpeg,image/webp",className:"hidden",onChange:e=>{var t;let l=null===(t=e.target.files)||void 0===t?void 0:t[0];if(!l)return;let i=new FileReader;i.onload=()=>{let e=new Image;e.onload=()=>{let t=document.createElement("canvas");t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0),a(t.toDataURL("image/png"))},e.src=String(i.result)},i.readAsDataURL(l)}})]}),(0,l.jsxs)("div",{className:"ml-auto flex gap-2",children:[(0,l.jsx)("button",{onClick:t,className:"rounded-lg px-3 py-1.5 text-sm font-medium text-slate-500 hover:bg-slate-100",children:"Cancelar"}),(0,l.jsx)("button",{disabled:o,onClick:()=>a(n.current.toDataURL("image/png")),className:"rounded-lg bg-sky-500 px-4 py-1.5 text-sm font-semibold text-white hover:bg-sky-400 disabled:opacity-50",children:"Usar"})]})]})]})})}},87769:function(e,t,a){a.d(t,{Z:function(){return l}});let l=(0,a(79205).Z)("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},44743:function(e,t,a){a.d(t,{Z:function(){return l}});let l=(0,a(79205).Z)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},18930:function(e,t,a){a.d(t,{Z:function(){return l}});let l=(0,a(79205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}
1],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},75277:function(e,t,a){a.d(t,{Z:function(){return l}});let l=(0,a(79205).Z)("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]])},14064:function(e,t,a){a.d(t,{Z:function(){return l}});let l=(0,a(79205).Z)("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]])}}]);

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.