@johpaz/hive-agents 0.0.28 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -16
- package/dist/hive.js +2194 -1986
- package/dist/ui/assets/{index-BPhhlVgu.js → index-CS7uWSOk.js} +3 -3
- package/dist/ui/{dist/assets/index-D-gAnNFM.css → assets/index-DUIt49UX.css} +1 -1
- package/dist/ui/assets/{ui-Cw_eF3wo.js → ui-Ra3lIxcJ.js} +1 -1
- package/dist/ui/dist/assets/{index-BPhhlVgu.js → index-CS7uWSOk.js} +3 -3
- package/dist/ui/{assets/index-D-gAnNFM.css → dist/assets/index-DUIt49UX.css} +1 -1
- package/dist/ui/dist/assets/{ui-Cw_eF3wo.js → ui-Ra3lIxcJ.js} +1 -1
- package/dist/ui/dist/index.html +2 -2
- package/dist/ui/index.html +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ui-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ui-Ra3lIxcJ.js","assets/rolldown-runtime-S-ySWqyJ.js","assets/react-C63RN3Ve.js","assets/ui-CHpVij2M.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{n as e,r as t,t as n}from"./rolldown-runtime-S-ySWqyJ.js";import{n as r,t as i}from"./react-C63RN3Ve.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var a=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=O,k=function(){j.postMessage(null)}}else k=function(){g(O,0)};function M(e){C=e,S||(S=!0,k())}function N(t,n){w=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,M(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),o=n(((e,t)=>{t.exports=a()})),s=n((e=>{var t=r(),n=o();function i(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n]);return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}var a=new Set,s={};function c(e,t){l(e,t),l(e+`Capture`,t)}function l(e,t){for(s[e]=t,e=0;e<t.length;e++)a.add(t[e])}var u=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),d=Object.prototype.hasOwnProperty,f=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},m={};function h(e){return d.call(m,e)?!0:d.call(p,e)?!1:f.test(e)?m[e]=!0:(p[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(_(t,n,i,r)&&(n=null),r||i===null?h(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for(`react.element`),T=Symbol.for(`react.portal`),E=Symbol.for(`react.fragment`),D=Symbol.for(`react.strict_mode`),O=Symbol.for(`react.profiler`),k=Symbol.for(`react.provider`),A=Symbol.for(`react.context`),j=Symbol.for(`react.forward_ref`),M=Symbol.for(`react.suspense`),N=Symbol.for(`react.suspense_list`),P=Symbol.for(`react.memo`),F=Symbol.for(`react.lazy`),I=Symbol.for(`react.offscreen`),L=Symbol.iterator;function R(e){return typeof e!=`object`||!e?null:(e=L&&e[L]||e[`@@iterator`],typeof e==`function`?e:null)}var ee=Object.assign,te;function ne(e){if(te===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);te=t&&t[1]||``}return`
|
|
3
3
|
`+te+e}var z=!1;function re(e,t){if(!e||z)return``;z=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
|
|
4
4
|
`),a=r.stack.split(`
|
|
@@ -290,7 +290,7 @@ Minimum version required to store current data is: `+c+`.
|
|
|
290
290
|
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
291
291
|
`,...a.current()});return/^[\t ]/.test(l)&&(l=u9(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}p9.peek=QDe;function p9(e){return e.value||``}function QDe(){return`<`}m9.peek=$De;function m9(e,t,n,r){let i=l9(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function $De(){return`!`}h9.peek=eOe;function h9(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function eOe(){return`!`}g9.peek=tOe;function g9(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function tOe(){return"`"}function _9(e,t){let n=tZ(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}v9.peek=nOe;function v9(e,t,n,r){let i=l9(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(_9(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function nOe(e,t,n){return _9(e,n)?`<`:`[`}y9.peek=rOe;function y9(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function rOe(){return`[`}function b9(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function iOe(e){let t=b9(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function aOe(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function x9(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function oOe(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?aOe(n):b9(n),s=e.ordered?o===`.`?`)`:`.`:iOe(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),x9(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function sOe(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function cOe(e,t,n,r){let i=sOe(n),a=n.bulletCurrent||b9(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function lOe(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var uOe=hQ([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function dOe(e,t,n,r){return(e.children.some(function(e){return uOe(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function fOe(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}S9.peek=pOe;function S9(e,t,n,r){let i=fOe(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=d9(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=u9(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=d9(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+u9(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function pOe(e,t,n){return n.options.strong||`*`}function mOe(e,t,n,r){return n.safe(e.value,r)}function hOe(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function gOe(e,t,n){let r=(x9(n)+(n.options.ruleSpaces?` `:``)).repeat(hOe(n));return n.options.ruleSpaces?r.slice(0,-1):r}var C9={blockquote:zDe,break:c9,code:GDe,definition:qDe,emphasis:f9,hardBreak:c9,heading:ZDe,html:p9,image:m9,imageReference:h9,inlineCode:g9,link:v9,linkReference:y9,list:oOe,listItem:cOe,paragraph:lOe,root:dOe,strong:S9,text:mOe,thematicBreak:gOe};function _Oe(){return{enter:{table:vOe,tableData:T9,tableHeader:T9,tableRow:bOe},exit:{codeText:xOe,table:yOe,tableData:w9,tableHeader:w9,tableRow:w9}}}function vOe(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function yOe(e){this.exit(e),this.data.inTable=void 0}function bOe(e){this.enter({type:`tableRow`,children:[]},e)}function w9(e){this.exit(e)}function T9(e){this.enter({type:`tableCell`,children:[]},e)}function xOe(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,SOe));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function SOe(e,t){return t===`|`?t:e}function COe(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
292
292
|
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
293
|
-
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return LDe(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=C9.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function wOe(){return{exit:{taskListCheckValueChecked:E9,taskListCheckValueUnchecked:E9,paragraph:EOe}}}function TOe(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:DOe}}}function E9(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function EOe(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function DOe(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=C9.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function OOe(){return[oDe(),DDe(),jDe(),_Oe(),wOe()]}function kOe(e){return{extensions:[sDe(),ODe(e),MDe(),COe(e),TOe()]}}var AOe={tokenize:IOe,partial:!0},D9={tokenize:LOe,partial:!0},O9={tokenize:ROe,partial:!0},k9={tokenize:zOe,partial:!0},jOe={tokenize:BOe,partial:!0},A9={name:`wwwAutolink`,tokenize:POe,previous:F9},j9={name:`protocolAutolink`,tokenize:FOe,previous:I9},M9={name:`emailAutolink`,tokenize:NOe,previous:L9},N9={};function MOe(){return{text:N9}}for(var P9=48;P9<123;)N9[P9]=M9,P9++,P9===58?P9=65:P9===91&&(P9=97);N9[43]=M9,N9[45]=M9,N9[46]=M9,N9[95]=M9,N9[72]=[M9,j9],N9[104]=[M9,j9],N9[87]=[M9,A9],N9[119]=[M9,A9];function NOe(e,t,n){let r=this,i,a;return o;function o(t){return!R9(t)||!L9.call(r,r.previous)||z9(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return R9(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(jOe,u,l)(t):t===45||t===95||mZ(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&pZ(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function POe(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!F9.call(r,r.previous)||z9(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(AOe,e.attempt(D9,e.attempt(O9,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function FOe(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&I9.call(r,r.previous)&&!z9(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(pZ(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||hZ(t)||vZ(t)||xZ(t)||bZ(t)?n(t):e.attempt(D9,e.attempt(O9,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function IOe(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function LOe(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(k9,c,s)(t):t===null||vZ(t)||xZ(t)||t!==45&&bZ(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function ROe(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(k9,t,a)(o):o===null||vZ(o)||xZ(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function zOe(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||vZ(o)||xZ(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||vZ(e)||xZ(e)?t(e):r(e)}function a(e){return pZ(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):pZ(t)?(e.consume(t),o):n(t)}}function BOe(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return mZ(e)?n(e):t(e)}}function F9(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||vZ(e)}function I9(e){return!pZ(e)}function L9(e){return!(e===47||R9(e))}function R9(e){return e===43||e===45||e===46||e===95||mZ(e)}function z9(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var VOe={tokenize:JOe,partial:!0};function HOe(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:KOe,continuation:{tokenize:B9},exit:qOe}},text:{91:{name:`gfmFootnoteCall`,tokenize:GOe},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:UOe,resolveTo:WOe}}}}function UOe(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=fZ(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function WOe(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function GOe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||vZ(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(fZ(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return vZ(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function KOe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||vZ(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=fZ(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return vZ(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),wZ(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function B9(e,t,n){return e.check(AZ,t,e.attempt(VOe,t,n))}function qOe(e){e.exit(`gfmFootnoteDefinition`)}function JOe(e,t,n){let r=this;return wZ(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function YOe(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&sZ(o,o.length,0,DZ(s,e.slice(r+1,n),t)),sZ(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),sZ(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=EZ(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=EZ(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var XOe=class{constructor(){this.map=[]}add(e,t,n){ZOe(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function ZOe(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function QOe(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function $Oe(){return{flow:{null:{name:`table`,tokenize:eke,resolveAll:tke}}}}function eke(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):_Z(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):yZ(t)?wZ(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||vZ(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,yZ(t)?wZ(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return yZ(t)?wZ(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||_Z(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return yZ(t)?wZ(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||_Z(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||_Z(n)?(e.exit(`tableRow`),t(n)):yZ(n)?wZ(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||vZ(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function tke(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new XOe;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(H9(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=V9(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=V9(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=V9(f,t,o,i,n,d)):(o[0]=o[1],d=V9(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&H9(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=QOe(t.events,n))}return e}function V9(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},U9(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=U9(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=U9(t.events,n[2]),a=U9(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},U9(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function H9(e,t,n,r,i){let a=[],o=U9(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function U9(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var nke={name:`tasklistCheck`,tokenize:ike};function rke(){return{text:{91:nke}}}function ike(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return vZ(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return _Z(r)?t(r):yZ(r)?e.check({tokenize:ake},t,n)(r):n(r)}}function ake(e,t,n){return wZ(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function oke(e){return uZ([MOe(),HOe(),YOe(e),$Oe(),rke()])}var ske={};function cke(e){let t=this,n=e||ske,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(oke(n)),a.push(OOe()),o.push(kOe(n))}function W9(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function G9({audio:e,mimeType:t=`audio/webm`}){let[n,r]=(0,u.useState)(!1),[i,a]=(0,u.useState)(null);return e?(0,A.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,A.jsx)(`button`,{onClick:n?()=>{r(!1)}:()=>{i||a(`data:${t};base64,${e}`),r(!0)},className:`h-7 w-7 rounded-full bg-cyan-600/80 hover:bg-cyan-500 flex items-center justify-center transition-colors`,children:n?(0,A.jsx)(pr,{className:`h-3.5 w-3.5 text-white`}):(0,A.jsx)(_r,{className:`h-3.5 w-3.5 text-white ml-0.5`})}),i&&(0,A.jsx)(`audio`,{src:i,onEnded:()=>r(!1),autoPlay:n,className:`hidden`}),(0,A.jsx)(`div`,{className:`flex-1 h-7 bg-zinc-800/80 rounded-lg overflow-hidden`,children:(0,A.jsxs)(`div`,{className:`h-full w-full flex items-center px-2`,children:[(0,A.jsx)(Xr,{className:`h-3.5 w-3.5 text-zinc-400 mr-2`}),(0,A.jsx)(`div`,{className:`flex-1 h-1.5 bg-zinc-700 rounded-full overflow-hidden`,children:(0,A.jsx)(`div`,{className:`h-full w-1/3 bg-cyan-500 rounded-full animate-pulse`})})]})})]}):null}function lke({message:e,userName:t=`Tu`,agentName:n=`Agente`,isStreaming:r,onNarrate:i}){let a=e.type===`user`,o=e.type===`error`,s=e.type===`system`,c=!!e.audio?.base64||!!e.audio?.url;return s?(0,A.jsx)(`div`,{className:`flex justify-center my-1`,children:(0,A.jsx)(`span`,{className:`text-[10px] text-zinc-600 bg-zinc-900/50 border border-white/5 px-3 py-1 rounded-full font-mono`,children:e.content})}):o?(0,A.jsx)(`div`,{className:`flex items-center gap-2 justify-center my-1`,children:(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-red-400 bg-red-500/10 border border-red-500/20 px-3 py-1.5 rounded-xl`,children:[(0,A.jsx)(Kr,{className:`h-3 w-3 shrink-0`}),e.content]})}):a?(0,A.jsx)(`div`,{className:`flex items-end justify-end gap-2 group`,children:(0,A.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5 max-w-[72%]`,children:[(0,A.jsx)(`div`,{className:`bg-gradient-to-br from-blue-600 to-indigo-600 text-white px-4 py-2.5 rounded-2xl rounded-tr-sm shadow-lg shadow-blue-600/10 text-sm leading-relaxed whitespace-pre-wrap`,children:e.content}),c&&e.audio?.base64&&(0,A.jsx)(G9,{audio:e.audio.base64,mimeType:e.audio.mimeType}),(0,A.jsx)(`span`,{className:`text-[10px] text-zinc-700 pr-1`,children:W9(e.timestamp)})]})}):(0,A.jsxs)(`div`,{className:`flex items-start gap-2 group`,children:[(0,A.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-zinc-900 border border-cyan-500/20 flex items-center justify-center shrink-0 mt-0.5 ring-2 ring-zinc-950`,children:(0,A.jsx)(Kt,{className:`h-4 w-4 text-cyan-400`})}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-0.5 max-w-[80%] min-w-0`,children:[(0,A.jsx)(`span`,{className:`text-[10px] font-semibold text-cyan-500/70 uppercase tracking-wider`,children:n}),(0,A.jsxs)(`div`,{className:`bg-zinc-900 border text-zinc-100 px-4 py-2.5 rounded-2xl rounded-tl-sm text-sm leading-relaxed shadow prose prose-invert prose-p:leading-relaxed prose-pre:bg-black/50 prose-pre:border prose-pre:border-white/10 max-w-none prose-sm ${r?`border-cyan-500/30 animate-pulse`:`border-white/5`}`,children:[(0,A.jsx)(HQ,{remarkPlugins:[cke],children:e.content}),r&&(0,A.jsx)(`span`,{className:`inline-block w-1.5 h-4 bg-cyan-400 ml-0.5 animate-pulse align-text-bottom rounded-sm`})]}),c&&e.audio?.base64&&(0,A.jsx)(G9,{audio:e.audio.base64,mimeType:e.audio.mimeType}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2 pl-1`,children:[(0,A.jsx)(`span`,{className:`text-[10px] text-zinc-700`,children:W9(e.timestamp)}),i&&(0,A.jsx)(`button`,{onClick:()=>i(e.content),className:`opacity-0 group-hover:opacity-100 transition-opacity h-5 w-5 rounded flex items-center justify-center text-zinc-600 hover:text-cyan-400 hover:bg-zinc-800`,title:`Narrar mensaje`,children:(0,A.jsx)(Xr,{className:`h-3 w-3`})})]})]})]})}var uke=[{icon:Rr,text:`Que puedes hacer?`},{icon:ri,text:`Dame un resumen`},{icon:Kt,text:`Ayudame con una tarea`}];function dke({messages:e,isLoading:t=!1,currentSteps:n=[],streamingMessageId:r,userName:i,agentName:a,onSuggestionClick:o,onNarrateMessage:s}){let c=(0,u.useRef)(null),l=(0,u.useRef)(null);return(0,u.useEffect)(()=>{c.current?.scrollIntoView({behavior:`smooth`})},[e,t,n]),e.length===0&&!t?(0,A.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center p-8 h-full`,children:[(0,A.jsxs)(`div`,{className:`relative mb-4`,children:[(0,A.jsx)(`div`,{className:`h-16 w-16 rounded-2xl bg-zinc-900 border border-cyan-500/20 flex items-center justify-center shadow-xl`,children:(0,A.jsx)(Kt,{className:`h-8 w-8 text-cyan-400`})}),(0,A.jsx)(`span`,{className:`absolute -bottom-1 -right-1 h-4 w-4 rounded-full bg-emerald-500 border-2 border-zinc-950 shadow`})]}),(0,A.jsxs)(`div`,{className:`text-center space-y-1 mb-6`,children:[(0,A.jsx)(`p`,{className:`text-sm font-semibold text-zinc-300`,children:a?`${a} esta listo`:`Agente listo`}),(0,A.jsx)(`p`,{className:`text-xs text-zinc-600`,children:`Inicia la conversacion escribiendo un mensaje`})]}),o&&(0,A.jsx)(`div`,{className:`flex flex-col sm:flex-row items-center gap-2`,children:uke.map(e=>{let t=e.icon;return(0,A.jsxs)(`button`,{onClick:()=>o(e.text),className:`flex items-center gap-1.5 text-xs text-zinc-400 hover:text-zinc-200 border border-white/10 hover:border-white/20 bg-zinc-900/80 hover:bg-zinc-800/80 px-3 py-2 rounded-xl transition-all cursor-pointer`,children:[(0,A.jsx)(t,{className:`h-3 w-3`}),e.text]},e.text)})})]}):(0,A.jsx)(`div`,{ref:l,className:`flex flex-col h-full`,children:(0,A.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,A.jsxs)(`div`,{className:`max-w-3xl mx-auto flex flex-col gap-4 p-4 pb-2`,children:[e.map(e=>(0,A.jsx)(lke,{message:e,userName:i,agentName:a,isStreaming:e.id===r,onNarrate:s},e.id)),t&&!r&&(0,A.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,A.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-zinc-900 border border-cyan-500/20 flex items-center justify-center shrink-0 ring-2 ring-zinc-950`,children:(0,A.jsx)(Kt,{className:`h-4 w-4 text-cyan-400`})}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5 max-w-[80%]`,children:[n.length>0&&(0,A.jsx)(`div`,{className:`flex flex-col gap-1`,children:n.map((e,t)=>{let r=t===n.length-1;return(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl border text-xs transition-all ${r?`bg-zinc-900 border-cyan-500/20 text-cyan-300`:`bg-zinc-950/50 border-white/5 text-zinc-600`}`,children:[(0,A.jsx)(ri,{className:`h-3 w-3 shrink-0 ${r?`text-cyan-500 animate-pulse`:`text-zinc-700`}`}),(0,A.jsx)(`span`,{className:`leading-tight`,children:e})]},t)})}),(0,A.jsxs)(`div`,{className:`bg-zinc-900 border border-white/5 px-4 py-3 rounded-2xl rounded-tl-sm flex items-center gap-1.5 w-fit`,children:[(0,A.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-cyan-500 animate-bounce [animation-delay:0ms]`}),(0,A.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-cyan-500 animate-bounce [animation-delay:150ms]`}),(0,A.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-cyan-500 animate-bounce [animation-delay:300ms]`})]})]})]}),(0,A.jsx)(`div`,{ref:c,className:`h-0`})]})})})}function fke({onSendMessage:e,disabled:t=!1,isStreaming:n=!1}){let[r,i]=(0,u.useState)(``),[a,o]=(0,u.useState)(!1),s=(0,u.useRef)(null),c=(0,u.useRef)([]),l=(0,u.useRef)(null);(0,u.useEffect)(()=>{l.current&&(l.current.style.height=`auto`,l.current.style.height=l.current.scrollHeight+`px`)},[r]);let d=()=>{r.trim()&&!t&&(e(r.trim()),i(``),l.current&&(l.current.style.height=`auto`))};return(0,A.jsx)(`div`,{className:`px-3 pb-3 pt-2`,children:(0,A.jsxs)(`div`,{className:`max-w-3xl mx-auto`,children:[(0,A.jsxs)(`div`,{className:`flex items-end gap-2 rounded-2xl border bg-zinc-900/60 backdrop-blur-sm px-3 py-2 transition-all shadow-lg shadow-black/20 ${t?`border-white/5 opacity-60`:`border-white/10 focus-within:border-blue-500/30 focus-within:shadow-blue-500/5`}`,children:[(0,A.jsx)(`button`,{onClick:a?()=>{s.current&&a&&(s.current.stop(),o(!1))}:async()=>{try{let t=await navigator.mediaDevices.getUserMedia({audio:!0}),n=new MediaRecorder(t,{mimeType:`audio/webm`});s.current=n,c.current=[],n.ondataavailable=e=>{e.data.size>0&&c.current.push(e.data)},n.onstop=async()=>{let n=new Blob(c.current,{type:`audio/webm`}),r=new FileReader;r.readAsDataURL(n),r.onloadend=()=>{let t=r.result.split(`,`)[1];e(`[Audio mensaje]`,t)},t.getTracks().forEach(e=>e.stop())},n.start(),o(!0)}catch(e){console.error(`Error accessing microphone:`,e)}},disabled:t,className:`h-8 w-8 rounded-xl flex items-center justify-center shrink-0 mb-0.5 transition-all ${a?`bg-red-600 hover:bg-red-500 animate-pulse`:`bg-zinc-800 hover:bg-zinc-700 border border-white/5`} disabled:opacity-30 disabled:cursor-not-allowed text-white`,children:a?(0,A.jsx)(zr,{className:`h-3 w-3`}):(0,A.jsx)(lr,{className:`h-3.5 w-3.5`})}),(0,A.jsx)(`textarea`,{ref:l,value:r,onChange:e=>{i(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),d())},placeholder:t?`Conectando al agente...`:n?`Escribe mientras espera...`:`Escribe un mensaje...`,disabled:t,rows:1,className:`flex-1 min-h-[36px] max-h-[160px] resize-none bg-transparent text-sm text-zinc-100 placeholder:text-zinc-600 focus:outline-none leading-relaxed py-1.5`,style:{overflow:`auto`}}),(0,A.jsx)(`button`,{onClick:d,disabled:!r.trim()||t,className:`h-8 w-8 rounded-xl flex items-center justify-center shrink-0 mb-0.5 transition-all disabled:opacity-30 disabled:cursor-not-allowed bg-blue-600 hover:bg-blue-500 disabled:bg-zinc-800 text-white shadow shadow-blue-600/20`,children:(0,A.jsx)(Er,{className:`h-3.5 w-3.5`})})]}),(0,A.jsx)(`p`,{className:`text-[10px] text-zinc-700 mt-1.5 text-center`,children:a?`Grabando... haz clic para enviar`:`Enter para enviar · Shift+Enter nueva linea`})]})})}function pke({agentId:e=`agent_id`,sessionId:t=`user_id`}){let{messages:n,addMessage:r,setMessages:i,isLoading:a,currentSteps:o,streamingMessageId:s,connectionWarning:c,setConnectionWarning:l}=Y7(),{status:d,send:f,subscribe:p}=dg(),{currentUser:m,fetchUser:h}=jg(),g=X(e=>e.agents),_=X(e=>e.fetchAgents),{handleStreamingChunk:v,handleAudioMessage:y,handleProgress:b,handleTyping:x,resetStreamingRef:S}=QEe(e,t),C=eDe(),w=d===`connected`,T=d===`connecting`,E=g.find(e=>e.role===`coordinator`&&e.enabled)?.name??`Coordinador`;(0,u.useEffect)(()=>{m||h(),g.length===0&&_()},[]),(0,u.useEffect)(()=>{t&&(async()=>{try{let n=await K(`/api/chat/history?sessionId=${t}&limit=15`);n.messages&&i(n.messages.filter(e=>e.role===`user`||e.role===`assistant`).map(t=>({id:t.id,conversationId:t.session_id||t.thread_id,type:t.role===`user`?`user`:`agent`,content:t.content,agentId:e,timestamp:t.created_at})))}catch(e){console.error(`Failed to fetch chat history:`,e)}})()},[t,e,i]),(0,u.useEffect)(()=>{let e=p(`message`,v),t=p(`response`,v),n=p(`audio`,y),r=p(`progress`,b),i=p(`typing`,x);return()=>{e(),t(),n(),r(),i()}},[p,v,y,b,x]),(0,u.useEffect)(()=>{w?l(null):T||l(`Conexion perdida. Reconectando...`)},[w,T,l]);let D=(0,u.useCallback)((n,i)=>{let a=na();C.stop(),r(i?{id:a,conversationId:t,type:`user`,content:n,agentId:e,timestamp:new Date().toISOString(),audio:{base64:i,mimeType:`audio/webm`}}:{id:a,conversationId:t,type:`user`,content:n,agentId:e,timestamp:new Date().toISOString()}),Y7.getState().setLoading(!0),S(),w?f(i?{type:`audio`,audio:i,sessionId:t,timestamp:new Date().toISOString()}:{type:`message`,content:n,sessionId:t,timestamp:new Date().toISOString()}):(r({id:na(),conversationId:t,type:`error`,content:`No se pudo conectar al agente. Verifica que el gateway este funcionando.`,timestamp:new Date().toISOString()}),Y7.getState().setLoading(!1))},[w,t,e,r,f,C,S]),O=(0,u.useCallback)(e=>{C.isSpeaking?C.stop():C.narrate(e)},[C]);return(0,A.jsxs)(`div`,{className:`flex h-full flex-col min-h-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2.5 shrink-0 border-b border-white/5 bg-zinc-950/80 backdrop-blur-sm z-10`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(`div`,{className:`h-8 w-8 rounded-lg bg-zinc-900 border border-cyan-500/20 flex items-center justify-center`,children:(0,A.jsx)(Kt,{className:`h-4 w-4 text-cyan-400`})}),(0,A.jsx)(`span`,{className:`absolute -bottom-0.5 -right-0.5 h-2 w-2 rounded-full border border-zinc-950 ${w?`bg-emerald-500`:T?`bg-yellow-500 animate-pulse`:`bg-zinc-600`}`})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`text-sm font-semibold text-zinc-200`,children:E}),(0,A.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded-full ${w?`text-emerald-400 bg-emerald-500/10`:T?`text-yellow-400 bg-yellow-500/10 animate-pulse`:`text-zinc-500 bg-zinc-800`}`,children:w?`en linea`:T?`conectando`:`desconectado`})]})]}),(0,A.jsx)(`button`,{onClick:C.toggle,className:`h-8 w-8 rounded-lg flex items-center justify-center transition-all ${C.isEnabled?`bg-cyan-600/20 text-cyan-400 hover:bg-cyan-600/30 border border-cyan-500/30`:`bg-zinc-900 text-zinc-500 hover:text-zinc-300 hover:bg-zinc-800 border border-white/5`}`,title:C.isEnabled?`Desactivar narracion`:`Activar narracion`,children:C.isEnabled?(0,A.jsx)(Xr,{className:`h-4 w-4`}):(0,A.jsx)(Zr,{className:`h-4 w-4`})})]}),c&&!w&&(0,A.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 bg-amber-500/10 border-b border-amber-500/20 shrink-0`,children:[(0,A.jsx)(an,{className:`h-3.5 w-3.5 text-amber-400 shrink-0`}),(0,A.jsx)(`span`,{className:`text-xs text-amber-300 flex-1`,children:c}),(0,A.jsxs)(`button`,{onClick:()=>{let{connect:e}=ug.getState();m?.id&&e(m.id)},className:`flex items-center gap-1 text-[10px] font-semibold text-amber-400 hover:text-amber-300 transition-colors`,children:[(0,A.jsx)(Sr,{className:`h-3 w-3`}),`Reintentar`]})]}),C.isSpeaking&&(0,A.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-1.5 bg-cyan-500/10 border-b border-cyan-500/20 shrink-0`,children:[(0,A.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,A.jsx)(`span`,{className:`h-2 w-0.5 bg-cyan-400 rounded-full animate-pulse`,style:{animationDelay:`0ms`}}),(0,A.jsx)(`span`,{className:`h-2 w-0.5 bg-cyan-400 rounded-full animate-pulse`,style:{animationDelay:`150ms`}}),(0,A.jsx)(`span`,{className:`h-2 w-0.5 bg-cyan-400 rounded-full animate-pulse`,style:{animationDelay:`300ms`}})]}),(0,A.jsxs)(`span`,{className:`text-[10px] text-cyan-400 font-medium`,children:[`Narrando`,C.currentText?`: ${C.currentText}...`:`...`]}),(0,A.jsx)(`button`,{onClick:C.stop,className:`text-[10px] text-cyan-500 hover:text-cyan-300 ml-auto`,children:`Detener`})]}),(0,A.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0`,children:(0,A.jsx)(dke,{messages:n,isLoading:a,currentSteps:o,streamingMessageId:s,userName:m?.name??`Usuario`,agentName:E,onSuggestionClick:D,onNarrateMessage:C.isEnabled?O:void 0})}),(0,A.jsx)(`div`,{className:`shrink-0 bg-zinc-950`,children:(0,A.jsx)(fke,{onSendMessage:D,disabled:!w&&!T,isStreaming:a})})]})}function mke(){let{currentUser:e}=jg();return(0,A.jsx)(`div`,{className:`h-full bg-zinc-950 overflow-hidden`,children:(0,A.jsx)(pke,{agentId:`main`,sessionId:e?.id||`default`})})}var hke={gemini:`🔵`,anthropic:`🟠`,openai:`🟢`,groq:`🔴`,ollama:`🟣`,openrouter:`🟡`,deepseek:`🔷`,mistral:`🔸`,kimi:`🌙`},K9={gemini:`https://aistudio.google.com/app/apikey`,anthropic:`https://console.anthropic.com/keys`,openai:`https://platform.openai.com/api-keys`,groq:`https://console.groq.com/keys`,openrouter:`https://openrouter.ai/keys`,deepseek:`https://platform.deepseek.com/api_keys`,mistral:`https://console.mistral.ai/api-keys`,kimi:`https://platform.moonshot.cn/console/api-keys`},q9=[{id:`webchat`,name:`WebChat`,description:`Chat web integrado`,icon:`💬`,required:!0},{id:`telegram`,name:`Telegram`,description:`Bot de Telegram`,icon:`✈️`,required:!1},{id:`discord`,name:`Discord`,description:`Bot de Discord`,icon:`🎮`,required:!1},{id:`whatsapp`,name:`WhatsApp`,description:`Bot de WhatsApp`,icon:`📱`,required:!1},{id:`slack`,name:`Slack`,description:`Bot de Slack`,icon:`💼`,required:!1}],J9=`hive_setup_wizard_data`;function gke(){try{let e=sessionStorage.getItem(J9);if(e){let t=JSON.parse(e);return{...X9(),...t}}}catch(e){console.error(`Failed to load wizard data:`,e)}return null}function _ke(e){try{sessionStorage.setItem(J9,JSON.stringify(e))}catch(e){console.error(`Failed to save wizard data:`,e)}}function Y9(){try{sessionStorage.removeItem(J9)}catch(e){console.error(`Failed to clear wizard data:`,e)}}function X9(){return{userName:``,userLanguage:`es`,userTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,userOccupation:``,userNotes:``,agentName:`Bee`,agentDescription:``,agentTone:`friendly`,provider:``,apiKey:``,model:``,apiKeyVerified:!1,channels:{webchat:{enabled:!0},telegram:{enabled:!1},discord:{enabled:!1},whatsapp:{enabled:!1},slack:{enabled:!1}},voiceEnabled:!1,sttProvider:`groq-whisper`,ttsProvider:`elevenlabs`,ttsVoice:``,ethicsRules:{},customRules:[],hiveLearnEnabled:!1}}function vke(){let e=Gd(),[t,n]=(0,u.useState)(1),[r,i]=(0,u.useState)(()=>gke()||X9()),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)(!1),{showLoader:l,hideLoader:d}=pg(),[f,p]=(0,u.useState)(`idle`),[m,h]=(0,u.useState)(null),[g,_]=(0,u.useState)([]),[v,y]=(0,u.useState)(null),[b,x]=(0,u.useState)(!1),[S,C]=(0,u.useState)([]);(0,u.useEffect)(()=>{fetch(`${cg()}/api/setup/providers`).then(e=>e.json()).then(e=>{Array.isArray(e)&&_(e)}).catch(()=>{}),fetch(`${cg()}/api/setup/ethics`).then(e=>e.json()).then(e=>{Array.isArray(e)&&(C(e),i(t=>Object.keys(t.ethicsRules).length===0?{...t,ethicsRules:Object.fromEntries(e.map(e=>[e.id,!0]))}:t))}).catch(()=>{})},[]),(0,u.useEffect)(()=>{_ke(r)},[r]),(0,u.useEffect)(()=>{fetch(`${cg()}/api/setup/status`).then(e=>e.json()).then(t=>{t.configured&&e(`/ui`)}).catch(()=>{})},[e]);let w=e=>{h(null),i(t=>({...t,...e}))},T=()=>{switch(t){case 1:return r.userName.trim()?r.userName.trim().length<2?`El nombre debe tener al menos 2 caracteres.`:null:`El nombre es obligatorio.`;case 2:return r.agentName.trim()?r.agentName.trim().length<2?`El nombre debe tener al menos 2 caracteres.`:null:`El nombre del agente es obligatorio.`;case 3:return r.provider?r.provider!==`ollama`&&!r.apiKey?`Ingresa tu API key.`:r.provider!==`ollama`&&!r.apiKeyVerified?`Verifica tu API key antes de continuar.`:r.model?null:`Selecciona un modelo.`:`Selecciona un proveedor LLM.`;default:return null}},E=()=>{let e=T();if(e){h(e);return}h(null),t<8&&n(e=>e+1)},D=()=>{t>1&&n(e=>e-1)},O=()=>{confirm(`¿Estás seguro de que quieres reiniciar la configuración? Se perderá todo el progreso.`)&&(Y9(),i(X9()),n(1))},k=async()=>{if(!(!r.apiKey||!r.provider)){p(`verifying`);try{(await K(`/api/setup/verify-provider`,{method:`POST`,body:{provider:r.provider,apiKey:r.apiKey},showLoader:`Verificando conexión...`,showError:!1})).success?(p(`success`),w({apiKeyVerified:!0})):(p(`error`),w({apiKeyVerified:!1}))}catch{p(`error`),w({apiKeyVerified:!1})}}},j=async()=>{o(!0);try{let t=await K(`/api/setup/complete`,{method:`POST`,body:r,showLoader:`Finalizando configuración...`,showError:!0});if(t.success){let n=t.authToken;n&&localStorage.setItem(`hive-auth-token`,n),c(!0),Y9(),(async()=>{await new Promise(e=>setTimeout(e,1500)),l(`Iniciando a ${r.agentName}... esto toma unos segundos`);for(let t=0;t<40;t++){try{let t=await fetch(`${cg()}/api/setup/status`);if(t.ok){let{configured:r}=await t.json();if(r){d(),e(n?`/?token=${n}`:`/`);return}}}catch{}await new Promise(e=>setTimeout(e,1e3))}d(),e(n?`/?token=${n}`:`/`)})()}}catch{}finally{o(!1)}},M=()=>{switch(t){case 1:return N();case 2:return P();case 3:return F();case 4:return I();case 5:return L();case 6:return R();case 7:return ee();case 8:return te();default:return null}},N=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-4`,children:[(0,A.jsx)(`div`,{className:`flex justify-center`,children:(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(Wn,{className:`w-24 h-24 text-amber-500`,fill:`currentColor`}),(0,A.jsx)(Rr,{className:`w-8 h-8 text-amber-300 absolute -top-2 -right-2`})]})}),(0,A.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Bienvenido a Hive`}),(0,A.jsx)(`p`,{className:`text-muted-foreground max-w-md mx-auto`,children:`Hive es tu colmena de agentes IA. Local-first. Multi-canal. Open source. En los próximos minutos configurarás tu agente personal Bee.`})]}),(0,A.jsxs)(OR,{children:[(0,A.jsxs)(kR,{children:[(0,A.jsx)(AR,{children:`Tu información`}),(0,A.jsx)(jR,{children:`Comencemos con tus datos básicos`})]}),(0,A.jsxs)(MR,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`userName`,children:`Tu nombre`}),(0,A.jsx)(G,{id:`userName`,placeholder:`¿Cómo te llamas?`,value:r.userName,onChange:e=>w({userName:e.target.value})})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`userLanguage`,children:`Idioma preferido`}),(0,A.jsxs)(RK,{value:r.userLanguage,onValueChange:e=>w({userLanguage:e}),children:[(0,A.jsx)(VK,{children:(0,A.jsx)(BK,{})}),(0,A.jsxs)(WK,{children:[(0,A.jsx)(Q,{value:`es`,children:`Español`}),(0,A.jsx)(Q,{value:`en`,children:`English`}),(0,A.jsx)(Q,{value:`pt`,children:`Português`}),(0,A.jsx)(Q,{value:`fr`,children:`Français`})]})]})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`userTimezone`,children:`Zona horaria`}),(0,A.jsx)(G,{id:`userTimezone`,value:r.userTimezone,onChange:e=>w({userTimezone:e.target.value}),placeholder:`America/Bogota`}),(0,A.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Detectada automáticamente: `,Intl.DateTimeFormat().resolvedOptions().timeZone]})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsxs)(Z,{htmlFor:`userOccupation`,children:[`Ocupación `,(0,A.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(opcional)`})]}),(0,A.jsx)(G,{id:`userOccupation`,value:r.userOccupation,onChange:e=>w({userOccupation:e.target.value}),placeholder:`Ej: Desarrollador de software, diseñador, estudiante...`})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsxs)(Z,{htmlFor:`userNotes`,children:[`Preferencias de comunicación `,(0,A.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(opcional)`})]}),(0,A.jsx)(`textarea`,{id:`userNotes`,className:`w-full min-h-[80px] p-3 border rounded-md bg-background resize-none text-sm`,value:r.userNotes,onChange:e=>w({userNotes:e.target.value}),placeholder:`Ej: Prefiero respuestas cortas y directas. Usa ejemplos de código cuando expliques conceptos técnicos...`})]})]})]})]}),P=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Tu agente`}),(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Personaliza a Bee, tu agente personal`})]}),(0,A.jsxs)(OR,{children:[(0,A.jsx)(kR,{children:(0,A.jsx)(AR,{children:`Identidad del agente`})}),(0,A.jsxs)(MR,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`agentName`,children:`Nombre del agente`}),(0,A.jsx)(G,{id:`agentName`,value:r.agentName,onChange:e=>w({agentName:e.target.value}),placeholder:`Bee`})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`agentDescription`,children:`Descripción / Personalidad`}),(0,A.jsx)(`textarea`,{id:`agentDescription`,className:`w-full min-h-[100px] p-3 border rounded-md bg-background resize-none`,value:r.agentDescription,onChange:e=>w({agentDescription:e.target.value}),placeholder:`Ej: Eres un asistente útil y amable. Respondes de forma concisa pero completa. Te especializas en ayudar con tareas de programación y productividad...`})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`agentTone`,children:`Tono de comunicación`}),(0,A.jsxs)(RK,{value:r.agentTone,onValueChange:e=>w({agentTone:e}),children:[(0,A.jsx)(VK,{children:(0,A.jsx)(BK,{placeholder:`Selecciona un tono`})}),(0,A.jsxs)(WK,{children:[(0,A.jsx)(Q,{value:`friendly`,children:`Amigable y cercano`}),(0,A.jsx)(Q,{value:`professional`,children:`Profesional y formal`}),(0,A.jsx)(Q,{value:`direct`,children:`Directo y conciso`}),(0,A.jsx)(Q,{value:`casual`,children:`Casual y relajado`})]})]}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Define cómo se comunicará tu agente contigo`})]})]})]})]}),F=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Proveedor LLM`}),(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Selecciona el cerebro de tu agente`})]}),(0,A.jsx)(`div`,{className:`grid gap-3`,children:g.map(e=>(0,A.jsx)(OR,{className:H(`cursor-pointer transition-all hover:shadow-md`,r.provider===e.id&&`border-amber-500 ring-2 ring-amber-500`),onClick:()=>{w({provider:e.id,model:``,apiKeyVerified:!1}),e.id===`ollama`&&y(null)},children:(0,A.jsxs)(MR,{className:`flex items-center gap-4 p-4`,children:[(0,A.jsx)(`span`,{className:`text-3xl`,children:hke[e.id]??`🤖`}),(0,A.jsxs)(`div`,{className:`flex-1`,children:[(0,A.jsx)(`h3`,{className:`font-semibold`,children:e.name}),(0,A.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[e.models.length,` modelo`,e.models.length===1?``:`s`,` disponible`,e.models.length===1?``:`s`]})]}),r.provider===e.id&&(0,A.jsx)(sn,{className:`w-5 h-5 text-amber-500`})]})},e.id))}),r.provider&&(()=>{let e=g.find(e=>e.id===r.provider);return(0,A.jsxs)(OR,{className:`mt-4`,children:[(0,A.jsx)(kR,{children:(0,A.jsxs)(AR,{children:[`Configuración de `,e?.name]})}),(0,A.jsxs)(MR,{className:`space-y-4`,children:[r.provider!==`ollama`&&(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`apiKey`,children:`API Key`}),(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsx)(G,{id:`apiKey`,type:`password`,value:r.apiKey,onChange:e=>w({apiKey:e.target.value,apiKeyVerified:!1}),placeholder:`sk-...`,className:H(m?.includes(`API key`)&&!r.apiKey&&`border-red-500`)}),(0,A.jsx)(W,{variant:`outline`,onClick:k,disabled:!r.apiKey||f===`verifying`,children:f===`verifying`?(0,A.jsx)(tr,{className:`w-4 h-4 animate-spin`}):f===`success`?(0,A.jsx)(sn,{className:`w-4 h-4 text-green-500`}):f===`error`?(0,A.jsx)(dn,{className:`w-4 h-4 text-red-500`}):`Verificar`})]}),f===`success`&&(0,A.jsxs)(`p`,{className:`text-sm text-green-600 flex items-center gap-1`,children:[(0,A.jsx)(sn,{className:`w-4 h-4`}),` API key verificada correctamente`]}),f===`error`&&(0,A.jsxs)(`p`,{className:`text-sm text-red-600 flex items-center gap-1`,children:[(0,A.jsx)(dn,{className:`w-4 h-4`}),` API key inválida o error de conexión`]}),K9[r.provider]&&(0,A.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`¿No tienes tu API key?`,` `,(0,A.jsx)(`a`,{href:K9[r.provider],target:`_blank`,rel:`noopener noreferrer`,className:`text-amber-500 hover:underline`,children:`Obtener aquí`})]})]}),r.provider===`ollama`&&(0,A.jsxs)(`div`,{className:`space-y-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,disabled:b,onClick:()=>{y(null),x(!0),w({model:``}),fetch(`${cg()}/api/setup/ollama-models`).then(e=>e.json()).then(e=>{y(e.models??[]),x(!1)}).catch(()=>{y([]),x(!1)})},children:b?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(tr,{className:`w-3 h-3 animate-spin mr-1`}),`Detectando...`]}):`🔍 Detectar modelos`}),!b&&v!==null&&(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:v.length>0?`${v.length} modelo${v.length===1?``:`s`} encontrado${v.length===1?``:`s`}`:`Sin modelos — instala uno con ollama pull`})]}),v&&v.length>0&&(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsx)(Z,{htmlFor:`model`,children:`Modelo`}),(0,A.jsxs)(RK,{value:r.model,onValueChange:e=>w({model:e}),children:[(0,A.jsx)(VK,{className:H(!r.model&&m?.includes(`modelo`)&&`border-red-500`),children:(0,A.jsx)(BK,{placeholder:`Selecciona un modelo`})}),(0,A.jsx)(WK,{children:v.map((e,t)=>(0,A.jsxs)(Q,{value:e.id,children:[e.name,t===0?` (Recomendado)`:``]},e.id))})]})]}),!b&&v!==null&&v.length===0&&(0,A.jsxs)(`p`,{className:`text-xs text-amber-600`,children:[`Asegúrate que Ollama esté corriendo (`,(0,A.jsx)(`code`,{children:`ollama serve`}),`) y tengas modelos (`,(0,A.jsx)(`code`,{children:`ollama pull llama3.2`}),`).`]})]}),r.provider!==`ollama`&&r.apiKeyVerified&&(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`model`,children:`Modelo`}),(0,A.jsxs)(RK,{value:r.model,onValueChange:e=>w({model:e}),children:[(0,A.jsx)(VK,{className:H(!r.model&&m?.includes(`modelo`)&&`border-red-500`),children:(0,A.jsx)(BK,{placeholder:`Selecciona un modelo`})}),(0,A.jsx)(WK,{children:(e?.models??[]).map((e,t)=>(0,A.jsxs)(Q,{value:e.id,children:[e.name||e.id,t===0?` (Recomendado)`:``]},e.id))})]})]})]})]})})()]}),I=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Canales`}),(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`¿Dónde quieres que Bee esté disponible?`})]}),(0,A.jsx)(`div`,{className:`grid gap-3`,children:q9.map(e=>(0,A.jsx)(OR,{className:H(`transition-all`,r.channels[e.id]?.enabled&&`border-amber-500`),children:(0,A.jsxs)(MR,{className:`p-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,A.jsx)(`span`,{className:`text-2xl`,children:e.icon}),(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`h3`,{className:`font-semibold flex items-center gap-2`,children:[e.name,e.required&&(0,A.jsx)(jz,{variant:`secondary`,className:`text-xs`,children:`Requerido`})]}),(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description})]})]}),(0,A.jsx)(aq,{checked:r.channels[e.id]?.enabled,onCheckedChange:t=>{e.required&&!t||w({channels:{...r.channels,[e.id]:{enabled:t}}})},disabled:e.required})]}),!e.required&&r.channels[e.id]?.enabled&&(0,A.jsx)(c3,{type:`single`,collapsible:!0,className:`mt-4`,children:(0,A.jsxs)(l3,{value:`config`,children:[(0,A.jsx)(u3,{children:`Configuración`}),(0,A.jsx)(d3,{children:(0,A.jsxs)(`div`,{className:`space-y-3 pt-2`,children:[e.id===`telegram`&&(0,A.jsx)(A.Fragment,{children:(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`telegramToken`,children:`Token del Bot`}),(0,A.jsx)(G,{id:`telegramToken`,placeholder:`123456789:ABCdefGHIjklMNOpqrsTUVwxyz`,value:r.channels.telegram.config?.botToken||``,onChange:e=>w({channels:{...r.channels,telegram:{enabled:!0,config:{botToken:e.target.value}}}})}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,A.jsx)(`a`,{href:`https://t.me/BotFather`,target:`_blank`,rel:`noopener noreferrer`,className:`text-amber-500 hover:underline`,children:`Obtén tu token en BotFather`})})]})}),e.id===`discord`&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`discordToken`,children:`Token del Bot`}),(0,A.jsx)(G,{id:`discordToken`,placeholder:`MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.GJKlMn.OpQrStUvWxYz`,value:r.channels.discord.config?.botToken||``,onChange:e=>w({channels:{...r.channels,discord:{enabled:!0,config:{botToken:e.target.value}}}})})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`discordClientId`,children:`Client ID`}),(0,A.jsx)(G,{id:`discordClientId`,placeholder:`1234567890123456789`,value:r.channels.discord.config?.clientId||``,onChange:e=>w({channels:{...r.channels,discord:{enabled:!0,config:{clientId:e.target.value}}}})})]})]}),e.id===`whatsapp`&&(0,A.jsx)(A.Fragment,{children:(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`whatsappToken`,children:`Token de la API`}),(0,A.jsx)(G,{id:`whatsappToken`,placeholder:`...`,value:r.channels.whatsapp.config?.apiToken||``,onChange:e=>w({channels:{...r.channels,whatsapp:{enabled:!0,config:{apiToken:e.target.value}}}})})]})}),e.id===`slack`&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`slackToken`,children:`Bot Token`}),(0,A.jsx)(G,{id:`slackToken`,placeholder:`xoxb-...`,value:r.channels.slack.config?.botToken||``,onChange:e=>w({channels:{...r.channels,slack:{enabled:!0,config:{botToken:e.target.value}}}})})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`slackSigningSecret`,children:`Signing Secret`}),(0,A.jsx)(G,{id:`slackSigningSecret`,placeholder:`...`,value:r.channels.slack.config?.signingSecret||``,onChange:e=>w({channels:{...r.channels,slack:{enabled:!0,config:{signingSecret:e.target.value}}}})})]})]})]})})]})})]})},e.id))})]}),L=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Voz (opcional)`}),(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Permite que Bee hable y escuche`})]}),(0,A.jsxs)(OR,{children:[(0,A.jsx)(kR,{children:(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsx)(AR,{children:`Activar voz`}),(0,A.jsx)(aq,{checked:r.voiceEnabled,onCheckedChange:e=>w({voiceEnabled:e})})]})}),(0,A.jsx)(MR,{children:r.voiceEnabled?(0,A.jsxs)(`div`,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`sttProvider`,children:`Reconocimiento de voz (STT)`}),(0,A.jsxs)(RK,{value:r.sttProvider,onValueChange:e=>w({sttProvider:e}),children:[(0,A.jsx)(VK,{children:(0,A.jsx)(BK,{})}),(0,A.jsxs)(WK,{children:[(0,A.jsx)(Q,{value:`groq-whisper`,children:`Groq Whisper (Recomendado)`}),(0,A.jsx)(Q,{value:`openai-whisper`,children:`OpenAI Whisper`})]})]})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`ttsProvider`,children:`Síntesis de voz (TTS)`}),(0,A.jsxs)(RK,{value:r.ttsProvider,onValueChange:e=>w({ttsProvider:e}),children:[(0,A.jsx)(VK,{children:(0,A.jsx)(BK,{})}),(0,A.jsxs)(WK,{children:[(0,A.jsx)(Q,{value:`elevenlabs`,children:`ElevenLabs (Recomendado)`}),(0,A.jsx)(Q,{value:`openai`,children:`OpenAI TTS`}),(0,A.jsx)(Q,{value:`gemini`,children:`Google Gemini`})]})]})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`ttsVoice`,children:`Voz`}),(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsxs)(RK,{value:r.ttsVoice,onValueChange:e=>w({ttsVoice:e}),children:[(0,A.jsx)(VK,{children:(0,A.jsx)(BK,{placeholder:`Selecciona una voz`})}),(0,A.jsxs)(WK,{children:[(0,A.jsx)(Q,{value:`Rachel`,children:`Rachel (ElevenLabs)`}),(0,A.jsx)(Q,{value:`Adam`,children:`Adam (ElevenLabs)`}),(0,A.jsx)(Q,{value:`Antoni`,children:`Antoni (ElevenLabs)`}),(0,A.jsx)(Q,{value:`Elli`,children:`Elli (ElevenLabs)`}),(0,A.jsx)(Q,{value:`Josh`,children:`Josh (ElevenLabs)`}),(0,A.jsx)(Q,{value:`alloy`,children:`Alloy (OpenAI)`}),(0,A.jsx)(Q,{value:`echo`,children:`Echo (OpenAI)`}),(0,A.jsx)(Q,{value:`fable`,children:`Fable (OpenAI)`}),(0,A.jsx)(Q,{value:`onyx`,children:`Onyx (OpenAI)`}),(0,A.jsx)(Q,{value:`nova`,children:`Nova (OpenAI)`}),(0,A.jsx)(Q,{value:`shimmer`,children:`Shimmer (OpenAI)`})]})]}),(0,A.jsx)(W,{variant:`outline`,size:`icon`,children:(0,A.jsx)(Xr,{className:`w-4 h-4`})})]})]}),(0,A.jsx)(UQ,{children:(0,A.jsx)(GQ,{className:`text-sm`,children:r.provider===r.ttsProvider&&(0,A.jsxs)(`span`,{className:`text-green-600 flex items-center gap-1`,children:[(0,A.jsx)(sn,{className:`w-4 h-4`}),` Ya tienes la API key configurada`]})})})]}):(0,A.jsx)(`p`,{className:`text-muted-foreground text-center py-4`,children:`Puedes activar la voz más tarde en la configuración`})})]})]}),R=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Reglas éticas`}),(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Define los límites de tu agente`})]}),(0,A.jsx)(UQ,{children:(0,A.jsxs)(GQ,{className:`text-sm`,children:[`Las reglas de categoría `,(0,A.jsx)(`strong`,{className:`text-red-500`,children:`NUNCA`}),` son las protecciones más importantes. Desactivarlas puede comprometer la seguridad.`]})}),(0,A.jsxs)(`div`,{className:`space-y-3`,children:[S.map(e=>{let t=r.ethicsRules[e.id]!==!1;return(0,A.jsx)(OR,{className:H(!t&&`opacity-60`),children:(0,A.jsx)(MR,{className:`p-4`,children:(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,A.jsx)(r$,{checked:t,onCheckedChange:t=>{e.isDefault&&!t&&!confirm(`¿Estás seguro de desactivar los lineamientos éticos por defecto?`)||w({ethicsRules:{...r.ethicsRules,[e.id]:t}})}}),(0,A.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`h3`,{className:`font-medium`,children:e.name}),e.isDefault&&(0,A.jsx)(jz,{className:`text-xs bg-blue-500/10 text-blue-500`,children:`Por defecto`})]}),e.description&&(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),(0,A.jsxs)(`details`,{className:`mt-2`,children:[(0,A.jsx)(`summary`,{className:`text-xs text-muted-foreground cursor-pointer hover:text-foreground`,children:`Ver contenido`}),(0,A.jsx)(`pre`,{className:`text-xs mt-2 p-2 bg-muted rounded whitespace-pre-wrap font-mono`,children:e.content})]})]})]})})},e.id)}),S.length===0&&(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-4`,children:`Cargando lineamientos éticos...`})]}),(0,A.jsx)(W,{variant:`outline`,className:`w-full`,onClick:()=>{let e=prompt(`Ingresa tu regla personalizada:`);if(e){let t=prompt(`Categoría (SIEMPRE/NUNCA/CONFIRMAR):`,`CONFIRMAR`);t&&[`SIEMPRE`,`NUNCA`,`CONFIRMAR`].includes(t.toUpperCase())&&w({customRules:[...r.customRules,{text:e,category:t.toUpperCase()}]})}},children:`+ Añadir regla personalizada`}),r.customRules.length>0&&(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{children:`Reglas personalizadas`}),r.customRules.map((e,t)=>(0,A.jsx)(OR,{children:(0,A.jsxs)(MR,{className:`p-4 flex items-center justify-between`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`font-medium`,children:e.text}),(0,A.jsx)(jz,{className:H(`text-xs mt-1`,e.category===`NUNCA`&&`text-red-500 bg-red-500/10`,e.category===`SIEMPRE`&&`text-green-500 bg-green-500/10`,e.category===`CONFIRMAR`&&`text-amber-500 bg-amber-500/10`),children:e.category})]}),(0,A.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>{w({customRules:r.customRules.filter((e,n)=>n!==t)})},children:`Eliminar`})]})},t))]})]}),ee=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Módulos opcionales`}),(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Activa las funcionalidades adicionales que quieras usar`})]}),(0,A.jsx)(OR,{className:`cursor-pointer transition-all border-2 ${r.hiveLearnEnabled?`border-amber-500 bg-amber-500/5`:`border-border hover:border-amber-500/40`}`,onClick:()=>w({hiveLearnEnabled:!r.hiveLearnEnabled}),children:(0,A.jsxs)(MR,{className:`p-5 flex items-start gap-4`,children:[(0,A.jsx)(`div`,{className:`mt-1 p-2.5 rounded-xl ${r.hiveLearnEnabled?`bg-amber-500/20`:`bg-muted`}`,children:(0,A.jsx)(Rn,{className:`w-6 h-6 ${r.hiveLearnEnabled?`text-amber-500`:`text-muted-foreground`}`})}),(0,A.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,A.jsx)(`h3`,{className:`font-semibold text-base`,children:`HiveLearn`}),(0,A.jsx)(jz,{variant:`outline`,className:`text-[10px] font-bold uppercase tracking-wider`,children:`Enjambre Educativo`})]}),(0,A.jsxs)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:[`Genera lecciones personalizadas con 17 agentes de IA trabajando en paralelo. Requiere `,(0,A.jsx)(`strong`,{children:`Ollama`}),` corriendo localmente.`]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-3 mt-3 text-xs text-muted-foreground`,children:[(0,A.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(_n,{className:`w-3 h-3`}),` 17 agentes especializados`]}),(0,A.jsx)(`span`,{children:`·`}),(0,A.jsx)(`span`,{children:`Ollama requerido`}),(0,A.jsx)(`span`,{children:`·`}),(0,A.jsx)(`span`,{children:`~2 min primera lección`})]})]}),(0,A.jsx)(aq,{checked:r.hiveLearnEnabled,onCheckedChange:e=>{w({hiveLearnEnabled:e})},onClick:e=>e.stopPropagation(),className:`mt-1 shrink-0`})]})}),(0,A.jsx)(`p`,{className:`text-xs text-center text-muted-foreground`,children:`Puedes activar o desactivar módulos en cualquier momento desde la configuración.`})]}),te=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-bold`,children:`¡Todo listo!`}),(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Revisa tu configuración antes de continuar`})]}),s?(0,A.jsx)(OR,{className:`border-green-500 bg-green-500/10`,children:(0,A.jsxs)(MR,{className:`p-8 text-center space-y-4`,children:[(0,A.jsx)(`div`,{className:`flex justify-center`,children:(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(Wn,{className:`w-24 h-24 text-amber-500 animate-pulse`,fill:`currentColor`}),(0,A.jsx)(Rr,{className:`w-8 h-8 text-amber-300 absolute -top-2 -right-2 animate-bounce`})]})}),(0,A.jsx)(`h3`,{className:`text-xl font-bold`,children:`¡Bienvenido a Hive!`}),(0,A.jsxs)(`p`,{className:`text-muted-foreground`,children:[r.agentName,` está listo para ayudarte.`]})]})}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(OR,{children:[(0,A.jsxs)(kR,{children:[(0,A.jsxs)(AR,{className:`flex items-center gap-3`,children:[(0,A.jsx)(`div`,{className:`w-10 h-10 rounded-lg flex items-center justify-center bg-amber-500`,children:(0,A.jsx)(Wn,{className:`w-6 h-6 text-white`,fill:`currentColor`})}),r.agentName]}),(0,A.jsx)(jR,{children:r.agentDescription||`Sin descripción`})]}),(0,A.jsxs)(MR,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(Z,{className:`text-sm text-muted-foreground`,children:`Proveedor`}),(0,A.jsxs)(`p`,{className:`font-medium`,children:[g.find(e=>e.id===r.provider)?.name||r.provider,` — `,r.model]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(Z,{className:`text-sm text-muted-foreground`,children:`Canales activos`}),(0,A.jsx)(`div`,{className:`flex gap-2 flex-wrap mt-1`,children:Object.entries(r.channels).filter(([e,t])=>t.enabled).map(([e])=>{let t=q9.find(t=>t.id===e);return(0,A.jsxs)(jz,{variant:`secondary`,children:[t?.icon,` `,t?.name]},e)})})]}),r.voiceEnabled&&(0,A.jsxs)(`div`,{children:[(0,A.jsx)(Z,{className:`text-sm text-muted-foreground`,children:`Voz`}),(0,A.jsxs)(`p`,{className:`font-medium`,children:[`STT: `,r.sttProvider,` | TTS: `,r.ttsProvider,r.ttsVoice&&` (${r.ttsVoice})`]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(Z,{className:`text-sm text-muted-foreground`,children:`Reglas éticas activas`}),(0,A.jsx)(`div`,{className:`flex gap-2 flex-wrap mt-1`,children:Object.entries(r.ethicsRules).filter(([e,t])=>t).map(([e])=>(0,A.jsx)(jz,{variant:`outline`,children:S.find(t=>t.id===e)?.name??e},e))})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(Z,{className:`text-sm text-muted-foreground`,children:`Módulos`}),(0,A.jsx)(`div`,{className:`flex gap-2 mt-1`,children:(0,A.jsxs)(jz,{variant:r.hiveLearnEnabled?`default`:`secondary`,className:r.hiveLearnEnabled?`bg-amber-500`:``,children:[(0,A.jsx)(Rn,{className:`w-3 h-3 mr-1`}),`HiveLearn `,r.hiveLearnEnabled?`activado`:`desactivado`]})})]})]})]}),(0,A.jsx)(W,{className:`w-full h-14 text-lg bg-amber-500 hover:bg-amber-600`,onClick:j,disabled:a,children:a?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(tr,{className:`w-5 h-5 mr-2 animate-spin`}),`Configurando...`]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Rr,{className:`w-5 h-5 mr-2`}),`Iniciar a `,r.agentName]})})]})]});return(0,A.jsx)(`div`,{className:`min-h-screen bg-gradient-to-b from-background to-muted/20`,children:(0,A.jsxs)(`div`,{className:`container max-w-2xl mx-auto py-8 px-4`,children:[(0,A.jsxs)(`div`,{className:`mb-8 space-y-2`,children:[(0,A.jsxs)(`div`,{className:`flex justify-between text-sm text-muted-foreground`,children:[(0,A.jsxs)(`span`,{children:[`Paso `,t,` de 8`]}),(0,A.jsx)(`button`,{onClick:O,className:`text-xs text-muted-foreground hover:text-foreground`,children:`Reiniciar configuración`})]}),(0,A.jsx)(Zz,{value:t/8*100,className:`h-2`})]}),M(),m&&(0,A.jsx)(UQ,{variant:`destructive`,className:`mt-6`,children:(0,A.jsx)(GQ,{children:m})}),!s&&(0,A.jsxs)(`div`,{className:`flex justify-between mt-6 pt-6 border-t`,children:[(0,A.jsx)(W,{variant:`outline`,onClick:D,disabled:t===1,children:`← Anterior`}),t<8?(0,A.jsx)(W,{onClick:E,className:`bg-amber-500 hover:bg-amber-600`,children:`Siguiente →`}):(0,A.jsx)(`div`,{})]})]})})}function yke(){let e=Gd(),[t,n]=(0,u.useState)(``),[r,i]=(0,u.useState)(``),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)(!1),[l,d]=(0,u.useState)(``);(0,u.useEffect)(()=>{fetch(`/api/auth/status`).then(e=>e.json()).then(({hasCredentials:t})=>{t||e(`/`,{replace:!0})}).catch(()=>{})},[]);async function f(n){n.preventDefault(),d(``),c(!0);try{let n=await fetch(`/api/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:t,password:r})}),i=await n.json();if(!n.ok){d(i.error||`Credenciales inválidas`);return}localStorage.setItem(`hive-auth-token`,i.authToken),e(`/`,{replace:!0})}catch{d(`No se pudo conectar al servidor`)}finally{c(!1)}}return(0,A.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,A.jsxs)(`div`,{className:`w-full max-w-sm space-y-6 p-8`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`div`,{className:`text-4xl`,children:`🐝`}),(0,A.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:`Hive`}),(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Inicia sesión para continuar`})]}),(0,A.jsxs)(`form`,{onSubmit:f,className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`email`,children:`Email`}),(0,A.jsx)(G,{id:`email`,type:`email`,autoComplete:`email`,placeholder:`tu@email.com`,value:t,onChange:e=>n(e.target.value),required:!0,disabled:s})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`password`,children:`Contraseña`}),(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(G,{id:`password`,type:a?`text`:`password`,autoComplete:`current-password`,placeholder:`••••••••`,value:r,onChange:e=>i(e.target.value),required:!0,disabled:s,className:`pr-10`}),(0,A.jsx)(`button`,{type:`button`,className:`absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>o(e=>!e),tabIndex:-1,children:a?(0,A.jsx)(On,{className:`h-4 w-4`}):(0,A.jsx)(kn,{className:`h-4 w-4`})})]})]}),l&&(0,A.jsx)(`p`,{className:`text-sm text-destructive`,children:l}),(0,A.jsxs)(W,{type:`submit`,className:`w-full`,disabled:s,children:[s&&(0,A.jsx)(tr,{className:`mr-2 h-4 w-4 animate-spin`}),`Iniciar Sesión`]})]}),(0,A.jsx)(`div`,{className:`text-center`,children:(0,A.jsx)(`button`,{type:`button`,onClick:()=>e(`/recover`),className:`text-sm text-muted-foreground hover:text-foreground underline underline-offset-4`,children:`¿Olvidaste tu contraseña?`})})]})})}function bke(){let e=Gd(),[t,n]=(0,u.useState)(``),[r,i]=(0,u.useState)(``),[a,o]=(0,u.useState)(``),[s,c]=(0,u.useState)(!1),[l,d]=(0,u.useState)(!1),[f,p]=(0,u.useState)(``);async function m(n){if(n.preventDefault(),p(``),r!==a){p(`Las contraseñas no coinciden`);return}if(r.length<8){p(`La contraseña debe tener al menos 8 caracteres`);return}d(!0);try{let n=await fetch(`/api/auth/recover`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({recoveryKey:t,newPassword:r})}),i=await n.json();if(!n.ok){p(i.error||`Recovery key inválido`);return}localStorage.setItem(`hive-auth-token`,i.authToken),e(`/`,{replace:!0})}catch{p(`No se pudo conectar al servidor`)}finally{d(!1)}}return(0,A.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,A.jsxs)(`div`,{className:`w-full max-w-sm space-y-6 p-8`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`div`,{className:`text-4xl`,children:`🐝`}),(0,A.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:`Recuperar acceso`}),(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Usa tu recovery key para restablecer la contraseña`})]}),(0,A.jsxs)(`form`,{onSubmit:m,className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`recoveryKey`,children:`Recovery Key`}),(0,A.jsx)(G,{id:`recoveryKey`,type:`text`,placeholder:`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`,value:t,onChange:e=>n(e.target.value),required:!0,disabled:l,className:`font-mono text-sm`}),(0,A.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Encuéntralo en `,(0,A.jsx)(`code`,{className:`bg-muted px-1 rounded`,children:`~/.hive/.auth_token`})]})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`newPassword`,children:`Nueva contraseña`}),(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(G,{id:`newPassword`,type:s?`text`:`password`,placeholder:`••••••••`,value:r,onChange:e=>i(e.target.value),required:!0,disabled:l,className:`pr-10`}),(0,A.jsx)(`button`,{type:`button`,className:`absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>c(e=>!e),tabIndex:-1,children:s?(0,A.jsx)(On,{className:`h-4 w-4`}):(0,A.jsx)(kn,{className:`h-4 w-4`})})]})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`confirmPassword`,children:`Confirmar contraseña`}),(0,A.jsx)(G,{id:`confirmPassword`,type:s?`text`:`password`,placeholder:`••••••••`,value:a,onChange:e=>o(e.target.value),required:!0,disabled:l})]}),f&&(0,A.jsx)(`p`,{className:`text-sm text-destructive`,children:f}),(0,A.jsxs)(W,{type:`submit`,className:`w-full`,disabled:l,children:[l&&(0,A.jsx)(tr,{className:`mr-2 h-4 w-4 animate-spin`}),`Recuperar acceso`]})]}),(0,A.jsx)(`div`,{className:`text-center`,children:(0,A.jsxs)(`button`,{type:`button`,onClick:()=>e(`/login`),className:`text-sm text-muted-foreground hover:text-foreground inline-flex items-center gap-1`,children:[(0,A.jsx)(Vt,{className:`h-3 w-3`}),`Volver al login`]})})]})})}var xke=()=>{let e=Hd();return(0,u.useEffect)(()=>{console.error(`404 Error: User attempted to access non-existent route:`,e.pathname)},[e.pathname]),(0,A.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-muted`,children:(0,A.jsxs)(`div`,{className:`text-center`,children:[(0,A.jsx)(`h1`,{className:`mb-4 text-4xl font-bold`,children:`404`}),(0,A.jsx)(`p`,{className:`mb-4 text-xl text-muted-foreground`,children:`Oops! Page not found`}),(0,A.jsx)(`a`,{href:`/`,className:`text-primary underline hover:text-primary/90`,children:`Return to Home`})]})})};function Z9({delay:e,startX:t,startY:n,duration:r}){return(0,A.jsxs)(`svg`,{style:{position:`absolute`,left:`${t}%`,top:`${n}%`,animation:`flyBee ${r}s ease-in-out ${e}s infinite`,opacity:0},width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,className:`drop-shadow-lg`,children:[(0,A.jsx)(`ellipse`,{cx:`12`,cy:`14`,rx:`6`,ry:`8`,fill:`#FBBF24`}),(0,A.jsx)(`ellipse`,{cx:`12`,cy:`14`,rx:`3`,ry:`6`,fill:`#1F2937`}),(0,A.jsx)(`circle`,{cx:`8`,cy:`10`,r:`2`,fill:`#1F2937`}),(0,A.jsx)(`circle`,{cx:`16`,cy:`10`,r:`2`,fill:`#1F2937`}),(0,A.jsx)(`path`,{d:`M6 8 Q4 4 8 6`,stroke:`#1F2937`,strokeWidth:`1`,fill:`none`}),(0,A.jsx)(`path`,{d:`M18 8 Q20 4 16 6`,stroke:`#1F2937`,strokeWidth:`1`,fill:`none`}),(0,A.jsx)(`path`,{d:`M9 18 L6 22 L9 20 Z`,fill:`#1F2937`}),(0,A.jsx)(`path`,{d:`M15 18 L18 22 L15 20 Z`,fill:`#1F2937`})]})}function Q9({delay:e,x:t,y:n}){return(0,A.jsx)(`svg`,{style:{position:`absolute`,left:`${t}%`,top:`${n}%`,animation:`sparkle 2s ease-in-out ${e}s infinite`},width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,children:(0,A.jsx)(`path`,{d:`M12 2 L14 10 L22 12 L14 14 L12 22 L10 14 L2 12 L10 10 Z`,fill:`#FCD34D`,className:`animate-pulse`})})}function Ske(){let{isOpen:e,data:t,close:n}=ng(),[r,i]=(0,u.useState)(4);if((0,u.useEffect)(()=>{if(e){i(4);let e=setInterval(()=>{i(t=>t<=1?(clearInterval(e),n(),0):t-1)},1e3);return()=>clearInterval(e)}},[e,n]),!e||!t)return null;let a=t.channels?.length>0?t.channels.join(`, `):`WebChat`;return(0,A.jsxs)(uh,{open:e,onOpenChange:e=>!e&&n(),children:[(0,A.jsxs)(fh,{children:[(0,A.jsx)(ph,{className:`fixed inset-0 bg-black/60 backdrop-blur-sm z-50 animate-fade-in`}),(0,A.jsxs)(mh,{className:`fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 w-full max-w-lg focus:outline-none`,children:[(0,A.jsx)(hh,{className:`sr-only`,children:`Bienvenido al Enjambre`}),(0,A.jsxs)(`div`,{className:`relative bg-gradient-to-br from-amber-50 via-yellow-50 to-orange-100 rounded-3xl shadow-2xl overflow-hidden border-4 border-amber-300/50`,children:[(0,A.jsxs)(`div`,{className:`absolute inset-0 overflow-hidden pointer-events-none`,children:[(0,A.jsx)(`div`,{className:`absolute inset-0 bg-gradient-to-b from-amber-200/30 to-orange-200/30`}),(0,A.jsx)(Z9,{delay:0,startX:10,startY:20,duration:8}),(0,A.jsx)(Z9,{delay:1,startX:80,startY:30,duration:7}),(0,A.jsx)(Z9,{delay:2,startX:20,startY:60,duration:9}),(0,A.jsx)(Z9,{delay:.5,startX:70,startY:70,duration:8}),(0,A.jsx)(Z9,{delay:1.5,startX:40,startY:10,duration:10}),(0,A.jsx)(Z9,{delay:2.5,startX:60,startY:50,duration:7}),(0,A.jsx)(Q9,{delay:0,x:15,y:15}),(0,A.jsx)(Q9,{delay:.5,x:85,y:25}),(0,A.jsx)(Q9,{delay:1,x:25,y:75}),(0,A.jsx)(Q9,{delay:1.5,x:75,y:80}),(0,A.jsx)(Q9,{delay:2,x:50,y:10})]}),(0,A.jsxs)(`div`,{className:`relative p-8 text-center`,children:[(0,A.jsxs)(`div`,{className:`mb-6`,children:[(0,A.jsx)(`h1`,{className:`text-4xl font-black text-transparent bg-clip-text bg-gradient-to-r from-amber-600 via-orange-600 to-amber-700 drop-shadow-sm`,children:`🐝 BIENVENIDO AL ENJAMBRE 🐝`}),(0,A.jsx)(`p`,{className:`text-lg font-semibold text-amber-800 mt-2`,children:`✦在你的 Hive✦`})]}),(0,A.jsx)(`div`,{className:`w-full h-px bg-gradient-to-r from-transparent via-amber-400 to-transparent mb-6`}),(0,A.jsxs)(`div`,{className:`mb-6`,children:[t.user&&(0,A.jsxs)(`p`,{className:`text-2xl font-bold text-gray-800 mb-4`,children:[`👋 Hola, `,(0,A.jsx)(`span`,{className:`text-amber-700`,children:t.user.name}),`!`]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 text-left bg-white/60 rounded-xl p-4 backdrop-blur-sm`,children:[t.agent&&(0,A.jsxs)(`p`,{className:`text-gray-700`,children:[(0,A.jsx)(`span`,{className:`font-semibold`,children:`🤖 Tu agente:`}),` `,(0,A.jsx)(`span`,{className:`text-amber-700`,children:t.agent.name})]}),t.agent&&(0,A.jsxs)(`p`,{className:`text-gray-700`,children:[(0,A.jsx)(`span`,{className:`font-semibold`,children:`🧠 Provider:`}),` `,(0,A.jsxs)(`span`,{className:`text-amber-700`,children:[t.agent.provider,`/`,t.agent.model]})]}),(0,A.jsxs)(`p`,{className:`text-gray-700`,children:[(0,A.jsx)(`span`,{className:`font-semibold`,children:`📡 Canales:`}),` `,(0,A.jsx)(`span`,{className:`text-amber-700`,children:a})]}),t.voice?.enabled&&(0,A.jsxs)(`p`,{className:`text-gray-700`,children:[(0,A.jsx)(`span`,{className:`font-semibold`,children:`🎤 Voz:`}),` `,(0,A.jsxs)(`span`,{className:`text-amber-700`,children:[t.voice.sttProvider,` + `,t.voice.ttsProvider]})]})]})]}),(0,A.jsx)(`div`,{className:`w-full h-px bg-gradient-to-r from-transparent via-amber-400 to-transparent mb-6`}),(0,A.jsxs)(`div`,{className:`mb-6 text-left`,children:[(0,A.jsx)(`p`,{className:`text-lg font-bold text-gray-800 mb-3 text-center`,children:`💡 LO QUE PUEDES HACER CON HIVE:`}),(0,A.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-sm`,children:[(0,A.jsx)($9,{icon:`🗣️`,text:`Voz en tiempo real (STT/TTS)`}),(0,A.jsx)($9,{icon:`🔧`,text:`Code Bridge (claude-code, gemini)`}),(0,A.jsx)($9,{icon:`🔌`,text:`MCP Servers`}),(0,A.jsx)($9,{icon:`🎨`,text:`Canvas visual`}),(0,A.jsx)($9,{icon:`📱`,text:`Múltiples canales`}),(0,A.jsx)($9,{icon:`🧠`,text:`Múltiples agentes`}),(0,A.jsx)($9,{icon:`💬`,text:`Memoria conversacional`}),(0,A.jsx)($9,{icon:`⚡`,text:`Ejecución de tools`})]})]}),(0,A.jsx)(`div`,{className:`mt-4`,children:(0,A.jsxs)(`p`,{className:`text-amber-600 font-medium animate-pulse`,children:[`🌐 Abriendo Dashboard en `,r,`s...`]})}),(0,A.jsx)(_h,{asChild:!0,children:(0,A.jsx)(`button`,{className:`absolute top-4 right-4 p-2 rounded-full bg-amber-200/80 hover:bg-amber-300 transition-colors`,"aria-label":`Cerrar`,children:(0,A.jsx)(ni,{className:`w-5 h-5 text-amber-800`})})})]})]})]})]}),(0,A.jsx)(`style`,{children:`
|
|
293
|
+
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return LDe(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=C9.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function wOe(){return{exit:{taskListCheckValueChecked:E9,taskListCheckValueUnchecked:E9,paragraph:EOe}}}function TOe(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:DOe}}}function E9(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function EOe(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function DOe(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=C9.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function OOe(){return[oDe(),DDe(),jDe(),_Oe(),wOe()]}function kOe(e){return{extensions:[sDe(),ODe(e),MDe(),COe(e),TOe()]}}var AOe={tokenize:IOe,partial:!0},D9={tokenize:LOe,partial:!0},O9={tokenize:ROe,partial:!0},k9={tokenize:zOe,partial:!0},jOe={tokenize:BOe,partial:!0},A9={name:`wwwAutolink`,tokenize:POe,previous:F9},j9={name:`protocolAutolink`,tokenize:FOe,previous:I9},M9={name:`emailAutolink`,tokenize:NOe,previous:L9},N9={};function MOe(){return{text:N9}}for(var P9=48;P9<123;)N9[P9]=M9,P9++,P9===58?P9=65:P9===91&&(P9=97);N9[43]=M9,N9[45]=M9,N9[46]=M9,N9[95]=M9,N9[72]=[M9,j9],N9[104]=[M9,j9],N9[87]=[M9,A9],N9[119]=[M9,A9];function NOe(e,t,n){let r=this,i,a;return o;function o(t){return!R9(t)||!L9.call(r,r.previous)||z9(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return R9(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(jOe,u,l)(t):t===45||t===95||mZ(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&pZ(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function POe(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!F9.call(r,r.previous)||z9(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(AOe,e.attempt(D9,e.attempt(O9,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function FOe(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&I9.call(r,r.previous)&&!z9(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(pZ(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||hZ(t)||vZ(t)||xZ(t)||bZ(t)?n(t):e.attempt(D9,e.attempt(O9,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function IOe(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function LOe(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(k9,c,s)(t):t===null||vZ(t)||xZ(t)||t!==45&&bZ(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function ROe(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(k9,t,a)(o):o===null||vZ(o)||xZ(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function zOe(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||vZ(o)||xZ(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||vZ(e)||xZ(e)?t(e):r(e)}function a(e){return pZ(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):pZ(t)?(e.consume(t),o):n(t)}}function BOe(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return mZ(e)?n(e):t(e)}}function F9(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||vZ(e)}function I9(e){return!pZ(e)}function L9(e){return!(e===47||R9(e))}function R9(e){return e===43||e===45||e===46||e===95||mZ(e)}function z9(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var VOe={tokenize:JOe,partial:!0};function HOe(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:KOe,continuation:{tokenize:B9},exit:qOe}},text:{91:{name:`gfmFootnoteCall`,tokenize:GOe},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:UOe,resolveTo:WOe}}}}function UOe(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=fZ(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function WOe(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function GOe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||vZ(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(fZ(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return vZ(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function KOe(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||vZ(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=fZ(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return vZ(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),wZ(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function B9(e,t,n){return e.check(AZ,t,e.attempt(VOe,t,n))}function qOe(e){e.exit(`gfmFootnoteDefinition`)}function JOe(e,t,n){let r=this;return wZ(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function YOe(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&sZ(o,o.length,0,DZ(s,e.slice(r+1,n),t)),sZ(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),sZ(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=EZ(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=EZ(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var XOe=class{constructor(){this.map=[]}add(e,t,n){ZOe(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function ZOe(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function QOe(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function $Oe(){return{flow:{null:{name:`table`,tokenize:eke,resolveAll:tke}}}}function eke(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):_Z(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):yZ(t)?wZ(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||vZ(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,yZ(t)?wZ(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return yZ(t)?wZ(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||_Z(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return yZ(t)?wZ(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||_Z(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||_Z(n)?(e.exit(`tableRow`),t(n)):yZ(n)?wZ(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||vZ(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function tke(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new XOe;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(H9(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=V9(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=V9(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=V9(f,t,o,i,n,d)):(o[0]=o[1],d=V9(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&H9(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=QOe(t.events,n))}return e}function V9(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},U9(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=U9(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=U9(t.events,n[2]),a=U9(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},U9(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function H9(e,t,n,r,i){let a=[],o=U9(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function U9(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var nke={name:`tasklistCheck`,tokenize:ike};function rke(){return{text:{91:nke}}}function ike(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return vZ(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return _Z(r)?t(r):yZ(r)?e.check({tokenize:ake},t,n)(r):n(r)}}function ake(e,t,n){return wZ(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function oke(e){return uZ([MOe(),HOe(),YOe(e),$Oe(),rke()])}var ske={};function cke(e){let t=this,n=e||ske,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(oke(n)),a.push(OOe()),o.push(kOe(n))}function W9(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function G9({audio:e,mimeType:t=`audio/webm`}){let[n,r]=(0,u.useState)(!1),[i,a]=(0,u.useState)(null);return e?(0,A.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,A.jsx)(`button`,{onClick:n?()=>{r(!1)}:()=>{i||a(`data:${t};base64,${e}`),r(!0)},className:`h-7 w-7 rounded-full bg-cyan-600/80 hover:bg-cyan-500 flex items-center justify-center transition-colors`,children:n?(0,A.jsx)(pr,{className:`h-3.5 w-3.5 text-white`}):(0,A.jsx)(_r,{className:`h-3.5 w-3.5 text-white ml-0.5`})}),i&&(0,A.jsx)(`audio`,{src:i,onEnded:()=>r(!1),autoPlay:n,className:`hidden`}),(0,A.jsx)(`div`,{className:`flex-1 h-7 bg-zinc-800/80 rounded-lg overflow-hidden`,children:(0,A.jsxs)(`div`,{className:`h-full w-full flex items-center px-2`,children:[(0,A.jsx)(Xr,{className:`h-3.5 w-3.5 text-zinc-400 mr-2`}),(0,A.jsx)(`div`,{className:`flex-1 h-1.5 bg-zinc-700 rounded-full overflow-hidden`,children:(0,A.jsx)(`div`,{className:`h-full w-1/3 bg-cyan-500 rounded-full animate-pulse`})})]})})]}):null}function lke({message:e,userName:t=`Tu`,agentName:n=`Agente`,isStreaming:r,onNarrate:i}){let a=e.type===`user`,o=e.type===`error`,s=e.type===`system`,c=!!e.audio?.base64||!!e.audio?.url;return s?(0,A.jsx)(`div`,{className:`flex justify-center my-1`,children:(0,A.jsx)(`span`,{className:`text-[10px] text-zinc-600 bg-zinc-900/50 border border-white/5 px-3 py-1 rounded-full font-mono`,children:e.content})}):o?(0,A.jsx)(`div`,{className:`flex items-center gap-2 justify-center my-1`,children:(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-red-400 bg-red-500/10 border border-red-500/20 px-3 py-1.5 rounded-xl`,children:[(0,A.jsx)(Kr,{className:`h-3 w-3 shrink-0`}),e.content]})}):a?(0,A.jsx)(`div`,{className:`flex items-end justify-end gap-2 group`,children:(0,A.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5 max-w-[72%]`,children:[(0,A.jsx)(`div`,{className:`bg-gradient-to-br from-blue-600 to-indigo-600 text-white px-4 py-2.5 rounded-2xl rounded-tr-sm shadow-lg shadow-blue-600/10 text-sm leading-relaxed whitespace-pre-wrap`,children:e.content}),c&&e.audio?.base64&&(0,A.jsx)(G9,{audio:e.audio.base64,mimeType:e.audio.mimeType}),(0,A.jsx)(`span`,{className:`text-[10px] text-zinc-700 pr-1`,children:W9(e.timestamp)})]})}):(0,A.jsxs)(`div`,{className:`flex items-start gap-2 group`,children:[(0,A.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-zinc-900 border border-cyan-500/20 flex items-center justify-center shrink-0 mt-0.5 ring-2 ring-zinc-950`,children:(0,A.jsx)(Kt,{className:`h-4 w-4 text-cyan-400`})}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-0.5 max-w-[80%] min-w-0`,children:[(0,A.jsx)(`span`,{className:`text-[10px] font-semibold text-cyan-500/70 uppercase tracking-wider`,children:n}),(0,A.jsxs)(`div`,{className:`bg-zinc-900 border text-zinc-100 px-4 py-2.5 rounded-2xl rounded-tl-sm text-sm leading-relaxed shadow prose prose-invert prose-p:leading-relaxed prose-pre:bg-black/50 prose-pre:border prose-pre:border-white/10 max-w-none prose-sm ${r?`border-cyan-500/30 animate-pulse`:`border-white/5`}`,children:[(0,A.jsx)(HQ,{remarkPlugins:[cke],children:e.content}),r&&(0,A.jsx)(`span`,{className:`inline-block w-1.5 h-4 bg-cyan-400 ml-0.5 animate-pulse align-text-bottom rounded-sm`})]}),c&&e.audio?.base64&&(0,A.jsx)(G9,{audio:e.audio.base64,mimeType:e.audio.mimeType}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2 pl-1`,children:[(0,A.jsx)(`span`,{className:`text-[10px] text-zinc-700`,children:W9(e.timestamp)}),i&&(0,A.jsx)(`button`,{onClick:()=>i(e.content),className:`opacity-0 group-hover:opacity-100 transition-opacity h-5 w-5 rounded flex items-center justify-center text-zinc-600 hover:text-cyan-400 hover:bg-zinc-800`,title:`Narrar mensaje`,children:(0,A.jsx)(Xr,{className:`h-3 w-3`})})]})]})]})}var uke=[{icon:Rr,text:`Que puedes hacer?`},{icon:ri,text:`Dame un resumen`},{icon:Kt,text:`Ayudame con una tarea`}];function dke({messages:e,isLoading:t=!1,currentSteps:n=[],streamingMessageId:r,userName:i,agentName:a,onSuggestionClick:o,onNarrateMessage:s}){let c=(0,u.useRef)(null),l=(0,u.useRef)(null);return(0,u.useEffect)(()=>{c.current?.scrollIntoView({behavior:`smooth`})},[e,t,n]),e.length===0&&!t?(0,A.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center p-8 h-full`,children:[(0,A.jsxs)(`div`,{className:`relative mb-4`,children:[(0,A.jsx)(`div`,{className:`h-16 w-16 rounded-2xl bg-zinc-900 border border-cyan-500/20 flex items-center justify-center shadow-xl`,children:(0,A.jsx)(Kt,{className:`h-8 w-8 text-cyan-400`})}),(0,A.jsx)(`span`,{className:`absolute -bottom-1 -right-1 h-4 w-4 rounded-full bg-emerald-500 border-2 border-zinc-950 shadow`})]}),(0,A.jsxs)(`div`,{className:`text-center space-y-1 mb-6`,children:[(0,A.jsx)(`p`,{className:`text-sm font-semibold text-zinc-300`,children:a?`${a} esta listo`:`Agente listo`}),(0,A.jsx)(`p`,{className:`text-xs text-zinc-600`,children:`Inicia la conversacion escribiendo un mensaje`})]}),o&&(0,A.jsx)(`div`,{className:`flex flex-col sm:flex-row items-center gap-2`,children:uke.map(e=>{let t=e.icon;return(0,A.jsxs)(`button`,{onClick:()=>o(e.text),className:`flex items-center gap-1.5 text-xs text-zinc-400 hover:text-zinc-200 border border-white/10 hover:border-white/20 bg-zinc-900/80 hover:bg-zinc-800/80 px-3 py-2 rounded-xl transition-all cursor-pointer`,children:[(0,A.jsx)(t,{className:`h-3 w-3`}),e.text]},e.text)})})]}):(0,A.jsx)(`div`,{ref:l,className:`flex flex-col h-full`,children:(0,A.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,A.jsxs)(`div`,{className:`max-w-3xl mx-auto flex flex-col gap-4 p-4 pb-2`,children:[e.map(e=>(0,A.jsx)(lke,{message:e,userName:i,agentName:a,isStreaming:e.id===r,onNarrate:s},e.id)),t&&!r&&(0,A.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,A.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-zinc-900 border border-cyan-500/20 flex items-center justify-center shrink-0 ring-2 ring-zinc-950`,children:(0,A.jsx)(Kt,{className:`h-4 w-4 text-cyan-400`})}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5 max-w-[80%]`,children:[n.length>0&&(0,A.jsx)(`div`,{className:`flex flex-col gap-1`,children:n.map((e,t)=>{let r=t===n.length-1;return(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl border text-xs transition-all ${r?`bg-zinc-900 border-cyan-500/20 text-cyan-300`:`bg-zinc-950/50 border-white/5 text-zinc-600`}`,children:[(0,A.jsx)(ri,{className:`h-3 w-3 shrink-0 ${r?`text-cyan-500 animate-pulse`:`text-zinc-700`}`}),(0,A.jsx)(`span`,{className:`leading-tight`,children:e})]},t)})}),(0,A.jsxs)(`div`,{className:`bg-zinc-900 border border-white/5 px-4 py-3 rounded-2xl rounded-tl-sm flex items-center gap-1.5 w-fit`,children:[(0,A.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-cyan-500 animate-bounce [animation-delay:0ms]`}),(0,A.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-cyan-500 animate-bounce [animation-delay:150ms]`}),(0,A.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-cyan-500 animate-bounce [animation-delay:300ms]`})]})]})]}),(0,A.jsx)(`div`,{ref:c,className:`h-0`})]})})})}function fke({onSendMessage:e,onStop:t,disabled:n=!1,isStreaming:r=!1}){let[i,a]=(0,u.useState)(``),[o,s]=(0,u.useState)(!1),c=(0,u.useRef)(null),l=(0,u.useRef)([]),d=(0,u.useRef)(null);(0,u.useEffect)(()=>{d.current&&(d.current.style.height=`auto`,d.current.style.height=d.current.scrollHeight+`px`)},[i]);let f=()=>{i.trim()&&!n&&(e(i.trim()),a(``),d.current&&(d.current.style.height=`auto`))};return(0,A.jsx)(`div`,{className:`px-3 pb-3 pt-2`,children:(0,A.jsxs)(`div`,{className:`max-w-3xl mx-auto`,children:[(0,A.jsxs)(`div`,{className:`flex items-end gap-2 rounded-2xl border bg-zinc-900/60 backdrop-blur-sm px-3 py-2 transition-all shadow-lg shadow-black/20 ${n?`border-white/5 opacity-60`:`border-white/10 focus-within:border-blue-500/30 focus-within:shadow-blue-500/5`}`,children:[(0,A.jsx)(`button`,{onClick:o?()=>{c.current&&o&&(c.current.stop(),s(!1))}:async()=>{try{let t=await navigator.mediaDevices.getUserMedia({audio:!0}),n=new MediaRecorder(t,{mimeType:`audio/webm`});c.current=n,l.current=[],n.ondataavailable=e=>{e.data.size>0&&l.current.push(e.data)},n.onstop=async()=>{let n=new Blob(l.current,{type:`audio/webm`}),r=new FileReader;r.readAsDataURL(n),r.onloadend=()=>{let t=r.result.split(`,`)[1];e(`[Audio mensaje]`,t)},t.getTracks().forEach(e=>e.stop())},n.start(),s(!0)}catch(e){console.error(`Error accessing microphone:`,e)}},disabled:n,className:`h-8 w-8 rounded-xl flex items-center justify-center shrink-0 mb-0.5 transition-all ${o?`bg-red-600 hover:bg-red-500 animate-pulse`:`bg-zinc-800 hover:bg-zinc-700 border border-white/5`} disabled:opacity-30 disabled:cursor-not-allowed text-white`,children:o?(0,A.jsx)(zr,{className:`h-3 w-3`}):(0,A.jsx)(lr,{className:`h-3.5 w-3.5`})}),(0,A.jsx)(`textarea`,{ref:d,value:i,onChange:e=>{a(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),f())},placeholder:n?`Conectando al agente...`:r?`Escribe mientras espera...`:`Escribe un mensaje...`,disabled:n,rows:1,className:`flex-1 min-h-[36px] max-h-[160px] resize-none bg-transparent text-sm text-zinc-100 placeholder:text-zinc-600 focus:outline-none leading-relaxed py-1.5`,style:{overflow:`auto`}}),r&&t?(0,A.jsx)(`button`,{onClick:t,className:`h-8 w-8 rounded-xl flex items-center justify-center shrink-0 mb-0.5 transition-all bg-red-600 hover:bg-red-500 text-white shadow shadow-red-600/20`,title:`Detener generación`,children:(0,A.jsx)(zr,{className:`h-3.5 w-3.5 fill-current`})}):(0,A.jsx)(`button`,{onClick:f,disabled:!i.trim()||n,className:`h-8 w-8 rounded-xl flex items-center justify-center shrink-0 mb-0.5 transition-all disabled:opacity-30 disabled:cursor-not-allowed bg-blue-600 hover:bg-blue-500 disabled:bg-zinc-800 text-white shadow shadow-blue-600/20`,children:(0,A.jsx)(Er,{className:`h-3.5 w-3.5`})})]}),(0,A.jsx)(`p`,{className:`text-[10px] text-zinc-700 mt-1.5 text-center`,children:o?`Grabando... haz clic para enviar`:`Enter para enviar · Shift+Enter nueva linea`})]})})}function pke({agentId:e=`agent_id`,sessionId:t=`user_id`}){let{messages:n,addMessage:r,setMessages:i,isLoading:a,currentSteps:o,streamingMessageId:s,connectionWarning:c,setConnectionWarning:l}=Y7(),{status:d,send:f,subscribe:p}=dg(),{currentUser:m,fetchUser:h}=jg(),g=X(e=>e.agents),_=X(e=>e.fetchAgents),{handleStreamingChunk:v,handleAudioMessage:y,handleProgress:b,handleTyping:x,resetStreamingRef:S}=QEe(e,t),C=eDe(),w=d===`connected`,T=d===`connecting`,E=g.find(e=>e.role===`coordinator`&&e.enabled)?.name??`Coordinador`;(0,u.useEffect)(()=>{m||h(),g.length===0&&_()},[]),(0,u.useEffect)(()=>{t&&(async()=>{try{let n=await K(`/api/chat/history?sessionId=${t}&limit=15`);n.messages&&i(n.messages.filter(e=>e.role===`user`||e.role===`assistant`).map(t=>({id:t.id,conversationId:t.session_id||t.thread_id,type:t.role===`user`?`user`:`agent`,content:t.content,agentId:e,timestamp:t.created_at})))}catch(e){console.error(`Failed to fetch chat history:`,e)}})()},[t,e,i]),(0,u.useEffect)(()=>{let e=p(`message`,v),t=p(`response`,v),n=p(`audio`,y),r=p(`progress`,b),i=p(`typing`,x);return()=>{e(),t(),n(),r(),i()}},[p,v,y,b,x]),(0,u.useEffect)(()=>{w?l(null):T||l(`Conexion perdida. Reconectando...`)},[w,T,l]);let D=(0,u.useCallback)((n,i)=>{let a=na();C.stop(),r(i?{id:a,conversationId:t,type:`user`,content:n,agentId:e,timestamp:new Date().toISOString(),audio:{base64:i,mimeType:`audio/webm`}}:{id:a,conversationId:t,type:`user`,content:n,agentId:e,timestamp:new Date().toISOString()}),Y7.getState().setLoading(!0),S(),w?f(i?{type:`audio`,audio:i,sessionId:t,timestamp:new Date().toISOString()}:{type:`message`,content:n,sessionId:t,timestamp:new Date().toISOString()}):(r({id:na(),conversationId:t,type:`error`,content:`No se pudo conectar al agente. Verifica que el gateway este funcionando.`,timestamp:new Date().toISOString()}),Y7.getState().setLoading(!1))},[w,t,e,r,f,C,S]),O=(0,u.useCallback)(e=>{C.isSpeaking?C.stop():C.narrate(e)},[C]);return(0,A.jsxs)(`div`,{className:`flex h-full flex-col min-h-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2.5 shrink-0 border-b border-white/5 bg-zinc-950/80 backdrop-blur-sm z-10`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(`div`,{className:`h-8 w-8 rounded-lg bg-zinc-900 border border-cyan-500/20 flex items-center justify-center`,children:(0,A.jsx)(Kt,{className:`h-4 w-4 text-cyan-400`})}),(0,A.jsx)(`span`,{className:`absolute -bottom-0.5 -right-0.5 h-2 w-2 rounded-full border border-zinc-950 ${w?`bg-emerald-500`:T?`bg-yellow-500 animate-pulse`:`bg-zinc-600`}`})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`text-sm font-semibold text-zinc-200`,children:E}),(0,A.jsx)(`span`,{className:`text-[10px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded-full ${w?`text-emerald-400 bg-emerald-500/10`:T?`text-yellow-400 bg-yellow-500/10 animate-pulse`:`text-zinc-500 bg-zinc-800`}`,children:w?`en linea`:T?`conectando`:`desconectado`})]})]}),(0,A.jsx)(`button`,{onClick:C.toggle,className:`h-8 w-8 rounded-lg flex items-center justify-center transition-all ${C.isEnabled?`bg-cyan-600/20 text-cyan-400 hover:bg-cyan-600/30 border border-cyan-500/30`:`bg-zinc-900 text-zinc-500 hover:text-zinc-300 hover:bg-zinc-800 border border-white/5`}`,title:C.isEnabled?`Desactivar narracion`:`Activar narracion`,children:C.isEnabled?(0,A.jsx)(Xr,{className:`h-4 w-4`}):(0,A.jsx)(Zr,{className:`h-4 w-4`})})]}),c&&!w&&(0,A.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 bg-amber-500/10 border-b border-amber-500/20 shrink-0`,children:[(0,A.jsx)(an,{className:`h-3.5 w-3.5 text-amber-400 shrink-0`}),(0,A.jsx)(`span`,{className:`text-xs text-amber-300 flex-1`,children:c}),(0,A.jsxs)(`button`,{onClick:()=>{let{connect:e}=ug.getState();m?.id&&e(m.id)},className:`flex items-center gap-1 text-[10px] font-semibold text-amber-400 hover:text-amber-300 transition-colors`,children:[(0,A.jsx)(Sr,{className:`h-3 w-3`}),`Reintentar`]})]}),C.isSpeaking&&(0,A.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-1.5 bg-cyan-500/10 border-b border-cyan-500/20 shrink-0`,children:[(0,A.jsxs)(`div`,{className:`flex gap-0.5`,children:[(0,A.jsx)(`span`,{className:`h-2 w-0.5 bg-cyan-400 rounded-full animate-pulse`,style:{animationDelay:`0ms`}}),(0,A.jsx)(`span`,{className:`h-2 w-0.5 bg-cyan-400 rounded-full animate-pulse`,style:{animationDelay:`150ms`}}),(0,A.jsx)(`span`,{className:`h-2 w-0.5 bg-cyan-400 rounded-full animate-pulse`,style:{animationDelay:`300ms`}})]}),(0,A.jsxs)(`span`,{className:`text-[10px] text-cyan-400 font-medium`,children:[`Narrando`,C.currentText?`: ${C.currentText}...`:`...`]}),(0,A.jsx)(`button`,{onClick:C.stop,className:`text-[10px] text-cyan-500 hover:text-cyan-300 ml-auto`,children:`Detener`})]}),(0,A.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0`,children:(0,A.jsx)(dke,{messages:n,isLoading:a,currentSteps:o,streamingMessageId:s,userName:m?.name??`Usuario`,agentName:E,onSuggestionClick:D,onNarrateMessage:C.isEnabled?O:void 0})}),(0,A.jsx)(`div`,{className:`shrink-0 bg-zinc-950`,children:(0,A.jsx)(fke,{onSendMessage:D,onStop:()=>{w&&f({type:`stop`,sessionId:t})},disabled:!w&&!T,isStreaming:a})})]})}function mke(){let{currentUser:e}=jg();return(0,A.jsx)(`div`,{className:`h-full bg-zinc-950 overflow-hidden`,children:(0,A.jsx)(pke,{agentId:`main`,sessionId:e?.id||`default`})})}var hke={gemini:`🔵`,anthropic:`🟠`,openai:`🟢`,groq:`🔴`,ollama:`🟣`,openrouter:`🟡`,deepseek:`🔷`,mistral:`🔸`,kimi:`🌙`},K9={gemini:`https://aistudio.google.com/app/apikey`,anthropic:`https://console.anthropic.com/keys`,openai:`https://platform.openai.com/api-keys`,groq:`https://console.groq.com/keys`,openrouter:`https://openrouter.ai/keys`,deepseek:`https://platform.deepseek.com/api_keys`,mistral:`https://console.mistral.ai/api-keys`,kimi:`https://platform.moonshot.cn/console/api-keys`},q9=[{id:`webchat`,name:`WebChat`,description:`Chat web integrado`,icon:`💬`,required:!0},{id:`telegram`,name:`Telegram`,description:`Bot de Telegram`,icon:`✈️`,required:!1},{id:`discord`,name:`Discord`,description:`Bot de Discord`,icon:`🎮`,required:!1},{id:`whatsapp`,name:`WhatsApp`,description:`Bot de WhatsApp`,icon:`📱`,required:!1},{id:`slack`,name:`Slack`,description:`Bot de Slack`,icon:`💼`,required:!1}],J9=`hive_setup_wizard_data`;function gke(){try{let e=sessionStorage.getItem(J9);if(e){let t=JSON.parse(e);return{...X9(),...t}}}catch(e){console.error(`Failed to load wizard data:`,e)}return null}function _ke(e){try{sessionStorage.setItem(J9,JSON.stringify(e))}catch(e){console.error(`Failed to save wizard data:`,e)}}function Y9(){try{sessionStorage.removeItem(J9)}catch(e){console.error(`Failed to clear wizard data:`,e)}}function X9(){return{userName:``,userLanguage:`es`,userTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,userOccupation:``,userNotes:``,agentName:`Bee`,agentDescription:``,agentTone:`friendly`,provider:``,apiKey:``,model:``,apiKeyVerified:!1,channels:{webchat:{enabled:!0},telegram:{enabled:!1},discord:{enabled:!1},whatsapp:{enabled:!1},slack:{enabled:!1}},voiceEnabled:!1,sttProvider:`groq-whisper`,ttsProvider:`elevenlabs`,ttsVoice:``,ethicsRules:{},customRules:[],hiveLearnEnabled:!1}}function vke(){let e=Gd(),[t,n]=(0,u.useState)(1),[r,i]=(0,u.useState)(()=>gke()||X9()),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)(!1),{showLoader:l,hideLoader:d}=pg(),[f,p]=(0,u.useState)(`idle`),[m,h]=(0,u.useState)(null),[g,_]=(0,u.useState)([]),[v,y]=(0,u.useState)(null),[b,x]=(0,u.useState)(!1),[S,C]=(0,u.useState)([]);(0,u.useEffect)(()=>{fetch(`${cg()}/api/setup/providers`).then(e=>e.json()).then(e=>{Array.isArray(e)&&_(e)}).catch(()=>{}),fetch(`${cg()}/api/setup/ethics`).then(e=>e.json()).then(e=>{Array.isArray(e)&&(C(e),i(t=>Object.keys(t.ethicsRules).length===0?{...t,ethicsRules:Object.fromEntries(e.map(e=>[e.id,!0]))}:t))}).catch(()=>{})},[]),(0,u.useEffect)(()=>{_ke(r)},[r]),(0,u.useEffect)(()=>{fetch(`${cg()}/api/setup/status`).then(e=>e.json()).then(t=>{t.configured&&e(`/ui`)}).catch(()=>{})},[e]);let w=e=>{h(null),i(t=>({...t,...e}))},T=()=>{switch(t){case 1:return r.userName.trim()?r.userName.trim().length<2?`El nombre debe tener al menos 2 caracteres.`:null:`El nombre es obligatorio.`;case 2:return r.agentName.trim()?r.agentName.trim().length<2?`El nombre debe tener al menos 2 caracteres.`:null:`El nombre del agente es obligatorio.`;case 3:return r.provider?r.provider!==`ollama`&&!r.apiKey?`Ingresa tu API key.`:r.provider!==`ollama`&&!r.apiKeyVerified?`Verifica tu API key antes de continuar.`:r.model?null:`Selecciona un modelo.`:`Selecciona un proveedor LLM.`;default:return null}},E=()=>{let e=T();if(e){h(e);return}h(null),t<8&&n(e=>e+1)},D=()=>{t>1&&n(e=>e-1)},O=()=>{confirm(`¿Estás seguro de que quieres reiniciar la configuración? Se perderá todo el progreso.`)&&(Y9(),i(X9()),n(1))},k=async()=>{if(!(!r.apiKey||!r.provider)){p(`verifying`);try{(await K(`/api/setup/verify-provider`,{method:`POST`,body:{provider:r.provider,apiKey:r.apiKey},showLoader:`Verificando conexión...`,showError:!1})).success?(p(`success`),w({apiKeyVerified:!0})):(p(`error`),w({apiKeyVerified:!1}))}catch{p(`error`),w({apiKeyVerified:!1})}}},j=async()=>{o(!0);try{let t=await K(`/api/setup/complete`,{method:`POST`,body:r,showLoader:`Finalizando configuración...`,showError:!0});if(t.success){let n=t.authToken;n&&localStorage.setItem(`hive-auth-token`,n),c(!0),Y9(),(async()=>{await new Promise(e=>setTimeout(e,1500)),l(`Iniciando a ${r.agentName}... esto toma unos segundos`);for(let t=0;t<40;t++){try{let t=await fetch(`${cg()}/api/setup/status`);if(t.ok){let{configured:r}=await t.json();if(r){d(),e(n?`/?token=${n}`:`/`);return}}}catch{}await new Promise(e=>setTimeout(e,1e3))}d(),e(n?`/?token=${n}`:`/`)})()}}catch{}finally{o(!1)}},M=()=>{switch(t){case 1:return N();case 2:return P();case 3:return F();case 4:return I();case 5:return L();case 6:return R();case 7:return ee();case 8:return te();default:return null}},N=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-4`,children:[(0,A.jsx)(`div`,{className:`flex justify-center`,children:(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(Wn,{className:`w-24 h-24 text-amber-500`,fill:`currentColor`}),(0,A.jsx)(Rr,{className:`w-8 h-8 text-amber-300 absolute -top-2 -right-2`})]})}),(0,A.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Bienvenido a Hive`}),(0,A.jsx)(`p`,{className:`text-muted-foreground max-w-md mx-auto`,children:`Hive es tu colmena de agentes IA. Local-first. Multi-canal. Open source. En los próximos minutos configurarás tu agente personal Bee.`})]}),(0,A.jsxs)(OR,{children:[(0,A.jsxs)(kR,{children:[(0,A.jsx)(AR,{children:`Tu información`}),(0,A.jsx)(jR,{children:`Comencemos con tus datos básicos`})]}),(0,A.jsxs)(MR,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`userName`,children:`Tu nombre`}),(0,A.jsx)(G,{id:`userName`,placeholder:`¿Cómo te llamas?`,value:r.userName,onChange:e=>w({userName:e.target.value})})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`userLanguage`,children:`Idioma preferido`}),(0,A.jsxs)(RK,{value:r.userLanguage,onValueChange:e=>w({userLanguage:e}),children:[(0,A.jsx)(VK,{children:(0,A.jsx)(BK,{})}),(0,A.jsxs)(WK,{children:[(0,A.jsx)(Q,{value:`es`,children:`Español`}),(0,A.jsx)(Q,{value:`en`,children:`English`}),(0,A.jsx)(Q,{value:`pt`,children:`Português`}),(0,A.jsx)(Q,{value:`fr`,children:`Français`})]})]})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`userTimezone`,children:`Zona horaria`}),(0,A.jsx)(G,{id:`userTimezone`,value:r.userTimezone,onChange:e=>w({userTimezone:e.target.value}),placeholder:`America/Bogota`}),(0,A.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Detectada automáticamente: `,Intl.DateTimeFormat().resolvedOptions().timeZone]})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsxs)(Z,{htmlFor:`userOccupation`,children:[`Ocupación `,(0,A.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(opcional)`})]}),(0,A.jsx)(G,{id:`userOccupation`,value:r.userOccupation,onChange:e=>w({userOccupation:e.target.value}),placeholder:`Ej: Desarrollador de software, diseñador, estudiante...`})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsxs)(Z,{htmlFor:`userNotes`,children:[`Preferencias de comunicación `,(0,A.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(opcional)`})]}),(0,A.jsx)(`textarea`,{id:`userNotes`,className:`w-full min-h-[80px] p-3 border rounded-md bg-background resize-none text-sm`,value:r.userNotes,onChange:e=>w({userNotes:e.target.value}),placeholder:`Ej: Prefiero respuestas cortas y directas. Usa ejemplos de código cuando expliques conceptos técnicos...`})]})]})]})]}),P=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Tu agente`}),(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Personaliza a Bee, tu agente personal`})]}),(0,A.jsxs)(OR,{children:[(0,A.jsx)(kR,{children:(0,A.jsx)(AR,{children:`Identidad del agente`})}),(0,A.jsxs)(MR,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`agentName`,children:`Nombre del agente`}),(0,A.jsx)(G,{id:`agentName`,value:r.agentName,onChange:e=>w({agentName:e.target.value}),placeholder:`Bee`})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`agentDescription`,children:`Descripción / Personalidad`}),(0,A.jsx)(`textarea`,{id:`agentDescription`,className:`w-full min-h-[100px] p-3 border rounded-md bg-background resize-none`,value:r.agentDescription,onChange:e=>w({agentDescription:e.target.value}),placeholder:`Ej: Eres un asistente útil y amable. Respondes de forma concisa pero completa. Te especializas en ayudar con tareas de programación y productividad...`})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`agentTone`,children:`Tono de comunicación`}),(0,A.jsxs)(RK,{value:r.agentTone,onValueChange:e=>w({agentTone:e}),children:[(0,A.jsx)(VK,{children:(0,A.jsx)(BK,{placeholder:`Selecciona un tono`})}),(0,A.jsxs)(WK,{children:[(0,A.jsx)(Q,{value:`friendly`,children:`Amigable y cercano`}),(0,A.jsx)(Q,{value:`professional`,children:`Profesional y formal`}),(0,A.jsx)(Q,{value:`direct`,children:`Directo y conciso`}),(0,A.jsx)(Q,{value:`casual`,children:`Casual y relajado`})]})]}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Define cómo se comunicará tu agente contigo`})]})]})]})]}),F=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Proveedor LLM`}),(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Selecciona el cerebro de tu agente`})]}),(0,A.jsx)(`div`,{className:`grid gap-3`,children:g.map(e=>(0,A.jsx)(OR,{className:H(`cursor-pointer transition-all hover:shadow-md`,r.provider===e.id&&`border-amber-500 ring-2 ring-amber-500`),onClick:()=>{w({provider:e.id,model:``,apiKeyVerified:!1}),e.id===`ollama`&&y(null)},children:(0,A.jsxs)(MR,{className:`flex items-center gap-4 p-4`,children:[(0,A.jsx)(`span`,{className:`text-3xl`,children:hke[e.id]??`🤖`}),(0,A.jsxs)(`div`,{className:`flex-1`,children:[(0,A.jsx)(`h3`,{className:`font-semibold`,children:e.name}),(0,A.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[e.models.length,` modelo`,e.models.length===1?``:`s`,` disponible`,e.models.length===1?``:`s`]})]}),r.provider===e.id&&(0,A.jsx)(sn,{className:`w-5 h-5 text-amber-500`})]})},e.id))}),r.provider&&(()=>{let e=g.find(e=>e.id===r.provider);return(0,A.jsxs)(OR,{className:`mt-4`,children:[(0,A.jsx)(kR,{children:(0,A.jsxs)(AR,{children:[`Configuración de `,e?.name]})}),(0,A.jsxs)(MR,{className:`space-y-4`,children:[r.provider!==`ollama`&&(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`apiKey`,children:`API Key`}),(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsx)(G,{id:`apiKey`,type:`password`,value:r.apiKey,onChange:e=>w({apiKey:e.target.value,apiKeyVerified:!1}),placeholder:`sk-...`,className:H(m?.includes(`API key`)&&!r.apiKey&&`border-red-500`)}),(0,A.jsx)(W,{variant:`outline`,onClick:k,disabled:!r.apiKey||f===`verifying`,children:f===`verifying`?(0,A.jsx)(tr,{className:`w-4 h-4 animate-spin`}):f===`success`?(0,A.jsx)(sn,{className:`w-4 h-4 text-green-500`}):f===`error`?(0,A.jsx)(dn,{className:`w-4 h-4 text-red-500`}):`Verificar`})]}),f===`success`&&(0,A.jsxs)(`p`,{className:`text-sm text-green-600 flex items-center gap-1`,children:[(0,A.jsx)(sn,{className:`w-4 h-4`}),` API key verificada correctamente`]}),f===`error`&&(0,A.jsxs)(`p`,{className:`text-sm text-red-600 flex items-center gap-1`,children:[(0,A.jsx)(dn,{className:`w-4 h-4`}),` API key inválida o error de conexión`]}),K9[r.provider]&&(0,A.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`¿No tienes tu API key?`,` `,(0,A.jsx)(`a`,{href:K9[r.provider],target:`_blank`,rel:`noopener noreferrer`,className:`text-amber-500 hover:underline`,children:`Obtener aquí`})]})]}),r.provider===`ollama`&&(0,A.jsxs)(`div`,{className:`space-y-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,disabled:b,onClick:()=>{y(null),x(!0),w({model:``}),fetch(`${cg()}/api/setup/ollama-models`).then(e=>e.json()).then(e=>{y(e.models??[]),x(!1)}).catch(()=>{y([]),x(!1)})},children:b?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(tr,{className:`w-3 h-3 animate-spin mr-1`}),`Detectando...`]}):`🔍 Detectar modelos`}),!b&&v!==null&&(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:v.length>0?`${v.length} modelo${v.length===1?``:`s`} encontrado${v.length===1?``:`s`}`:`Sin modelos — instala uno con ollama pull`})]}),v&&v.length>0&&(0,A.jsxs)(`div`,{className:`space-y-1`,children:[(0,A.jsx)(Z,{htmlFor:`model`,children:`Modelo`}),(0,A.jsxs)(RK,{value:r.model,onValueChange:e=>w({model:e}),children:[(0,A.jsx)(VK,{className:H(!r.model&&m?.includes(`modelo`)&&`border-red-500`),children:(0,A.jsx)(BK,{placeholder:`Selecciona un modelo`})}),(0,A.jsx)(WK,{children:v.map((e,t)=>(0,A.jsxs)(Q,{value:e.id,children:[e.name,t===0?` (Recomendado)`:``]},e.id))})]})]}),!b&&v!==null&&v.length===0&&(0,A.jsxs)(`p`,{className:`text-xs text-amber-600`,children:[`Asegúrate que Ollama esté corriendo (`,(0,A.jsx)(`code`,{children:`ollama serve`}),`) y tengas modelos (`,(0,A.jsx)(`code`,{children:`ollama pull llama3.2`}),`).`]})]}),r.provider!==`ollama`&&r.apiKeyVerified&&(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`model`,children:`Modelo`}),(0,A.jsxs)(RK,{value:r.model,onValueChange:e=>w({model:e}),children:[(0,A.jsx)(VK,{className:H(!r.model&&m?.includes(`modelo`)&&`border-red-500`),children:(0,A.jsx)(BK,{placeholder:`Selecciona un modelo`})}),(0,A.jsx)(WK,{children:(e?.models??[]).map((e,t)=>(0,A.jsxs)(Q,{value:e.id,children:[e.name||e.id,t===0?` (Recomendado)`:``]},e.id))})]})]})]})]})})()]}),I=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Canales`}),(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`¿Dónde quieres que Bee esté disponible?`})]}),(0,A.jsx)(`div`,{className:`grid gap-3`,children:q9.map(e=>(0,A.jsx)(OR,{className:H(`transition-all`,r.channels[e.id]?.enabled&&`border-amber-500`),children:(0,A.jsxs)(MR,{className:`p-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,A.jsx)(`span`,{className:`text-2xl`,children:e.icon}),(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`h3`,{className:`font-semibold flex items-center gap-2`,children:[e.name,e.required&&(0,A.jsx)(jz,{variant:`secondary`,className:`text-xs`,children:`Requerido`})]}),(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description})]})]}),(0,A.jsx)(aq,{checked:r.channels[e.id]?.enabled,onCheckedChange:t=>{e.required&&!t||w({channels:{...r.channels,[e.id]:{enabled:t}}})},disabled:e.required})]}),!e.required&&r.channels[e.id]?.enabled&&(0,A.jsx)(c3,{type:`single`,collapsible:!0,className:`mt-4`,children:(0,A.jsxs)(l3,{value:`config`,children:[(0,A.jsx)(u3,{children:`Configuración`}),(0,A.jsx)(d3,{children:(0,A.jsxs)(`div`,{className:`space-y-3 pt-2`,children:[e.id===`telegram`&&(0,A.jsx)(A.Fragment,{children:(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`telegramToken`,children:`Token del Bot`}),(0,A.jsx)(G,{id:`telegramToken`,placeholder:`123456789:ABCdefGHIjklMNOpqrsTUVwxyz`,value:r.channels.telegram.config?.botToken||``,onChange:e=>w({channels:{...r.channels,telegram:{enabled:!0,config:{botToken:e.target.value}}}})}),(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,A.jsx)(`a`,{href:`https://t.me/BotFather`,target:`_blank`,rel:`noopener noreferrer`,className:`text-amber-500 hover:underline`,children:`Obtén tu token en BotFather`})})]})}),e.id===`discord`&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`discordToken`,children:`Token del Bot`}),(0,A.jsx)(G,{id:`discordToken`,placeholder:`MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.GJKlMn.OpQrStUvWxYz`,value:r.channels.discord.config?.botToken||``,onChange:e=>w({channels:{...r.channels,discord:{enabled:!0,config:{botToken:e.target.value}}}})})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`discordClientId`,children:`Client ID`}),(0,A.jsx)(G,{id:`discordClientId`,placeholder:`1234567890123456789`,value:r.channels.discord.config?.clientId||``,onChange:e=>w({channels:{...r.channels,discord:{enabled:!0,config:{clientId:e.target.value}}}})})]})]}),e.id===`whatsapp`&&(0,A.jsx)(A.Fragment,{children:(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`whatsappToken`,children:`Token de la API`}),(0,A.jsx)(G,{id:`whatsappToken`,placeholder:`...`,value:r.channels.whatsapp.config?.apiToken||``,onChange:e=>w({channels:{...r.channels,whatsapp:{enabled:!0,config:{apiToken:e.target.value}}}})})]})}),e.id===`slack`&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`slackToken`,children:`Bot Token`}),(0,A.jsx)(G,{id:`slackToken`,placeholder:`xoxb-...`,value:r.channels.slack.config?.botToken||``,onChange:e=>w({channels:{...r.channels,slack:{enabled:!0,config:{botToken:e.target.value}}}})})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`slackSigningSecret`,children:`Signing Secret`}),(0,A.jsx)(G,{id:`slackSigningSecret`,placeholder:`...`,value:r.channels.slack.config?.signingSecret||``,onChange:e=>w({channels:{...r.channels,slack:{enabled:!0,config:{signingSecret:e.target.value}}}})})]})]})]})})]})})]})},e.id))})]}),L=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Voz (opcional)`}),(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Permite que Bee hable y escuche`})]}),(0,A.jsxs)(OR,{children:[(0,A.jsx)(kR,{children:(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsx)(AR,{children:`Activar voz`}),(0,A.jsx)(aq,{checked:r.voiceEnabled,onCheckedChange:e=>w({voiceEnabled:e})})]})}),(0,A.jsx)(MR,{children:r.voiceEnabled?(0,A.jsxs)(`div`,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`sttProvider`,children:`Reconocimiento de voz (STT)`}),(0,A.jsxs)(RK,{value:r.sttProvider,onValueChange:e=>w({sttProvider:e}),children:[(0,A.jsx)(VK,{children:(0,A.jsx)(BK,{})}),(0,A.jsxs)(WK,{children:[(0,A.jsx)(Q,{value:`groq-whisper`,children:`Groq Whisper (Recomendado)`}),(0,A.jsx)(Q,{value:`openai-whisper`,children:`OpenAI Whisper`})]})]})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`ttsProvider`,children:`Síntesis de voz (TTS)`}),(0,A.jsxs)(RK,{value:r.ttsProvider,onValueChange:e=>w({ttsProvider:e}),children:[(0,A.jsx)(VK,{children:(0,A.jsx)(BK,{})}),(0,A.jsxs)(WK,{children:[(0,A.jsx)(Q,{value:`elevenlabs`,children:`ElevenLabs (Recomendado)`}),(0,A.jsx)(Q,{value:`openai`,children:`OpenAI TTS`}),(0,A.jsx)(Q,{value:`gemini`,children:`Google Gemini`})]})]})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`ttsVoice`,children:`Voz`}),(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsxs)(RK,{value:r.ttsVoice,onValueChange:e=>w({ttsVoice:e}),children:[(0,A.jsx)(VK,{children:(0,A.jsx)(BK,{placeholder:`Selecciona una voz`})}),(0,A.jsxs)(WK,{children:[(0,A.jsx)(Q,{value:`Rachel`,children:`Rachel (ElevenLabs)`}),(0,A.jsx)(Q,{value:`Adam`,children:`Adam (ElevenLabs)`}),(0,A.jsx)(Q,{value:`Antoni`,children:`Antoni (ElevenLabs)`}),(0,A.jsx)(Q,{value:`Elli`,children:`Elli (ElevenLabs)`}),(0,A.jsx)(Q,{value:`Josh`,children:`Josh (ElevenLabs)`}),(0,A.jsx)(Q,{value:`alloy`,children:`Alloy (OpenAI)`}),(0,A.jsx)(Q,{value:`echo`,children:`Echo (OpenAI)`}),(0,A.jsx)(Q,{value:`fable`,children:`Fable (OpenAI)`}),(0,A.jsx)(Q,{value:`onyx`,children:`Onyx (OpenAI)`}),(0,A.jsx)(Q,{value:`nova`,children:`Nova (OpenAI)`}),(0,A.jsx)(Q,{value:`shimmer`,children:`Shimmer (OpenAI)`})]})]}),(0,A.jsx)(W,{variant:`outline`,size:`icon`,children:(0,A.jsx)(Xr,{className:`w-4 h-4`})})]})]}),(0,A.jsx)(UQ,{children:(0,A.jsx)(GQ,{className:`text-sm`,children:r.provider===r.ttsProvider&&(0,A.jsxs)(`span`,{className:`text-green-600 flex items-center gap-1`,children:[(0,A.jsx)(sn,{className:`w-4 h-4`}),` Ya tienes la API key configurada`]})})})]}):(0,A.jsx)(`p`,{className:`text-muted-foreground text-center py-4`,children:`Puedes activar la voz más tarde en la configuración`})})]})]}),R=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Reglas éticas`}),(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Define los límites de tu agente`})]}),(0,A.jsx)(UQ,{children:(0,A.jsxs)(GQ,{className:`text-sm`,children:[`Las reglas de categoría `,(0,A.jsx)(`strong`,{className:`text-red-500`,children:`NUNCA`}),` son las protecciones más importantes. Desactivarlas puede comprometer la seguridad.`]})}),(0,A.jsxs)(`div`,{className:`space-y-3`,children:[S.map(e=>{let t=r.ethicsRules[e.id]!==!1;return(0,A.jsx)(OR,{className:H(!t&&`opacity-60`),children:(0,A.jsx)(MR,{className:`p-4`,children:(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,A.jsx)(r$,{checked:t,onCheckedChange:t=>{e.isDefault&&!t&&!confirm(`¿Estás seguro de desactivar los lineamientos éticos por defecto?`)||w({ethicsRules:{...r.ethicsRules,[e.id]:t}})}}),(0,A.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(`h3`,{className:`font-medium`,children:e.name}),e.isDefault&&(0,A.jsx)(jz,{className:`text-xs bg-blue-500/10 text-blue-500`,children:`Por defecto`})]}),e.description&&(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e.description}),(0,A.jsxs)(`details`,{className:`mt-2`,children:[(0,A.jsx)(`summary`,{className:`text-xs text-muted-foreground cursor-pointer hover:text-foreground`,children:`Ver contenido`}),(0,A.jsx)(`pre`,{className:`text-xs mt-2 p-2 bg-muted rounded whitespace-pre-wrap font-mono`,children:e.content})]})]})]})})},e.id)}),S.length===0&&(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-4`,children:`Cargando lineamientos éticos...`})]}),(0,A.jsx)(W,{variant:`outline`,className:`w-full`,onClick:()=>{let e=prompt(`Ingresa tu regla personalizada:`);if(e){let t=prompt(`Categoría (SIEMPRE/NUNCA/CONFIRMAR):`,`CONFIRMAR`);t&&[`SIEMPRE`,`NUNCA`,`CONFIRMAR`].includes(t.toUpperCase())&&w({customRules:[...r.customRules,{text:e,category:t.toUpperCase()}]})}},children:`+ Añadir regla personalizada`}),r.customRules.length>0&&(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{children:`Reglas personalizadas`}),r.customRules.map((e,t)=>(0,A.jsx)(OR,{children:(0,A.jsxs)(MR,{className:`p-4 flex items-center justify-between`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`p`,{className:`font-medium`,children:e.text}),(0,A.jsx)(jz,{className:H(`text-xs mt-1`,e.category===`NUNCA`&&`text-red-500 bg-red-500/10`,e.category===`SIEMPRE`&&`text-green-500 bg-green-500/10`,e.category===`CONFIRMAR`&&`text-amber-500 bg-amber-500/10`),children:e.category})]}),(0,A.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>{w({customRules:r.customRules.filter((e,n)=>n!==t)})},children:`Eliminar`})]})},t))]})]}),ee=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Módulos opcionales`}),(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Activa las funcionalidades adicionales que quieras usar`})]}),(0,A.jsx)(OR,{className:`cursor-pointer transition-all border-2 ${r.hiveLearnEnabled?`border-amber-500 bg-amber-500/5`:`border-border hover:border-amber-500/40`}`,onClick:()=>w({hiveLearnEnabled:!r.hiveLearnEnabled}),children:(0,A.jsxs)(MR,{className:`p-5 flex items-start gap-4`,children:[(0,A.jsx)(`div`,{className:`mt-1 p-2.5 rounded-xl ${r.hiveLearnEnabled?`bg-amber-500/20`:`bg-muted`}`,children:(0,A.jsx)(Rn,{className:`w-6 h-6 ${r.hiveLearnEnabled?`text-amber-500`:`text-muted-foreground`}`})}),(0,A.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,A.jsx)(`h3`,{className:`font-semibold text-base`,children:`HiveLearn`}),(0,A.jsx)(jz,{variant:`outline`,className:`text-[10px] font-bold uppercase tracking-wider`,children:`Enjambre Educativo`})]}),(0,A.jsxs)(`p`,{className:`text-sm text-muted-foreground leading-relaxed`,children:[`Genera lecciones personalizadas con 17 agentes de IA trabajando en paralelo. Requiere `,(0,A.jsx)(`strong`,{children:`Ollama`}),` corriendo localmente.`]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-3 mt-3 text-xs text-muted-foreground`,children:[(0,A.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(_n,{className:`w-3 h-3`}),` 17 agentes especializados`]}),(0,A.jsx)(`span`,{children:`·`}),(0,A.jsx)(`span`,{children:`Ollama requerido`}),(0,A.jsx)(`span`,{children:`·`}),(0,A.jsx)(`span`,{children:`~2 min primera lección`})]})]}),(0,A.jsx)(aq,{checked:r.hiveLearnEnabled,onCheckedChange:e=>{w({hiveLearnEnabled:e})},onClick:e=>e.stopPropagation(),className:`mt-1 shrink-0`})]})}),(0,A.jsx)(`p`,{className:`text-xs text-center text-muted-foreground`,children:`Puedes activar o desactivar módulos en cualquier momento desde la configuración.`})]}),te=()=>(0,A.jsxs)(`div`,{className:`space-y-6`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`h2`,{className:`text-2xl font-bold`,children:`¡Todo listo!`}),(0,A.jsx)(`p`,{className:`text-muted-foreground`,children:`Revisa tu configuración antes de continuar`})]}),s?(0,A.jsx)(OR,{className:`border-green-500 bg-green-500/10`,children:(0,A.jsxs)(MR,{className:`p-8 text-center space-y-4`,children:[(0,A.jsx)(`div`,{className:`flex justify-center`,children:(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(Wn,{className:`w-24 h-24 text-amber-500 animate-pulse`,fill:`currentColor`}),(0,A.jsx)(Rr,{className:`w-8 h-8 text-amber-300 absolute -top-2 -right-2 animate-bounce`})]})}),(0,A.jsx)(`h3`,{className:`text-xl font-bold`,children:`¡Bienvenido a Hive!`}),(0,A.jsxs)(`p`,{className:`text-muted-foreground`,children:[r.agentName,` está listo para ayudarte.`]})]})}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(OR,{children:[(0,A.jsxs)(kR,{children:[(0,A.jsxs)(AR,{className:`flex items-center gap-3`,children:[(0,A.jsx)(`div`,{className:`w-10 h-10 rounded-lg flex items-center justify-center bg-amber-500`,children:(0,A.jsx)(Wn,{className:`w-6 h-6 text-white`,fill:`currentColor`})}),r.agentName]}),(0,A.jsx)(jR,{children:r.agentDescription||`Sin descripción`})]}),(0,A.jsxs)(MR,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(Z,{className:`text-sm text-muted-foreground`,children:`Proveedor`}),(0,A.jsxs)(`p`,{className:`font-medium`,children:[g.find(e=>e.id===r.provider)?.name||r.provider,` — `,r.model]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(Z,{className:`text-sm text-muted-foreground`,children:`Canales activos`}),(0,A.jsx)(`div`,{className:`flex gap-2 flex-wrap mt-1`,children:Object.entries(r.channels).filter(([e,t])=>t.enabled).map(([e])=>{let t=q9.find(t=>t.id===e);return(0,A.jsxs)(jz,{variant:`secondary`,children:[t?.icon,` `,t?.name]},e)})})]}),r.voiceEnabled&&(0,A.jsxs)(`div`,{children:[(0,A.jsx)(Z,{className:`text-sm text-muted-foreground`,children:`Voz`}),(0,A.jsxs)(`p`,{className:`font-medium`,children:[`STT: `,r.sttProvider,` | TTS: `,r.ttsProvider,r.ttsVoice&&` (${r.ttsVoice})`]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(Z,{className:`text-sm text-muted-foreground`,children:`Reglas éticas activas`}),(0,A.jsx)(`div`,{className:`flex gap-2 flex-wrap mt-1`,children:Object.entries(r.ethicsRules).filter(([e,t])=>t).map(([e])=>(0,A.jsx)(jz,{variant:`outline`,children:S.find(t=>t.id===e)?.name??e},e))})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(Z,{className:`text-sm text-muted-foreground`,children:`Módulos`}),(0,A.jsx)(`div`,{className:`flex gap-2 mt-1`,children:(0,A.jsxs)(jz,{variant:r.hiveLearnEnabled?`default`:`secondary`,className:r.hiveLearnEnabled?`bg-amber-500`:``,children:[(0,A.jsx)(Rn,{className:`w-3 h-3 mr-1`}),`HiveLearn `,r.hiveLearnEnabled?`activado`:`desactivado`]})})]})]})]}),(0,A.jsx)(W,{className:`w-full h-14 text-lg bg-amber-500 hover:bg-amber-600`,onClick:j,disabled:a,children:a?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(tr,{className:`w-5 h-5 mr-2 animate-spin`}),`Configurando...`]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Rr,{className:`w-5 h-5 mr-2`}),`Iniciar a `,r.agentName]})})]})]});return(0,A.jsx)(`div`,{className:`min-h-screen bg-gradient-to-b from-background to-muted/20`,children:(0,A.jsxs)(`div`,{className:`container max-w-2xl mx-auto py-8 px-4`,children:[(0,A.jsxs)(`div`,{className:`mb-8 space-y-2`,children:[(0,A.jsxs)(`div`,{className:`flex justify-between text-sm text-muted-foreground`,children:[(0,A.jsxs)(`span`,{children:[`Paso `,t,` de 8`]}),(0,A.jsx)(`button`,{onClick:O,className:`text-xs text-muted-foreground hover:text-foreground`,children:`Reiniciar configuración`})]}),(0,A.jsx)(Zz,{value:t/8*100,className:`h-2`})]}),M(),m&&(0,A.jsx)(UQ,{variant:`destructive`,className:`mt-6`,children:(0,A.jsx)(GQ,{children:m})}),!s&&(0,A.jsxs)(`div`,{className:`flex justify-between mt-6 pt-6 border-t`,children:[(0,A.jsx)(W,{variant:`outline`,onClick:D,disabled:t===1,children:`← Anterior`}),t<8?(0,A.jsx)(W,{onClick:E,className:`bg-amber-500 hover:bg-amber-600`,children:`Siguiente →`}):(0,A.jsx)(`div`,{})]})]})})}function yke(){let e=Gd(),[t,n]=(0,u.useState)(``),[r,i]=(0,u.useState)(``),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)(!1),[l,d]=(0,u.useState)(``);(0,u.useEffect)(()=>{fetch(`/api/auth/status`).then(e=>e.json()).then(({hasCredentials:t})=>{t||e(`/`,{replace:!0})}).catch(()=>{})},[]);async function f(n){n.preventDefault(),d(``),c(!0);try{let n=await fetch(`/api/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:t,password:r})}),i=await n.json();if(!n.ok){d(i.error||`Credenciales inválidas`);return}localStorage.setItem(`hive-auth-token`,i.authToken),e(`/`,{replace:!0})}catch{d(`No se pudo conectar al servidor`)}finally{c(!1)}}return(0,A.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,A.jsxs)(`div`,{className:`w-full max-w-sm space-y-6 p-8`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`div`,{className:`text-4xl`,children:`🐝`}),(0,A.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:`Hive`}),(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Inicia sesión para continuar`})]}),(0,A.jsxs)(`form`,{onSubmit:f,className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`email`,children:`Email`}),(0,A.jsx)(G,{id:`email`,type:`email`,autoComplete:`email`,placeholder:`tu@email.com`,value:t,onChange:e=>n(e.target.value),required:!0,disabled:s})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`password`,children:`Contraseña`}),(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(G,{id:`password`,type:a?`text`:`password`,autoComplete:`current-password`,placeholder:`••••••••`,value:r,onChange:e=>i(e.target.value),required:!0,disabled:s,className:`pr-10`}),(0,A.jsx)(`button`,{type:`button`,className:`absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>o(e=>!e),tabIndex:-1,children:a?(0,A.jsx)(On,{className:`h-4 w-4`}):(0,A.jsx)(kn,{className:`h-4 w-4`})})]})]}),l&&(0,A.jsx)(`p`,{className:`text-sm text-destructive`,children:l}),(0,A.jsxs)(W,{type:`submit`,className:`w-full`,disabled:s,children:[s&&(0,A.jsx)(tr,{className:`mr-2 h-4 w-4 animate-spin`}),`Iniciar Sesión`]})]}),(0,A.jsx)(`div`,{className:`text-center`,children:(0,A.jsx)(`button`,{type:`button`,onClick:()=>e(`/recover`),className:`text-sm text-muted-foreground hover:text-foreground underline underline-offset-4`,children:`¿Olvidaste tu contraseña?`})})]})})}function bke(){let e=Gd(),[t,n]=(0,u.useState)(``),[r,i]=(0,u.useState)(``),[a,o]=(0,u.useState)(``),[s,c]=(0,u.useState)(!1),[l,d]=(0,u.useState)(!1),[f,p]=(0,u.useState)(``);async function m(n){if(n.preventDefault(),p(``),r!==a){p(`Las contraseñas no coinciden`);return}if(r.length<8){p(`La contraseña debe tener al menos 8 caracteres`);return}d(!0);try{let n=await fetch(`/api/auth/recover`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({recoveryKey:t,newPassword:r})}),i=await n.json();if(!n.ok){p(i.error||`Recovery key inválido`);return}localStorage.setItem(`hive-auth-token`,i.authToken),e(`/`,{replace:!0})}catch{p(`No se pudo conectar al servidor`)}finally{d(!1)}}return(0,A.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-background`,children:(0,A.jsxs)(`div`,{className:`w-full max-w-sm space-y-6 p-8`,children:[(0,A.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,A.jsx)(`div`,{className:`text-4xl`,children:`🐝`}),(0,A.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight`,children:`Recuperar acceso`}),(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Usa tu recovery key para restablecer la contraseña`})]}),(0,A.jsxs)(`form`,{onSubmit:m,className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`recoveryKey`,children:`Recovery Key`}),(0,A.jsx)(G,{id:`recoveryKey`,type:`text`,placeholder:`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`,value:t,onChange:e=>n(e.target.value),required:!0,disabled:l,className:`font-mono text-sm`}),(0,A.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Encuéntralo en `,(0,A.jsx)(`code`,{className:`bg-muted px-1 rounded`,children:`~/.hive/.auth_token`})]})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`newPassword`,children:`Nueva contraseña`}),(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(G,{id:`newPassword`,type:s?`text`:`password`,placeholder:`••••••••`,value:r,onChange:e=>i(e.target.value),required:!0,disabled:l,className:`pr-10`}),(0,A.jsx)(`button`,{type:`button`,className:`absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>c(e=>!e),tabIndex:-1,children:s?(0,A.jsx)(On,{className:`h-4 w-4`}):(0,A.jsx)(kn,{className:`h-4 w-4`})})]})]}),(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(Z,{htmlFor:`confirmPassword`,children:`Confirmar contraseña`}),(0,A.jsx)(G,{id:`confirmPassword`,type:s?`text`:`password`,placeholder:`••••••••`,value:a,onChange:e=>o(e.target.value),required:!0,disabled:l})]}),f&&(0,A.jsx)(`p`,{className:`text-sm text-destructive`,children:f}),(0,A.jsxs)(W,{type:`submit`,className:`w-full`,disabled:l,children:[l&&(0,A.jsx)(tr,{className:`mr-2 h-4 w-4 animate-spin`}),`Recuperar acceso`]})]}),(0,A.jsx)(`div`,{className:`text-center`,children:(0,A.jsxs)(`button`,{type:`button`,onClick:()=>e(`/login`),className:`text-sm text-muted-foreground hover:text-foreground inline-flex items-center gap-1`,children:[(0,A.jsx)(Vt,{className:`h-3 w-3`}),`Volver al login`]})})]})})}var xke=()=>{let e=Hd();return(0,u.useEffect)(()=>{console.error(`404 Error: User attempted to access non-existent route:`,e.pathname)},[e.pathname]),(0,A.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-muted`,children:(0,A.jsxs)(`div`,{className:`text-center`,children:[(0,A.jsx)(`h1`,{className:`mb-4 text-4xl font-bold`,children:`404`}),(0,A.jsx)(`p`,{className:`mb-4 text-xl text-muted-foreground`,children:`Oops! Page not found`}),(0,A.jsx)(`a`,{href:`/`,className:`text-primary underline hover:text-primary/90`,children:`Return to Home`})]})})};function Z9({delay:e,startX:t,startY:n,duration:r}){return(0,A.jsxs)(`svg`,{style:{position:`absolute`,left:`${t}%`,top:`${n}%`,animation:`flyBee ${r}s ease-in-out ${e}s infinite`,opacity:0},width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,className:`drop-shadow-lg`,children:[(0,A.jsx)(`ellipse`,{cx:`12`,cy:`14`,rx:`6`,ry:`8`,fill:`#FBBF24`}),(0,A.jsx)(`ellipse`,{cx:`12`,cy:`14`,rx:`3`,ry:`6`,fill:`#1F2937`}),(0,A.jsx)(`circle`,{cx:`8`,cy:`10`,r:`2`,fill:`#1F2937`}),(0,A.jsx)(`circle`,{cx:`16`,cy:`10`,r:`2`,fill:`#1F2937`}),(0,A.jsx)(`path`,{d:`M6 8 Q4 4 8 6`,stroke:`#1F2937`,strokeWidth:`1`,fill:`none`}),(0,A.jsx)(`path`,{d:`M18 8 Q20 4 16 6`,stroke:`#1F2937`,strokeWidth:`1`,fill:`none`}),(0,A.jsx)(`path`,{d:`M9 18 L6 22 L9 20 Z`,fill:`#1F2937`}),(0,A.jsx)(`path`,{d:`M15 18 L18 22 L15 20 Z`,fill:`#1F2937`})]})}function Q9({delay:e,x:t,y:n}){return(0,A.jsx)(`svg`,{style:{position:`absolute`,left:`${t}%`,top:`${n}%`,animation:`sparkle 2s ease-in-out ${e}s infinite`},width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,children:(0,A.jsx)(`path`,{d:`M12 2 L14 10 L22 12 L14 14 L12 22 L10 14 L2 12 L10 10 Z`,fill:`#FCD34D`,className:`animate-pulse`})})}function Ske(){let{isOpen:e,data:t,close:n}=ng(),[r,i]=(0,u.useState)(4);if((0,u.useEffect)(()=>{if(e){i(4);let e=setInterval(()=>{i(t=>t<=1?(clearInterval(e),n(),0):t-1)},1e3);return()=>clearInterval(e)}},[e,n]),!e||!t)return null;let a=t.channels?.length>0?t.channels.join(`, `):`WebChat`;return(0,A.jsxs)(uh,{open:e,onOpenChange:e=>!e&&n(),children:[(0,A.jsxs)(fh,{children:[(0,A.jsx)(ph,{className:`fixed inset-0 bg-black/60 backdrop-blur-sm z-50 animate-fade-in`}),(0,A.jsxs)(mh,{className:`fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 w-full max-w-lg focus:outline-none`,children:[(0,A.jsx)(hh,{className:`sr-only`,children:`Bienvenido al Enjambre`}),(0,A.jsxs)(`div`,{className:`relative bg-gradient-to-br from-amber-50 via-yellow-50 to-orange-100 rounded-3xl shadow-2xl overflow-hidden border-4 border-amber-300/50`,children:[(0,A.jsxs)(`div`,{className:`absolute inset-0 overflow-hidden pointer-events-none`,children:[(0,A.jsx)(`div`,{className:`absolute inset-0 bg-gradient-to-b from-amber-200/30 to-orange-200/30`}),(0,A.jsx)(Z9,{delay:0,startX:10,startY:20,duration:8}),(0,A.jsx)(Z9,{delay:1,startX:80,startY:30,duration:7}),(0,A.jsx)(Z9,{delay:2,startX:20,startY:60,duration:9}),(0,A.jsx)(Z9,{delay:.5,startX:70,startY:70,duration:8}),(0,A.jsx)(Z9,{delay:1.5,startX:40,startY:10,duration:10}),(0,A.jsx)(Z9,{delay:2.5,startX:60,startY:50,duration:7}),(0,A.jsx)(Q9,{delay:0,x:15,y:15}),(0,A.jsx)(Q9,{delay:.5,x:85,y:25}),(0,A.jsx)(Q9,{delay:1,x:25,y:75}),(0,A.jsx)(Q9,{delay:1.5,x:75,y:80}),(0,A.jsx)(Q9,{delay:2,x:50,y:10})]}),(0,A.jsxs)(`div`,{className:`relative p-8 text-center`,children:[(0,A.jsxs)(`div`,{className:`mb-6`,children:[(0,A.jsx)(`h1`,{className:`text-4xl font-black text-transparent bg-clip-text bg-gradient-to-r from-amber-600 via-orange-600 to-amber-700 drop-shadow-sm`,children:`🐝 BIENVENIDO AL ENJAMBRE 🐝`}),(0,A.jsx)(`p`,{className:`text-lg font-semibold text-amber-800 mt-2`,children:`✦在你的 Hive✦`})]}),(0,A.jsx)(`div`,{className:`w-full h-px bg-gradient-to-r from-transparent via-amber-400 to-transparent mb-6`}),(0,A.jsxs)(`div`,{className:`mb-6`,children:[t.user&&(0,A.jsxs)(`p`,{className:`text-2xl font-bold text-gray-800 mb-4`,children:[`👋 Hola, `,(0,A.jsx)(`span`,{className:`text-amber-700`,children:t.user.name}),`!`]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-2 text-left bg-white/60 rounded-xl p-4 backdrop-blur-sm`,children:[t.agent&&(0,A.jsxs)(`p`,{className:`text-gray-700`,children:[(0,A.jsx)(`span`,{className:`font-semibold`,children:`🤖 Tu agente:`}),` `,(0,A.jsx)(`span`,{className:`text-amber-700`,children:t.agent.name})]}),t.agent&&(0,A.jsxs)(`p`,{className:`text-gray-700`,children:[(0,A.jsx)(`span`,{className:`font-semibold`,children:`🧠 Provider:`}),` `,(0,A.jsxs)(`span`,{className:`text-amber-700`,children:[t.agent.provider,`/`,t.agent.model]})]}),(0,A.jsxs)(`p`,{className:`text-gray-700`,children:[(0,A.jsx)(`span`,{className:`font-semibold`,children:`📡 Canales:`}),` `,(0,A.jsx)(`span`,{className:`text-amber-700`,children:a})]}),t.voice?.enabled&&(0,A.jsxs)(`p`,{className:`text-gray-700`,children:[(0,A.jsx)(`span`,{className:`font-semibold`,children:`🎤 Voz:`}),` `,(0,A.jsxs)(`span`,{className:`text-amber-700`,children:[t.voice.sttProvider,` + `,t.voice.ttsProvider]})]})]})]}),(0,A.jsx)(`div`,{className:`w-full h-px bg-gradient-to-r from-transparent via-amber-400 to-transparent mb-6`}),(0,A.jsxs)(`div`,{className:`mb-6 text-left`,children:[(0,A.jsx)(`p`,{className:`text-lg font-bold text-gray-800 mb-3 text-center`,children:`💡 LO QUE PUEDES HACER CON HIVE:`}),(0,A.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-sm`,children:[(0,A.jsx)($9,{icon:`🗣️`,text:`Voz en tiempo real (STT/TTS)`}),(0,A.jsx)($9,{icon:`🔧`,text:`Code Bridge (claude-code, gemini)`}),(0,A.jsx)($9,{icon:`🔌`,text:`MCP Servers`}),(0,A.jsx)($9,{icon:`🎨`,text:`Canvas visual`}),(0,A.jsx)($9,{icon:`📱`,text:`Múltiples canales`}),(0,A.jsx)($9,{icon:`🧠`,text:`Múltiples agentes`}),(0,A.jsx)($9,{icon:`💬`,text:`Memoria conversacional`}),(0,A.jsx)($9,{icon:`⚡`,text:`Ejecución de tools`})]})]}),(0,A.jsx)(`div`,{className:`mt-4`,children:(0,A.jsxs)(`p`,{className:`text-amber-600 font-medium animate-pulse`,children:[`🌐 Abriendo Dashboard en `,r,`s...`]})}),(0,A.jsx)(_h,{asChild:!0,children:(0,A.jsx)(`button`,{className:`absolute top-4 right-4 p-2 rounded-full bg-amber-200/80 hover:bg-amber-300 transition-colors`,"aria-label":`Cerrar`,children:(0,A.jsx)(ni,{className:`w-5 h-5 text-amber-800`})})})]})]})]})]}),(0,A.jsx)(`style`,{children:`
|
|
294
294
|
@keyframes flyBee {
|
|
295
295
|
0% {
|
|
296
296
|
transform: translate(0, 0) rotate(0deg);
|
|
@@ -341,4 +341,4 @@ Minimum version required to store current data is: `+c+`.
|
|
|
341
341
|
0%, 100% { transform: scaleY(1); }
|
|
342
342
|
50% { transform: scaleY(0.5); }
|
|
343
343
|
}
|
|
344
|
-
`}})]}):null},wke=(0,u.lazy)(()=>qu(()=>import(`./ui-
|
|
344
|
+
`}})]}):null},wke=(0,u.lazy)(()=>qu(()=>import(`./ui-Ra3lIxcJ.js`).then(e=>({default:e.LessonCanvas})),__vite__mapDeps([0,1,2,3])).catch(()=>({default:()=>(0,A.jsx)(`div`,{className:`flex h-screen items-center justify-center text-gray-400`,children:`HiveLearn no disponible — verifica que Ollama esté corriendo.`})}))),Tke=new Au;function Eke({children:e}){let t=localStorage.getItem(`hive-auth-token`),[n,r]=(0,u.useState)(`loading`);return(0,u.useEffect)(()=>{fetch(`/api/auth/status`).then(e=>e.json()).then(e=>r(e.hasCredentials?`protected`:`open`)).catch(()=>r(`open`))},[]),n===`loading`?null:n===`open`||t?(0,A.jsx)(A.Fragment,{children:e}):(0,A.jsx)(rf,{to:`/login`,replace:!0})}var Dke=()=>{let e=jg(e=>e.fetchUser),t=Gd(),n=Hd(),[r,i]=(0,u.useState)(!1),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)(!1);return vR(!s&&a&&r),(0,u.useEffect)(()=>{let e=!1,t=`${cg()}/health`;async function n(){for(;!e;){try{if((await(await fetch(t)).json().catch(()=>({}))).status===`ok`){i(!0);return}}catch{}await new Promise(e=>setTimeout(e,1e3))}}return n(),()=>{e=!0}},[]),(0,u.useEffect)(()=>{if(!r)return;let i=new URLSearchParams(window.location.search).get(`token`);if(i){localStorage.setItem(`hive-auth-token`,i);let e=window.location.pathname+window.location.hash;window.history.replaceState({},``,e)}fetch(`/api/setup/status`).then(e=>e.json()).then(({setupMode:r})=>{c(!!r),r&&n.pathname!==`/setup`?t(`/setup`,{replace:!0}):!r&&n.pathname===`/setup`&&t(`/`,{replace:!0}),o(!0),r||localStorage.getItem(`hive-auth-token`)&&e()}).catch(()=>{o(!0),localStorage.getItem(`hive-auth-token`)&&e()})},[r]),!r||!a?(0,A.jsxs)(`div`,{className:`fixed inset-0 z-[9999] flex flex-col items-center justify-center bg-background/60 backdrop-blur-md`,children:[(0,A.jsx)(`div`,{className:`relative h-32 w-32 animate-bounce`,style:{animationDuration:`2000ms`},children:(0,A.jsxs)(`svg`,{viewBox:`0 0 100 100`,className:`h-full w-full`,style:{filter:`drop-shadow(0 0 15px rgba(245,158,11,0.5))`},children:[(0,A.jsx)(`ellipse`,{cx:`50`,cy:`55`,rx:`20`,ry:`15`,fill:`#F59E0B`}),(0,A.jsx)(`path`,{d:`M40 45 Q50 40 60 45`,fill:`none`,stroke:`#1F2937`,strokeWidth:`2`,strokeLinecap:`round`}),(0,A.jsx)(`path`,{d:`M35 55 Q50 50 65 55`,fill:`none`,stroke:`#1F2937`,strokeWidth:`3`}),(0,A.jsx)(`path`,{d:`M40 65 Q50 60 60 65`,fill:`none`,stroke:`#1F2937`,strokeWidth:`2`}),(0,A.jsx)(`circle`,{cx:`68`,cy:`50`,r:`8`,fill:`#F59E0B`}),(0,A.jsx)(`circle`,{cx:`72`,cy:`48`,r:`1.5`,fill:`#1F2937`}),(0,A.jsx)(`path`,{d:`M70 42 Q75 35 80 38`,fill:`none`,stroke:`#1F2937`,strokeWidth:`1`}),(0,A.jsx)(`path`,{d:`M68 42 Q65 35 60 38`,fill:`none`,stroke:`#1F2937`,strokeWidth:`1`}),(0,A.jsx)(`path`,{d:`M30 55 L20 55`,stroke:`#1F2937`,strokeWidth:`2`,strokeLinecap:`round`})]})}),(0,A.jsx)(`p`,{className:`mt-8 text-lg font-medium tracking-wide text-primary animate-pulse italic`,children:r?`Sincronizando...`:`Iniciando la colmena...`})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Cke,{}),(0,A.jsx)(Ske,{}),(0,A.jsxs)(cf,{children:[(0,A.jsx)(of,{path:`/setup`,element:(0,A.jsx)(vke,{})}),(0,A.jsx)(of,{path:`/login`,element:(0,A.jsx)(yke,{})}),(0,A.jsx)(of,{path:`/recover`,element:(0,A.jsx)(bke,{})}),(0,A.jsxs)(of,{element:(0,A.jsx)(Eke,{children:(0,A.jsx)(ane,{})}),children:[(0,A.jsx)(of,{path:`/`,element:(0,A.jsx)(tB,{})}),(0,A.jsx)(of,{path:`/chat`,element:(0,A.jsx)(mke,{})}),(0,A.jsx)(of,{path:`/agents`,element:(0,A.jsx)(yq,{})}),(0,A.jsx)(of,{path:`/agents/new`,element:(0,A.jsx)($J,{})}),(0,A.jsx)(of,{path:`/agents/:id`,element:(0,A.jsx)(wq,{})}),(0,A.jsx)(of,{path:`/notas`,element:(0,A.jsx)(QJ,{forcePanel:`notas`})}),(0,A.jsx)(of,{path:`/cron-jobs`,element:(0,A.jsx)(QJ,{forcePanel:`cron-jobs`})}),(0,A.jsx)(of,{path:`/settings`,element:(0,A.jsx)(QJ,{})}),(0,A.jsx)(of,{path:`/settings/:panel`,element:(0,A.jsx)(QJ,{})}),(0,A.jsx)(of,{path:`/canvas`,element:(0,A.jsx)(g7,{})}),(0,A.jsx)(of,{path:`/canvas/:sessionId`,element:(0,A.jsx)(g7,{})}),(0,A.jsx)(of,{path:`/projects`,element:(0,A.jsx)(pEe,{})}),(0,A.jsx)(of,{path:`/bridge`,element:(0,A.jsx)(ATe,{})}),(0,A.jsx)(of,{path:`/channels`,element:(0,A.jsx)(aEe,{})}),(0,A.jsx)(of,{path:`/providers`,element:(0,A.jsx)(AEe,{})}),(0,A.jsx)(of,{path:`/logs`,element:(0,A.jsx)(jTe,{})}),(0,A.jsx)(of,{path:`/hivelearn`,element:(0,A.jsx)(u.Suspense,{fallback:(0,A.jsx)(`div`,{className:`flex h-screen items-center justify-center text-amber-400`,children:`Cargando HiveLearn...`}),children:(0,A.jsx)(wke,{})})}),(0,A.jsx)(of,{path:`/hivelearn/sessions`,element:(0,A.jsx)(ZEe,{})}),(0,A.jsx)(of,{path:`/hivelearn/swarm`,element:(0,A.jsx)(REe,{})}),(0,A.jsx)(of,{path:`/hivelearn/config`,element:(0,A.jsx)(GEe,{})})]}),(0,A.jsx)(of,{path:`*`,element:(0,A.jsx)(xke,{})})]})]})};(0,l.createRoot)(document.getElementById(`root`)).render((0,A.jsx)(()=>(0,A.jsx)(Nu,{client:Tke,children:(0,A.jsxs)(vl,{children:[(0,A.jsx)(da,{}),(0,A.jsx)(Ka,{}),(0,A.jsx)(Yf,{children:(0,A.jsx)(Dke,{})})]})}),{}));export{tw as a,NC as c,nw as i,k as l,J7 as n,QC as o,X$ as r,ZC as s,K7 as t,c as u};
|