diff --git a/orchestrator/src/views/TenantAgentes.vue b/orchestrator/src/views/TenantAgentes.vue index cfa6a97..49217cf 100644 --- a/orchestrator/src/views/TenantAgentes.vue +++ b/orchestrator/src/views/TenantAgentes.vue @@ -93,6 +93,24 @@ async function cargar() { } } +// Un agente que ya funciona es la mejor plantilla del siguiente: el catálogo de +// rubros da un arranque genérico, esto copia uno real con su conocimiento. +async function duplicarAgente(a) { + const nombre = prompt(`Nombre de la copia de "${a.nombre}":`, `${a.nombre} (copia)`) + if (nombre === null) return + error.value = '' + try { + const r = await api.post(apiUmind(`/umind/agentes/${a.ID}/duplicar`), { + tenant_id: Number(tenantId.value), + nombre: nombre.trim(), + }) + await cargar() + if (r.aviso) alert(r.aviso) + } catch (e) { + error.value = e.message + } +} + function nuevoAgente() { editing.value = null form.value = vacio() @@ -225,6 +243,11 @@ watch(() => props.id, cargar, { immediate: true })
J)for(;k<=H;)Le(f[k],S,_,!0),k++;else{const Y=k,ue=k,de=new Map;for(k=ue;k<=J;k++){const Me=p[k]=N?kt(p[k]):vt(p[k]);Me.key!=null&&de.set(Me.key,k)}let pe,ke=0;const Ee=J-ue+1;let qe=!1,Fe=0;const Gt=new Array(Ee);for(k=0;k=Ee){Le(Me,S,_,!0);continue}let ot;if(Me.key!=null)ot=de.get(Me.key);else for(pe=ue;pe<=J;pe++)if(Gt[pe-ue]===0&&xn(Me,p[pe])){ot=pe;break}ot===void 0?Le(Me,S,_,!0):(Gt[ot-ue]=k+1,ot>=Fe?Fe=ot:qe=!0,O(Me,p[ot],m,null,S,_,L,$,N),ke++)}const Bn=qe?ya(Gt):on;for(pe=Bn.length-1,k=Ee-1;k>=0;k--){const Me=ue+k,ot=p[Me],Kn=p[Me+1],qn=Me+1 {const{el:_,type:L,transition:$,children:N,shapeFlag:k}=f;if(k&6){Ze(f.component.subTree,p,m,y);return}if(k&128){f.suspense.move(p,m,y);return}if(k&64){L.move(f,p,m,T);return}if(L===fe){s(_,p,m);for(let H=0;H$.enter(_),S));else{const{leave:H,delayLeave:J,afterLeave:Y}=$,ue=()=>{f.ctx.isUnmounted?o(_):s(_,p,m)},de=()=>{const pe=_._isLeaving||!!_[Os];_._isLeaving&&_[Os](!0),$.persisted&&!pe?ue():H(_,()=>{ue(),Y&&Y()})};J?J(_,ue,de):de()}else s(_,p,m)},Le=(f,p,m,y=!1,S=!1)=>{const{type:_,props:L,ref:$,children:N,dynamicChildren:k,shapeFlag:Q,patchFlag:H,dirs:J,cacheIndex:Y,memo:ue}=f;if(H===-2&&(S=!1),$!=null&&(Tt(),kn($,null,m,f,!0),$t()),Y!=null&&(p.renderCache[Y]=void 0),Q&256){p.ctx.deactivate(f);return}const de=Q&1&&J,pe=!an(f);let ke;if(pe&&(ke=L&&L.onVnodeBeforeUnmount)&&ht(ke,p,f),Q&6)yt(f.component,m,y);else{if(Q&128){f.suspense.unmount(m,y);return}de&&Wt(f,null,p,"beforeUnmount"),Q&64?f.type.remove(f,p,m,T,y):k&&!k.hasOnce&&(_!==fe||H>0&&H&64)?et(k,p,m,!1,!0):(_===fe&&H&384||!S&&Q&16)&&et(N,p,m),y&&Vt(f)}const Ee=ue!=null&&Y==null;(pe&&(ke=L&&L.onVnodeUnmounted)||de||Ee)&&tt(()=>{ke&&ht(ke,p,f),de&&Wt(f,null,p,"unmounted"),Ee&&(f.el=null)},m)},Vt=f=>{const{type:p,el:m,anchor:y,transition:S}=f;if(p===fe){jt(m,y);return}if(p===es){I(f);return}const _=()=>{o(m),S&&!S.persisted&&S.afterLeave&&S.afterLeave()};if(f.shapeFlag&1&&S&&!S.persisted){const{leave:L,delayLeave:$}=S,N=()=>L(m,_);$?$(f.el,_,N):N()}else _()},jt=(f,p)=>{let m;for(;f!==p;)m=g(f),o(f),f=m;o(p)},yt=(f,p,m)=>{const{bum:y,scope:S,job:_,subTree:L,um:$,m:N,a:k}=f;Uo(N),Uo(k),y&&Xn(y),S.stop(),_&&(_.flags|=8,Le(L,f,p,m)),$&&tt($,p),tt(()=>{f.isUnmounted=!0},p)},et=(f,p,m,y=!1,S=!1,_=0)=>{for(let L=_;L {if(f.shapeFlag&6)return C(f.component.subTree);if(f.shapeFlag&128)return f.suspense.next();const p=g(f.anchor||f.el),m=p&&p[Nl];return m?g(m):p};let B=!1;const U=(f,p,m)=>{let y;f==null?p._vnode&&(Le(p._vnode,null,null,!0),y=p._vnode.component):O(p._vnode||null,f,p,null,null,null,m),p._vnode=f,B||(B=!0,Ro(y),Gr(),B=!1)},T={p:O,um:Le,m:Ze,r:Vt,mt:Xe,mc:F,pc:ae,pbc:Z,n:C,o:e};return{render:U,hydrate:void 0,createApp:oa(U)}}function $s({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function zt({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function _a(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function gi(e,t,n=!1){const s=e.children,o=t.children;if(X(s)&&X(o))for(let r=0;r >1,e[n[l]] 0&&(t[s]=n[r-1]),n[r]=s)}}for(r=n.length,i=n[r-1];r-- >0;)n[r]=i,i=t[i];return n}function vi(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:vi(t)}function Uo(e){if(e)for(let t=0;t e.__isSuspense;function wa(e,t){t&&t.pendingBranch?X(e)?t.effects.push(...e):t.effects.push(e):Pl(e)}const fe=Symbol.for("v-fgt"),ws=Symbol.for("v-txt"),_t=Symbol.for("v-cmt"),es=Symbol.for("v-stc"),Ot=[];let nt=null;function w(e=!1){Ot.push(nt=e?null:[])}function _o(){Ot.pop(),nt=Ot[Ot.length-1]||null}let $n=1;function ls(e,t=!1){$n+=e,e<0&&nt&&t&&(nt.hasOnce=!0)}function _i(e){return e.dynamicChildren=$n>0?nt||on:null,_o(),$n>0&&nt&&nt.push(e),e}function E(e,t,n,s,o,r){return _i(u(e,t,n,s,o,r,!0))}function dn(e,t,n,s,o){return _i(Pe(e,t,n,s,o,!0))}function Nn(e){return e?e.__v_isVNode===!0:!1}function xn(e,t){return e.type===t.type&&e.key===t.key}const yi=({key:e})=>e??null,ts=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Oe(e)||Ke(e)||te(e)?{i:je,r:e,k:t,f:!!n}:e:null);function u(e,t=null,n=null,s=0,o=null,r=e===fe?0:1,i=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&yi(t),ref:t&&ts(t),scopeId:zr,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:s,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:je};return l?(as(a,n),r&128&&e.normalize(a)):n&&(a.shapeFlag|=Oe(n)?8:16),$n>0&&!i&&nt&&(a.patchFlag>0||r&6)&&a.patchFlag!==32&&nt.push(a),a}const Pe=Ca;function Ca(e,t=null,n=null,s=0,o=null,r=!1){if((!e||e===zl)&&(e=_t),Nn(e)){const l=pn(e,t,!0);return n&&as(l,n),$n>0&&!r&&nt&&(l.shapeFlag&6?nt[nt.indexOf(e)]=l:nt.push(l)),l.patchFlag=-2,l}if(Da(e)&&(e=e.__vccOpts),t){t=Ea(t);let{class:l,style:a}=t;l&&!Oe(l)&&(t.class=Ie(l)),ve(a)&&(fo(a)&&!X(a)&&(a=Ue({},a)),t.style=Zt(a))}const i=Oe(e)?1:xi(e)?128:xs(e)?64:ve(e)?4:te(e)?2:0;return u(e,t,n,s,o,i,r,!0)}function Ea(e){return e?fo(e)||ci(e)?Ue({},e):e:null}function pn(e,t,n=!1,s=!1){const{props:o,ref:r,patchFlag:i,children:l,transition:a}=e,d=t?Sa(o||{},t):o,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:d,key:d&&yi(d),ref:t&&t.ref?n&&r?X(r)?r.concat(ts(t)):[r,ts(t)]:ts(t):r,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:l,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==fe?i===-1?16:i|16:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:a,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&pn(e.ssContent),ssFallback:e.ssFallback&&pn(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return a&&s&&mo(c,a.clone(c)),c}function we(e=" ",t=0){return Pe(ws,null,e,t)}function wi(e,t){const n=Pe(es,null,e);return n.staticCount=t,n}function ee(e="",t=!1){return t?(w(),dn(_t,null,e)):Pe(_t,null,e)}function vt(e){return e==null||typeof e=="boolean"?Pe(_t):X(e)?Pe(fe,null,e.slice()):Nn(e)?kt(e):Pe(ws,null,String(e))}function kt(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:pn(e)}function as(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(X(t))n=16;else if(typeof t=="object")if(s&65){const o=t.default;o&&(o._c&&(o._d=!1),as(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!ci(t)?t._ctx=je:o===3&&je&&(je.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(te(t)){if(s&65){as(e,{default:t});return}t={default:t,_ctx:je},n=32}else t=String(t),s&64?(n=16,t=[we(t)]):n=8;e.children=t,e.shapeFlag|=n}function Sa(...e){const t={};for(let n=0;n Be||je;let us,Dn;{const e=ms(),t=(n,s)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(s),r=>{o.length>1?o.forEach(i=>i(r)):o[0](r)}};us=t("__VUE_INSTANCE_SETTERS__",n=>Be=n),Dn=t("__VUE_SSR_SETTERS__",n=>Mn=n)}const Hn=e=>{const t=Be;return us(e),e.scope.on(),()=>{e.scope.off(),us(t)}},Lo=()=>{Be&&Be.scope.off(),us(null)};function Ci(e){return e.vnode.shapeFlag&4}let Mn=!1;function Pa(e,t=!1,n=!1){t&&Dn(t);const{props:s,children:o}=e.vnode,r=Ci(e);da(e,s,r,t),ga(e,o,n||t);const i=r?Oa(e,t):void 0;return t&&Dn(!1),i}function Oa(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Yl);const{setup:s}=n;if(s){Tt();const o=e.setupContext=s.length>1?$a(e):null,r=Hn(e),i=Ln(s,e,0,[e.props,o]),l=_r(i);if($t(),r(),(l||e.sp)&&!an(e)&&Zr(e),l){if(i.then(Lo,Lo),t)return i.then(a=>{Dn(!0);try{Fo(e,a,t)}finally{Dn(!1)}}).catch(a=>{bs(a,e,0)});e.asyncDep=i}else Fo(e,i)}else Ei(e)}function Fo(e,t,n){te(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:ve(t)&&(e.setupState=Br(t)),Ei(e)}function Ei(e,t,n){const s=e.type;e.render||(e.render=s.render||xt);{const o=Hn(e);Tt();try{Xl(e)}finally{$t(),o()}}}const Ta={get(e,t){return He(e,"get",""),e[t]}};function $a(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Ta),slots:e.slots,emit:e.emit,expose:t}}function Cs(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Br(_l(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Rn)return Rn[n](e)},has(t,n){return n in t||n in Rn}})):e.proxy}function Na(e,t=!0){return te(e)?e.displayName||e.name:e.name||t&&e.__name}function Da(e){return te(e)&&"__vccOpts"in e}const ye=(e,t)=>Sl(e,t,Mn);function Si(e,t,n){try{ls(-1);const s=arguments.length;return s===2?ve(t)&&!X(t)?Nn(t)?Pe(e,null,[t]):Pe(e,t):Pe(e,null,t):(s>3?n=Array.prototype.slice.call(arguments,2):s===3&&Nn(n)&&(n=[n]),Pe(e,t,n))}finally{ls(1)}}const Ma="3.5.41";/** +* @vue/runtime-dom v3.5.41 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/let Qs;const Ho=typeof window<"u"&&window.trustedTypes;if(Ho)try{Qs=Ho.createPolicy("vue",{createHTML:e=>e})}catch{}const Ai=Qs?e=>Qs.createHTML(e):e=>e,Va="http://www.w3.org/2000/svg",ja="http://www.w3.org/1998/Math/MathML",St=typeof document<"u"?document:null,Bo=St&&St.createElement("template"),Ua={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const o=t==="svg"?St.createElementNS(Va,e):t==="mathml"?St.createElementNS(ja,e):n?St.createElement(e,{is:n}):St.createElement(e);return e==="select"&&s&&s.multiple!=null&&o.setAttribute("multiple",s.multiple),o},createText:e=>St.createTextNode(e),createComment:e=>St.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>St.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,o,r){const i=n?n.previousSibling:t.lastChild;if(o&&(o===r||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===r||!(o=o.nextSibling)););else{Bo.innerHTML=Ai(s==="svg"?``:s==="mathml"?``:e);const l=Bo.content;if(s==="svg"||s==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}t.insertBefore(l,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},La=Symbol("_vtc");function Fa(e,t,n){const s=e[La];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Ko=Symbol("_vod"),Ha=Symbol("_vsh"),Ba=Symbol(""),Ka=/(?:^|;)\s*display\s*:/;function qa(e,t,n){const s=e.style,o=Oe(n);let r=!1;if(n&&!o){if(t)if(Oe(t))for(const i of t.split(";")){const l=i.slice(0,i.indexOf(":")).trim();n[l]==null&&wn(s,l,"")}else for(const i in t)n[i]==null&&wn(s,i,"");for(const i in n){i==="display"&&(r=!0);const l=n[i];l!=null?Wa(e,i,!Oe(t)&&t?t[i]:void 0,l)||wn(s,i,l):wn(s,i,"")}}else if(o){if(t!==n){const i=s[Ba];i&&(n+=";"+i),s.cssText=n,r=Ka.test(n)}}else t&&e.removeAttribute("style");Ko in e&&(e[Ko]=r?s.display:"",e[Ha]&&(s.display="none"))}const qo=/\s*!important$/;function wn(e,t,n){if(X(n))n.forEach(s=>wn(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const s=Ga(e,t);qo.test(n)?e.setProperty(en(s),n.replace(qo,""),"important"):e[s]=n}}const Go=["Webkit","Moz","ms"],Ns={};function Ga(e,t){const n=Ns[t];if(n)return n;let s=Ye(t);if(s!=="filter"&&s in e)return Ns[t]=s;s=ps(s);for(let o=0;o Ds||(Za.then(()=>Ds=0),Ds=Date.now());function tu(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;const o=n.value;if(X(o)){const r=s.stopImmediatePropagation;s.stopImmediatePropagation=()=>{r.call(s),s._stopped=!0};const i=o.slice(),l=[s];for(let a=0;a e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,nu=(e,t,n,s,o,r)=>{const i=o==="svg";t==="class"?Fa(e,s,i):t==="style"?qa(e,n,s):cs(t)?fs(t)||Ja(e,t,n,s,r):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):su(e,t,s,i))?(Jo(e,t,s),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&zo(e,t,s,i,r,t!=="value")):e._isVueCE&&(ou(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Oe(s)))?Jo(e,Ye(t),s,r,t):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),zo(e,t,s,i))};function su(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&Yo(t)&&te(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return Yo(t)&&Oe(n)?!1:t in e}function ou(e,t){const n=e._def.props;if(!n)return!1;const s=Ye(t);return Array.isArray(n)?n.some(o=>Ye(o)===s):Object.keys(n).some(o=>Ye(o)===s)}const qt=e=>{const t=e.props["onUpdate:modelValue"]||!1;return X(t)?n=>Xn(t,n):t};function ru(e){e.target.composing=!0}function Xo(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const st=Symbol("_assign"),Jn=Symbol("_initialValue");function Ms(e,t,n){return t&&(e=e.trim()),n&&(e=hs(e)),e}const xe={created(e,{modifiers:{lazy:t,trim:n,number:s}},o){e.parentNode&&(e.type==="text"?e[Jn]=e.defaultValue.replace(/[\r\n]/g,""):e.type==="textarea"&&(e[Jn]=e.defaultValue.replace(/\r\n?/g,` +`))),e[st]=qt(o);const r=s||o.props&&o.props.type==="number";Pt(e,t?"change":"input",i=>{i.target.composing||e[st](Ms(e.value,n,r))}),(n||r)&&Pt(e,"change",()=>{e.value=Ms(e.value,n,r)}),t||(Pt(e,"compositionstart",ru),Pt(e,"compositionend",Xo),Pt(e,"change",Xo))},mounted(e,{value:t,modifiers:{trim:n,number:s}}){const o=t??"",r=e[Jn];delete e[Jn],r!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==r?e[st](Ms(e.value,n,s)):e.value=o},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:s,trim:o,number:r}},i){if(e[st]=qt(i),e.composing)return;const l=(r||e.type==="number")&&!/^0\d/.test(e.value)?hs(e.value):e.value,a=t??"";if(l===a)return;const d=e.getRootNode();(d instanceof Document||d instanceof ShadowRoot)&&d.activeElement===e&&e.type!=="range"&&(s&&t===n||o&&e.value.trim()===a)||(e.value=a)}},At={deep:!0,created(e,t,n){e[st]=qt(n),Pt(e,"change",()=>{const s=e._modelValue,o=hn(e),r=e.checked,i=e[st];if(X(s)){const l=oo(s,o),a=l!==-1;if(r&&!a)i(s.concat(o));else if(!r&&a){const d=[...s];d.splice(l,1),i(d)}}else if(vn(s)){const l=new Set(s);r?l.add(o):l.delete(o),i(l)}else i(ki(e,r))})},mounted:Zo,beforeUpdate(e,t,n){e[st]=qt(n),Zo(e,t,n)}};function Zo(e,{value:t,oldValue:n},s){e._modelValue=t;let o;if(X(t))o=oo(t,s.props.value)>-1;else if(vn(t))o=t.has(s.props.value);else{if(t===n)return;o=Kt(t,ki(e,!0))}e.checked!==o&&(e.checked=o)}const iu={created(e,{value:t},n){e.checked=Kt(t,n.props.value),e[st]=qt(n),Pt(e,"change",()=>{e[st](hn(e))})},beforeUpdate(e,{value:t,oldValue:n},s){e[st]=qt(s),t!==n&&(e.checked=Kt(t,s.props.value))}},Vn={deep:!0,created(e,{value:t,modifiers:{number:n}},s){e._modelValue=t,Pt(e,"change",()=>{const o=Array.prototype.filter.call(e.options,r=>r.selected).map(r=>n?hs(hn(r)):hn(r));e[st](e.multiple?vn(e._modelValue)?new Set(o):o:o[0]),e._assigning=!0,po(()=>{e._assigning=!1})}),e[st]=qt(s)},mounted(e,{value:t}){er(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[st]=qt(n)},updated(e,{value:t}){e._assigning||er(e,t)}};function er(e,t){const n=e.multiple,s=X(t);if(!(n&&!s&&!vn(t))){for(let o=0,r=e.options.length;o String(d)===String(l)):i.selected=oo(t,l)>-1}else i.selected=t.has(l);else if(Kt(hn(i),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function hn(e){return"_value"in e?e._value:e.value}function ki(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const lu=["ctrl","shift","alt","meta"],au={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>lu.some(n=>e[`${n}Key`]&&!t.includes(n))},ze=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=((o,...r)=>{for(let i=0;i {const t=cu().createApp(...e),{mount:n}=t;return t.mount=s=>{const o=pu(s);if(!o)return;const r=t._component;!te(r)&&!r.render&&!r.template&&(r.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const i=n(o,!1,du(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),i},t});function du(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function pu(e){return Oe(e)?document.querySelector(e):e}/*! + * vue-router v4.6.4 + * (c) 2025 Eduardo San Martin Morote + * @license MIT + */const sn=typeof document<"u";function Ri(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function hu(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Ri(e.default)}const he=Object.assign;function Vs(e,t){const n={};for(const s in t){const o=t[s];n[s]=pt(o)?o.map(e):e(o)}return n}const In=()=>{},pt=Array.isArray;function nr(e,t){const n={};for(const s in e)n[s]=s in t?t[s]:e[s];return n}const Ii=/#/g,mu=/&/g,gu=/\//g,vu=/=/g,bu=/\?/g,Pi=/\+/g,xu=/%5B/g,_u=/%5D/g,Oi=/%5E/g,yu=/%60/g,Ti=/%7B/g,wu=/%7C/g,$i=/%7D/g,Cu=/%20/g;function yo(e){return e==null?"":encodeURI(""+e).replace(wu,"|").replace(xu,"[").replace(_u,"]")}function Eu(e){return yo(e).replace(Ti,"{").replace($i,"}").replace(Oi,"^")}function Ys(e){return yo(e).replace(Pi,"%2B").replace(Cu,"+").replace(Ii,"%23").replace(mu,"%26").replace(yu,"`").replace(Ti,"{").replace($i,"}").replace(Oi,"^")}function Su(e){return Ys(e).replace(vu,"%3D")}function Au(e){return yo(e).replace(Ii,"%23").replace(bu,"%3F")}function ku(e){return Au(e).replace(gu,"%2F")}function jn(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Ru=/\/$/,Iu=e=>e.replace(Ru,"");function js(e,t,n="/"){let s,o={},r="",i="";const l=t.indexOf("#");let a=t.indexOf("?");return a=l>=0&&a>l?-1:a,a>=0&&(s=t.slice(0,a),r=t.slice(a,l>0?l:t.length),o=e(r.slice(1))),l>=0&&(s=s||t.slice(0,l),i=t.slice(l,t.length)),s=$u(s??t,n),{fullPath:s+r+i,path:s,query:o,hash:jn(i)}}function Pu(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function sr(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Ou(e,t,n){const s=t.matched.length-1,o=n.matched.length-1;return s>-1&&s===o&&mn(t.matched[s],n.matched[o])&&Ni(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function mn(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Ni(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Tu(e[n],t[n]))return!1;return!0}function Tu(e,t){return pt(e)?or(e,t):pt(t)?or(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function or(e,t){return pt(t)?e.length===t.length&&e.every((n,s)=>n===t[s]):e.length===1&&e[0]===t}function $u(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),s=e.split("/"),o=s[s.length-1];(o===".."||o===".")&&s.push("");let r=n.length-1,i,l;for(i=0;i 1&&r--;else break;return n.slice(0,r).join("/")+"/"+s.slice(i).join("/")}const Ut={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Xs=(function(e){return e.pop="pop",e.push="push",e})({}),Us=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Nu(e){if(!e)if(sn){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Iu(e)}const Du=/^[^#]+#/;function Mu(e,t){return e.replace(Du,"#")+t}function Vu(e,t){const n=document.documentElement.getBoundingClientRect(),s=e.getBoundingClientRect();return{behavior:t.behavior,left:s.left-n.left-(t.left||0),top:s.top-n.top-(t.top||0)}}const Es=()=>({left:window.scrollX,top:window.scrollY});function ju(e){let t;if("el"in e){const n=e.el,s=typeof n=="string"&&n.startsWith("#"),o=typeof n=="string"?s?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!o)return;t=Vu(o,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function rr(e,t){return(history.state?history.state.position-t:-1)+e}const Zs=new Map;function Uu(e,t){Zs.set(e,t)}function Lu(e){const t=Zs.get(e);return Zs.delete(e),t}function Fu(e){return typeof e=="string"||e&&typeof e=="object"}function Di(e){return typeof e=="string"||typeof e=="symbol"}let Re=(function(e){return e[e.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",e[e.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",e[e.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",e[e.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",e[e.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",e})({});const Mi=Symbol("");Re.MATCHER_NOT_FOUND+"",Re.NAVIGATION_GUARD_REDIRECT+"",Re.NAVIGATION_ABORTED+"",Re.NAVIGATION_CANCELLED+"",Re.NAVIGATION_DUPLICATED+"";function gn(e,t){return he(new Error,{type:e,[Mi]:!0},t)}function Et(e,t){return e instanceof Error&&Mi in e&&(t==null||!!(e.type&t))}const Hu=["params","query","hash"];function Bu(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Hu)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Ku(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let s=0;s o&&Ys(o)):[s&&Ys(s)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+n,o!=null&&(t+="="+o))})}return t}function qu(e){const t={};for(const n in e){const s=e[n];s!==void 0&&(t[n]=pt(s)?s.map(o=>o==null?null:""+o):s==null?s:""+s)}return t}const Gu=Symbol(""),lr=Symbol(""),Ss=Symbol(""),wo=Symbol(""),eo=Symbol("");function _n(){let e=[];function t(s){return e.push(s),()=>{const o=e.indexOf(s);o>-1&&e.splice(o,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Ft(e,t,n,s,o,r=i=>i()){const i=s&&(s.enterCallbacks[o]=s.enterCallbacks[o]||[]);return()=>new Promise((l,a)=>{const d=g=>{g===!1?a(gn(Re.NAVIGATION_ABORTED,{from:n,to:t})):g instanceof Error?a(g):Fu(g)?a(gn(Re.NAVIGATION_GUARD_REDIRECT,{from:t,to:g})):(i&&s.enterCallbacks[o]===i&&typeof g=="function"&&i.push(g),l())},c=r(()=>e.call(s&&s.instances[o],t,n,d));let h=Promise.resolve(c);e.length<3&&(h=h.then(d)),h.catch(g=>a(g))})}function Ls(e,t,n,s,o=r=>r()){const r=[];for(const i of e)for(const l in i.components){let a=i.components[l];if(!(t!=="beforeRouteEnter"&&!i.instances[l]))if(Ri(a)){const d=(a.__vccOpts||a)[t];d&&r.push(Ft(d,n,s,i,l,o))}else{let d=a();r.push(()=>d.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${l}" at "${i.path}"`);const h=hu(c)?c.default:c;i.mods[l]=c,i.components[l]=h;const g=(h.__vccOpts||h)[t];return g&&Ft(g,n,s,i,l,o)()}))}}return r}function Wu(e,t){const n=[],s=[],o=[],r=Math.max(t.matched.length,e.matched.length);for(let i=0;i mn(d,l))?s.push(l):n.push(l));const a=e.matched[i];a&&(t.matched.find(d=>mn(d,a))||o.push(a))}return[n,s,o]}/*! + * vue-router v4.6.4 + * (c) 2025 Eduardo San Martin Morote + * @license MIT + */let zu=()=>location.protocol+"//"+location.host;function Vi(e,t){const{pathname:n,search:s,hash:o}=t,r=e.indexOf("#");if(r>-1){let i=o.includes(e.slice(r))?e.slice(r).length:1,l=o.slice(i);return l[0]!=="/"&&(l="/"+l),sr(l,"")}return sr(n,e)+s+o}function Ju(e,t,n,s){let o=[],r=[],i=null;const l=({state:g})=>{const x=Vi(e,location),j=n.value,O=t.value;let W=0;if(g){if(n.value=x,t.value=g,i&&i===j){i=null;return}W=O?g.position-O.position:0}else s(x);o.forEach(K=>{K(n.value,j,{delta:W,type:Xs.pop,direction:W?W>0?Us.forward:Us.back:Us.unknown})})};function a(){i=n.value}function d(g){o.push(g);const x=()=>{const j=o.indexOf(g);j>-1&&o.splice(j,1)};return r.push(x),x}function c(){if(document.visibilityState==="hidden"){const{history:g}=window;if(!g.state)return;g.replaceState(he({},g.state,{scroll:Es()}),"")}}function h(){for(const g of r)g();r=[],window.removeEventListener("popstate",l),window.removeEventListener("pagehide",c),document.removeEventListener("visibilitychange",c)}return window.addEventListener("popstate",l),window.addEventListener("pagehide",c),document.addEventListener("visibilitychange",c),{pauseListeners:a,listen:d,destroy:h}}function ar(e,t,n,s=!1,o=!1){return{back:e,current:t,forward:n,replaced:s,position:window.history.length,scroll:o?Es():null}}function Qu(e){const{history:t,location:n}=window,s={value:Vi(e,n)},o={value:t.state};o.value||r(s.value,{back:null,current:s.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function r(a,d,c){const h=e.indexOf("#"),g=h>-1?(n.host&&document.querySelector("base")?e:e.slice(h))+a:zu()+e+a;try{t[c?"replaceState":"pushState"](d,"",g),o.value=d}catch(x){console.error(x),n[c?"replace":"assign"](g)}}function i(a,d){r(a,he({},t.state,ar(o.value.back,a,o.value.forward,!0),d,{position:o.value.position}),!0),s.value=a}function l(a,d){const c=he({},o.value,t.state,{forward:a,scroll:Es()});r(c.current,c,!0),r(a,he({},ar(s.value,a,null),{position:c.position+1},d),!1),s.value=a}return{location:s,state:o,push:l,replace:i}}function Yu(e){e=Nu(e);const t=Qu(e),n=Ju(e,t.state,t.location,t.replace);function s(r,i=!0){i||n.pauseListeners(),history.go(r)}const o=he({location:"",base:e,go:s,createHref:Mu.bind(null,e)},t,n);return Object.defineProperty(o,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(o,"state",{enumerable:!0,get:()=>t.state.value}),o}let Qt=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var Ne=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.ParamRegExp=2]="ParamRegExp",e[e.ParamRegExpEnd=3]="ParamRegExpEnd",e[e.EscapeNext=4]="EscapeNext",e})(Ne||{});const Xu={type:Qt.Static,value:""},Zu=/[a-zA-Z0-9_]/;function ec(e){if(!e)return[[]];if(e==="/")return[[Xu]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(x){throw new Error(`ERR (${n})/"${d}": ${x}`)}let n=Ne.Static,s=n;const o=[];let r;function i(){r&&o.push(r),r=[]}let l=0,a,d="",c="";function h(){d&&(n===Ne.Static?r.push({type:Qt.Static,value:d}):n===Ne.Param||n===Ne.ParamRegExp||n===Ne.ParamRegExpEnd?(r.length>1&&(a==="*"||a==="+")&&t(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),r.push({type:Qt.Param,value:d,regexp:c,repeatable:a==="*"||a==="+",optional:a==="*"||a==="?"})):t("Invalid state to consume buffer"),d="")}function g(){d+=a}for(;l t.length?t.length===1&&t[0]===We.Static+We.Segment?1:-1:0}function ji(e,t){let n=0;const s=e.score,o=t.score;for(;n 0&&t[t.length-1]<0}const rc={strict:!1,end:!0,sensitive:!1};function ic(e,t,n){const s=sc(ec(e.path),n),o=he(s,{record:e,parent:t,children:[],alias:[]});return t&&!o.record.aliasOf==!t.record.aliasOf&&t.children.push(o),o}function lc(e,t){const n=[],s=new Map;t=nr(rc,t);function o(h){return s.get(h)}function r(h,g,x){const j=!x,O=dr(h);O.aliasOf=x&&x.record;const W=nr(t,h),K=[O];if("alias"in h){const I=typeof h.alias=="string"?[h.alias]:h.alias;for(const A of I)K.push(dr(he({},O,{components:x?x.record.components:O.components,path:A,aliasOf:x?x.record:O})))}let D,q;for(const I of K){const{path:A}=I;if(g&&A[0]!=="/"){const M=g.record.path,ne=M[M.length-1]==="/"?"":"/";I.path=g.record.path+(A&&ne+A)}if(D=ic(I,g,W),x?x.alias.push(D):(q=q||D,q!==D&&q.alias.push(D),j&&h.name&&!pr(D)&&i(h.name)),Ui(D)&&a(D),O.children){const M=O.children;for(let ne=0;ne {i(q)}:In}function i(h){if(Di(h)){const g=s.get(h);g&&(s.delete(h),n.splice(n.indexOf(g),1),g.children.forEach(i),g.alias.forEach(i))}else{const g=n.indexOf(h);g>-1&&(n.splice(g,1),h.record.name&&s.delete(h.record.name),h.children.forEach(i),h.alias.forEach(i))}}function l(){return n}function a(h){const g=cc(h,n);n.splice(g,0,h),h.record.name&&!pr(h)&&s.set(h.record.name,h)}function d(h,g){let x,j={},O,W;if("name"in h&&h.name){if(x=s.get(h.name),!x)throw gn(Re.MATCHER_NOT_FOUND,{location:h});W=x.record.name,j=he(fr(g.params,x.keys.filter(q=>!q.optional).concat(x.parent?x.parent.keys.filter(q=>q.optional):[]).map(q=>q.name)),h.params&&fr(h.params,x.keys.map(q=>q.name))),O=x.stringify(j)}else if(h.path!=null)O=h.path,x=n.find(q=>q.re.test(O)),x&&(j=x.parse(O),W=x.record.name);else{if(x=g.name?s.get(g.name):n.find(q=>q.re.test(g.path)),!x)throw gn(Re.MATCHER_NOT_FOUND,{location:h,currentLocation:g});W=x.record.name,j=he({},g.params,h.params),O=x.stringify(j)}const K=[];let D=x;for(;D;)K.unshift(D.record),D=D.parent;return{name:W,path:O,params:j,matched:K,meta:uc(K)}}e.forEach(h=>r(h));function c(){n.length=0,s.clear()}return{addRoute:r,resolve:d,removeRoute:i,clearRoutes:c,getRoutes:l,getRecordMatcher:o}}function fr(e,t){const n={};for(const s of t)s in e&&(n[s]=e[s]);return n}function dr(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:ac(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,"mods",{value:{}}),t}function ac(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const s in e.components)t[s]=typeof n=="object"?n[s]:n;return t}function pr(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function uc(e){return e.reduce((t,n)=>he(t,n.meta),{})}function cc(e,t){let n=0,s=t.length;for(;n!==s;){const r=n+s>>1;ji(e,t[r])<0?s=r:n=r+1}const o=fc(e);return o&&(s=t.lastIndexOf(o,s-1)),s}function fc(e){let t=e;for(;t=t.parent;)if(Ui(t)&&ji(e,t)===0)return t}function Ui({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function hr(e){const t=ut(Ss),n=ut(wo),s=ye(()=>{const a=De(e.to);return t.resolve(a)}),o=ye(()=>{const{matched:a}=s.value,{length:d}=a,c=a[d-1],h=n.matched;if(!c||!h.length)return-1;const g=h.findIndex(mn.bind(null,c));if(g>-1)return g;const x=mr(a[d-2]);return d>1&&mr(c)===x&&h[h.length-1].path!==x?h.findIndex(mn.bind(null,a[d-2])):g}),r=ye(()=>o.value>-1&&gc(n.params,s.value.params)),i=ye(()=>o.value>-1&&o.value===n.matched.length-1&&Ni(n.params,s.value.params));function l(a={}){if(mc(a)){const d=t[De(e.replace)?"replace":"push"](De(e.to)).catch(In);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>d),d}return Promise.resolve()}return{route:s,href:ye(()=>s.value.href),isActive:r,isExactActive:i,navigate:l}}function dc(e){return e.length===1?e[0]:e}const pc=Xr({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:hr,setup(e,{slots:t}){const n=vs(hr(e)),{options:s}=ut(Ss),o=ye(()=>({[gr(e.activeClass,s.linkActiveClass,"router-link-active")]:n.isActive,[gr(e.exactActiveClass,s.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const r=t.default&&dc(t.default(n));return e.custom?r:Si("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:o.value},r)}}}),hc=pc;function mc(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function gc(e,t){for(const n in t){const s=t[n],o=e[n];if(typeof s=="string"){if(s!==o)return!1}else if(!pt(o)||o.length!==s.length||s.some((r,i)=>r.valueOf()!==o[i].valueOf()))return!1}return!0}function mr(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const gr=(e,t,n)=>e??t??n,vc=Xr({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const s=ut(eo),o=ye(()=>e.route||s.value),r=ut(lr,0),i=ye(()=>{let d=De(r);const{matched:c}=o.value;let h;for(;(h=c[d])&&!h.components;)d++;return d}),l=ye(()=>o.value.matched[i.value]);Zn(lr,ye(()=>i.value+1)),Zn(Gu,l),Zn(eo,o);const a=z();return Bt(()=>[a.value,l.value,e.name],([d,c,h],[g,x,j])=>{c&&(c.instances[h]=d,x&&x!==c&&d&&d===g&&(c.leaveGuards.size||(c.leaveGuards=x.leaveGuards),c.updateGuards.size||(c.updateGuards=x.updateGuards))),d&&c&&(!x||!mn(c,x)||!g)&&(c.enterCallbacks[h]||[]).forEach(O=>O(d))},{flush:"post"}),()=>{const d=o.value,c=e.name,h=l.value,g=h&&h.components[c];if(!g)return vr(n.default,{Component:g,route:d});const x=h.props[c],j=x?x===!0?d.params:typeof x=="function"?x(d):x:null,W=Si(g,he({},j,t,{onVnodeUnmounted:K=>{K.component.isUnmounted&&(h.instances[c]=null)},ref:a}));return vr(n.default,{Component:W,route:d})||W}}});function vr(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const bc=vc;function xc(e){const t=lc(e.routes,e),n=e.parseQuery||Ku,s=e.stringifyQuery||ir,o=e.history,r=_n(),i=_n(),l=_n(),a=yl(Ut);let d=Ut;sn&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=Vs.bind(null,C=>""+C),h=Vs.bind(null,ku),g=Vs.bind(null,jn);function x(C,B){let U,T;return Di(C)?(U=t.getRecordMatcher(C),T=B):T=C,t.addRoute(T,U)}function j(C){const B=t.getRecordMatcher(C);B&&t.removeRoute(B)}function O(){return t.getRoutes().map(C=>C.record)}function W(C){return!!t.getRecordMatcher(C)}function K(C,B){if(B=he({},B||a.value),typeof C=="string"){const m=js(n,C,B.path),y=t.resolve({path:m.path},B),S=o.createHref(m.fullPath);return he(m,y,{params:g(y.params),hash:jn(m.hash),redirectedFrom:void 0,href:S})}let U;if(C.path!=null)U=he({},C,{path:js(n,C.path,B.path).path});else{const m=he({},C.params);for(const y in m)m[y]==null&&delete m[y];U=he({},C,{params:h(m)}),B.params=h(B.params)}const T=t.resolve(U,B),re=C.hash||"";T.params=c(g(T.params));const f=Pu(s,he({},C,{hash:Eu(re),path:T.path})),p=o.createHref(f);return he({fullPath:f,hash:re,query:s===ir?qu(C.query):C.query||{}},T,{redirectedFrom:void 0,href:p})}function D(C){return typeof C=="string"?js(n,C,a.value.path):he({},C)}function q(C,B){if(d!==C)return gn(Re.NAVIGATION_CANCELLED,{from:B,to:C})}function I(C){return ne(C)}function A(C){return I(he(D(C),{replace:!0}))}function M(C,B){const U=C.matched[C.matched.length-1];if(U&&U.redirect){const{redirect:T}=U;let re=typeof T=="function"?T(C,B):T;return typeof re=="string"&&(re=re.includes("?")||re.includes("#")?re=D(re):{path:re},re.params={}),he({query:C.query,hash:C.hash,params:re.path!=null?{}:C.params},re)}}function ne(C,B){const U=d=K(C),T=a.value,re=C.state,f=C.force,p=C.replace===!0,m=M(U,T);if(m)return ne(he(D(m),{state:typeof m=="object"?he({},re,m.state):re,force:f,replace:p}),B||U);const y=U;y.redirectedFrom=B;let S;return!f&&Ou(s,T,U)&&(S=gn(Re.NAVIGATION_DUPLICATED,{to:y,from:T}),Ze(T,T,!0,!1)),(S?Promise.resolve(S):Z(y,T)).catch(_=>Et(_)?Et(_,Re.NAVIGATION_GUARD_REDIRECT)?_:lt(_):ae(_,y,T)).then(_=>{if(_){if(Et(_,Re.NAVIGATION_GUARD_REDIRECT))return ne(he({replace:p},D(_.to),{state:typeof _.to=="object"?he({},re,_.to.state):re,force:f}),B||y)}else _=Te(y,T,!0,p,re);return V(y,T,_),_})}function F(C,B){const U=q(C,B);return U?Promise.reject(U):Promise.resolve()}function Ae(C){const B=jt.values().next().value;return B&&typeof B.runWithContext=="function"?B.runWithContext(C):C()}function Z(C,B){let U;const[T,re,f]=Wu(C,B);U=Ls(T.reverse(),"beforeRouteLeave",C,B);for(const m of T)m.leaveGuards.forEach(y=>{U.push(Ft(y,C,B))});const p=F.bind(null,C,B);return U.push(p),et(U).then(()=>{U=[];for(const m of r.list())U.push(Ft(m,C,B));return U.push(p),et(U)}).then(()=>{U=Ls(re,"beforeRouteUpdate",C,B);for(const m of re)m.updateGuards.forEach(y=>{U.push(Ft(y,C,B))});return U.push(p),et(U)}).then(()=>{U=[];for(const m of f)if(m.beforeEnter)if(pt(m.beforeEnter))for(const y of m.beforeEnter)U.push(Ft(y,C,B));else U.push(Ft(m.beforeEnter,C,B));return U.push(p),et(U)}).then(()=>(C.matched.forEach(m=>m.enterCallbacks={}),U=Ls(f,"beforeRouteEnter",C,B,Ae),U.push(p),et(U))).then(()=>{U=[];for(const m of i.list())U.push(Ft(m,C,B));return U.push(p),et(U)}).catch(m=>Et(m,Re.NAVIGATION_CANCELLED)?m:Promise.reject(m))}function V(C,B,U){l.list().forEach(T=>Ae(()=>T(C,B,U)))}function Te(C,B,U,T,re){const f=q(C,B);if(f)return f;const p=B===Ut,m=sn?history.state:{};U&&(T||p?o.replace(C.fullPath,he({scroll:p&&m&&m.scroll},re)):o.push(C.fullPath,re)),a.value=C,Ze(C,B,U,p),lt()}let G;function Xe(){G||(G=o.listen((C,B,U)=>{if(!yt.listening)return;const T=K(C),re=M(T,yt.currentRoute.value);if(re){ne(he(re,{replace:!0,force:!0}),T).catch(In);return}d=T;const f=a.value;sn&&Uu(rr(f.fullPath,U.delta),Es()),Z(T,f).catch(p=>Et(p,Re.NAVIGATION_ABORTED|Re.NAVIGATION_CANCELLED)?p:Et(p,Re.NAVIGATION_GUARD_REDIRECT)?(ne(he(D(p.to),{force:!0}),T).then(m=>{Et(m,Re.NAVIGATION_ABORTED|Re.NAVIGATION_DUPLICATED)&&!U.delta&&U.type===Xs.pop&&o.go(-1,!1)}).catch(In),Promise.reject()):(U.delta&&o.go(-U.delta,!1),ae(p,T,f))).then(p=>{p=p||Te(T,f,!1),p&&(U.delta&&!Et(p,Re.NAVIGATION_CANCELLED)?o.go(-U.delta,!1):U.type===Xs.pop&&Et(p,Re.NAVIGATION_ABORTED|Re.NAVIGATION_DUPLICATED)&&o.go(-1,!1)),V(T,f,p)}).catch(In)}))}let Mt=_n(),Ce=_n(),ce;function ae(C,B,U){lt(C);const T=Ce.list();return T.length?T.forEach(re=>re(C,B,U)):console.error(C),Promise.reject(C)}function oe(){return ce&&a.value!==Ut?Promise.resolve():new Promise((C,B)=>{Mt.add([C,B])})}function lt(C){return ce||(ce=!C,Xe(),Mt.list().forEach(([B,U])=>C?U(C):B()),Mt.reset()),C}function Ze(C,B,U,T){const{scrollBehavior:re}=e;if(!sn||!re)return Promise.resolve();const f=!U&&Lu(rr(C.fullPath,0))||(T||!U)&&history.state&&history.state.scroll||null;return po().then(()=>re(C,B,f)).then(p=>p&&ju(p)).catch(p=>ae(p,C,B))}const Le=C=>o.go(C);let Vt;const jt=new Set,yt={currentRoute:a,listening:!0,addRoute:x,removeRoute:j,clearRoutes:t.clearRoutes,hasRoute:W,getRoutes:O,resolve:K,options:e,push:I,replace:A,go:Le,back:()=>Le(-1),forward:()=>Le(1),beforeEach:r.add,beforeResolve:i.add,afterEach:l.add,onError:Ce.add,isReady:oe,install(C){C.component("RouterLink",hc),C.component("RouterView",bc),C.config.globalProperties.$router=yt,Object.defineProperty(C.config.globalProperties,"$route",{enumerable:!0,get:()=>De(a)}),sn&&!Vt&&a.value===Ut&&(Vt=!0,I(o.location).catch(T=>{}));const B={};for(const T in Ut)Object.defineProperty(B,T,{get:()=>a.value[T],enumerable:!0});C.provide(Ss,yt),C.provide(wo,Fr(B)),C.provide(eo,a);const U=C.unmount;jt.add(C),C.unmount=function(){jt.delete(C),jt.size<1&&(d=Ut,G&&G(),G=null,a.value=Ut,Vt=!1,ce=!1),U()}}};function et(C){return C.reduce((B,U)=>B.then(()=>Ae(U)),Promise.resolve())}return yt}function Co(){return ut(Ss)}function Li(e){return ut(wo)}const Qn=window.location.pathname.startsWith("/portal/"),Qe={esPortal:Qn,baseRuta:Qn?"/portal/studio/":"/studio/",apiBase:Qn?"/portal":"/app",urlLogin:Qn?"/portal/login":"/login"};function ie(e){return Qe.apiBase+e}async function Yn(e,t={}){const n=await fetch(e,{...t,headers:{"Content-Type":"application/json",...t.headers}}),s=n.headers.get("content-type")||"";if(n.redirected||!s.includes("application/json"))throw window.location.href=Qe.urlLogin,new Error("Sesión expirada");const o=await n.json();if(!n.ok){const r=typeof(o==null?void 0:o.error)=="string"?o.error:o==null?void 0:o.message;throw new Error(r||"Error de servidor")}return o}const le={get:e=>Yn(e),post:(e,t)=>Yn(e,{method:"POST",body:JSON.stringify(t)}),put:(e,t)=>Yn(e,{method:"PUT",body:JSON.stringify(t)}),del:e=>Yn(e,{method:"DELETE"})},Cn=z(!1),_c={class:"h-14 px-4 flex items-center gap-2 border-b border-borde"},yc={key:0,class:"px-3 pt-3"},wc={key:1,class:"px-3 pt-2 text-xs text-red-600 dark:text-red-400"},Cc={class:"flex-1 overflow-y-auto px-2 py-3 space-y-0.5"},Ec={key:0,class:"px-2 text-xs text-tenue"},Sc={key:1,class:"px-2 text-xs text-tenue"},Ac={class:"truncate"},kc={class:"flex items-center gap-1 mt-0.5"},Rc={class:"text-[11px] text-tenue"},Ic={key:0,class:"flex opacity-0 group-hover:opacity-100 transition-opacity pr-1.5 gap-0.5"},Pc=["onClick"],Oc=["onClick"],Tc={class:"card w-full max-w-lg p-6 animate-escalar shadow-2xl"},$c={class:"font-semibold text-texto mb-4"},Nc={key:0,class:"grid grid-cols-2 gap-3"},Dc=["value"],Mc={class:"text-[11px] text-tenue mt-1"},Vc=["value"],jc={class:"text-[11px] text-tenue mt-1"},Uc={class:"flex items-center gap-2 text-sm text-texto"},Lc={class:"flex justify-end gap-2 pt-2"},Fc={__name:"Sidebar",setup(e,{expose:t}){const n=Li(),s=Co(),o=z([]),r=z([]),i=z([]),l=z(!0),a=z(""),d=z(!1),c=z(null),h=z(x()),g=ye(()=>n.params.tenantId||n.params.id);Bt(()=>n.fullPath,()=>{Cn.value=!1});function x(){return{nombre:"",dominios_permitidos:"",activo:!0,cliente_id:null,plan_id:null}}async function j(){l.value=!0,a.value="";try{const A=await le.get(ie("/umind/tenants"));o.value=A.items||[]}catch(A){a.value=A.message}finally{l.value=!1}}function O(A){return Array.isArray(A)?A:(A==null?void 0:A.items)||(A==null?void 0:A.registros)||[]}async function W(){if(Qe.esPortal)return;const[A,M]=await Promise.allSettled([le.get("/app/api/clientes/select"),le.get("/app/umind-planes/list")]);r.value=A.status==="fulfilled"?O(A.value):[],i.value=M.status==="fulfilled"?O(M.value):[];const ne=[];A.status==="rejected"&&ne.push("clientes"),M.status==="rejected"&&ne.push("planes"),ne.length&&(a.value=`No se pudo cargar la lista de ${ne.join(" ni ")}.`)}function K(){c.value=null,h.value=x(),d.value=!0}function D(A){c.value=A,h.value={nombre:A.nombre,dominios_permitidos:A.dominios_permitidos,activo:A.activo,cliente_id:A.cliente_id??null,plan_id:A.plan_id??null},d.value=!0}async function q(){const A={...h.value,dominios_permitidos:h.value.dominios_permitidos.split(",").map(M=>M.trim()).filter(Boolean)};try{if(c.value)await le.put(ie(`/umind/tenants/${c.value.ID}`),A),d.value=!1,await j();else{const M=await le.post(ie("/umind/tenants"),A);d.value=!1,await j(),s.push(`/tenants/${M.id}`)}}catch(M){a.value=M.message}}async function I(A){confirm(`¿Eliminar el tenant "${A.nombre}"? Esto borra también sus agentes. No se puede deshacer.`)&&(await le.del(ie(`/umind/tenants/${A.ID}`)),g.value===String(A.ID)&&s.push("/"),await j())}return t({recargar:j}),vo(()=>{j(),W()}),(A,M)=>{const ne=Fn("router-link");return w(),E(fe,null,[De(Cn)?(w(),E("div",{key:0,class:"fixed inset-0 bg-black/50 z-30 md:hidden",onClick:M[0]||(M[0]=F=>Cn.value=!1)})):ee("",!0),u("aside",{class:Ie(["w-64 shrink-0 flex flex-col border-r border-borde bg-superficie fixed inset-y-0 left-0 z-40 transition-transform duration-200 md:static md:h-screen md:sticky md:top-0 md:translate-x-0",De(Cn)?"translate-x-0":"-translate-x-full"])},[u("div",_c,[Pe(ne,{to:"/",class:"flex items-center gap-2 text-base font-semibold text-texto"},{default:Ht(()=>[...M[8]||(M[8]=[u("svg",{viewBox:"0 0 96 96",class:"w-6 h-6 shrink-0","aria-hidden":"true"},[u("rect",{width:"96",height:"96",rx:"22",fill:"#8eb02f"}),u("path",{d:"M32,42 V58 A14,14 0 0 0 60,58 V42",fill:"none",stroke:"#fff","stroke-width":"10","stroke-linecap":"round","stroke-linejoin":"round"}),u("path",{d:"M60,58 V64",fill:"none",stroke:"#fff","stroke-width":"10","stroke-linecap":"round"}),u("circle",{cx:"60",cy:"28",r:"7",fill:"#fff"})],-1),u("span",null,[we("uMind "),u("span",{class:"text-brand"},"Studio")],-1)])]),_:1})]),De(Qe).esPortal?ee("",!0):(w(),E("div",yc,[u("button",{class:"btn-primary w-full",onClick:K}," + Nuevo tenant ")])),a.value?(w(),E("p",wc,P(a.value),1)):ee("",!0),u("nav",Cc,[l.value?(w(),E("p",Ec,"Cargando...")):o.value.length===0?(w(),E("p",Sc,P(De(Qe).esPortal?"Todavía no tenés ningún espacio asignado. Escribinos y lo activamos.":"Sin tenants todavía."),1)):ee("",!0),(w(!0),E(fe,null,$e(o.value,F=>(w(),E("div",{key:F.ID,class:Ie(["group flex items-center rounded-lg transition-colors",g.value===String(F.ID)?"bg-brand/10":"hover:bg-elevado"])},[Pe(ne,{to:`/tenants/${F.ID}`,class:Ie(["flex-1 min-w-0 px-2.5 py-2 text-sm",g.value===String(F.ID)?"text-brand font-medium":"text-texto"])},{default:Ht(()=>[u("div",Ac,P(F.nombre),1),u("div",kc,[u("span",{class:Ie(["w-1.5 h-1.5 rounded-full",F.activo?"bg-green-500":"bg-tenue/40"])},null,2),u("span",Rc,P(F.activo?"activo":"inactivo"),1)])]),_:2},1032,["to","class"]),De(Qe).esPortal?ee("",!0):(w(),E("div",Ic,[u("button",{class:"p-1 text-tenue hover:text-texto",title:"Editar",onClick:Ae=>D(F)}," ✎ ",8,Pc),u("button",{class:"p-1 text-tenue hover:text-red-600",title:"Eliminar",onClick:Ae=>I(F)}," ✕ ",8,Oc)]))],2))),128))])],2),d.value?(w(),E("div",{key:1,class:"fixed inset-0 bg-black/40 flex items-center justify-center p-4 z-50",onClick:M[7]||(M[7]=ze(F=>d.value=!1,["self"]))},[u("div",Tc,[u("h2",$c,P(c.value?"Editar tenant":"Nuevo tenant"),1),M[17]||(M[17]=u("p",{class:"text-xs text-tenue mb-3"}," Un tenant es el negocio/sitio dueño de los dominios permitidos. La config de IA, tono y demás se configuran por agente, dentro del tenant. ",-1)),u("form",{class:"space-y-3",onSubmit:ze(q,["prevent"])},[u("div",null,[M[9]||(M[9]=u("label",{class:"label"},"Nombre",-1)),se(u("input",{"onUpdate:modelValue":M[1]||(M[1]=F=>h.value.nombre=F),required:"",class:"input"},null,512),[[xe,h.value.nombre]])]),u("div",null,[M[10]||(M[10]=u("label",{class:"label"},"Dominios permitidos (separados por coma)",-1)),se(u("input",{"onUpdate:modelValue":M[2]||(M[2]=F=>h.value.dominios_permitidos=F),placeholder:"ejemplo.com, www.ejemplo.com",required:"",class:"input"},null,512),[[xe,h.value.dominios_permitidos]])]),De(Qe).esPortal?ee("",!0):(w(),E("div",Nc,[u("div",null,[M[12]||(M[12]=u("label",{class:"label"},"Cliente",-1)),se(u("select",{"onUpdate:modelValue":M[3]||(M[3]=F=>h.value.cliente_id=F),class:"input"},[M[11]||(M[11]=u("option",{value:null},"— sin asignar —",-1)),(w(!0),E(fe,null,$e(r.value,F=>(w(),E("option",{key:F.ID,value:F.ID},P(F.nombre),9,Dc))),128))],512),[[Vn,h.value.cliente_id]]),u("p",Mc,P(r.value.length?"Define quién ve este tenant desde el portal.":"No hay clientes activos — creá uno en Clientes."),1)]),u("div",null,[M[14]||(M[14]=u("label",{class:"label"},"Plan",-1)),se(u("select",{"onUpdate:modelValue":M[4]||(M[4]=F=>h.value.plan_id=F),class:"input"},[M[13]||(M[13]=u("option",{value:null},"— sin plan —",-1)),(w(!0),E(fe,null,$e(i.value,F=>(w(),E("option",{key:F.ID,value:F.ID},P(F.nombre)+" ("+P(F.max_agentes===0?"∞":F.max_agentes)+" agentes) ",9,Vc))),128))],512),[[Vn,h.value.plan_id]]),u("p",jc,P(i.value.length?"Límite de agentes y precios de consumo.":"No hay planes — creá uno en uMind Planes."),1)])])),u("label",Uc,[se(u("input",{"onUpdate:modelValue":M[5]||(M[5]=F=>h.value.activo=F),type:"checkbox"},null,512),[[At,h.value.activo]]),M[15]||(M[15]=we(" Activo ",-1))]),u("div",Lc,[u("button",{type:"button",class:"btn-ghost",onClick:M[6]||(M[6]=F=>d.value=!1)}," Cancelar "),M[16]||(M[16]=u("button",{type:"submit",class:"btn-primary"}," Guardar ",-1))])],32)])])):ee("",!0)],64)}}},Fi="umind-tema";function Hc(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"oscuro":"claro"}const cn=z(localStorage.getItem(Fi)||Hc());function Hi(){document.documentElement.classList.toggle("dark",cn.value==="oscuro")}function br(){cn.value=cn.value==="oscuro"?"claro":"oscuro",localStorage.setItem(Fi,cn.value),Hi()}Hi();const Bc={class:"min-h-screen flex"},Kc={class:"flex-1 min-w-0 flex flex-col"},qc={class:"h-14 shrink-0 flex items-center gap-1 px-4 sm:px-6 border-b border-borde"},Gc=["title"],Wc={class:"text-base leading-none"},zc={class:"flex-1 max-w-5xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-6 sm:py-8 animate-aparecer"},Jc={__name:"App",setup(e){return(t,n)=>{const s=Fn("router-view");return w(),E("div",Bc,[Pe(Fc),u("main",Kc,[u("header",qc,[u("button",{class:"btn-ghost !px-2 !py-1.5 md:hidden","aria-label":"Abrir menú",onClick:n[0]||(n[0]=o=>Cn.value=!0)},[...n[2]||(n[2]=[u("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor","stroke-width":"2",viewBox:"0 0 24 24"},[u("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4 6h16M4 12h16M4 18h16"})],-1)])]),n[3]||(n[3]=u("span",{class:"flex-1"},null,-1)),u("button",{class:"btn-ghost !px-2.5 !py-1.5",title:De(cn)==="oscuro"?"Cambiar a claro":"Cambiar a oscuro",onClick:n[1]||(n[1]=(...o)=>De(br)&&De(br)(...o))},[u("span",Wc,P(De(cn)==="oscuro"?"☀️":"🌙"),1)],8,Gc)]),u("div",zc,[Pe(s)])])])}}},Qc={key:0,class:"flex flex-col items-center justify-center py-24 text-sm text-tenue"},Yc={key:1,class:"max-w-md mx-auto text-center py-20"},Xc={key:2,class:"flex flex-col items-center justify-center text-center py-24"},Zc={class:"text-lg font-medium text-texto"},ef={class:"text-sm text-tenue mt-1"},tf={__name:"Home",setup(e){const t=Co(),n=z(Qe.esPortal),s=z(!1);async function o(){if(Qe.esPortal)try{const i=(await le.get(ie("/umind/tenants"))).items||[];if(i.length===0){s.value=!0;return}if(i.length!==1)return;const l=i[0].ID,d=(await le.get(ie(`/umind/agentes?tenant_id=${l}`))).items||[];if(d.length===1){t.replace(`/tenants/${l}/agentes/${d[0].ID}`);return}t.replace(`/tenants/${l}`)}catch{}finally{n.value=!1}}return vo(o),(r,i)=>n.value?(w(),E("div",Qc," Abriendo tu asistente… ")):s.value?(w(),E("div",Yc,[...i[0]||(i[0]=[wi(' 🤖Todavía no tenés un asistente activo
uMind contesta por vos en WhatsApp y en tu sitio, con la información de tu negocio. Entiende las notas de voz y lee las fotos y archivos que te mandan tus clientes.
Quiero activarlo',5)])])):(w(),E("div",Xc,[i[1]||(i[1]=u("div",{class:"text-4xl mb-4"},"💬",-1)),u("h1",Zc,P(De(Qe).esPortal?"Elegí tu espacio de la izquierda":"Elegí un tenant de la izquierda"),1),u("p",ef,P(De(Qe).esPortal?"Adentro vas a poder crear y configurar tus agentes.":"o creá uno nuevo para empezar a configurar su agente."),1)]))}},nf={class:"flex flex-col items-center justify-center text-center py-12 px-6"},sf={key:0,class:"text-3xl mb-3 opacity-70"},of={class:"text-sm font-medium text-texto"},rf={key:1,class:"text-xs text-tenue mt-1 max-w-sm"},lf={class:"mt-4"},Bi={__name:"UiEmptyState",props:{icono:{type:String,default:""},titulo:String,detalle:String},setup(e){return(t,n)=>(w(),E("div",nf,[e.icono?(w(),E("div",sf,P(e.icono),1)):ee("",!0),u("p",of,P(e.titulo),1),e.detalle?(w(),E("p",rf,P(e.detalle),1)):ee("",!0),u("div",lf,[Ql(t.$slots,"default")])]))}},af={key:0,class:"mb-6"},uf={class:"flex items-start justify-between gap-4"},cf={class:"text-xl font-semibold text-texto"},ff={class:"text-xs text-tenue mt-1"},df={key:1,class:"text-sm text-red-600 dark:text-red-400 mb-4"},pf={class:"flex items-center justify-between mb-4"},hf={class:"flex items-center gap-2"},mf={key:0,class:"badge-alerta"},gf={key:1,class:"badge-neutro"},vf=["disabled"],bf={key:2,class:"text-xs text-tenue -mt-2 mb-4"},xf={key:3,class:"text-xs text-tenue -mt-2 mb-4"},_f={key:4,class:"grid gap-3 sm:grid-cols-2"},yf=["disabled"],wf={key:6,class:"grid gap-3 sm:grid-cols-2"},Cf={class:"flex items-start gap-3"},Ef={class:"min-w-0 flex-1"},Sf={class:"flex items-center gap-2"},Af={class:"font-medium text-texto truncate"},kf={class:"text-xs text-tenue mt-0.5 truncate"},Rf={class:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0"},If=["onClick"],Pf=["onClick"],Of=["onClick"],Tf={class:"flex items-center gap-4 mt-3.5 pt-3 border-t border-borde text-xs text-tenue"},$f={class:"tabular-nums"},Nf={class:"text-texto font-medium"},Df={class:"tabular-nums"},Mf={class:"text-texto font-medium"},Vf={class:"tabular-nums"},jf={class:"text-texto font-medium"},Uf={class:"bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-xl p-6 w-full max-w-lg max-h-[calc(100vh-2rem)] overflow-y-auto"},Lf={class:"font-semibold text-gray-800 dark:text-gray-100 mb-4"},Ff={key:0},Hf={class:"grid gap-1.5"},Bf=["value"],Kf={class:"min-w-0"},qf={class:"block text-sm text-texto"},Gf={class:"block text-xs text-tenue"},Wf={key:0,class:"block text-xs text-tenue mt-0.5"},zf=["value"],Jf={class:"flex items-center gap-2"},Qf={class:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-300"},Yf={class:"flex justify-end gap-2 pt-2"},Xf={type:"submit",class:"bg-brand hover:bg-brand-dark text-white text-sm font-medium px-4 py-2 rounded-lg"},Zf={__name:"TenantAgentes",props:{id:{type:String,required:!0}},setup(e){const t=e,n=ye(()=>Number(t.id)),s=Co(),o=z(null),r=z([]),i=z([]),l=z(""),a=z(!1),d=z(null),c=z(D()),h=z(null),g=z({}),x=z(!0);function j(Z){const V=g.value[Z.ID]||{};return Z.activo?V.documentos>0?{tipo:"ok",texto:"listo"}:{tipo:"alerta",texto:"sin conocimiento"}:{tipo:"neutro",texto:"inactivo"}}function O(Z){const V=g.value[Z.ID]||{};return{documentos:V.documentos||0,canales:V.canales||0,conversaciones:V.conversaciones_7d||0}}function W(Z){return String(Z||"?").trim().split(/\s+/).slice(0,2).map(V=>V[0]).join("").toUpperCase()}const K=ye(()=>{if(!h.value)return{sinPlan:!0};const Z=h.value.max_agentes||0;return{sinPlan:!1,nombre:h.value.nombre,ilimitado:Z<=0,max:Z,usados:r.value.length,lleno:Z>0&&r.value.length>=Z}});function D(){return{nombre:"",ai_config_id:null,tono:"",mensaje_bienvenida:"",color:"#8eb02f",activo:!0,plantilla_rubro:""}}const q=z([]);async function I(){l.value="",x.value=!0;try{const[Z,V,Te,G]=await Promise.all([le.get(ie("/umind/tenants")),le.get(ie(`/umind/agentes?tenant_id=${t.id}`)),le.get(ie("/umind/ai-configs")),le.get(ie("/umind/plantillas-rubro"))]);o.value=(Z.items||[]).find(Xe=>String(Xe.ID)===t.id)||null,r.value=V.items||[],h.value=V.plan||null,g.value=V.resumen||{},i.value=Te.items||[],q.value=G.items||[]}catch(Z){l.value=Z.message}finally{x.value=!1}}async function A(Z){const V=prompt(`Nombre de la copia de "${Z.nombre}":`,`${Z.nombre} (copia)`);if(V!==null){l.value="";try{const Te=await le.post(ie(`/umind/agentes/${Z.ID}/duplicar`),{tenant_id:Number(n.value),nombre:V.trim()});await I(),Te.aviso&&alert(Te.aviso)}catch(Te){l.value=Te.message}}}function M(){d.value=null,c.value=D(),a.value=!0}function ne(Z){d.value=Z,c.value={nombre:Z.nombre,ai_config_id:Z.ai_config_id,tono:Z.tono,mensaje_bienvenida:Z.mensaje_bienvenida,color:Z.color||"#8eb02f",activo:Z.activo},a.value=!0}async function F(){try{if(d.value)await le.put(ie(`/umind/agentes/${d.value.ID}`),{tenant_id:n.value,...c.value}),a.value=!1,await I();else{const Z=await le.post(ie("/umind/agentes"),{tenant_id:n.value,...c.value});a.value=!1,s.push(`/tenants/${n.value}/agentes/${Z.id}`)}}catch(Z){l.value=Z.message}}async function Ae(Z){confirm(`¿Eliminar el agente "${Z.nombre}"? Esto no se puede deshacer.`)&&(await le.del(ie(`/umind/agentes/${Z.ID}`)),await I())}return Bt(()=>t.id,I,{immediate:!0}),(Z,V)=>{const Te=Fn("router-link");return w(),E("div",null,[o.value?(w(),E("div",af,[u("div",uf,[u("div",null,[u("h1",cf,P(o.value.nombre),1),u("p",ff,P(o.value.dominios_permitidos||"sin dominios configurados"),1)]),Pe(Te,{to:`/tenants/${n.value??e.id}/uso`,class:"btn-ghost"},{default:Ht(()=>[...V[10]||(V[10]=[we("📊 Consumo",-1)])]),_:1},8,["to"])])])):ee("",!0),l.value?(w(),E("p",df,P(l.value),1)):ee("",!0),u("div",pf,[u("div",hf,[V[11]||(V[11]=u("h2",{class:"text-sm font-medium text-tenue"},"Agentes",-1)),K.value.sinPlan?(w(),E("span",mf,"sin plan · sin límite")):K.value.ilimitado?(w(),E("span",gf,P(K.value.nombre)+" · ilimitado",1)):(w(),E("span",{key:2,class:Ie(K.value.lleno?"badge-alerta":"badge-neutro")},P(K.value.nombre)+" · "+P(K.value.usados)+" de "+P(K.value.max),3))]),u("button",{class:"btn-primary",disabled:K.value.lleno,onClick:M},"+ Nuevo agente",8,vf)]),K.value.sinPlan&&!De(Qe).esPortal?(w(),E("p",bf," Este tenant no tiene plan asignado, así que no se le aplica ningún límite de agentes. Asignale uno desde el lápiz del tenant en la barra izquierda. ")):K.value.lleno?(w(),E("p",xf," Alcanzaste el máximo de agentes de tu plan. ")):ee("",!0),x.value?(w(),E("div",_f,[(w(),E(fe,null,$e(2,G=>u("div",{key:G,class:"card p-4 animate-pulse"},[...V[12]||(V[12]=[wi('',2)])])),64))])):r.value.length===0?(w(),dn(Bi,{key:5,class:"card",icono:"🤖",titulo:"Todavía no hay agentes",detalle:"Creá el primero y cargale su base de conocimiento para que empiece a responder."},{default:Ht(()=>[u("button",{class:"btn-primary",disabled:K.value.lleno,onClick:M},"+ Crear el primer agente",8,yf)]),_:1})):(w(),E("div",wf,[(w(!0),E(fe,null,$e(r.value,G=>(w(),dn(Te,{key:G.ID,to:`/tenants/${n.value}/agentes/${G.ID}`,class:"card p-4 relative group hover:shadow-lg hover:-translate-y-0.5 transition-all overflow-hidden"},{default:Ht(()=>[u("span",{class:"absolute inset-x-0 top-0 h-1",style:Zt({background:G.color||"#8eb02f"})},null,4),u("div",Cf,[u("span",{class:"w-10 h-10 rounded-xl flex items-center justify-center text-white text-sm font-semibold shrink-0",style:Zt({background:G.color||"#8eb02f",opacity:G.activo?1:.4})},P(W(G.nombre)),5),u("div",Ef,[u("div",Sf,[u("span",Af,P(G.nombre),1),u("span",{class:Ie(`badge-${j(G).tipo}`)},P(j(G).texto),3)]),u("p",kf,P(G.tono||"sin tono definido"),1)]),u("div",Rf,[u("button",{class:"p-1 text-tenue hover:text-texto",title:"Editar",onClick:ze(Xe=>ne(G),["prevent","stop"])},"✎",8,If),u("button",{class:"p-1 text-tenue hover:text-texto",title:"Duplicar: copia el conocimiento y las herramientas a un agente nuevo",onClick:ze(Xe=>A(G),["prevent","stop"])},"⧉",8,Pf),u("button",{class:"p-1 text-tenue hover:text-red-600",title:"Eliminar",onClick:ze(Xe=>Ae(G),["prevent","stop"])},"✕",8,Of)])]),u("div",Tf,[u("span",$f,[u("b",Nf,P(O(G).conversaciones),1),V[13]||(V[13]=we(" conversaciones · 7d",-1))]),u("span",Df,[u("b",Mf,P(O(G).documentos),1),V[14]||(V[14]=we(" fuentes",-1))]),u("span",Vf,[u("b",jf,P(O(G).canales),1),V[15]||(V[15]=we(" canales",-1))])])]),_:2},1032,["to"]))),128))])),a.value?(w(),E("div",{key:7,class:"fixed inset-0 bg-black/40 flex items-center justify-center p-4 z-50",onClick:V[9]||(V[9]=ze(G=>a.value=!1,["self"]))},[u("div",Uf,[u("h2",Lf,P(d.value?"Editar agente":"Nuevo agente"),1),u("form",{class:"space-y-3",onSubmit:ze(F,["prevent"])},[u("div",null,[V[16]||(V[16]=u("label",{class:"label"},"Nombre",-1)),se(u("input",{"onUpdate:modelValue":V[0]||(V[0]=G=>c.value.nombre=G),required:"",placeholder:"ej: Ventas, Soporte",class:"input"},null,512),[[xe,c.value.nombre]])]),!d.value&&q.value.length?(w(),E("div",Ff,[V[17]||(V[17]=u("label",{class:"label"},"Arrancar con",-1)),u("div",Hf,[(w(!0),E(fe,null,$e([{clave:"",nombre:"Agente en blanco",descripcion:"Sin conocimiento cargado. Lo escribís vos desde cero."},...q.value],G=>(w(),E("label",{key:G.clave,class:Ie(["flex gap-2.5 p-2.5 rounded-lg border cursor-pointer transition-colors",c.value.plantilla_rubro===G.clave?"border-brand bg-brand/5":"border-borde hover:border-brand/40"])},[se(u("input",{"onUpdate:modelValue":V[1]||(V[1]=Xe=>c.value.plantilla_rubro=Xe),type:"radio",value:G.clave,class:"mt-1 text-brand focus:ring-brand"},null,8,Bf),[[iu,c.value.plantilla_rubro]]),u("span",Kf,[u("span",qf,P(G.nombre),1),u("span",Gf,P(G.descripcion),1),G.notas?(w(),E("span",Wf,P(G.notas)+" notas listas para editar · "+P(G.resumen),1)):ee("",!0)])],2))),128))]),V[18]||(V[18]=u("p",{class:"text-xs text-tenue mt-1.5"}," Las notas vienen con ejemplos entre corchetes — abrilas y reemplazalas por tus datos reales. ",-1))])):ee("",!0),u("div",null,[V[20]||(V[20]=u("label",{class:"label"},"Config de IA",-1)),se(u("select",{"onUpdate:modelValue":V[2]||(V[2]=G=>c.value.ai_config_id=G),class:"input"},[V[19]||(V[19]=u("option",{value:null},"— sin asignar —",-1)),(w(!0),E(fe,null,$e(i.value,G=>(w(),E("option",{key:G.ID,value:G.ID},P(G.nombre)+" ("+P(G.provider)+")",9,zf))),128))],512),[[Vn,c.value.ai_config_id]])]),u("div",null,[V[21]||(V[21]=u("label",{class:"label"},"Tono / personalidad",-1)),se(u("textarea",{"onUpdate:modelValue":V[3]||(V[3]=G=>c.value.tono=G),rows:"2",class:"input"},null,512),[[xe,c.value.tono]])]),u("div",null,[V[22]||(V[22]=u("label",{class:"label"},"Mensaje de bienvenida",-1)),se(u("input",{"onUpdate:modelValue":V[4]||(V[4]=G=>c.value.mensaje_bienvenida=G),class:"input"},null,512),[[xe,c.value.mensaje_bienvenida]])]),u("div",null,[V[23]||(V[23]=u("label",{class:"label"},"Color del widget",-1)),u("div",Jf,[se(u("input",{"onUpdate:modelValue":V[5]||(V[5]=G=>c.value.color=G),type:"color",class:"w-10 h-9 border border-gray-300 dark:border-gray-700 rounded cursor-pointer bg-white dark:bg-gray-800"},null,512),[[xe,c.value.color]]),se(u("input",{"onUpdate:modelValue":V[6]||(V[6]=G=>c.value.color=G),type:"text",pattern:"#[0-9a-fA-F]{6}",class:"flex-1 border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-100 rounded-lg px-3 py-2 text-sm font-mono"},null,512),[[xe,c.value.color]])])]),u("label",Qf,[se(u("input",{"onUpdate:modelValue":V[7]||(V[7]=G=>c.value.activo=G),type:"checkbox"},null,512),[[At,c.value.activo]]),V[24]||(V[24]=we(" Activo ",-1))]),u("div",Yf,[u("button",{type:"button",class:"px-4 py-2 text-sm text-gray-500 dark:text-gray-400",onClick:V[8]||(V[8]=G=>a.value=!1)},"Cancelar"),u("button",Xf,P(d.value?"Guardar":"Crear"),1)])],32)])])):ee("",!0)])}}},ed={key:0,class:"mb-6 mt-1 flex items-start justify-between gap-4"},td={class:"min-w-0"},nd={class:"text-xl font-semibold text-texto"},sd={class:"text-xs text-tenue mt-1"},od={class:"bg-elevado px-1.5 py-0.5 rounded"},rd=["href"],id={key:1,class:"text-sm text-red-600 dark:text-red-400 mb-4"},ld={class:"flex gap-1.5 mb-6 overflow-x-auto pb-1"},ad=["onClick"],ud={key:2},cd={class:"card p-4 mb-4"},fd={class:"flex gap-1 mb-3"},dd=["onClick"],pd={class:"flex items-center justify-between"},hd=["disabled"],md={class:"flex items-center justify-between"},gd=["disabled"],vd={class:"flex gap-2"},bd={class:"flex items-center justify-between"},xd={class:"flex items-center gap-2 text-xs text-tenue cursor-pointer"},_d=["disabled"],yd={class:"card divide-y divide-borde"},wd={key:0,class:"p-6 text-sm text-tenue"},Cd={class:"text-sm text-texto"},Ed={class:"text-xs text-tenue mt-0.5"},Sd={key:0},Ad={key:1},kd={key:2},Rd={key:3,class:"text-red-600 dark:text-red-400"},Id={class:"flex items-center gap-3 shrink-0"},Pd=["title","onClick"],Od=["disabled","onClick"],Td=["onClick"],$d={key:3},Nd={class:"card divide-y divide-borde"},Dd={key:0,class:"p-6 text-sm text-tenue"},Md={class:"text-sm text-texto font-mono"},Vd={class:"label mt-0.5"},jd={class:"text-xs text-tenue mt-0.5"},Ud={key:0,class:"ml-1 text-green-600 dark:text-green-400"},Ld={key:1,class:"ml-1 text-gray-400"},Fd={class:"flex gap-3 text-sm shrink-0"},Hd=["onClick"],Bd=["onClick"],Kd={class:"card p-6 w-full max-w-xl max-h-[85vh] overflow-y-auto"},qd={class:"font-semibold text-texto mb-4"},Gd={class:"border border-borde rounded-lg p-3 space-y-2"},Wd=["onUpdate:modelValue"],zd=["onUpdate:modelValue"],Jd=["onUpdate:modelValue"],Qd={class:"label flex items-center gap-1"},Yd=["onUpdate:modelValue"],Xd=["onClick"],Zd={key:0,class:"text-xs text-gray-400"},ep={class:"border border-borde rounded-lg p-3 space-y-2"},tp={class:"flex items-center gap-2 label"},np={class:"flex items-center gap-2 text-sm text-texto"},sp={class:"flex justify-end gap-2 pt-2"},op={key:4},rp={class:"card p-4 mb-4"},ip={class:"flex items-center justify-between mb-2"},lp={class:"bg-elevado border border-borde rounded-lg p-2.5 text-xs text-texto overflow-x-auto"},ap={class:"card divide-y divide-borde"},up={key:0,class:"p-6 text-sm text-tenue"},cp={class:"flex items-center justify-between"},fp={class:"font-medium text-texto capitalize"},dp={class:"flex gap-3 text-sm"},pp=["onClick"],hp=["onClick"],mp={class:"flex gap-4 mt-2 text-xs"},gp={class:"flex items-center gap-1.5 text-texto cursor-pointer"},vp=["checked","onChange"],bp={class:"flex items-center gap-1.5 text-texto cursor-pointer"},xp=["checked","onChange"],_p={class:"flex items-center gap-1.5 text-texto cursor-pointer"},yp=["checked","onChange"],wp={class:"label mt-1 break-all"},Cp={class:"bg-elevado px-1 rounded"},Ep={key:0,class:"text-xs text-tenue mt-1"},Sp={key:1,class:"text-xs text-red-600 dark:text-red-400 mt-1"},Ap={class:"card p-6 w-full max-w-md"},kp={key:0},Rp={class:"flex flex-col gap-2 pt-1"},Ip={class:"flex items-center gap-2 text-sm text-texto cursor-pointer"},Pp={class:"flex items-center gap-2 text-sm text-texto cursor-pointer"},Op={class:"flex items-center gap-2 text-sm text-texto cursor-pointer"},Tp={class:"flex justify-end gap-2 pt-2"},$p={key:5},Np={class:"flex gap-2 mb-4"},Dp={class:"card divide-y divide-borde"},Mp={key:0,class:"p-6 text-sm text-tenue"},Vp={class:"font-medium text-texto capitalize"},jp={class:"ml-2 text-sm text-tenue"},Up=["onClick"],Lp={key:6,class:"card p-4 flex flex-col h-[28rem]"},Fp={class:"flex-1 overflow-y-auto space-y-2 mb-3"},Hp={key:0,class:"text-sm text-tenue"},Bp={key:1,class:"text-xs text-tenue"},Kp=["disabled"],qp={key:7,class:"grid grid-cols-3 gap-4"},Gp={class:"col-span-1 card divide-y divide-borde max-h-[28rem] overflow-y-auto"},Wp={key:0,class:"p-4 text-sm text-tenue"},zp=["onClick"],Jp={class:"text-texto truncate"},Qp={class:"text-xs text-tenue mt-0.5"},Yp={class:"col-span-2 card p-4 max-h-[28rem] overflow-y-auto space-y-2"},Xp={key:0,class:"text-sm text-tenue"},Zp={key:8},eh={class:"card divide-y divide-borde max-h-[32rem] overflow-y-auto"},th={key:0,class:"p-6 text-sm text-tenue"},nh={class:"cursor-pointer flex items-center gap-2 text-sm"},sh={class:"text-tenue text-xs shrink-0"},oh={class:"text-texto truncate"},rh={class:"text-tenue text-xs ml-auto shrink-0"},ih={key:0,class:"mt-2 bg-elevado border border-borde rounded-lg p-2 text-xs text-gray-600 dark:text-gray-400 overflow-x-auto whitespace-pre-wrap"},lh={__name:"AgenteDetail",props:{tenantId:{type:String,required:!0},agenteId:{type:String,required:!0}},setup(e){const t=e,n=ye(()=>Number(t.agenteId)),s=Li(),o=z(null),r=z(""),i=z(typeof s.query.tab=="string"?s.query.tab:Qe.esPortal?"conversaciones":"conocimiento"),l=z([]),a=z(""),d=z(30),c=z(!1);async function h(){const R=await le.get(ie(`/umind/agentes?tenant_id=${t.tenantId}`));o.value=(R.items||[]).find(v=>String(v.ID)===t.agenteId)||null}async function g(){const R=await le.get(ie(`/umind/documentos?agente_id=${t.agenteId}`));l.value=R.items||[]}const x=z("texto"),j=z(!0),O=z(""),W=z(""),K=z(null);async function D(){if(a.value.trim()){c.value=!0,r.value="";try{await le.post(ie("/umind/documentos"),{agente_id:n.value,url:a.value.trim(),max_paginas:Number(d.value)||30,auto_actualizar:j.value}),a.value="",await g()}catch(R){r.value=R.message}finally{c.value=!1}}}async function q(){if(W.value.trim()){c.value=!0,r.value="";try{await le.post(ie("/umind/documentos/texto"),{agente_id:n.value,titulo:O.value.trim(),contenido:W.value}),O.value="",W.value="",await g()}catch(R){r.value=R.message}finally{c.value=!1}}}async function I(){var v,wt;const R=(wt=(v=K.value)==null?void 0:v.files)==null?void 0:wt[0];if(R){c.value=!0,r.value="";try{const b=new FormData;b.append("agente_id",String(n.value)),b.append("archivo",R);const Se=await fetch(ie("/umind/documentos/archivo"),{method:"POST",body:b}),rt=await Se.json();if(!Se.ok)throw new Error(rt.error||"No se pudo subir");K.value.value="",await g()}catch(b){r.value=b.message}finally{c.value=!1}}}async function A(R){r.value="";try{await le.post(ie(`/umind/documentos/${R.ID}/reprocesar`),{}),await g()}catch(v){r.value=v.message}}async function M(R){try{await le.put(ie(`/umind/documentos/${R.ID}`),{auto_actualizar:!R.auto_actualizar}),await g()}catch(v){r.value=v.message}}function ne(R){if(!R)return"sin procesar";const v=Math.floor((Date.now()-new Date(R))/864e5);if(v<=0)return"hoy";if(v===1)return"ayer";if(v<30)return`hace ${v} días`;const wt=Math.floor(v/30);return wt===1?"hace un mes":`hace ${wt} meses`}function F(R){return R.procesado_at?Date.now()-new Date(R.procesado_at)>60*864e5:!1}async function Ae(R){confirm("¿Eliminar esta fuente y sus fragmentos indexados?")&&(await le.del(ie(`/umind/documentos/${R}`)),await g())}const Z=ye(()=>R=>({listo:"badge-ok",procesando:"badge-alerta",pendiente:"badge-neutro",error:"badge-error"})[R]||"badge-neutro"),V=z([]),Te=z([]),G=z(null);async function Xe(){const R=await le.get(ie(`/umind/sesiones?agente_id=${t.agenteId}`));V.value=R.items||[]}async function Mt(R){G.value=R;const v=await le.get(ie(`/umind/historial?agente_id=${t.agenteId}&session_id=${R}`));Te.value=v.items||[]}const Ce=z([]),ce=z(!1),ae=z(null),oe=z(lt());function lt(){return{nombre:"",descripcion:"",url:"",auth_header_nombre:"",auth_header_valor:"",tocarAuth:!1,parametros:[],activa:!0}}async function Ze(){const R=await le.get(ie(`/umind/tools?agente_id=${t.agenteId}`));Ce.value=R.items||[]}function Le(){ae.value=null,oe.value=lt(),ce.value=!0}function Vt(R){ae.value=R;let v=[];try{v=JSON.parse(R.parametros_json||"[]")||[]}catch{v=[]}oe.value={nombre:R.nombre,descripcion:R.descripcion,url:R.url,auth_header_nombre:R.auth_header_nombre,auth_header_valor:"",tocarAuth:!1,parametros:v,activa:R.activa},ce.value=!0}function jt(){oe.value.parametros.push({nombre:"",tipo:"string",descripcion:"",requerido:!1})}function yt(R){oe.value.parametros.splice(R,1)}async function et(){const R={agente_id:n.value,nombre:oe.value.nombre.trim(),descripcion:oe.value.descripcion,url:oe.value.url.trim(),auth_header_nombre:oe.value.auth_header_nombre,parametros:oe.value.parametros,activa:oe.value.activa};oe.value.tocarAuth&&(R.auth_header_valor=oe.value.auth_header_valor);try{ae.value?await le.put(ie(`/umind/tools/${ae.value.ID}`),R):await le.post(ie("/umind/tools"),R),ce.value=!1,await Ze()}catch(v){r.value=v.message}}async function C(R){confirm(`¿Eliminar la tool "${R.nombre}"?`)&&(await le.del(ie(`/umind/tools/${R.ID}`)),await Ze())}const B=z([]),U=z(!1),T=z(y()),re=z(!1),f=ye(()=>{const R=new Date,v=new Date(R.getFullYear(),R.getMonth(),1).toISOString().slice(0,10),wt=R.toISOString().slice(0,10);return ie(`/umind/reporte.xlsx?agente_id=${t.agenteId}&desde=${v}&hasta=${wt}`)}),p=ye(()=>{var v;const R=((v=o.value)==null?void 0:v.site_key)||"TU_SITE_KEY";return` +