{"version":3,"file":"Chatweb.DRNd_dKT.mjs","names":[],"sources":["https:/framerusercontent.com/modules/r6VcPLYgwLaYd6mFDz7m/uBVpxL1Z9V6kPJ8CNNbF/Chatweb.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";export default function Chatweb(){useEffect(()=>{if(window.__lp4)return;window.__lp4=1;// Limpiar versiones anteriores\ndocument.getElementById(\"lp-css\")?.remove();document.getElementById(\"lp-btn\")?.remove();document.getElementById(\"lp-win\")?.remove();const HOOK=\"https://n8n.hnt.com.ar/webhook/lp-chat\";const SK=\"lp_sid\",MK=\"lp_msgs\",OK=\"lp_open\";let SID=sessionStorage.getItem(SK);if(!SID){SID=\"lp_\"+Date.now();sessionStorage.setItem(SK,SID);}const css=document.createElement(\"style\");css.id=\"lp-css\";css.textContent=\"#lp-btn{position:fixed;bottom:28px;right:28px;z-index:99999;width:56px;height:56px;border-radius:50%;background:#2563eb;border:none;cursor:pointer}\"+\"#lp-btn svg{width:24px;height:24px;fill:#fff;display:block;margin:auto}\"+\"#lp-win{position:fixed;bottom:96px;right:28px;z-index:99998;width:340px;height:480px;background:#0f0f0f;border:1px solid rgba(255,255,255,.15);border-radius:16px;flex-direction:column;overflow:hidden;font-family:sans-serif;display:none}\"+\"#lp-win.on{display:flex}\"+\"#lp-top{padding:12px 14px;background:#141414;border-bottom:1px solid rgba(255,255,255,.08);display:flex;align-items:center;gap:10px;flex-shrink:0}\"+\"#lp-av{width:32px;height:32px;border-radius:50%;background:#2563eb;color:#fff;font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center;flex-shrink:0}\"+\".lp-n1{font-size:13px;font-weight:500;color:#f0f0f0;margin:0}\"+\".lp-n2{font-size:11px;color:#6ee7b7;margin:2px 0 0}\"+\"#lp-log{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:8px}\"+\".lp-m{max-width:80%;font-size:13px;line-height:1.6;padding:9px 12px;border-radius:10px}\"+\".lp-b{background:#1e1e1e;color:#e0e0e0;align-self:flex-start}\"+\".lp-u{background:#2563eb;color:#fff;align-self:flex-end}\"+\".lp-b a{color:#60a5fa !important;text-decoration:underline !important;cursor:pointer}\"+\".lp-b a:hover{color:#93c5fd !important}\"+\".lp-typ{display:flex;gap:4px;padding:9px 12px;background:#1e1e1e;border-radius:10px;align-self:flex-start}\"+\".lp-typ span{width:6px;height:6px;background:#555;border-radius:50%;animation:lpb 1.2s infinite}\"+\".lp-typ span:nth-child(2){animation-delay:.2s}\"+\".lp-typ span:nth-child(3){animation-delay:.4s}\"+\"@keyframes lpb{0%,80%,100%{opacity:.3}40%{opacity:1}}\"+\"#lp-bar{padding:10px;background:#141414;border-top:1px solid rgba(255,255,255,.08);display:flex;gap:8px;flex-shrink:0}\"+\"#lp-txt{flex:1;background:#1e1e1e;border:1px solid rgba(255,255,255,.1);border-radius:8px;padding:8px 10px;color:#e0e0e0;font-size:13px;outline:none;resize:none;font-family:sans-serif}\"+\"#lp-txt::placeholder{color:#555}\"+\"#lp-go{width:34px;height:34px;border-radius:8px;background:#2563eb;border:none;cursor:pointer;flex-shrink:0}\"+\"#lp-go svg{width:14px;height:14px;fill:#fff;display:block;margin:auto}\";document.head.appendChild(css);const win=document.createElement(\"div\");win.id=\"lp-win\";win.innerHTML='<div id=\"lp-top\"><div id=\"lp-av\">LP</div><div><p class=\"lp-n1\">Lautaro Puebla</p><p class=\"lp-n2\">&#9679; En l\\xednea</p></div></div>'+'<div id=\"lp-log\"></div>'+'<div id=\"lp-bar\"><textarea id=\"lp-txt\" rows=\"1\" placeholder=\"Escrib\\xed tu consulta...\"></textarea><button id=\"lp-go\"><svg viewBox=\"0 0 24 24\"><path d=\"M2.01 21L23 12 2.01 3 2 10l15 2-15 2z\"/></svg></button></div>';const btn=document.createElement(\"button\");btn.id=\"lp-btn\";btn.innerHTML='<svg viewBox=\"0 0 24 24\"><path d=\"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z\"/></svg>';document.body.appendChild(win);document.body.appendChild(btn);const log=document.getElementById(\"lp-log\");const txt=document.getElementById(\"lp-txt\");const go=document.getElementById(\"lp-go\");let busy=false;function parseLinks(text){// Markdown [texto](url)\nlet html=text.replace(/\\[([^\\]]+)\\]\\((https?:\\/\\/[^\\)]+)\\)/g,'<a href=\"$2\" target=\"_blank\" rel=\"noopener\">$1</a>');// URLs planas no dentro de href\nhtml=html.replace(RegExp('(?<![\"=])(https?:\\\\/\\\\/[^\\\\s<>\"]+)',\"g\"),'<a href=\"$1\" target=\"_blank\" rel=\"noopener\">$1</a>');return html;}function renderMsg(role,text){const el=document.createElement(\"div\");el.className=\"lp-m \"+(role===\"b\"?\"lp-b\":\"lp-u\");if(role===\"b\"){el.innerHTML=parseLinks(text);}else{el.textContent=text;}log.appendChild(el);}function msg(role,text){renderMsg(role,text);log.scrollTop=log.scrollHeight;const stored=JSON.parse(sessionStorage.getItem(MK)||\"[]\");stored.push({role,text});sessionStorage.setItem(MK,JSON.stringify(stored));}function typing(on){if(on){const el=document.createElement(\"div\");el.className=\"lp-typ\";el.id=\"lp-ty\";el.innerHTML=\"<span></span><span></span><span></span>\";log.appendChild(el);log.scrollTop=log.scrollHeight;}else{document.getElementById(\"lp-ty\")?.remove();}}const saved=JSON.parse(sessionStorage.getItem(MK)||\"[]\");if(saved.length===0){msg(\"b\",\"\\xa1Hola! Soy el asistente de Lautaro Puebla. \\xbfEn qu\\xe9 puedo ayudarte?\");}else{saved.forEach(m=>renderMsg(m.role,m.text));log.scrollTop=log.scrollHeight;}if(sessionStorage.getItem(OK)===\"1\")win.classList.add(\"on\");btn.onclick=()=>{const isOpen=win.classList.toggle(\"on\");sessionStorage.setItem(OK,isOpen?\"1\":\"0\");if(isOpen)setTimeout(()=>txt.focus(),150);};async function send(){if(busy)return;const t=txt.value.trim();if(!t)return;txt.value=\"\";msg(\"u\",t);typing(true);busy=true;go.setAttribute(\"disabled\",\"1\");try{const r=await fetch(HOOK,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({chatInput:t,sessionId:SID})});const d=await r.json();typing(false);msg(\"b\",d.output||d.text||d.reply||d.message||d.response||JSON.stringify(d));}catch{typing(false);msg(\"b\",\"Error al conectar. Intent\\xe1 de nuevo.\");}busy=false;go.removeAttribute(\"disabled\");txt.focus();}go.onclick=send;txt.onkeydown=e=>{if(e.key===\"Enter\"&&!e.shiftKey){e.preventDefault();send();}};},[]);return /*#__PURE__*/_jsx(\"div\",{style:{width:1,height:1,position:\"absolute\",pointerEvents:\"none\"}});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Chatweb\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Chatweb.map"],"mappings":"2HAAwE,SAAwB,GAAS,CAGkwD,OAHjwD,MAAc,CAAC,GAAG,EAAO,MAAM,OAAO,EAAO,MAAM,EAC7J,SAAS,eAAe,SAAS,EAAE,QAAQ,CAAC,SAAS,eAAe,SAAS,EAAE,QAAQ,CAAC,SAAS,eAAe,SAAS,EAAE,QAAQ,CAAC,IAA0D,EAAG,SAAS,EAAG,UAAU,EAAG,UAAc,EAAI,eAAe,QAAQ,EAAG,CAAK,IAAK,EAAI,MAAM,KAAK,KAAK,CAAC,eAAe,QAAQ,EAAG,EAAI,EAAE,IAAM,EAAI,SAAS,cAAc,QAAQ,CAAC,EAAI,GAAG,SAAS,EAAI,YAAY,+oEAAotE,SAAS,KAAK,YAAY,EAAI,CAAC,IAAM,EAAI,SAAS,cAAc,MAAM,CAAC,EAAI,GAAG,SAAS,EAAI,UAAU,8WAA0X,IAAM,EAAI,SAAS,cAAc,SAAS,CAAC,EAAI,GAAG,SAAS,EAAI,UAAU,gHAAgH,SAAS,KAAK,YAAY,EAAI,CAAC,SAAS,KAAK,YAAY,EAAI,CAAC,IAAM,EAAI,SAAS,eAAe,S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