site-operator 0.2.5 → 0.2.6

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.
@@ -1,5 +1,5 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@a2ui/lit`),require(`@a2ui/lit/ui`),require(`@ag-ui/client`)):typeof define==`function`&&define.amd?define([`exports`,`@a2ui/lit`,`@a2ui/lit/ui`,`@ag-ui/client`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.SiteOperator={},e.A2UILit,e.A2UILitUI,e.AgUiClient))})(this,function(e,t,n,r){var i=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=s(t),c=0,u=i.length,d;c<u;c++)d=i[c],!l.call(e,d)&&d!==n&&a(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=o(t,d))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:i(c(e)),u(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e)))(n);var d=globalThis,ee=d.ShadowRoot&&(d.ShadyCSS===void 0||d.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,te=Symbol(),ne=new WeakMap,re=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==te)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(ee&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=ne.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&ne.set(t,e))}return e}toString(){return this.cssText}},ie=e=>new re(typeof e==`string`?e:e+``,void 0,te),f=(e,...t)=>new re(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,te),ae=(e,t)=>{if(ee)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=d.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},oe=ee?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return ie(t)})(e):e,{is:se,defineProperty:ce,getOwnPropertyDescriptor:le,getOwnPropertyNames:ue,getOwnPropertySymbols:de,getPrototypeOf:fe}=Object,p=globalThis,pe=p.trustedTypes,me=pe?pe.emptyScript:``,he=p.reactiveElementPolyfillSupport,m=(e,t)=>e,ge={toAttribute(e,t){switch(t){case Boolean:e=e?me:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},_e=(e,t)=>!se(e,t),ve={attribute:!0,type:String,converter:ge,reflect:!1,useDefault:!1,hasChanged:_e};Symbol.metadata??=Symbol(`metadata`),p.litPropertyMetadata??=new WeakMap;var h=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ve){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&ce(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=le(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ve}static _$Ei(){if(this.hasOwnProperty(m(`elementProperties`)))return;let e=fe(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(m(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(m(`properties`))){let e=this.properties,t=[...ue(e),...de(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(oe(e))}else e!==void 0&&t.push(oe(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ae(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?ge:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?ge:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??_e)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};h.elementStyles=[],h.shadowRootOptions={mode:`open`},h[m(`elementProperties`)]=new Map,h[m(`finalized`)]=new Map,he?.({ReactiveElement:h}),(p.reactiveElementVersions??=[]).push(`2.1.2`);var ye=globalThis,be=e=>e,g=ye.trustedTypes,xe=g?g.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,Se=`$lit$`,_=`lit$${Math.random().toFixed(9).slice(2)}$`,Ce=`?`+_,we=`<${Ce}>`,v=document,y=()=>v.createComment(``),b=e=>e===null||typeof e!=`object`&&typeof e!=`function`,Te=Array.isArray,Ee=e=>Te(e)||typeof e?.[Symbol.iterator]==`function`,De=`[
2
- \f\r]`,x=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Oe=/-->/g,ke=/>/g,S=RegExp(`>|${De}(?:([^\\s"'>=/]+)(${De}*=${De}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),Ae=/'/g,je=/"/g,Me=/^(?:script|style|textarea|title)$/i,C=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),w=Symbol.for(`lit-noChange`),T=Symbol.for(`lit-nothing`),Ne=new WeakMap,E=v.createTreeWalker(v,129);function Pe(e,t){if(!Te(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return xe===void 0?t:xe.createHTML(t)}var Fe=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=x;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===x?c[1]===`!--`?o=Oe:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=S):(Me.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=S):o=ke:o===S?c[0]===`>`?(o=i??x,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?S:c[3]===`"`?je:Ae):o===je||o===Ae?o=S:o===Oe||o===ke?o=x:(o=S,i=void 0);let d=o===S&&e[t+1].startsWith(`/>`)?` `:``;a+=o===x?n+we:l>=0?(r.push(s),n.slice(0,l)+Se+n.slice(l)+_+d):n+_+(l===-2?t:d)}return[Pe(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},Ie=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=Fe(t,n);if(this.el=e.createElement(l,r),E.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=E.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(Se)){let t=u[o++],n=i.getAttribute(e).split(_),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?Re:r[1]===`?`?ze:r[1]===`@`?Be:k}),i.removeAttribute(e)}else e.startsWith(_)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(Me.test(i.tagName)){let e=i.textContent.split(_),t=e.length-1;if(t>0){i.textContent=g?g.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],y()),E.nextNode(),c.push({type:2,index:++a});i.append(e[t],y())}}}else if(i.nodeType===8)if(i.data===Ce)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(_,e+1))!==-1;)c.push({type:7,index:a}),e+=_.length-1}a++}}static createElement(e,t){let n=v.createElement(`template`);return n.innerHTML=e,n}};function D(e,t,n=e,r){if(t===w)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=b(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=D(e,i._$AS(e,t.values),i,r)),t}var Le=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??v).importNode(t,!0);E.currentNode=r;let i=E.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new O(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new Ve(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=E.nextNode(),a++)}return E.currentNode=v,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},O=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=T,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=D(this,e,t),b(e)?e===T||e==null||e===``?(this._$AH!==T&&this._$AR(),this._$AH=T):e!==this._$AH&&e!==w&&this._(e):e._$litType$===void 0?e.nodeType===void 0?Ee(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==T&&b(this._$AH)?this._$AA.nextSibling.data=e:this.T(v.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=Ie.createElement(Pe(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new Le(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Ne.get(e.strings);return t===void 0&&Ne.set(e.strings,t=new Ie(e)),t}k(t){Te(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(y()),this.O(y()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=be(e).nextSibling;be(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},k=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=T,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=T}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=D(this,e,t,0),a=!b(e)||e!==this._$AH&&e!==w,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=D(this,r[n+o],t,o),s===w&&(s=this._$AH[o]),a||=!b(s)||s!==this._$AH[o],s===T?e=T:e!==T&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},Re=class extends k{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===T?void 0:e}},ze=class extends k{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==T)}},Be=class extends k{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=D(this,e,t,0)??T)===w)return;let n=this._$AH,r=e===T&&n!==T||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==T&&(n===T||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ve=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){D(this,e)}},He={M:Se,P:_,A:Ce,C:1,L:Fe,R:Le,D:Ee,V:D,I:O,H:k,N:ze,U:Be,B:Re,F:Ve},Ue=ye.litHtmlPolyfillSupport;Ue?.(Ie,O),(ye.litHtmlVersions??=[]).push(`3.3.2`);var We=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new O(t.insertBefore(y(),e),e,void 0,n??{})}return i._$AI(e),i},Ge=globalThis,A=class extends h{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=We(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return w}};A._$litElement$=!0,A.finalized=!0,Ge.litElementHydrateSupport?.({LitElement:A});var Ke=Ge.litElementPolyfillSupport;Ke?.({LitElement:A}),(Ge.litElementVersions??=[]).push(`4.2.2`);var j=e=>(t,n)=>{n===void 0?customElements.define(e,t):n.addInitializer(()=>{customElements.define(e,t)})},qe={attribute:!0,type:String,converter:ge,reflect:!1,hasChanged:_e},Je=(e=qe,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function M(e){return(t,n)=>typeof n==`object`?Je(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function N(e){return M({...e,state:!0,attribute:!1})}var Ye=(e,t,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&typeof t!=`object`&&Object.defineProperty(e,t,n),n);function Xe(e,t){return(n,r,i)=>{let a=t=>t.renderRoot?.querySelector(e)??null;if(t){let{get:e,set:t}=typeof r==`object`?n:i??(()=>{let e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return Ye(n,r,{get(){let n=e.call(this);return n===void 0&&(n=a(this),(n!==null||this.hasUpdated)&&t.call(this,n)),n}})}return Ye(n,r,{get(){return a(this)}})}}let Ze=f`
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@a2ui/lit`),require(`@a2ui/lit/ui`),require(`@ag-ui/client`)):typeof define==`function`&&define.amd?define([`exports`,`@a2ui/lit`,`@a2ui/lit/ui`,`@ag-ui/client`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.SiteOperator={},e.A2UILit,e.A2UILitUI,e.AgUiClient))})(this,function(e,t,n,r){var i=Object.create,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=s(t),c=0,u=i.length,d;c<u;c++)d=i[c],!l.call(e,d)&&d!==n&&a(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=o(t,d))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:i(c(e)),u(t||!e||!e.__esModule?a(n,`default`,{value:e,enumerable:!0}):n,e)))(n);var d=globalThis,ee=d.ShadowRoot&&(d.ShadyCSS===void 0||d.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,te=Symbol(),ne=new WeakMap,re=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==te)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(ee&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=ne.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&ne.set(t,e))}return e}toString(){return this.cssText}},ie=e=>new re(typeof e==`string`?e:e+``,void 0,te),f=(e,...t)=>new re(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,te),ae=(e,t)=>{if(ee)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=d.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},oe=ee?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return ie(t)})(e):e,{is:se,defineProperty:ce,getOwnPropertyDescriptor:le,getOwnPropertyNames:ue,getOwnPropertySymbols:de,getPrototypeOf:fe}=Object,pe=globalThis,me=pe.trustedTypes,he=me?me.emptyScript:``,ge=pe.reactiveElementPolyfillSupport,p=(e,t)=>e,m={toAttribute(e,t){switch(t){case Boolean:e=e?he:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},_e=(e,t)=>!se(e,t),ve={attribute:!0,type:String,converter:m,reflect:!1,useDefault:!1,hasChanged:_e};Symbol.metadata??=Symbol(`metadata`),pe.litPropertyMetadata??=new WeakMap;var h=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ve){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&ce(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=le(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ve}static _$Ei(){if(this.hasOwnProperty(p(`elementProperties`)))return;let e=fe(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(p(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(p(`properties`))){let e=this.properties,t=[...ue(e),...de(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(oe(e))}else e!==void 0&&t.push(oe(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ae(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?m:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?m:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??_e)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};h.elementStyles=[],h.shadowRootOptions={mode:`open`},h[p(`elementProperties`)]=new Map,h[p(`finalized`)]=new Map,ge?.({ReactiveElement:h}),(pe.reactiveElementVersions??=[]).push(`2.1.2`);var ye=globalThis,be=e=>e,xe=ye.trustedTypes,Se=xe?xe.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,Ce=`$lit$`,g=`lit$${Math.random().toFixed(9).slice(2)}$`,we=`?`+g,Te=`<${we}>`,_=document,v=()=>_.createComment(``),y=e=>e===null||typeof e!=`object`&&typeof e!=`function`,Ee=Array.isArray,De=e=>Ee(e)||typeof e?.[Symbol.iterator]==`function`,Oe=`[
2
+ \f\r]`,b=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ke=/-->/g,Ae=/>/g,x=RegExp(`>|${Oe}(?:([^\\s"'>=/]+)(${Oe}*=${Oe}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),je=/'/g,Me=/"/g,Ne=/^(?:script|style|textarea|title)$/i,S=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),C=Symbol.for(`lit-noChange`),w=Symbol.for(`lit-nothing`),Pe=new WeakMap,T=_.createTreeWalker(_,129);function Fe(e,t){if(!Ee(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return Se===void 0?t:Se.createHTML(t)}var Ie=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=b;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===b?c[1]===`!--`?o=ke:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=x):(Ne.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=x):o=Ae:o===x?c[0]===`>`?(o=i??b,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?x:c[3]===`"`?Me:je):o===Me||o===je?o=x:o===ke||o===Ae?o=b:(o=x,i=void 0);let d=o===x&&e[t+1].startsWith(`/>`)?` `:``;a+=o===b?n+Te:l>=0?(r.push(s),n.slice(0,l)+Ce+n.slice(l)+g+d):n+g+(l===-2?t:d)}return[Fe(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},Le=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=Ie(t,n);if(this.el=e.createElement(l,r),T.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=T.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(Ce)){let t=u[o++],n=i.getAttribute(e).split(g),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?ze:r[1]===`?`?Be:r[1]===`@`?Ve:O}),i.removeAttribute(e)}else e.startsWith(g)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(Ne.test(i.tagName)){let e=i.textContent.split(g),t=e.length-1;if(t>0){i.textContent=xe?xe.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],v()),T.nextNode(),c.push({type:2,index:++a});i.append(e[t],v())}}}else if(i.nodeType===8)if(i.data===we)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(g,e+1))!==-1;)c.push({type:7,index:a}),e+=g.length-1}a++}}static createElement(e,t){let n=_.createElement(`template`);return n.innerHTML=e,n}};function E(e,t,n=e,r){if(t===C)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=y(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=E(e,i._$AS(e,t.values),i,r)),t}var Re=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??_).importNode(t,!0);T.currentNode=r;let i=T.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new D(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new He(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=T.nextNode(),a++)}return T.currentNode=_,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},D=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=w,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=E(this,e,t),y(e)?e===w||e==null||e===``?(this._$AH!==w&&this._$AR(),this._$AH=w):e!==this._$AH&&e!==C&&this._(e):e._$litType$===void 0?e.nodeType===void 0?De(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==w&&y(this._$AH)?this._$AA.nextSibling.data=e:this.T(_.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=Le.createElement(Fe(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new Re(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Pe.get(e.strings);return t===void 0&&Pe.set(e.strings,t=new Le(e)),t}k(t){Ee(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(v()),this.O(v()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=be(e).nextSibling;be(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},O=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=w,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=w}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=E(this,e,t,0),a=!y(e)||e!==this._$AH&&e!==C,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=E(this,r[n+o],t,o),s===C&&(s=this._$AH[o]),a||=!y(s)||s!==this._$AH[o],s===w?e=w:e!==w&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===w?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},ze=class extends O{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===w?void 0:e}},Be=class extends O{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==w)}},Ve=class extends O{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=E(this,e,t,0)??w)===C)return;let n=this._$AH,r=e===w&&n!==w||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==w&&(n===w||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},He=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){E(this,e)}},Ue={M:Ce,P:g,A:we,C:1,L:Ie,R:Re,D:De,V:E,I:D,H:O,N:Be,U:Ve,B:ze,F:He},We=ye.litHtmlPolyfillSupport;We?.(Le,D),(ye.litHtmlVersions??=[]).push(`3.3.2`);var Ge=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new D(t.insertBefore(v(),e),e,void 0,n??{})}return i._$AI(e),i},Ke=globalThis,k=class extends h{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ge(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return C}};k._$litElement$=!0,k.finalized=!0,Ke.litElementHydrateSupport?.({LitElement:k});var qe=Ke.litElementPolyfillSupport;qe?.({LitElement:k}),(Ke.litElementVersions??=[]).push(`4.2.2`);var A=e=>(t,n)=>{n===void 0?customElements.define(e,t):n.addInitializer(()=>{customElements.define(e,t)})},Je={attribute:!0,type:String,converter:m,reflect:!1,hasChanged:_e},Ye=(e=Je,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function j(e){return(t,n)=>typeof n==`object`?Ye(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function M(e){return j({...e,state:!0,attribute:!1})}var Xe=(e,t,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&typeof t!=`object`&&Object.defineProperty(e,t,n),n);function Ze(e,t){return(n,r,i)=>{let a=t=>t.renderRoot?.querySelector(e)??null;if(t){let{get:e,set:t}=typeof r==`object`?n:i??(()=>{let e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return Xe(n,r,{get(){let n=e.call(this);return n===void 0&&(n=a(this),(n!==null||this.hasUpdated)&&t.call(this,n)),n}})}return Xe(n,r,{get(){return a(this)}})}}let Qe=f`
3
3
  :host {
4
4
  display: flex;
5
5
  flex-direction: column;
@@ -54,7 +54,7 @@
54
54
  transform: scale(1.1);
55
55
  }
56
56
 
57
- `,Qe=f`
57
+ `,$e=f`
58
58
  :host {
59
59
  display: block;
60
60
  border-bottom: 1px solid var(--agent-border-zinc-200, #e4e4e7);
@@ -82,7 +82,7 @@
82
82
  display: flex;
83
83
  gap: 0.5rem;
84
84
  }
85
- `,$e=f`
85
+ `,et=f`
86
86
  :host {
87
87
  display: inline-flex;
88
88
  }
@@ -109,50 +109,50 @@
109
109
  width: 1.25rem;
110
110
  height: 1.25rem;
111
111
  }
112
- `;function P(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var et=class extends A{constructor(...e){super(...e),this.tooltip=``}static#e=this.styles=$e;render(){return C`
112
+ `;function N(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var tt=class extends k{constructor(...e){super(...e),this.tooltip=``}static#e=this.styles=et;render(){return S`
113
113
  <button title="${this.tooltip}" aria-label="${this.tooltip||`Action`}">
114
114
  <slot></slot>
115
115
  </button>
116
- `}};P([M()],et.prototype,`tooltip`,void 0),et=P([j(`agent-icon-button`)],et);let tt=C`
116
+ `}};N([j()],tt.prototype,`tooltip`,void 0),tt=N([A(`agent-icon-button`)],tt);let nt=S`
117
117
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-plus">
118
118
  <path d="M5 12h14" />
119
119
  <path d="M12 5v14" />
120
- </svg>`,nt=C`
120
+ </svg>`,rt=S`
121
121
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-send">
122
122
  <path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z" />
123
123
  <path d="m21.854 2.147-10.94 10.939" />
124
- </svg>`,rt=C`
124
+ </svg>`,it=S`
125
125
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy">
126
126
  <rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
127
127
  <path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
128
- </svg>`,it=C`
128
+ </svg>`,at=S`
129
129
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw">
130
130
  <path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" />
131
131
  <path d="M21 3v5h-5" />
132
- </svg>`,at=C`
132
+ </svg>`,ot=S`
133
133
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square">
134
134
  <rect width="18" height="18" x="3" y="3" rx="2" />
135
- </svg>`,ot=C`
135
+ </svg>`,st=S`
136
136
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-history">
137
137
  <path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" />
138
138
  <path d="M3 3v5h5" />
139
139
  <path d="M12 7v5l4 2" />
140
- </svg>`,st=C`
140
+ </svg>`,ct=S`
141
141
  <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-wrench">
142
142
  <path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z" />
143
- </svg>`;var ct=class extends A{constructor(...e){super(...e),this.title=`Agent Chat`}static#e=this.styles=Qe;_handleNewThread(){this.dispatchEvent(new CustomEvent(`new-thread`,{bubbles:!0,composed:!0}))}_handleToggleHistory(){this.dispatchEvent(new CustomEvent(`toggle-history`,{bubbles:!0,composed:!0}))}render(){return C`
143
+ </svg>`;var lt=class extends k{constructor(...e){super(...e),this.title=`Agent Chat`}static#e=this.styles=$e;_handleNewThread(){this.dispatchEvent(new CustomEvent(`new-thread`,{bubbles:!0,composed:!0}))}_handleToggleHistory(){this.dispatchEvent(new CustomEvent(`toggle-history`,{bubbles:!0,composed:!0}))}render(){return S`
144
144
  <header class="header">
145
145
  <h1>${this.title}</h1>
146
146
  <div class="actions">
147
147
  <agent-icon-button tooltip="Conversaciones" @click="${this._handleToggleHistory}">
148
- ${ot}
148
+ ${st}
149
149
  </agent-icon-button>
150
150
  <agent-icon-button tooltip="Nuevo Chat" @click="${this._handleNewThread}">
151
- ${tt}
151
+ ${nt}
152
152
  </agent-icon-button>
153
153
  </div>
154
154
  </header>
155
- `}};P([M({type:String})],ct.prototype,`title`,void 0),ct=P([j(`agent-chat-header`)],ct);let lt=f`
155
+ `}};N([j({type:String})],lt.prototype,`title`,void 0),lt=N([A(`agent-chat-header`)],lt);let ut=f`
156
156
  :host {
157
157
  display: block;
158
158
  height: 100%;
@@ -209,7 +209,7 @@
209
209
  text-align: center;
210
210
  padding: 0 1rem;
211
211
  }
212
- `,ut=f`
212
+ `,dt=f`
213
213
  :host {
214
214
  display: block;
215
215
  margin: 1rem 0;
@@ -334,10 +334,10 @@
334
334
  transform: scale(1);
335
335
  }
336
336
  }
337
- `,dt=new class{constructor(){this.processor=t.v0_8.Data.createSignalA2uiMessageProcessor()}mapMessage(e){if(e.role!==`assistant`||!e.toolCalls)throw Error(`Unsupported message type for A2UI processing`);let t=[];for(let n of e.toolCalls){if(n.type!==`function`||!n.function)continue;let e=n.function.name,r=this.parseToolArguments(n.function.arguments,e);if(r){if(e===`a2ui_begin_rendering`){let e=this.mapBeginRendering(r);e&&t.push({beginRendering:e});continue}if(e===`a2ui_update_surface`){let e=this.mapSurfaceUpdate(r);e&&t.push({surfaceUpdate:e});continue}if(e===`a2ui_update_data_model`){let e=this.mapDataModelUpdate(r);e&&t.push({dataModelUpdate:e});continue}if(e===`a2ui_delete_surface`){let e=this.mapDeleteSurface(r);e&&t.push({deleteSurface:e});continue}}}return t}parseToolArguments(e,t){if(e==null)return console.warn(`A2UIService: Missing arguments for ${t}`),null;if(typeof e==`string`){let n=e.trim();if(n===``)return{};try{return JSON.parse(n)}catch(e){return console.warn(`A2UIService: Failed to parse arguments for ${t}`,e),null}}return typeof e==`object`?e:(console.warn(`A2UIService: Unsupported arguments type for ${t}`),null)}mapBeginRendering(e){let t=this.getSurfaceId(e),n=this.getRootComponentId(e);if(!t||!n)return console.warn(`A2UIService: Missing surfaceId or root for begin rendering`),null;let r=typeof e.styles==`object`&&e.styles?e.styles:void 0;return r?{surfaceId:t,root:n,styles:r}:{surfaceId:t,root:n}}mapSurfaceUpdate(e){let t=this.getSurfaceId(e);return t?{surfaceId:t,components:Array.isArray(e.components)?e.components:[]}:(console.warn(`A2UIService: Missing surfaceId for surface update`),null)}mapDataModelUpdate(e){let t=this.getSurfaceId(e);if(!t)return console.warn(`A2UIService: Missing surfaceId for data model update`),null;let n={surfaceId:t,contents:this.normalizeValueMapArray(e.contents)};return typeof e.path==`string`&&(n.path=e.path),n}normalizeDataModelUpdate(e){let t={surfaceId:e.surfaceId,contents:this.normalizeValueMapArray(e.contents)};return typeof e.path==`string`&&(t.path=e.path),t}mapDeleteSurface(e){let t=this.getSurfaceId(e);return t?{surfaceId:t}:(console.warn(`A2UIService: Missing surfaceId for delete surface`),null)}getSurfaceId(e){let t=e.surfaceId??e.surface_id;return typeof t==`string`&&t.trim()?t:typeof t==`number`?String(t):null}getRootComponentId(e){let t=e.root??e.rootComponentId??e.root_component??e.root_component_id;return typeof t==`string`&&t.trim()?t:typeof t==`number`?String(t):null}normalizeValueMapArray(e){return Array.isArray(e)?e.filter(e=>e&&typeof e==`object`&&`key`in e).map(e=>this.normalizeValueMapEntry(e)):[]}normalizeValueMapEntry(e){let t={...e};`value_string`in e&&(t.valueString=e.value_string),`valueString`in e&&(t.valueString=e.valueString),`value_number`in e&&(t.valueNumber=e.value_number),`valueNumber`in e&&(t.valueNumber=e.valueNumber),`value_boolean`in e&&(t.valueBoolean=e.value_boolean),`valueBoolean`in e&&(t.valueBoolean=e.valueBoolean);let n=e.valueMap??e.value_map;return n!==void 0&&(t.valueMap=this.normalizeValueMapArray(n)),delete t.value_string,delete t.value_number,delete t.value_boolean,delete t.value_map,typeof t.key!=`string`&&(t.key=String(t.key??``)),t}isServerToClientMessage(e){if(!e||typeof e!=`object`)return!1;let t=e;return`beginRendering`in t||`begin_rendering`in t||`surfaceUpdate`in t||`surface_update`in t||`dataModelUpdate`in t||`data_model_update`in t||`deleteSurface`in t||`delete_surface`in t}normalizeServerMessage(e){let t=e;if(`beginRendering`in t||`surfaceUpdate`in t||`dataModelUpdate`in t||`deleteSurface`in t){let t=e;return t.dataModelUpdate?{...t,dataModelUpdate:this.normalizeDataModelUpdate(t.dataModelUpdate)}:t}let n={},r=t.begin_rendering;if(r&&typeof r==`object`){let e=this.mapBeginRendering(r);e&&(n.beginRendering=e)}let i=t.surface_update;if(i&&typeof i==`object`){let e=this.mapSurfaceUpdate(i);e&&(n.surfaceUpdate=e)}let a=t.data_model_update;if(a&&typeof a==`object`){let e=this.mapDataModelUpdate(a);e&&(n.dataModelUpdate=e)}let o=t.delete_surface;if(o&&typeof o==`object`){let e=this.mapDeleteSurface(o);e&&(n.deleteSurface=e)}return n}processMessages(e){let t=[];for(let n of e){if(this.isServerToClientMessage(n)){t.push(this.normalizeServerMessage(n));continue}n.role===`assistant`&&n.toolCalls&&t.push(...this.mapMessage(n))}if(t.length!==0)return this.processor.processMessages(t)}processMessage(e){this.processMessages([e])}processSnapshot(e){if(e.activityType===`a2ui`&&e.content){let t=e.content,n=Array.isArray(t)?t:[t],r=this.getSurfaceIdsFromEvent(e),i=e.replace===!1?[]:r.map(e=>({deleteSurface:{surfaceId:e}})),a=n.map(e=>{if(e.surfaceUpdate||e.surface_update){let t=e.surfaceUpdate||e.surface_update,n=t.surfaceId||t.surface_id,r=t.components||[];if(n&&r.length>0){let t=this.processor.getSurfaces().get(n)?.rootComponentId;if(!r.some(e=>e.id===t)||!t){let t=r[0].id;return console.warn(`A2UIService: Auto-fixing root mismatch for surface ${n}. Mapeando root a ${t}`),[{beginRendering:{surfaceId:n,root:t}},e]}}}return e}).flat(),o=[...i,...a];console.log(`A2UIService: Processing messages (fixed)`,o),this.processor.processMessages(o);let s=Array.from(this.processor.getSurfaces().entries());console.log(`A2UIService: Estado del procesador tras procesado:`,s.map(([e,t])=>({id:e,root:t.rootComponentId,components:t.components.size,hasTree:!!t.componentTree})))}}getSurfaceIdsFromEvent(e){if(e.activityType!==`a2ui`||!e.content)return[];let t=e.content,n=Array.isArray(t)?t:[t],r=new Set;return n.forEach(e=>{let t=e.beginRendering||e.begin_rendering||e.surfaceUpdate||e.surface_update||e.deleteSurface||e.delete_surface,n=t?.surfaceId||t?.surface_id;n&&r.add(n)}),Array.from(r)}};var F=class extends A{constructor(...e){super(...e),this.isLast=!1,this.isStreaming=!1,this.agentAvatar=``}static#e=this.styles=ut;updated(e){e.has(`message`)&&(this.setAttribute(`role`,this.message.role),this.requestUpdate())}_handleCopy(){let e=typeof this.message.content==`string`?this.message.content:JSON.stringify(this.message.content||``);navigator.clipboard.writeText(e)}_handleReload(){this.dispatchEvent(new CustomEvent(`reload-message`,{detail:{id:this.message.id},bubbles:!0,composed:!0}))}render(){let e=this.message.role===`user`;if(this.message.role===`assistant`&&Array.isArray(this.message.toolCalls)&&this.message.toolCalls.length>0){dt.processMessages([this.message]);let e=Array.from(dt.processor.getSurfaces().entries()),t=dt.processor;if(e.length>0)return C`
337
+ `,P=new class{constructor(){this.processor=t.v0_8.Data.createSignalA2uiMessageProcessor()}mapMessage(e){if(e.role!==`assistant`||!e.toolCalls)throw Error(`Unsupported message type for A2UI processing`);let t=[];for(let n of e.toolCalls){if(n.type!==`function`||!n.function)continue;let e=n.function.name,r=this.parseToolArguments(n.function.arguments,e);if(r){if(e===`a2ui_begin_rendering`){let e=this.mapBeginRendering(r);e&&t.push({beginRendering:e});continue}if(e===`a2ui_update_surface`){let e=this.mapSurfaceUpdate(r);e&&t.push({surfaceUpdate:e});continue}if(e===`a2ui_update_data_model`){let e=this.mapDataModelUpdate(r);e&&t.push({dataModelUpdate:e});continue}if(e===`a2ui_delete_surface`){let e=this.mapDeleteSurface(r);e&&t.push({deleteSurface:e});continue}}}return t}parseToolArguments(e,t){if(e==null)return console.warn(`A2UIService: Missing arguments for ${t}`),null;if(typeof e==`string`){let n=e.trim();if(n===``)return{};try{return JSON.parse(n)}catch(e){return console.warn(`A2UIService: Failed to parse arguments for ${t}`,e),null}}return typeof e==`object`?e:(console.warn(`A2UIService: Unsupported arguments type for ${t}`),null)}mapBeginRendering(e){let t=this.getSurfaceId(e),n=this.getRootComponentId(e);if(!t||!n)return console.warn(`A2UIService: Missing surfaceId or root for begin rendering`),null;let r=typeof e.styles==`object`&&e.styles?e.styles:void 0;return r?{surfaceId:t,root:n,styles:r}:{surfaceId:t,root:n}}mapSurfaceUpdate(e){let t=this.getSurfaceId(e);return t?{surfaceId:t,components:Array.isArray(e.components)?e.components:[]}:(console.warn(`A2UIService: Missing surfaceId for surface update`),null)}mapDataModelUpdate(e){let t=this.getSurfaceId(e);if(!t)return console.warn(`A2UIService: Missing surfaceId for data model update`),null;let n={surfaceId:t,contents:this.normalizeValueMapArray(e.contents)};return typeof e.path==`string`&&(n.path=e.path),n}normalizeDataModelUpdate(e){let t={surfaceId:e.surfaceId,contents:this.normalizeValueMapArray(e.contents)};return typeof e.path==`string`&&(t.path=e.path),t}mapDeleteSurface(e){let t=this.getSurfaceId(e);return t?{surfaceId:t}:(console.warn(`A2UIService: Missing surfaceId for delete surface`),null)}getSurfaceId(e){let t=e.surfaceId??e.surface_id;return typeof t==`string`&&t.trim()?t:typeof t==`number`?String(t):null}getRootComponentId(e){let t=e.root??e.rootComponentId??e.root_component??e.root_component_id;return typeof t==`string`&&t.trim()?t:typeof t==`number`?String(t):null}normalizeValueMapArray(e){return Array.isArray(e)?e.filter(e=>e&&typeof e==`object`&&`key`in e).map(e=>this.normalizeValueMapEntry(e)):[]}normalizeValueMapEntry(e){let t={...e};`value_string`in e&&(t.valueString=e.value_string),`valueString`in e&&(t.valueString=e.valueString),`value_number`in e&&(t.valueNumber=e.value_number),`valueNumber`in e&&(t.valueNumber=e.valueNumber),`value_boolean`in e&&(t.valueBoolean=e.value_boolean),`valueBoolean`in e&&(t.valueBoolean=e.valueBoolean);let n=e.valueMap??e.value_map;return n!==void 0&&(t.valueMap=this.normalizeValueMapArray(n)),delete t.value_string,delete t.value_number,delete t.value_boolean,delete t.value_map,typeof t.key!=`string`&&(t.key=String(t.key??``)),t}isServerToClientMessage(e){if(!e||typeof e!=`object`)return!1;let t=e;return`beginRendering`in t||`begin_rendering`in t||`surfaceUpdate`in t||`surface_update`in t||`dataModelUpdate`in t||`data_model_update`in t||`deleteSurface`in t||`delete_surface`in t}normalizeServerMessage(e){let t=e;if(`beginRendering`in t||`surfaceUpdate`in t||`dataModelUpdate`in t||`deleteSurface`in t){let t=e;return t.dataModelUpdate?{...t,dataModelUpdate:this.normalizeDataModelUpdate(t.dataModelUpdate)}:t}let n={},r=t.begin_rendering;if(r&&typeof r==`object`){let e=this.mapBeginRendering(r);e&&(n.beginRendering=e)}let i=t.surface_update;if(i&&typeof i==`object`){let e=this.mapSurfaceUpdate(i);e&&(n.surfaceUpdate=e)}let a=t.data_model_update;if(a&&typeof a==`object`){let e=this.mapDataModelUpdate(a);e&&(n.dataModelUpdate=e)}let o=t.delete_surface;if(o&&typeof o==`object`){let e=this.mapDeleteSurface(o);e&&(n.deleteSurface=e)}return n}processMessages(e){let t=[];for(let n of e){if(this.isServerToClientMessage(n)){t.push(this.normalizeServerMessage(n));continue}n.role===`assistant`&&n.toolCalls&&t.push(...this.mapMessage(n))}if(t.length!==0)return this.processor.processMessages(t)}processMessage(e){this.processMessages([e])}processSnapshot(e){if(e.activityType===`a2ui`&&e.content){let t=e.content,n=Array.isArray(t)?t:[t],r=this.getSurfaceIdsFromEvent(e),i=e.replace===!1?[]:r.map(e=>({deleteSurface:{surfaceId:e}})),a=n.map(e=>{if(e.surfaceUpdate||e.surface_update){let t=e.surfaceUpdate||e.surface_update,n=t.surfaceId||t.surface_id,r=t.components||[];if(n&&r.length>0){let t=this.processor.getSurfaces().get(n)?.rootComponentId;if(!r.some(e=>e.id===t)||!t){let t=r[0].id;return console.warn(`A2UIService: Auto-fixing root mismatch for surface ${n}. Mapeando root a ${t}`),[{beginRendering:{surfaceId:n,root:t}},e]}}}return e}).flat(),o=[...i,...a];console.log(`A2UIService: Processing messages (fixed)`,o),this.processor.processMessages(o);let s=Array.from(this.processor.getSurfaces().entries());console.log(`A2UIService: Estado del procesador tras procesado:`,s.map(([e,t])=>({id:e,root:t.rootComponentId,components:t.components.size,hasTree:!!t.componentTree})))}}getSurfaceIdsFromEvent(e){if(e.activityType!==`a2ui`||!e.content)return[];let t=e.content,n=Array.isArray(t)?t:[t],r=new Set;return n.forEach(e=>{let t=e.beginRendering||e.begin_rendering||e.surfaceUpdate||e.surface_update||e.deleteSurface||e.delete_surface,n=t?.surfaceId||t?.surface_id;n&&r.add(n)}),Array.from(r)}};var F=class extends k{constructor(...e){super(...e),this.isLast=!1,this.isStreaming=!1,this.agentAvatar=``}static#e=this.styles=dt;updated(e){e.has(`message`)&&(this.setAttribute(`role`,this.message.role),this.requestUpdate())}_handleCopy(){let e=typeof this.message.content==`string`?this.message.content:JSON.stringify(this.message.content||``);navigator.clipboard.writeText(e)}_handleReload(){this.dispatchEvent(new CustomEvent(`reload-message`,{detail:{id:this.message.id},bubbles:!0,composed:!0}))}render(){let e=this.message.role===`user`;if(this.message.role===`assistant`&&Array.isArray(this.message.toolCalls)&&this.message.toolCalls.length>0){P.processMessages([this.message]);let e=Array.from(P.processor.getSurfaces().entries()),t=P.processor;if(e.length>0)return S`
338
338
  <div class="message-container activity">
339
339
  <div class="content-wrapper">
340
- ${e.map(([e,n])=>C`
340
+ ${e.map(([e,n])=>S`
341
341
  <a2ui-theme-provider
342
342
  .surfaceId="${e}"
343
343
  .processor="${t}"
@@ -347,14 +347,14 @@
347
347
  `)}
348
348
  </div>
349
349
  </div>
350
- `}return C`
350
+ `}return S`
351
351
  <div class="message-container">
352
- ${e?``:C`
353
- ${this.agentAvatar?C`<img src="${this.agentAvatar}" class="avatar-img" alt="AI">`:C`<div class="avatar">C</div>`}
352
+ ${e?``:S`
353
+ ${this.agentAvatar?S`<img src="${this.agentAvatar}" class="avatar-img" alt="AI">`:S`<div class="avatar">C</div>`}
354
354
  `}
355
355
 
356
356
  <div class="content-wrapper">
357
- <div class="bubble ${this.isStreaming?`streaming`:``}">${this.message.isThinking?C`
357
+ <div class="bubble ${this.isStreaming?`streaming`:``}">${this.message.isThinking?S`
358
358
  <div class="typing-indicator">
359
359
  <div class="typing-dot"></div>
360
360
  <div class="typing-dot"></div>
@@ -362,26 +362,26 @@
362
362
  </div>
363
363
  `:this.message.content}</div>
364
364
 
365
- ${e?``:C`
365
+ ${e?``:S`
366
366
  <div class="actions">
367
367
  <agent-icon-button tooltip="Copy" @click="${this._handleCopy}">
368
- ${rt}
368
+ ${it}
369
369
  </agent-icon-button>
370
370
  <agent-icon-button tooltip="Reload" @click="${this._handleReload}">
371
- ${it}
371
+ ${at}
372
372
  </agent-icon-button>
373
373
  </div>
374
374
  `}
375
375
  </div>
376
376
  </div>
377
- `}};P([M({type:Object})],F.prototype,`message`,void 0),P([M({type:Boolean})],F.prototype,`isLast`,void 0),P([M({type:Boolean})],F.prototype,`isStreaming`,void 0),P([M({type:String})],F.prototype,`agentAvatar`,void 0),F=P([j(`agent-chat-message`)],F);var I=class extends A{constructor(...e){super(...e),this.messages=[],this.isRunning=!1,this.agentAvatar=``,this.emptyText=``}static#e=this.styles=lt;updated(e){e.has(`messages`)&&this.scrollToBottom()}async scrollToBottom(){await this.updateComplete,(this.shadowRoot?.querySelector(`agent-chat-message:last-of-type`))?.scrollIntoView({behavior:`smooth`,block:`end`})}render(){return this.messages.length===0?C`
377
+ `}};N([j({type:Object})],F.prototype,`message`,void 0),N([j({type:Boolean})],F.prototype,`isLast`,void 0),N([j({type:Boolean})],F.prototype,`isStreaming`,void 0),N([j({type:String})],F.prototype,`agentAvatar`,void 0),F=N([A(`agent-chat-message`)],F);var I=class extends k{constructor(...e){super(...e),this.messages=[],this.isRunning=!1,this.agentAvatar=``,this.emptyText=``}static#e=this.styles=ut;updated(e){e.has(`messages`)&&this.scrollToBottom()}async scrollToBottom(){await this.updateComplete,(this.shadowRoot?.querySelector(`agent-chat-message:last-of-type`))?.scrollIntoView({behavior:`smooth`,block:`end`})}render(){return this.messages.length===0?S`
378
378
  <div class="empty-state">
379
- ${this.agentAvatar?C`<img src="${this.agentAvatar}" alt="Agent Avatar" class="empty-avatar-img">`:C`<div class="empty-avatar">SM</div>`}
379
+ ${this.agentAvatar?S`<img src="${this.agentAvatar}" alt="Agent Avatar" class="empty-avatar-img">`:S`<div class="empty-avatar">SM</div>`}
380
380
  <p class="empty-text">${this.emptyText}</p>
381
381
  </div>
382
- `:C`
382
+ `:S`
383
383
  <div class="messages-list">
384
- ${this.messages.filter(e=>e.role===`assistant`||e.role===`user`||e.role===`activity`).map((e,t,n)=>C`
384
+ ${this.messages.filter(e=>e.role===`assistant`||e.role===`user`||e.role===`activity`).map((e,t,n)=>S`
385
385
  <agent-chat-message
386
386
  .message=${e}
387
387
  .isLast=${t===n.length-1}
@@ -390,7 +390,7 @@
390
390
  </agent-chat-message>
391
391
  `)}
392
392
  </div>
393
- `}};P([M({type:Array})],I.prototype,`messages`,void 0),P([M({type:Boolean})],I.prototype,`isRunning`,void 0),P([M({type:String})],I.prototype,`agentAvatar`,void 0),P([M({type:String})],I.prototype,`emptyText`,void 0),I=P([j(`agent-chat-thread`)],I);let ft=f`
393
+ `}};N([j({type:Array})],I.prototype,`messages`,void 0),N([j({type:Boolean})],I.prototype,`isRunning`,void 0),N([j({type:String})],I.prototype,`agentAvatar`,void 0),N([j({type:String})],I.prototype,`emptyText`,void 0),I=N([A(`agent-chat-thread`)],I);let ft=f`
394
394
  :host {
395
395
  display: block;
396
396
  padding: 1rem;
@@ -475,7 +475,49 @@
475
475
  font-size: 0.75rem;
476
476
  padding: 0.5rem;
477
477
  }
478
- `;var L=class extends A{constructor(...e){super(...e),this.isRunning=!1,this.disclaimer=``,this.placeholder=``,this._value=``}static#e=this.styles=ft;_handleInput(e){this._value=e.target.value,this._adjustHeight()}_handleKeyDown(e){e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),this._handleSubmit())}_adjustHeight(){this._textarea&&(this._textarea.style.height=`auto`,this._textarea.style.height=`${Math.min(this._textarea.scrollHeight,160)}px`)}async _handleSubmit(){this._value.trim()&&(this.dispatchEvent(new CustomEvent(`send`,{detail:{content:this._value},bubbles:!0,composed:!0})),this._value=``,await this.updateComplete,this._textarea.style.height=`3rem`)}_handleStop(){this.dispatchEvent(new CustomEvent(`cancel`,{bubbles:!0,composed:!0}))}render(){return C`
478
+
479
+ .prompts-list {
480
+ display: flex;
481
+ flex-direction: column;
482
+ margin-bottom: 0.75rem;
483
+ padding: 0 0.5rem;
484
+ }
485
+
486
+ .prompt-item {
487
+ background: transparent;
488
+ border: none;
489
+ border-bottom: 1px solid rgba(0, 0, 0, 0.05);
490
+ padding: 0.625rem 0.5rem;
491
+ text-align: left;
492
+ cursor: pointer;
493
+ font-size: 0.875rem;
494
+ color: var(--agent-text-zinc-600, #52525b);
495
+ transition: all 0.2s ease;
496
+ border-radius: 0.375rem;
497
+ white-space: nowrap;
498
+ overflow: hidden;
499
+ text-overflow: ellipsis;
500
+ }
501
+
502
+ .prompt-item:last-child {
503
+ border-bottom: none;
504
+ }
505
+
506
+ .prompt-item:hover {
507
+ background-color: var(--agent-bg-zinc-50, #fafafa);
508
+ color: var(--agent-text-foreground, #09090b);
509
+ padding-left: 0.75rem;
510
+ }
511
+ `;var L=class extends k{constructor(...e){super(...e),this.isRunning=!1,this.disclaimer=``,this.placeholder=``,this.prompts=[],this._value=``}static#e=this.styles=ft;_handleInput(e){this._value=e.target.value,this._adjustHeight()}_handleKeyDown(e){e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),this._handleSubmit())}_adjustHeight(){this._textarea&&(this._textarea.style.height=`auto`,this._textarea.style.height=`${Math.min(this._textarea.scrollHeight,160)}px`)}_handlePromptClick(e){this._value=e.message,this._textarea.focus(),setTimeout(()=>this._adjustHeight(),0)}async _handleSubmit(){this._value.trim()&&(this.dispatchEvent(new CustomEvent(`send`,{detail:{content:this._value},bubbles:!0,composed:!0})),this._value=``,await this.updateComplete,this._textarea.style.height=`3rem`)}_handleStop(){this.dispatchEvent(new CustomEvent(`cancel`,{bubbles:!0,composed:!0}))}render(){return S`
512
+ ${this.prompts.length>0?S`
513
+ <div class="prompts-list">
514
+ ${this.prompts.map(e=>S`
515
+ <button class="prompt-item" @click="${()=>this._handlePromptClick(e)}">
516
+ ${e.caption}
517
+ </button>
518
+ `)}
519
+ </div>
520
+ `:``}
479
521
  <div class="composer-container">
480
522
  <textarea
481
523
  placeholder="${this.placeholder}"
@@ -486,23 +528,23 @@
486
528
  rows="1"
487
529
  ></textarea>
488
530
 
489
- ${this.isRunning?C`<button class="action-button" @click="${this._handleStop}">${at}</button>`:C`<button class="action-button" ?disabled="${!this._value.trim()}" @click="${this._handleSubmit}">${nt}</button>`}
531
+ ${this.isRunning?S`<button class="action-button" @click="${this._handleStop}">${ot}</button>`:S`<button class="action-button" ?disabled="${!this._value.trim()}" @click="${this._handleSubmit}">${rt}</button>`}
490
532
  </div>
491
533
  <p class="disclaimer">
492
534
  ${this.disclaimer}
493
535
  </p>
494
- `}};P([M({type:Boolean})],L.prototype,`isRunning`,void 0),P([M({type:String})],L.prototype,`disclaimer`,void 0),P([M({type:String})],L.prototype,`placeholder`,void 0),P([N()],L.prototype,`_value`,void 0),P([Xe(`textarea`)],L.prototype,`_textarea`,void 0),L=P([j(`agent-chat-composer`)],L);var pt=Object.defineProperty,mt=(e,t,n)=>t in e?pt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ht=(e,t,n)=>(mt(e,typeof t==`symbol`?t:t+``,n),n),gt=(e,t,n)=>{if(!t.has(e))throw TypeError(`Cannot `+n)},_t=(e,t)=>{if(Object(t)!==t)throw TypeError(`Cannot use the "in" operator on this value`);return e.has(t)},vt=(e,t,n)=>{if(t.has(e))throw TypeError(`Cannot add the same private member more than once`);t instanceof WeakSet?t.add(e):t.set(e,n)},yt=(e,t,n)=>(gt(e,t,`access private method`),n);function bt(e,t){return Object.is(e,t)}var R=null,z=!1,xt=1,St=Symbol(`SIGNAL`);function B(e){let t=R;return R=e,t}function Ct(){return R}function wt(){return z}var Tt={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function Et(e){if(z)throw Error(typeof ngDevMode<`u`&&ngDevMode?`Assertion error: signal read during notification phase`:``);if(R===null)return;R.consumerOnSignalRead(e);let t=R.nextProducerIndex++;if(V(R),t<R.producerNode.length&&R.producerNode[t]!==e&&Lt(R)){let e=R.producerNode[t];It(e,R.producerIndexOfThis[t])}R.producerNode[t]!==e&&(R.producerNode[t]=e,R.producerIndexOfThis[t]=Lt(R)?Ft(e,R,t):0),R.producerLastReadVersion[t]=e.version}function Dt(){xt++}function Ot(e){if(!(!e.dirty&&e.lastCleanEpoch===xt)){if(!e.producerMustRecompute(e)&&!Pt(e)){e.dirty=!1,e.lastCleanEpoch=xt;return}e.producerRecomputeValue(e),e.dirty=!1,e.lastCleanEpoch=xt}}function kt(e){if(e.liveConsumerNode===void 0)return;let t=z;z=!0;try{for(let t of e.liveConsumerNode)t.dirty||jt(t)}finally{z=t}}function At(){return R?.consumerAllowSignalWrites!==!1}function jt(e){var t;e.dirty=!0,kt(e),(t=e.consumerMarkedDirty)==null||t.call(e.wrapper??e)}function Mt(e){return e&&(e.nextProducerIndex=0),B(e)}function Nt(e,t){if(B(t),!(!e||e.producerNode===void 0||e.producerIndexOfThis===void 0||e.producerLastReadVersion===void 0)){if(Lt(e))for(let t=e.nextProducerIndex;t<e.producerNode.length;t++)It(e.producerNode[t],e.producerIndexOfThis[t]);for(;e.producerNode.length>e.nextProducerIndex;)e.producerNode.pop(),e.producerLastReadVersion.pop(),e.producerIndexOfThis.pop()}}function Pt(e){V(e);for(let t=0;t<e.producerNode.length;t++){let n=e.producerNode[t],r=e.producerLastReadVersion[t];if(r!==n.version||(Ot(n),r!==n.version))return!0}return!1}function Ft(e,t,n){var r;if(Rt(e),V(e),e.liveConsumerNode.length===0){(r=e.watched)==null||r.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)e.producerIndexOfThis[t]=Ft(e.producerNode[t],e,t)}return e.liveConsumerIndexOfThis.push(n),e.liveConsumerNode.push(t)-1}function It(e,t){var n;if(Rt(e),V(e),typeof ngDevMode<`u`&&ngDevMode&&t>=e.liveConsumerNode.length)throw Error(`Assertion error: active consumer index ${t} is out of bounds of ${e.liveConsumerNode.length} consumers)`);if(e.liveConsumerNode.length===1){(n=e.unwatched)==null||n.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)It(e.producerNode[t],e.producerIndexOfThis[t])}let r=e.liveConsumerNode.length-1;if(e.liveConsumerNode[t]=e.liveConsumerNode[r],e.liveConsumerIndexOfThis[t]=e.liveConsumerIndexOfThis[r],e.liveConsumerNode.length--,e.liveConsumerIndexOfThis.length--,t<e.liveConsumerNode.length){let n=e.liveConsumerIndexOfThis[t],r=e.liveConsumerNode[t];V(r),r.producerIndexOfThis[n]=t}}function Lt(e){return e.consumerIsAlwaysLive||(e?.liveConsumerNode?.length??0)>0}function V(e){e.producerNode??=[],e.producerIndexOfThis??=[],e.producerLastReadVersion??=[]}function Rt(e){e.liveConsumerNode??=[],e.liveConsumerIndexOfThis??=[]}function zt(e){if(Ot(e),Et(e),e.value===Ut)throw e.error;return e.value}function Bt(e){let t=Object.create(Wt);t.computation=e;let n=()=>zt(t);return n[St]=t,n}var Vt=Symbol(`UNSET`),Ht=Symbol(`COMPUTING`),Ut=Symbol(`ERRORED`),Wt=(()=>({...Tt,value:Vt,dirty:!0,error:null,equal:bt,producerMustRecompute(e){return e.value===Vt||e.value===Ht},producerRecomputeValue(e){if(e.value===Ht)throw Error(`Detected cycle in computations.`);let t=e.value;e.value=Ht;let n=Mt(e),r,i=!1;try{r=e.computation.call(e.wrapper),i=t!==Vt&&t!==Ut&&e.equal.call(e.wrapper,t,r)}catch(t){r=Ut,e.error=t}finally{Nt(e,n)}if(i){e.value=t;return}e.value=r,e.version++}}))();function Gt(){throw Error()}var Kt=Gt;function qt(){Kt()}function Jt(e){let t=Object.create(Zt);t.value=e;let n=()=>(Et(t),t.value);return n[St]=t,n}function Yt(){return Et(this),this.value}function Xt(e,t){At()||qt(),e.equal.call(e.wrapper,e.value,t)||(e.value=t,Qt(e))}var Zt=(()=>({...Tt,equal:bt,value:void 0}))();function Qt(e){e.version++,Dt(),kt(e)}var H=Symbol(`node`),U;(e=>{var t,n,r,i;class a{constructor(r,i={}){vt(this,n),ht(this,t);let a=Jt(r)[St];if(this[H]=a,a.wrapper=this,i){let t=i.equals;t&&(a.equal=t),a.watched=i[e.subtle.watched],a.unwatched=i[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw TypeError(`Wrong receiver type for Signal.State.prototype.get`);return Yt.call(this[H])}set(t){if(!(0,e.isState)(this))throw TypeError(`Wrong receiver type for Signal.State.prototype.set`);if(wt())throw Error(`Writes to signals not permitted during Watcher callback`);let n=this[H];Xt(n,t)}}t=H,n=new WeakSet,e.isState=e=>typeof e==`object`&&_t(n,e),e.State=a;class o{constructor(t,n){vt(this,i),ht(this,r);let a=Bt(t)[St];if(a.consumerAllowSignalWrites=!0,this[H]=a,a.wrapper=this,n){let t=n.equals;t&&(a.equal=t),a.watched=n[e.subtle.watched],a.unwatched=n[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw TypeError(`Wrong receiver type for Signal.Computed.prototype.get`);return zt(this[H])}}r=H,i=new WeakSet,e.isComputed=e=>typeof e==`object`&&_t(i,e),e.Computed=o,(t=>{var n,r,i,a;function o(e){let t,n=null;try{n=B(null),t=e()}finally{B(n)}return t}t.untrack=o;function s(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw TypeError(`Called introspectSources without a Computed or Watcher argument`);return t[H].producerNode?.map(e=>e.wrapper)??[]}t.introspectSources=s;function c(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw TypeError(`Called introspectSinks without a Signal argument`);return t[H].liveConsumerNode?.map(e=>e.wrapper)??[]}t.introspectSinks=c;function l(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw TypeError(`Called hasSinks without a Signal argument`);let n=t[H].liveConsumerNode;return n?n.length>0:!1}t.hasSinks=l;function u(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw TypeError(`Called hasSources without a Computed or Watcher argument`);let n=t[H].producerNode;return n?n.length>0:!1}t.hasSources=u;class d{constructor(e){vt(this,r),vt(this,i),ht(this,n);let t=Object.create(Tt);t.wrapper=this,t.consumerMarkedDirty=e,t.consumerIsAlwaysLive=!0,t.consumerAllowSignalWrites=!1,t.producerNode=[],this[H]=t}watch(...t){if(!(0,e.isWatcher)(this))throw TypeError(`Called unwatch without Watcher receiver`);yt(this,i,a).call(this,t);let n=this[H];n.dirty=!1;let r=B(n);for(let e of t)Et(e[H]);B(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw TypeError(`Called unwatch without Watcher receiver`);yt(this,i,a).call(this,t);let n=this[H];V(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){It(n.producerNode[e],n.producerIndexOfThis[e]);let t=n.producerNode.length-1;if(n.producerNode[e]=n.producerNode[t],n.producerIndexOfThis[e]=n.producerIndexOfThis[t],n.producerNode.length--,n.producerIndexOfThis.length--,n.nextProducerIndex--,e<n.producerNode.length){let t=n.producerIndexOfThis[e],r=n.producerNode[e];Rt(r),r.liveConsumerIndexOfThis[t]=e}}}getPending(){if(!(0,e.isWatcher)(this))throw TypeError(`Called getPending without Watcher receiver`);return this[H].producerNode.filter(e=>e.dirty).map(e=>e.wrapper)}}n=H,r=new WeakSet,i=new WeakSet,a=function(t){for(let n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw TypeError(`Called watch/unwatch without a Computed or State argument`)},e.isWatcher=e=>_t(r,e),t.Watcher=d;function ee(){return Ct()?.wrapper}t.currentComputed=ee,t.watched=Symbol(`watched`),t.unwatched=Symbol(`unwatched`)})(e.subtle||={})})(U||={});var $t=Symbol(`SignalWatcherBrand`),en=new FinalizationRegistry((({watcher:e,signal:t})=>{e.unwatch(t)})),tn=new WeakMap;function nn(e){return!0===e[$t]?(console.warn(`SignalWatcher should not be applied to the same class more than once.`),e):class extends e{constructor(){super(...arguments),this._$St=new U.State(0),this._$Si=!1,this._$So=!0,this._$Sh=new Set}_$Sl(){if(this._$Su!==void 0)return;this._$Sv=new U.Computed((()=>{this._$St.get(),super.performUpdate()}));let e=this._$Su=new U.subtle.Watcher((function(){let e=tn.get(this);e!==void 0&&(!1===e._$Si&&e.requestUpdate(),this.watch())}));tn.set(e,this),en.register(this,{watcher:e,signal:this._$Sv}),e.watch(this._$Sv)}_$Sp(){this._$Su!==void 0&&(this._$Su.unwatch(this._$Sv),this._$Sv=void 0,this._$Su=void 0)}performUpdate(){this.isUpdatePending&&(this._$Sl(),this._$Si=!0,this._$St.set(this._$St.get()+1),this._$Si=!1,this._$Sv.get())}update(e){try{this._$So?(this._$So=!1,super.update(e)):this._$Sh.forEach((e=>e.commit()))}finally{this.isUpdatePending=!1,this._$Sh.clear()}}requestUpdate(e,t,n){this._$So=!0,super.requestUpdate(e,t,n)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),queueMicrotask((()=>{!1===this.isConnected&&this._$Sp()}))}_(e){this._$Sh.add(e);let t=this._$So;this.requestUpdate(),this._$So=t}m(e){this._$Sh.delete(e)}}}var rn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},{I:an}=He,on=(e,t)=>{let n=e._$AN;if(n===void 0)return!1;for(let e of n)e._$AO?.(t,!1),on(e,t);return!0},sn=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},cn=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),dn(t)}};function ln(e){this._$AN===void 0?this._$AM=e:(sn(this),this._$AM=e,cn(this))}function un(e,t=!1,n=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let e=n;e<r.length;e++)on(r[e],!1),sn(r[e]);else r!=null&&(on(r,!1),sn(r));else on(this,e)}var dn=e=>{e.type==rn.CHILD&&(e._$AP??=un,e._$AQ??=ln)};U.State,U.Computed;var fn=class extends Event{constructor(e,t,n,r){super(`context-request`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=n,this.subscribe=r??!1}},pn=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let n=t||!Object.is(e,this.o);this.o=e,n&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},e!==void 0&&(this.value=e)}addCallback(e,t,n){if(!n)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:r}=this.subscriptions.get(e);e(this.value,r)}clearCallbacks(){this.subscriptions.clear()}},mn=class extends Event{constructor(e,t){super(`context-provider`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},hn=class extends pn{constructor(e,t,n){super(t.context===void 0?n:t.initialValue),this.onContextRequest=e=>{if(e.context!==this.context)return;let t=e.contextTarget??e.composedPath()[0];t!==this.host&&(e.stopPropagation(),this.addCallback(e.callback,t,e.subscribe))},this.onProviderRequest=e=>{if(e.context!==this.context||(e.contextTarget??e.composedPath()[0])===this.host)return;let t=new Set;for(let[e,{consumerHost:n}]of this.subscriptions)t.has(e)||(t.add(e),n.dispatchEvent(new fn(this.context,n,e,!0)));e.stopPropagation()},this.host=e,t.context===void 0?this.context=t:this.context=t.context,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener(`context-request`,this.onContextRequest),this.host.addEventListener(`context-provider`,this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new mn(this.context,this.host))}};function gn({context:e}){return(t,n)=>{let r=new WeakMap;if(typeof n==`object`)return{get(){return t.get.call(this)},set(e){return r.get(this).setValue(e),t.set.call(this,e)},init(t){return r.set(this,new hn(this,{context:e,initialValue:t})),t}};{t.constructor.addInitializer((t=>{r.set(t,new hn(t,{context:e}))}));let i=Object.getOwnPropertyDescriptor(t,n),a;if(i===void 0){let e=new WeakMap;a={get(){return e.get(this)},set(t){r.get(this).setValue(t),e.set(this,t)},configurable:!0,enumerable:!0}}else{let e=i.set;a={...i,set(t){r.get(this).setValue(t),e?.call(this,t)}}}Object.defineProperty(t,n,a);return}}}var _n={"typography-f-sf":!0,"typography-fs-n":!0,"typography-w-500":!0,"layout-as-n":!0,"layout-dis-iflx":!0,"layout-al-c":!0},vn={"layout-w-100":!0},yn={"typography-f-s":!0,"typography-fs-n":!0,"typography-w-400":!0,"layout-mt-0":!0,"layout-mb-2":!0,"typography-sz-bm":!0,"color-c-n10":!0},bn={"typography-f-sf":!0,"typography-fs-n":!0,"typography-w-500":!0,"layout-pt-3":!0,"layout-pb-3":!0,"layout-pl-5":!0,"layout-pr-5":!0,"layout-mb-1":!0,"border-br-3":!0,"border-bw-0":!0,"border-c-n70":!0,"border-bs-s":!0,"color-bgc-s30":!0,"color-c-n100":!0,"behavior-ho-80":!0},xn={"typography-f-sf":!0,"typography-fs-n":!0,"typography-w-500":!0,"layout-mt-0":!0,"layout-mb-2":!0,"color-c-n10":!0},Sn={...xn,"typography-sz-tl":!0},Cn={...xn,"typography-sz-tm":!0},wn={...xn,"typography-sz-ts":!0},Tn={"behavior-sw-n":!0},En={"typography-f-sf":!0,"typography-fs-n":!0,"typography-w-400":!0,"layout-pl-4":!0,"layout-pr-4":!0,"layout-pt-2":!0,"layout-pb-2":!0,"border-br-3":!0,"border-bw-1":!0,"color-bc-s70":!0,"border-bs-s":!0,"layout-as-n":!0,"color-c-n10":!0},Dn={"typography-f-s":!0,"typography-fs-n":!0,"typography-w-400":!0,"layout-m-0":!0,"typography-sz-bm":!0,"layout-as-n":!0,"color-c-n10":!0},On={"typography-f-s":!0,"typography-fs-n":!0,"typography-w-400":!0,"layout-m-0":!0,"typography-sz-bm":!0,"layout-as-n":!0},kn={"typography-f-s":!0,"typography-fs-n":!0,"typography-w-400":!0,"layout-m-0":!0,"typography-sz-bm":!0,"layout-as-n":!0},An={"typography-f-s":!0,"typography-fs-n":!0,"typography-w-400":!0,"layout-m-0":!0,"typography-sz-bm":!0,"layout-as-n":!0},jn={"typography-f-c":!0,"typography-fs-n":!0,"typography-w-400":!0,"typography-sz-bm":!0,"typography-ws-p":!0,"layout-as-n":!0},Mn={...En,"layout-r-none":!0,"layout-fs-c":!0},Nn={"layout-el-cv":!0},Pn=t.v0_8.Styles.merge(_n,{"color-c-p30":!0}),Fn=t.v0_8.Styles.merge(En,{"color-c-n5":!0}),In=t.v0_8.Styles.merge(Mn,{"color-c-n5":!0}),Ln=t.v0_8.Styles.merge(bn,{"color-c-n100":!0}),Rn=t.v0_8.Styles.merge(Sn,{"color-c-n5":!0}),zn=t.v0_8.Styles.merge(Cn,{"color-c-n5":!0}),Bn=t.v0_8.Styles.merge(wn,{"color-c-n5":!0}),Vn=t.v0_8.Styles.merge(yn,{"color-c-n5":!0}),Hn=t.v0_8.Styles.merge(Dn,{"color-c-n60":!0}),Un=t.v0_8.Styles.merge(jn,{"color-c-n35":!0}),Wn=t.v0_8.Styles.merge(On,{"color-c-n35":!0}),Gn=t.v0_8.Styles.merge(kn,{"color-c-n35":!0}),Kn=t.v0_8.Styles.merge(An,{"color-c-n35":!0}),W={"--color-scheme":`light`,"--font-family":`"Montserrat", sans-serif`,"--font-family-flex":`"Montserrat", sans-serif`,"--p-30":`#00c73d`,"--p-60":`#66e08a`,"--p-80":`#c9f5d8`,"--p-100":`#ffffff`,"--s-30":`#f2f5f7`,"--s-70":`#d9dee4`,"--n-5":`#0b0b0b`,"--n-10":`#111827`,"--n-30":`#4b5563`,"--n-35":`#6b7280`,"--n-60":`#9ca3af`,"--n-70":`#cbd5e1`,"--n-90":`#e5e7eb`,"--n-98":`#f9fafb`,"--n-100":`#ffffff`};let qn={additionalStyles:{Card:{...W,"min-width":`320px`},Button:{...W,"--n-60":`var(--n-100)`},CheckBox:{...W},Column:{...W},DateTimeInput:{...W},Divider:{...W},Icon:{...W},Image:{...W,"max-width":`120px`,"max-height":`120px`,marginLeft:`auto`,marginRight:`auto`},List:{...W},Modal:{...W},MultipleChoice:{...W},Row:{...W},Slider:{...W},Tabs:{...W},Text:{...W},TextField:{...W},Video:{...W},AudioPlayer:{...W}},components:{AudioPlayer:{},Button:{"layout-pt-2":!0,"layout-pb-2":!0,"layout-pl-5":!0,"layout-pr-5":!0,"border-br-3":!0,"border-bw-0":!0,"border-bs-s":!0,"color-bgc-p30":!0,"color-c-n100":!0,"behavior-ho-70":!0},Card:{"border-br-3":!0,"color-bgc-p100":!0,"color-bc-n90":!0,"border-bw-1":!0,"border-bs-s":!0,"layout-pt-10":!0,"layout-pb-10":!0,"layout-pl-4":!0,"layout-pr-4":!0},CheckBox:{element:{"layout-m-0":!0,"layout-mr-2":!0,"layout-p-2":!0,"border-br-3":!0,"border-bw-1":!0,"border-bs-s":!0,"color-bgc-p100":!0,"color-bc-p60":!0,"color-c-n30":!0},label:{"color-c-n10":!0,"typography-f-sf":!0,"typography-v-r":!0,"typography-w-400":!0,"layout-flx-1":!0,"typography-sz-ll":!0},container:{"layout-dsp-iflex":!0,"layout-al-c":!0}},Column:{},DateTimeInput:{container:{},label:{},element:{"layout-pt-2":!0,"layout-pb-2":!0,"layout-pl-3":!0,"layout-pr-3":!0,"border-br-3":!0,"border-bw-1":!0,"border-bs-s":!0,"color-bgc-p100":!0,"color-bc-p60":!0,"color-c-n30":!0}},Divider:{"color-bgc-n90":!0,"layout-mt-6":!0,"layout-mb-6":!0},Image:{all:{"border-br-50pc":!0,"layout-el-cv":!0,"layout-w-100":!0,"layout-h-100":!0,"layout-dsp-flexhor":!0,"layout-al-c":!0,"layout-sp-c":!0,"layout-mb-3":!0},avatar:{},header:{},icon:{},largeFeature:{},mediumFeature:{},smallFeature:{}},Icon:{"border-br-1":!0,"layout-p-2":!0,"color-bgc-n98":!0,"layout-dsp-flexhor":!0,"layout-al-c":!0,"layout-sp-c":!0},List:{"layout-g-4":!0,"layout-p-2":!0},Modal:{backdrop:{"color-bbgc-p60_20":!0},element:{"border-br-3":!0,"color-bgc-p100":!0,"layout-p-4":!0,"border-bw-1":!0,"border-bs-s":!0,"color-bc-p80":!0}},MultipleChoice:{container:{},label:{},element:{}},Row:{"layout-g-4":!0,"layout-mb-3":!0},Slider:{container:{},label:{},element:{}},Tabs:{container:{},controls:{all:{},selected:{}},element:{}},Text:{all:{"layout-w-100":!0,"layout-g-2":!0,"color-c-n10":!0},h1:{"typography-f-sf":!0,"typography-ta-c":!0,"typography-v-r":!0,"typography-w-500":!0,"layout-mt-0":!0,"layout-mr-0":!0,"layout-ml-0":!0,"layout-mb-2":!0,"layout-p-0":!0,"typography-sz-tl":!0},h2:{"typography-f-sf":!0,"typography-ta-c":!0,"typography-v-r":!0,"typography-w-500":!0,"layout-mt-0":!0,"layout-mr-0":!0,"layout-ml-0":!0,"layout-mb-2":!0,"layout-p-0":!0,"typography-sz-tl":!0},h3:{"typography-f-sf":!0,"typography-ta-c":!0,"typography-v-r":!0,"typography-w-500":!0,"layout-mt-0":!0,"layout-mr-0":!0,"layout-ml-0":!0,"layout-mb-0":!0,"layout-p-0":!0,"typography-sz-ts":!0},h4:{"typography-f-sf":!0,"typography-ta-c":!0,"typography-v-r":!0,"typography-w-500":!0,"layout-mt-0":!0,"layout-mr-0":!0,"layout-ml-0":!0,"layout-mb-0":!0,"layout-p-0":!0,"typography-sz-bl":!0},h5:{"typography-f-sf":!0,"typography-ta-c":!0,"typography-v-r":!0,"typography-w-500":!0,"layout-mt-0":!0,"layout-mr-0":!0,"layout-ml-0":!0,"layout-mb-0":!0,"layout-p-0":!0,"color-c-n30":!0,"typography-sz-bm":!0,"layout-mb-1":!0},body:{},caption:{}},TextField:{container:{"typography-sz-bm":!0,"layout-w-100":!0,"layout-g-2":!0,"layout-dsp-flexhor":!0,"layout-al-c":!0},label:{"layout-flx-0":!0},element:{"typography-sz-bm":!0,"layout-pt-2":!0,"layout-pb-2":!0,"layout-pl-3":!0,"layout-pr-3":!0,"border-br-3":!0,"border-bw-1":!0,"border-bs-s":!0,"color-bgc-p100":!0,"color-bc-p60":!0,"color-c-n30":!0}},Video:{"border-br-5":!0,"layout-el-cv":!0}},elements:{a:Pn,audio:vn,body:Vn,button:Ln,h1:Rn,h2:zn,h3:Bn,h4:{},h5:{},iframe:Tn,input:Fn,p:Hn,pre:Un,textarea:In,video:Nn},markdown:{p:[...Object.keys(Hn)],h1:[...Object.keys(Rn)],h2:[...Object.keys(zn)],h3:[...Object.keys(Bn)],h4:[],h5:[],ul:[...Object.keys(Gn)],ol:[...Object.keys(Wn)],li:[...Object.keys(Kn)],a:[...Object.keys(Pn)],strong:[],em:[]}};var G=class extends nn(A){constructor(...e){super(...e),this.theme=qn,this.surfaceId=``,this.enableCustomElements=!0}static#e=this.styles=f`
536
+ `}};N([j({type:Boolean})],L.prototype,`isRunning`,void 0),N([j({type:String})],L.prototype,`disclaimer`,void 0),N([j({type:String})],L.prototype,`placeholder`,void 0),N([j({type:Array})],L.prototype,`prompts`,void 0),N([M()],L.prototype,`_value`,void 0),N([Ze(`textarea`)],L.prototype,`_textarea`,void 0),L=N([A(`agent-chat-composer`)],L);var pt=Object.defineProperty,mt=(e,t,n)=>t in e?pt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ht=(e,t,n)=>(mt(e,typeof t==`symbol`?t:t+``,n),n),gt=(e,t,n)=>{if(!t.has(e))throw TypeError(`Cannot `+n)},_t=(e,t)=>{if(Object(t)!==t)throw TypeError(`Cannot use the "in" operator on this value`);return e.has(t)},vt=(e,t,n)=>{if(t.has(e))throw TypeError(`Cannot add the same private member more than once`);t instanceof WeakSet?t.add(e):t.set(e,n)},yt=(e,t,n)=>(gt(e,t,`access private method`),n);function bt(e,t){return Object.is(e,t)}var R=null,z=!1,xt=1,St=Symbol(`SIGNAL`);function B(e){let t=R;return R=e,t}function Ct(){return R}function wt(){return z}var Tt={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function Et(e){if(z)throw Error(typeof ngDevMode<`u`&&ngDevMode?`Assertion error: signal read during notification phase`:``);if(R===null)return;R.consumerOnSignalRead(e);let t=R.nextProducerIndex++;if(V(R),t<R.producerNode.length&&R.producerNode[t]!==e&&Lt(R)){let e=R.producerNode[t];It(e,R.producerIndexOfThis[t])}R.producerNode[t]!==e&&(R.producerNode[t]=e,R.producerIndexOfThis[t]=Lt(R)?Ft(e,R,t):0),R.producerLastReadVersion[t]=e.version}function Dt(){xt++}function Ot(e){if(!(!e.dirty&&e.lastCleanEpoch===xt)){if(!e.producerMustRecompute(e)&&!Pt(e)){e.dirty=!1,e.lastCleanEpoch=xt;return}e.producerRecomputeValue(e),e.dirty=!1,e.lastCleanEpoch=xt}}function kt(e){if(e.liveConsumerNode===void 0)return;let t=z;z=!0;try{for(let t of e.liveConsumerNode)t.dirty||jt(t)}finally{z=t}}function At(){return R?.consumerAllowSignalWrites!==!1}function jt(e){var t;e.dirty=!0,kt(e),(t=e.consumerMarkedDirty)==null||t.call(e.wrapper??e)}function Mt(e){return e&&(e.nextProducerIndex=0),B(e)}function Nt(e,t){if(B(t),!(!e||e.producerNode===void 0||e.producerIndexOfThis===void 0||e.producerLastReadVersion===void 0)){if(Lt(e))for(let t=e.nextProducerIndex;t<e.producerNode.length;t++)It(e.producerNode[t],e.producerIndexOfThis[t]);for(;e.producerNode.length>e.nextProducerIndex;)e.producerNode.pop(),e.producerLastReadVersion.pop(),e.producerIndexOfThis.pop()}}function Pt(e){V(e);for(let t=0;t<e.producerNode.length;t++){let n=e.producerNode[t],r=e.producerLastReadVersion[t];if(r!==n.version||(Ot(n),r!==n.version))return!0}return!1}function Ft(e,t,n){var r;if(Rt(e),V(e),e.liveConsumerNode.length===0){(r=e.watched)==null||r.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)e.producerIndexOfThis[t]=Ft(e.producerNode[t],e,t)}return e.liveConsumerIndexOfThis.push(n),e.liveConsumerNode.push(t)-1}function It(e,t){var n;if(Rt(e),V(e),typeof ngDevMode<`u`&&ngDevMode&&t>=e.liveConsumerNode.length)throw Error(`Assertion error: active consumer index ${t} is out of bounds of ${e.liveConsumerNode.length} consumers)`);if(e.liveConsumerNode.length===1){(n=e.unwatched)==null||n.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)It(e.producerNode[t],e.producerIndexOfThis[t])}let r=e.liveConsumerNode.length-1;if(e.liveConsumerNode[t]=e.liveConsumerNode[r],e.liveConsumerIndexOfThis[t]=e.liveConsumerIndexOfThis[r],e.liveConsumerNode.length--,e.liveConsumerIndexOfThis.length--,t<e.liveConsumerNode.length){let n=e.liveConsumerIndexOfThis[t],r=e.liveConsumerNode[t];V(r),r.producerIndexOfThis[n]=t}}function Lt(e){return e.consumerIsAlwaysLive||(e?.liveConsumerNode?.length??0)>0}function V(e){e.producerNode??=[],e.producerIndexOfThis??=[],e.producerLastReadVersion??=[]}function Rt(e){e.liveConsumerNode??=[],e.liveConsumerIndexOfThis??=[]}function zt(e){if(Ot(e),Et(e),e.value===Ut)throw e.error;return e.value}function Bt(e){let t=Object.create(Wt);t.computation=e;let n=()=>zt(t);return n[St]=t,n}var Vt=Symbol(`UNSET`),Ht=Symbol(`COMPUTING`),Ut=Symbol(`ERRORED`),Wt=(()=>({...Tt,value:Vt,dirty:!0,error:null,equal:bt,producerMustRecompute(e){return e.value===Vt||e.value===Ht},producerRecomputeValue(e){if(e.value===Ht)throw Error(`Detected cycle in computations.`);let t=e.value;e.value=Ht;let n=Mt(e),r,i=!1;try{r=e.computation.call(e.wrapper),i=t!==Vt&&t!==Ut&&e.equal.call(e.wrapper,t,r)}catch(t){r=Ut,e.error=t}finally{Nt(e,n)}if(i){e.value=t;return}e.value=r,e.version++}}))();function Gt(){throw Error()}var Kt=Gt;function qt(){Kt()}function Jt(e){let t=Object.create(Zt);t.value=e;let n=()=>(Et(t),t.value);return n[St]=t,n}function Yt(){return Et(this),this.value}function Xt(e,t){At()||qt(),e.equal.call(e.wrapper,e.value,t)||(e.value=t,Qt(e))}var Zt=(()=>({...Tt,equal:bt,value:void 0}))();function Qt(e){e.version++,Dt(),kt(e)}var H=Symbol(`node`),U;(e=>{var t,n,r,i;class a{constructor(r,i={}){vt(this,n),ht(this,t);let a=Jt(r)[St];if(this[H]=a,a.wrapper=this,i){let t=i.equals;t&&(a.equal=t),a.watched=i[e.subtle.watched],a.unwatched=i[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw TypeError(`Wrong receiver type for Signal.State.prototype.get`);return Yt.call(this[H])}set(t){if(!(0,e.isState)(this))throw TypeError(`Wrong receiver type for Signal.State.prototype.set`);if(wt())throw Error(`Writes to signals not permitted during Watcher callback`);let n=this[H];Xt(n,t)}}t=H,n=new WeakSet,e.isState=e=>typeof e==`object`&&_t(n,e),e.State=a;class o{constructor(t,n){vt(this,i),ht(this,r);let a=Bt(t)[St];if(a.consumerAllowSignalWrites=!0,this[H]=a,a.wrapper=this,n){let t=n.equals;t&&(a.equal=t),a.watched=n[e.subtle.watched],a.unwatched=n[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw TypeError(`Wrong receiver type for Signal.Computed.prototype.get`);return zt(this[H])}}r=H,i=new WeakSet,e.isComputed=e=>typeof e==`object`&&_t(i,e),e.Computed=o,(t=>{var n,r,i,a;function o(e){let t,n=null;try{n=B(null),t=e()}finally{B(n)}return t}t.untrack=o;function s(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw TypeError(`Called introspectSources without a Computed or Watcher argument`);return t[H].producerNode?.map(e=>e.wrapper)??[]}t.introspectSources=s;function c(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw TypeError(`Called introspectSinks without a Signal argument`);return t[H].liveConsumerNode?.map(e=>e.wrapper)??[]}t.introspectSinks=c;function l(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw TypeError(`Called hasSinks without a Signal argument`);let n=t[H].liveConsumerNode;return n?n.length>0:!1}t.hasSinks=l;function u(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw TypeError(`Called hasSources without a Computed or Watcher argument`);let n=t[H].producerNode;return n?n.length>0:!1}t.hasSources=u;class d{constructor(e){vt(this,r),vt(this,i),ht(this,n);let t=Object.create(Tt);t.wrapper=this,t.consumerMarkedDirty=e,t.consumerIsAlwaysLive=!0,t.consumerAllowSignalWrites=!1,t.producerNode=[],this[H]=t}watch(...t){if(!(0,e.isWatcher)(this))throw TypeError(`Called unwatch without Watcher receiver`);yt(this,i,a).call(this,t);let n=this[H];n.dirty=!1;let r=B(n);for(let e of t)Et(e[H]);B(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw TypeError(`Called unwatch without Watcher receiver`);yt(this,i,a).call(this,t);let n=this[H];V(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){It(n.producerNode[e],n.producerIndexOfThis[e]);let t=n.producerNode.length-1;if(n.producerNode[e]=n.producerNode[t],n.producerIndexOfThis[e]=n.producerIndexOfThis[t],n.producerNode.length--,n.producerIndexOfThis.length--,n.nextProducerIndex--,e<n.producerNode.length){let t=n.producerIndexOfThis[e],r=n.producerNode[e];Rt(r),r.liveConsumerIndexOfThis[t]=e}}}getPending(){if(!(0,e.isWatcher)(this))throw TypeError(`Called getPending without Watcher receiver`);return this[H].producerNode.filter(e=>e.dirty).map(e=>e.wrapper)}}n=H,r=new WeakSet,i=new WeakSet,a=function(t){for(let n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw TypeError(`Called watch/unwatch without a Computed or State argument`)},e.isWatcher=e=>_t(r,e),t.Watcher=d;function ee(){return Ct()?.wrapper}t.currentComputed=ee,t.watched=Symbol(`watched`),t.unwatched=Symbol(`unwatched`)})(e.subtle||={})})(U||={});var $t=Symbol(`SignalWatcherBrand`),en=new FinalizationRegistry((({watcher:e,signal:t})=>{e.unwatch(t)})),tn=new WeakMap;function nn(e){return!0===e[$t]?(console.warn(`SignalWatcher should not be applied to the same class more than once.`),e):class extends e{constructor(){super(...arguments),this._$St=new U.State(0),this._$Si=!1,this._$So=!0,this._$Sh=new Set}_$Sl(){if(this._$Su!==void 0)return;this._$Sv=new U.Computed((()=>{this._$St.get(),super.performUpdate()}));let e=this._$Su=new U.subtle.Watcher((function(){let e=tn.get(this);e!==void 0&&(!1===e._$Si&&e.requestUpdate(),this.watch())}));tn.set(e,this),en.register(this,{watcher:e,signal:this._$Sv}),e.watch(this._$Sv)}_$Sp(){this._$Su!==void 0&&(this._$Su.unwatch(this._$Sv),this._$Sv=void 0,this._$Su=void 0)}performUpdate(){this.isUpdatePending&&(this._$Sl(),this._$Si=!0,this._$St.set(this._$St.get()+1),this._$Si=!1,this._$Sv.get())}update(e){try{this._$So?(this._$So=!1,super.update(e)):this._$Sh.forEach((e=>e.commit()))}finally{this.isUpdatePending=!1,this._$Sh.clear()}}requestUpdate(e,t,n){this._$So=!0,super.requestUpdate(e,t,n)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),queueMicrotask((()=>{!1===this.isConnected&&this._$Sp()}))}_(e){this._$Sh.add(e);let t=this._$So;this.requestUpdate(),this._$So=t}m(e){this._$Sh.delete(e)}}}var rn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},{I:an}=Ue,on=(e,t)=>{let n=e._$AN;if(n===void 0)return!1;for(let e of n)e._$AO?.(t,!1),on(e,t);return!0},sn=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},cn=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),dn(t)}};function ln(e){this._$AN===void 0?this._$AM=e:(sn(this),this._$AM=e,cn(this))}function un(e,t=!1,n=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let e=n;e<r.length;e++)on(r[e],!1),sn(r[e]);else r!=null&&(on(r,!1),sn(r));else on(this,e)}var dn=e=>{e.type==rn.CHILD&&(e._$AP??=un,e._$AQ??=ln)};U.State,U.Computed;var fn=class extends Event{constructor(e,t,n,r){super(`context-request`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=n,this.subscribe=r??!1}},pn=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let n=t||!Object.is(e,this.o);this.o=e,n&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},e!==void 0&&(this.value=e)}addCallback(e,t,n){if(!n)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:r}=this.subscriptions.get(e);e(this.value,r)}clearCallbacks(){this.subscriptions.clear()}},mn=class extends Event{constructor(e,t){super(`context-provider`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},hn=class extends pn{constructor(e,t,n){super(t.context===void 0?n:t.initialValue),this.onContextRequest=e=>{if(e.context!==this.context)return;let t=e.contextTarget??e.composedPath()[0];t!==this.host&&(e.stopPropagation(),this.addCallback(e.callback,t,e.subscribe))},this.onProviderRequest=e=>{if(e.context!==this.context||(e.contextTarget??e.composedPath()[0])===this.host)return;let t=new Set;for(let[e,{consumerHost:n}]of this.subscriptions)t.has(e)||(t.add(e),n.dispatchEvent(new fn(this.context,n,e,!0)));e.stopPropagation()},this.host=e,t.context===void 0?this.context=t:this.context=t.context,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener(`context-request`,this.onContextRequest),this.host.addEventListener(`context-provider`,this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new mn(this.context,this.host))}};function gn({context:e}){return(t,n)=>{let r=new WeakMap;if(typeof n==`object`)return{get(){return t.get.call(this)},set(e){return r.get(this).setValue(e),t.set.call(this,e)},init(t){return r.set(this,new hn(this,{context:e,initialValue:t})),t}};{t.constructor.addInitializer((t=>{r.set(t,new hn(t,{context:e}))}));let i=Object.getOwnPropertyDescriptor(t,n),a;if(i===void 0){let e=new WeakMap;a={get(){return e.get(this)},set(t){r.get(this).setValue(t),e.set(this,t)},configurable:!0,enumerable:!0}}else{let e=i.set;a={...i,set(t){r.get(this).setValue(t),e?.call(this,t)}}}Object.defineProperty(t,n,a);return}}}var _n={"typography-f-sf":!0,"typography-fs-n":!0,"typography-w-500":!0,"layout-as-n":!0,"layout-dis-iflx":!0,"layout-al-c":!0},vn={"layout-w-100":!0},yn={"typography-f-s":!0,"typography-fs-n":!0,"typography-w-400":!0,"layout-mt-0":!0,"layout-mb-2":!0,"typography-sz-bm":!0,"color-c-n10":!0},bn={"typography-f-sf":!0,"typography-fs-n":!0,"typography-w-500":!0,"layout-pt-3":!0,"layout-pb-3":!0,"layout-pl-5":!0,"layout-pr-5":!0,"layout-mb-1":!0,"border-br-3":!0,"border-bw-0":!0,"border-c-n70":!0,"border-bs-s":!0,"color-bgc-s30":!0,"color-c-n100":!0,"behavior-ho-80":!0},xn={"typography-f-sf":!0,"typography-fs-n":!0,"typography-w-500":!0,"layout-mt-0":!0,"layout-mb-2":!0,"color-c-n10":!0},Sn={...xn,"typography-sz-tl":!0},Cn={...xn,"typography-sz-tm":!0},wn={...xn,"typography-sz-ts":!0},Tn={"behavior-sw-n":!0},En={"typography-f-sf":!0,"typography-fs-n":!0,"typography-w-400":!0,"layout-pl-4":!0,"layout-pr-4":!0,"layout-pt-2":!0,"layout-pb-2":!0,"border-br-3":!0,"border-bw-1":!0,"color-bc-s70":!0,"border-bs-s":!0,"layout-as-n":!0,"color-c-n10":!0},Dn={"typography-f-s":!0,"typography-fs-n":!0,"typography-w-400":!0,"layout-m-0":!0,"typography-sz-bm":!0,"layout-as-n":!0,"color-c-n10":!0},On={"typography-f-s":!0,"typography-fs-n":!0,"typography-w-400":!0,"layout-m-0":!0,"typography-sz-bm":!0,"layout-as-n":!0},kn={"typography-f-s":!0,"typography-fs-n":!0,"typography-w-400":!0,"layout-m-0":!0,"typography-sz-bm":!0,"layout-as-n":!0},An={"typography-f-s":!0,"typography-fs-n":!0,"typography-w-400":!0,"layout-m-0":!0,"typography-sz-bm":!0,"layout-as-n":!0},jn={"typography-f-c":!0,"typography-fs-n":!0,"typography-w-400":!0,"typography-sz-bm":!0,"typography-ws-p":!0,"layout-as-n":!0},Mn={...En,"layout-r-none":!0,"layout-fs-c":!0},Nn={"layout-el-cv":!0},Pn=t.v0_8.Styles.merge(_n,{"color-c-p30":!0}),Fn=t.v0_8.Styles.merge(En,{"color-c-n5":!0}),In=t.v0_8.Styles.merge(Mn,{"color-c-n5":!0}),Ln=t.v0_8.Styles.merge(bn,{"color-c-n100":!0}),Rn=t.v0_8.Styles.merge(Sn,{"color-c-n5":!0}),zn=t.v0_8.Styles.merge(Cn,{"color-c-n5":!0}),Bn=t.v0_8.Styles.merge(wn,{"color-c-n5":!0}),Vn=t.v0_8.Styles.merge(yn,{"color-c-n5":!0}),Hn=t.v0_8.Styles.merge(Dn,{"color-c-n60":!0}),Un=t.v0_8.Styles.merge(jn,{"color-c-n35":!0}),Wn=t.v0_8.Styles.merge(On,{"color-c-n35":!0}),Gn=t.v0_8.Styles.merge(kn,{"color-c-n35":!0}),Kn=t.v0_8.Styles.merge(An,{"color-c-n35":!0}),W={"--color-scheme":`light`,"--font-family":`"Montserrat", sans-serif`,"--font-family-flex":`"Montserrat", sans-serif`,"--p-30":`#00c73d`,"--p-60":`#66e08a`,"--p-80":`#c9f5d8`,"--p-100":`#ffffff`,"--s-30":`#f2f5f7`,"--s-70":`#d9dee4`,"--n-5":`#0b0b0b`,"--n-10":`#111827`,"--n-30":`#4b5563`,"--n-35":`#6b7280`,"--n-60":`#9ca3af`,"--n-70":`#cbd5e1`,"--n-90":`#e5e7eb`,"--n-98":`#f9fafb`,"--n-100":`#ffffff`};let qn={additionalStyles:{Card:{...W,"min-width":`320px`},Button:{...W,"--n-60":`var(--n-100)`},CheckBox:{...W},Column:{...W},DateTimeInput:{...W},Divider:{...W},Icon:{...W},Image:{...W,"max-width":`120px`,"max-height":`120px`,marginLeft:`auto`,marginRight:`auto`},List:{...W},Modal:{...W},MultipleChoice:{...W},Row:{...W},Slider:{...W},Tabs:{...W},Text:{...W},TextField:{...W},Video:{...W},AudioPlayer:{...W}},components:{AudioPlayer:{},Button:{"layout-pt-2":!0,"layout-pb-2":!0,"layout-pl-5":!0,"layout-pr-5":!0,"border-br-3":!0,"border-bw-0":!0,"border-bs-s":!0,"color-bgc-p30":!0,"color-c-n100":!0,"behavior-ho-70":!0},Card:{"border-br-3":!0,"color-bgc-p100":!0,"color-bc-n90":!0,"border-bw-1":!0,"border-bs-s":!0,"layout-pt-10":!0,"layout-pb-10":!0,"layout-pl-4":!0,"layout-pr-4":!0},CheckBox:{element:{"layout-m-0":!0,"layout-mr-2":!0,"layout-p-2":!0,"border-br-3":!0,"border-bw-1":!0,"border-bs-s":!0,"color-bgc-p100":!0,"color-bc-p60":!0,"color-c-n30":!0},label:{"color-c-n10":!0,"typography-f-sf":!0,"typography-v-r":!0,"typography-w-400":!0,"layout-flx-1":!0,"typography-sz-ll":!0},container:{"layout-dsp-iflex":!0,"layout-al-c":!0}},Column:{},DateTimeInput:{container:{},label:{},element:{"layout-pt-2":!0,"layout-pb-2":!0,"layout-pl-3":!0,"layout-pr-3":!0,"border-br-3":!0,"border-bw-1":!0,"border-bs-s":!0,"color-bgc-p100":!0,"color-bc-p60":!0,"color-c-n30":!0}},Divider:{"color-bgc-n90":!0,"layout-mt-6":!0,"layout-mb-6":!0},Image:{all:{"border-br-50pc":!0,"layout-el-cv":!0,"layout-w-100":!0,"layout-h-100":!0,"layout-dsp-flexhor":!0,"layout-al-c":!0,"layout-sp-c":!0,"layout-mb-3":!0},avatar:{},header:{},icon:{},largeFeature:{},mediumFeature:{},smallFeature:{}},Icon:{"border-br-1":!0,"layout-p-2":!0,"color-bgc-n98":!0,"layout-dsp-flexhor":!0,"layout-al-c":!0,"layout-sp-c":!0},List:{"layout-g-4":!0,"layout-p-2":!0},Modal:{backdrop:{"color-bbgc-p60_20":!0},element:{"border-br-3":!0,"color-bgc-p100":!0,"layout-p-4":!0,"border-bw-1":!0,"border-bs-s":!0,"color-bc-p80":!0}},MultipleChoice:{container:{},label:{},element:{}},Row:{"layout-g-4":!0,"layout-mb-3":!0},Slider:{container:{},label:{},element:{}},Tabs:{container:{},controls:{all:{},selected:{}},element:{}},Text:{all:{"layout-w-100":!0,"layout-g-2":!0,"color-c-n10":!0},h1:{"typography-f-sf":!0,"typography-ta-c":!0,"typography-v-r":!0,"typography-w-500":!0,"layout-mt-0":!0,"layout-mr-0":!0,"layout-ml-0":!0,"layout-mb-2":!0,"layout-p-0":!0,"typography-sz-tl":!0},h2:{"typography-f-sf":!0,"typography-ta-c":!0,"typography-v-r":!0,"typography-w-500":!0,"layout-mt-0":!0,"layout-mr-0":!0,"layout-ml-0":!0,"layout-mb-2":!0,"layout-p-0":!0,"typography-sz-tl":!0},h3:{"typography-f-sf":!0,"typography-ta-c":!0,"typography-v-r":!0,"typography-w-500":!0,"layout-mt-0":!0,"layout-mr-0":!0,"layout-ml-0":!0,"layout-mb-0":!0,"layout-p-0":!0,"typography-sz-ts":!0},h4:{"typography-f-sf":!0,"typography-ta-c":!0,"typography-v-r":!0,"typography-w-500":!0,"layout-mt-0":!0,"layout-mr-0":!0,"layout-ml-0":!0,"layout-mb-0":!0,"layout-p-0":!0,"typography-sz-bl":!0},h5:{"typography-f-sf":!0,"typography-ta-c":!0,"typography-v-r":!0,"typography-w-500":!0,"layout-mt-0":!0,"layout-mr-0":!0,"layout-ml-0":!0,"layout-mb-0":!0,"layout-p-0":!0,"color-c-n30":!0,"typography-sz-bm":!0,"layout-mb-1":!0},body:{},caption:{}},TextField:{container:{"typography-sz-bm":!0,"layout-w-100":!0,"layout-g-2":!0,"layout-dsp-flexhor":!0,"layout-al-c":!0},label:{"layout-flx-0":!0},element:{"typography-sz-bm":!0,"layout-pt-2":!0,"layout-pb-2":!0,"layout-pl-3":!0,"layout-pr-3":!0,"border-br-3":!0,"border-bw-1":!0,"border-bs-s":!0,"color-bgc-p100":!0,"color-bc-p60":!0,"color-c-n30":!0}},Video:{"border-br-5":!0,"layout-el-cv":!0}},elements:{a:Pn,audio:vn,body:Vn,button:Ln,h1:Rn,h2:zn,h3:Bn,h4:{},h5:{},iframe:Tn,input:Fn,p:Hn,pre:Un,textarea:In,video:Nn},markdown:{p:[...Object.keys(Hn)],h1:[...Object.keys(Rn)],h2:[...Object.keys(zn)],h3:[...Object.keys(Bn)],h4:[],h5:[],ul:[...Object.keys(Gn)],ol:[...Object.keys(Wn)],li:[...Object.keys(Kn)],a:[...Object.keys(Pn)],strong:[],em:[]}};var G=class extends nn(k){constructor(...e){super(...e),this.theme=qn,this.surfaceId=``,this.enableCustomElements=!0}static#e=this.styles=f`
495
537
  :host {
496
538
  display: block;
497
539
  }
498
- `;render(){if(!this.surfaceId||!this.processor)return C``;let e=this.surface||this.processor.getSurfaces().get(this.surfaceId);return e?C`
540
+ `;render(){if(!this.surfaceId||!this.processor)return S``;let e=this.surface||this.processor.getSurfaces().get(this.surfaceId);return e?S`
499
541
  <a2ui-surface
500
542
  .surfaceId=${this.surfaceId}
501
543
  .surface=${e}
502
544
  .processor=${this.processor}
503
545
  .enableCustomElements=${this.enableCustomElements}
504
546
  ></a2ui-surface>
505
- `:(console.warn(`A2UIThemeProvider: Surface ${this.surfaceId} not found in processor`,this.processor.getSurfaces()),C`<!-- Surface ${this.surfaceId} not found -->`)}};P([gn({context:n.Context.themeContext})],G.prototype,`theme`,void 0),P([M({type:String})],G.prototype,`surfaceId`,void 0),P([M({type:Object})],G.prototype,`surface`,void 0),P([M({type:Object})],G.prototype,`processor`,void 0),P([M({type:Boolean})],G.prototype,`enableCustomElements`,void 0),G=P([j(`a2ui-theme-provider`)],G);let Jn=f`
547
+ `:(console.warn(`A2UIThemeProvider: Surface ${this.surfaceId} not found in processor`,this.processor.getSurfaces()),S`<!-- Surface ${this.surfaceId} not found -->`)}};N([gn({context:n.Context.themeContext})],G.prototype,`theme`,void 0),N([j({type:String})],G.prototype,`surfaceId`,void 0),N([j({type:Object})],G.prototype,`surface`,void 0),N([j({type:Object})],G.prototype,`processor`,void 0),N([j({type:Boolean})],G.prototype,`enableCustomElements`,void 0),G=N([A(`a2ui-theme-provider`)],G);let Jn=f`
506
548
  :host {
507
549
  display: block;
508
550
  position: absolute;
@@ -565,18 +607,18 @@
565
607
  color: #999;
566
608
  font-size: 0.9rem;
567
609
  }
568
- `;var Yn=class extends A{constructor(...e){super(...e),this.conversations=[],this.open=!1}static#e=this.styles=Jn;_handleSelect(e){this.dispatchEvent(new CustomEvent(`select-thread`,{detail:{conversation:e},bubbles:!0,composed:!0}))}render(){return C`
610
+ `;var Yn=class extends k{constructor(...e){super(...e),this.conversations=[],this.open=!1}static#e=this.styles=Jn;_handleSelect(e){this.dispatchEvent(new CustomEvent(`select-thread`,{detail:{conversation:e},bubbles:!0,composed:!0}))}render(){return S`
569
611
  <div class="header">
570
612
  Conversaciones
571
613
  </div>
572
614
  <ul class="list">
573
- ${this.conversations.length===0?C`<div class="empty-state">No hay conversaciones recientes</div>`:this.conversations.map(e=>C`
615
+ ${this.conversations.length===0?S`<div class="empty-state">No hay conversaciones recientes</div>`:this.conversations.map(e=>S`
574
616
  <li class="item" @click="${()=>this._handleSelect(e)}">
575
617
  ${e.title}
576
618
  </li>
577
619
  `)}
578
620
  </ul>
579
- `}};P([M({type:Array})],Yn.prototype,`conversations`,void 0),P([M({type:Boolean,reflect:!0})],Yn.prototype,`open`,void 0),Yn=P([j(`agent-chat-history-list`)],Yn);let K=new class extends EventTarget{constructor(...e){super(...e),this._context=null,this._state=null,this._messages=[],this._stream=[]}get context(){return this._context}get state(){return this._state}get messages(){return this._messages}get stream(){return this._stream}setContext(e){this._context=e,this.notify()}setState(e){this._state=e,this.notify()}setMessages(e){this._messages=[...e],this.notify()}addEvent(e,t){this._stream=[{event:e,content:t,time:new Date().toTimeString().split(` `)[0]},...this._stream].slice(0,100),this.notify()}clearStream(){this._stream=[],this.notify()}notify(){this.dispatchEvent(new CustomEvent(`inspector-change`))}},Xn=f`
621
+ `}};N([j({type:Array})],Yn.prototype,`conversations`,void 0),N([j({type:Boolean,reflect:!0})],Yn.prototype,`open`,void 0),Yn=N([A(`agent-chat-history-list`)],Yn);let K=new class extends EventTarget{constructor(...e){super(...e),this._context=null,this._state=null,this._messages=[],this._stream=[]}get context(){return this._context}get state(){return this._state}get messages(){return this._messages}get stream(){return this._stream}setContext(e){this._context=e,this.notify()}setState(e){this._state=e,this.notify()}setMessages(e){this._messages=[...e],this.notify()}addEvent(e,t){this._stream=[{event:e,content:t,time:new Date().toTimeString().split(` `)[0]},...this._stream].slice(0,100),this.notify()}clearStream(){this._stream=[],this.notify()}notify(){this.dispatchEvent(new CustomEvent(`inspector-change`))}},Xn=f`
580
622
  :host {
581
623
  position: absolute;
582
624
  bottom: 60px;
@@ -829,7 +871,7 @@
829
871
  justify-content: flex-end;
830
872
  }
831
873
 
832
- `;var q=class extends A{constructor(...e){super(...e),this._activeTab=`stream`,this._context=null,this._appState=null,this._messages=[],this._stream=[],this._isEditing=!1,this._editedData=``,this._isDragging=!1,this._isResizing=!1,this._currentX=0,this._currentY=0,this._initialX=0,this._initialY=0,this._xOffset=0,this._yOffset=0,this._initialWidth=0,this._initialHeight=0,this._onMouseMove=e=>{this._isDragging?this._drag(e):this._isResizing&&this._resize(e)},this._onMouseUp=()=>{this._isDragging?this._dragEnd():this._isResizing&&this._resizeEnd()},this._onInspectorChange=()=>{this._updateData()}}static#e=this.styles=Xn;connectedCallback(){super.connectedCallback(),K.addEventListener(`inspector-change`,this._onInspectorChange),window.addEventListener(`mousemove`,this._onMouseMove),window.addEventListener(`mouseup`,this._onMouseUp),this._updateData()}disconnectedCallback(){super.disconnectedCallback(),K.removeEventListener(`inspector-change`,this._onInspectorChange),window.removeEventListener(`mousemove`,this._onMouseMove),window.removeEventListener(`mouseup`,this._onMouseUp)}_updateData(){this._context=K.context,this._appState=K.state,this._messages=K.messages,this._stream=K.stream,this.requestUpdate()}_handleClose(){this.dispatchEvent(new CustomEvent(`close`))}_dragStart(e){e.target&&e.target.closest(`.close-button`)||(e.type===`touchstart`?(this._initialX=e.touches[0].clientX-this._xOffset,this._initialY=e.touches[0].clientY-this._yOffset):(this._initialX=e.clientX-this._xOffset,this._initialY=e.clientY-this._yOffset),this._isDragging=!0)}_drag(e){this._isDragging&&(e.type!==`mousemove`&&e.preventDefault(),e.type===`touchmove`?(this._currentX=e.touches[0].clientX-this._initialX,this._currentY=e.touches[0].clientY-this._initialY):(this._currentX=e.clientX-this._initialX,this._currentY=e.clientY-this._initialY),this._xOffset=this._currentX,this._yOffset=this._currentY,this._setTranslate(this._currentX,this._currentY))}_dragEnd(){this._initialX=this._currentX,this._initialY=this._currentY,this._isDragging=!1}_resizeStart(e){e.preventDefault(),e.stopPropagation(),this._isResizing=!0,this._initialX=e.clientX,this._initialY=e.clientY,this._initialWidth=this.getBoundingClientRect().width,this._initialHeight=this.getBoundingClientRect().height}_resize(e){if(this._isResizing){let t=e.clientX-this._initialX,n=e.clientY-this._initialY;this.style.width=`${this._initialWidth+t}px`,this.style.height=`${this._initialHeight+n}px`}}_resizeEnd(){this._isResizing=!1}_setTranslate(e,t){this.style.transform=`translate3d(${e}px, ${t}px, 0)`}render(){return C`
874
+ `;var q=class extends k{constructor(...e){super(...e),this._activeTab=`stream`,this._context=null,this._appState=null,this._messages=[],this._stream=[],this._isEditing=!1,this._editedData=``,this._isDragging=!1,this._isResizing=!1,this._currentX=0,this._currentY=0,this._initialX=0,this._initialY=0,this._xOffset=0,this._yOffset=0,this._initialWidth=0,this._initialHeight=0,this._onMouseMove=e=>{this._isDragging?this._drag(e):this._isResizing&&this._resize(e)},this._onMouseUp=()=>{this._isDragging?this._dragEnd():this._isResizing&&this._resizeEnd()},this._onInspectorChange=()=>{this._updateData()}}static#e=this.styles=Xn;connectedCallback(){super.connectedCallback(),K.addEventListener(`inspector-change`,this._onInspectorChange),window.addEventListener(`mousemove`,this._onMouseMove),window.addEventListener(`mouseup`,this._onMouseUp),this._updateData()}disconnectedCallback(){super.disconnectedCallback(),K.removeEventListener(`inspector-change`,this._onInspectorChange),window.removeEventListener(`mousemove`,this._onMouseMove),window.removeEventListener(`mouseup`,this._onMouseUp)}_updateData(){this._context=K.context,this._appState=K.state,this._messages=K.messages,this._stream=K.stream,this.requestUpdate()}_handleClose(){this.dispatchEvent(new CustomEvent(`close`))}_dragStart(e){e.target&&e.target.closest(`.close-button`)||(e.type===`touchstart`?(this._initialX=e.touches[0].clientX-this._xOffset,this._initialY=e.touches[0].clientY-this._yOffset):(this._initialX=e.clientX-this._xOffset,this._initialY=e.clientY-this._yOffset),this._isDragging=!0)}_drag(e){this._isDragging&&(e.type!==`mousemove`&&e.preventDefault(),e.type===`touchmove`?(this._currentX=e.touches[0].clientX-this._initialX,this._currentY=e.touches[0].clientY-this._initialY):(this._currentX=e.clientX-this._initialX,this._currentY=e.clientY-this._initialY),this._xOffset=this._currentX,this._yOffset=this._currentY,this._setTranslate(this._currentX,this._currentY))}_dragEnd(){this._initialX=this._currentX,this._initialY=this._currentY,this._isDragging=!1}_resizeStart(e){e.preventDefault(),e.stopPropagation(),this._isResizing=!0,this._initialX=e.clientX,this._initialY=e.clientY,this._initialWidth=this.getBoundingClientRect().width,this._initialHeight=this.getBoundingClientRect().height}_resize(e){if(this._isResizing){let t=e.clientX-this._initialX,n=e.clientY-this._initialY;this.style.width=`${this._initialWidth+t}px`,this.style.height=`${this._initialHeight+n}px`}}_resizeEnd(){this._isResizing=!1}_setTranslate(e,t){this.style.transform=`translate3d(${e}px, ${t}px, 0)`}render(){return S`
833
875
  <div class="header"
834
876
  @mousedown="${this._dragStart}"
835
877
  @touchstart="${this._dragStart}"
@@ -851,9 +893,9 @@
851
893
  ${this._renderContent()}
852
894
  </div>
853
895
  <div class="resize-handle" @mousedown="${this._resizeStart}"></div>
854
- `}_renderContent(){switch(this._activeTab){case`context`:return this._renderEditableSection(`context`,this._context);case`state`:return this._renderEditableSection(`state`,this._appState);case`messages`:return C`<pre>${JSON.stringify(this._messages,null,2)}</pre>`;case`stream`:return C`
896
+ `}_renderContent(){switch(this._activeTab){case`context`:return this._renderEditableSection(`context`,this._context);case`state`:return this._renderEditableSection(`state`,this._appState);case`messages`:return S`<pre>${JSON.stringify(this._messages,null,2)}</pre>`;case`stream`:return S`
855
897
  <div class="stream-list">
856
- ${this._stream.map(e=>C`
898
+ ${this._stream.map(e=>S`
857
899
  <div class="event-item">
858
900
  <div class="event-header">
859
901
  <span class="event-name">${e.event}</span>
@@ -867,9 +909,9 @@
867
909
  </div>
868
910
  </div>
869
911
  `)}
870
- ${this._stream.length===0?C`<div style="color: #9ca3af; text-align: center; padding: 20px;">No events yet</div>`:``}
912
+ ${this._stream.length===0?S`<div style="color: #9ca3af; text-align: center; padding: 20px;">No events yet</div>`:``}
871
913
  </div>
872
- `}}_renderEditableSection(e,t){return this._isEditing?C`
914
+ `}}_renderEditableSection(e,t){return this._isEditing?S`
873
915
  <div class="editor-container">
874
916
  <textarea
875
917
  class="context-editor"
@@ -881,15 +923,15 @@
881
923
  <button class="save-button" @click="${()=>this._handleSave(e)}">Save Changes</button>
882
924
  </div>
883
925
  </div>
884
- `:C`
926
+ `:S`
885
927
  <div class="context-header">
886
928
  <span>Current ${e===`context`?`Static Context`:`Dynamic State`}</span>
887
929
  <button class="edit-button" @click="${()=>this._handleEdit(t)}">Edit</button>
888
930
  </div>
889
931
  <pre>${JSON.stringify(t,null,2)}</pre>
890
- `}_handleEdit(e){this._editedData=JSON.stringify(e,null,2),this._isEditing=!0}_handleCancelEdit(){this._isEditing=!1}_handleSave(e){try{let t=JSON.parse(this._editedData),n=e===`context`?`context-update`:`state-update`;this.dispatchEvent(new CustomEvent(n,{detail:t,bubbles:!0,composed:!0})),this._isEditing=!1}catch(e){alert(`Invalid JSON: `+e.message)}}};P([N()],q.prototype,`_activeTab`,void 0),P([N()],q.prototype,`_context`,void 0),P([N()],q.prototype,`_appState`,void 0),P([N()],q.prototype,`_messages`,void 0),P([N()],q.prototype,`_stream`,void 0),P([N()],q.prototype,`_isEditing`,void 0),P([N()],q.prototype,`_editedData`,void 0),q=P([j(`agent-inspector-window`)],q);var Zn={thread:`thr`,message:`msg`,toolCall:`tc`,workflow:`wf`,task:`tsk`,attachment:`atc`,sdkHiddenContext:`shcx`};function Qn(e){return`${Zn[e]}_${crypto.randomUUID().replace(/-/g,``).slice(0,8)}`}var $n=class e extends EventTarget{constructor(){super(),this._context=null,this._visibleTargetIds=new Set,this._executePlanHandler=null}static getInstance(){return e._instance||=new e,e._instance}registerPortal(e,t){console.log(`Registering app context`,e),this._context=e,t?.executePlan&&(this._executePlanHandler=t.executePlan),this.dispatchEvent(new CustomEvent(`portal-registered`,{detail:e}))}setVisibleTargets(e){this._visibleTargetIds=new Set(e),this.dispatchEvent(new CustomEvent(`targets-updated`,{detail:e}))}async executePlan(e){if(e.type===`click`){let t=e.targetId;if(console.log(`ChatPortalService: Waiting for click target "${t}"...`),!await this._waitForTarget(t))return{status:`error`,details:`Target "${t}" not found or not visible after timeout.`}}return this._executePlanHandler?this._executePlanHandler(e):this._context?(console.log(`Executing plan (simplified):`,e),{status:`ok`}):(console.warn(`No portal registered. Cannot execute plan.`),{status:`error`,details:`No portal registered`})}_waitForTarget(e,t=1e4){return this._visibleTargetIds.has(e)?Promise.resolve(!0):new Promise(n=>{let r=setTimeout(()=>{this.removeEventListener(`targets-updated`,i),n(!1)},t),i=()=>{this._visibleTargetIds.has(e)&&(clearTimeout(r),this.removeEventListener(`targets-updated`,i),n(!0))};this.addEventListener(`targets-updated`,i)})}get context(){return this._context}get specs(){return this._context}};let J=$n.getInstance();var er=class{constructor(e){this.service=e}onRunFinishedEvent(e){K.addEvent(`onRunFinishedEvent`,e.event)}onRunStartedEvent(e){K.addEvent(`onRunStartedEvent`,e.event),this.service.addPlaceholderMessage()}onRunErrorEvent(e){K.addEvent(`onRunErrorEvent`,e.event),console.error(`ChatSubscriber: Run Error`,e.event)}onStepStartedEvent(e){K.addEvent(`onStepStartedEvent`,e.event)}onStepFinishedEvent(e){K.addEvent(`onStepFinishedEvent`,e.event)}onTextMessageStartEvent(e){K.addEvent(`onTextMessageStartEvent`,e.event),this.service.prepareMessageForStreaming(e.event.messageId)}onTextMessageContentEvent(e){K.addEvent(`onTextMessageContentEvent`,e.event);let t=e.event.delta||``;this.service.appendMessageContent(e.event.messageId,t)}onTextMessageEndEvent(e){K.addEvent(`onTextMessageEndEvent`,e.event)}onMessagesSnapshotEvent(e){K.addEvent(`onMessagesSnapshotEvent`,e.event);let t=e.event.messages.map(e=>({...e,createdAt:e.createdAt||Date.now()}));this.service.setMessages(t)}onToolCallStartEvent(e){K.addEvent(`onToolCallStartEvent`,e.event)}onToolCallArgsEvent(e){K.addEvent(`onToolCallArgsEvent`,e.event)}async onToolCallEndEvent(e){if(K.addEvent(`onToolCallEndEvent`,e.event),e.toolCallName===`executePlan`){console.log(`ChatSubscriber: Received executePlan tool call`,e.toolCallArgs);let t=await J.executePlan(e.toolCallArgs);console.log(`ChatSubscriber: executePlan result`,t)}if(e.toolCallName===`navigate_user`){console.log(`ChatSubscriber: Received navigate_user tool call`,e.toolCallArgs);let t=await J.executePlan({type:`navigate`,toPath:e.toolCallArgs.path,reason:e.toolCallArgs.reason});console.log(`ChatSubscriber: navigate_user result`,t)}if(e.toolCallName===`click_element`){console.log(`ChatSubscriber: Received click_element tool call`,e.toolCallArgs);let t=await J.executePlan({type:`click`,targetId:e.toolCallArgs.target_id,reason:e.toolCallArgs.reason});console.log(`ChatSubscriber: click_element result`,t)}}onToolCallResultEvent(e){K.addEvent(`onToolCallResultEvent`,e.event)}onStateSnapshotEvent(e){K.addEvent(`onStateSnapshotEvent`,e.event)}onStateDeltaEvent(e){K.addEvent(`onStateDeltaEvent`,e.event)}onActivitySnapshotEvent(e){K.addEvent(`onActivitySnapshotEvent`,e.event),e.event.activityType==`a2ui`&&e.event.content.surfaceUpdate?this.service.addA2UIMessage(e.event):e.event.activityType==`a2ui`&&e.event.content.beginRendering?dt.processMessages([e.event.content]):(e.event.activityType==`navigation`||e.event.activityType==`click`)&&J.executePlan(e.event.content)}onActivityDeltaEvent(e){K.addEvent(`onActivityDeltaEvent`,e.event)}onCustomEvent(e){K.addEvent(`onCustomEvent`,e.event)}async onClientToolCall(e){K.addEvent(`onClientToolCall`,e.event),e.toolName===`executePlan`&&(console.log(`ChatSubscriber: Received executePlan client tool call`,e.args),await J.executePlan(e.args))}onEvent(e){K.addEvent(`onEvent:${e.event.type}`,e.event)}onRawEvent(e){K.addEvent(`onRawEvent`,e.event)}},tr=class{constructor(){this.baseUrl=`/api/conversations`}initialize(e){this.baseUrl=`${e}/api/conversations`}async getConversations(){let e=await fetch(`${this.baseUrl}`);if(!e.ok)throw Error(`Failed to fetch conversations: ${e.statusText}`);return e.json()}async getConversation(e){let t=await fetch(`${this.baseUrl}/${e}`);if(!t.ok)throw Error(`Failed to fetch conversation: ${t.statusText}`);return t.json()}async createConversation(e){let t={...e,title:e.title||`Nueva conversación`},n=await fetch(this.baseUrl,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(`Failed to create conversation: ${n.statusText}`);return n.json()}async updateConversation(e,t){let n=await fetch(`${this.baseUrl}/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(`Failed to update conversation: ${n.statusText}`);return n.json()}async deleteConversation(e){let t=await fetch(`${this.baseUrl}/${e}`,{method:`DELETE`});if(!t.ok)throw Error(`Failed to delete conversation: ${t.statusText}`)}};let Y=new tr;var X=`thread-placeholder`,Z=`site-operator-thread-id`,nr=`/ag_ui`;let Q=new class extends EventTarget{get isRunning(){return this.agent?.isRunning||!1}get messages(){return this.agent?.messages||[]}constructor(){super(),this._conversations=[],this._appContext=null,this._appState={v:`1.1`,location:{path:``},ui:{visibleClickTargetIds:[]}},this.subscriber=new er(this),J.addEventListener(`portal-registered`,e=>{let t=e.detail;console.log(`ChatService: Portal context detected`,t),this.setAppContext(t)})}async initialize(e){let t=localStorage.getItem(Z);this.agent=new r.HttpAgent({url:`${e.backendUrl}${nr}`,threadId:t||X}),Y.initialize(e.backendUrl),J.context?this._appContext=J.context:this._appContext={v:`1.1`,site:{name:e.appName,locale:window.navigator.language||window.navigator.languages[0]||`en`}},t&&await this.loadConversation(t),K.setContext(this._appContext),K.setState(this._appState),K.setMessages(this.agent?.messages||[])}async loadConversation(e){try{let t=await Y.getConversation(e);this.agent&&(this.agent.threadId=t.id,this.agent.messages=t.messages||[],localStorage.setItem(Z,t.id)),this.notify()}catch(e){console.error(`Failed to load conversation`,e),this.agent&&(this.agent.threadId=X,this.agent.messages=[],localStorage.removeItem(Z)),this.notify()}}get conversations(){return this._conversations}setAppContext(e){this._appContext=e,K.setContext(this._appContext),this.notify()}setAppState(e){this._appState=e,K.setState(this._appState),e.ui?.visibleClickTargetIds&&J.setVisibleTargets(e.ui.visibleClickTargetIds),this.notify()}updateAppState(e){this._appState={...this._appState,...e},this.notify()}setAppLocation(e){this._appState.location=e,this.notify()}setAppUI(e){this._appState.ui=e,e?.visibleClickTargetIds&&J.setVisibleTargets(e.visibleClickTargetIds),this.notify()}setAppFocus(e){this._appState.focus=e,this.notify()}async sendMessage(e,t=`user`){if(!this.agent){console.error(`ChatService not initialized. Call initialize() first.`);return}let n=Qn(`message`),r=Date.now(),i;switch(t){case`activity`:i={id:n,role:`activity`,activityType:`message`,content:{text:e},createdAt:r};break;case`tool`:i={id:n,role:`tool`,content:e,toolCallId:Qn(`toolCall`),createdAt:r};break;case`user`:i={id:n,role:`user`,content:e,createdAt:r};break;case`assistant`:i={id:n,role:`assistant`,content:e,createdAt:r};break;case`system`:i={id:n,role:`system`,content:e,createdAt:r};break;case`developer`:i={id:n,role:`developer`,content:e,createdAt:r};break}this.notify();try{this.agent?.threadId==X&&await this._ensureConversation(),this.agent.addMessage(i),this.agent.state={appContext:this._appContext,appState:this._appState},await this.agent.runAgent({tools:[]},this.subscriber)}catch(e){console.error(`Failed to send message`,e)}finally{this.notify()}}async _ensureConversation(){if(!this.agent)throw Error(`Agent not initialized`);if(this.agent?.threadId==X){let e=await Y.createConversation({appContext:this._appContext||void 0});this.agent.threadId=e.id,localStorage.setItem(Z,e.id)}}addPlaceholderMessage(){if(!this.agent)throw Error(`Agent not initialized`);let e={id:`thinking-placeholder`,role:`assistant`,content:``,createdAt:Date.now(),isThinking:!0};this.agent.messages=[...this.agent.messages,e],this.notify()}prepareMessageForStreaming(e){if(!this.agent)throw Error(`Agent not initialized`);this.agent.messages=this.agent.messages.map(t=>t.id===`thinking-placeholder`&&this.isRunning?{...t,id:e,isThinking:!1}:t),this.notify()}appendMessageContent(e,t){if(!this.agent)throw Error(`Agent not initialized`);this.agent.messages=this.agent.messages.map(n=>n.id===e&&typeof n.content==`string`?{...n,content:(n.content||``)+t}:n),this.notify()}setMessages(e){if(!this.agent)throw Error(`Agent not initialized`);let t=this.agent.messages.filter(e=>e.role===`activity`),n=new Set(e.map(e=>e.id)),r=t.filter(e=>!n.has(e.id));console.log(`ChatService: setMessages - Preserving activities`,r.length),this.agent.messages=[...e,...r],this.agent.messages.sort((e,t)=>(e.createdAt||0)-(t.createdAt||0)),this.notify()}addA2UIMessage(e){if(!this.agent)throw Error(`Agent not initialized`);let t=e.content;if(typeof t==`string`)try{t=JSON.parse(t)}catch(e){console.error(`ChatService: Failed to parse activity content string`,e)}let n={id:e.messageId,role:`activity`,activityType:e.activityType,content:e.content,createdAt:Date.now()},r=this.agent.messages.filter(t=>t.id!==e.messageId);this.agent.messages=[...r,n],this.notify()}async startNewThread(){localStorage.removeItem(Z),this.agent&&(this.agent.threadId=X,this.agent.messages=[],this.agent.isRunning=!1),this.notify()}async refreshConversations(){try{this._conversations=(await Y.getConversations()).map(e=>({id:e.id,title:e.title})),this.notify()}catch(e){console.error(`Failed to refresh conversations`,e)}}notify(){K.setMessages(this.agent?.messages||[]),K.setState(this._appState),this.dispatchEvent(new CustomEvent(`state-change`))}};var rr=class{constructor(e){this._onStateChange=()=>{this._host.requestUpdate()},this._host=e,this._host.addController(this)}initialize(e){return Q.initialize(e)}hostConnected(){Q.addEventListener(`state-change`,this._onStateChange)}hostDisconnected(){Q.removeEventListener(`state-change`,this._onStateChange)}get isRunning(){return Q.isRunning}get messages(){return Q.messages}get conversations(){return Q.conversations}sendMessage(e,t=`user`){return Q.sendMessage(e,t)}startNewThread(){return Q.startNewThread()}loadConversation(e){return Q.loadConversation(e)}setAppContext(e){return Q.setAppContext(e)}setAppState(e){return Q.setAppState(e)}setAppLocation(e){return Q.setAppLocation(e)}setAppUI(e){return Q.setAppUI(e)}setAppFocus(e){return Q.setAppFocus(e)}refreshConversations(){return Q.refreshConversations()}},ir=class{constructor(){this.originalFetch=window.fetch.bind(window),this._isEnabled=!1}get isEnabled(){return this._isEnabled}init(){if(this._isEnabled)return;let e=this;window.fetch=async function(t,n){try{let r=new Headers(n?.headers||{});return r.has(`Authorization`)||r.append(`Authorization`,`Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6InhmcDRfR0tObWNBMHl3UUNrZ1BXVkJjTHZmRDVfZXZKOWg3bUhGbExBVWMiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiIwZWZhNWFhNy04OWRiLTQ5MTYtYmZlNC0wNTM3MjhlZWY2M2QiLCJpc3MiOiJodHRwczovL3NrY290ZXN0LmIyY2xvZ2luLmNvbS8wZGI2ZGJjMy02OTA4LTQ1MTctYTdmMi04MWVhNjg1YTI1ZTIvdjIuMC8iLCJleHAiOjE3NjkxMjA3OTgsIm5iZiI6MTc2OTExOTg5OCwibmFtZSI6IlZpYW5hIFZlbGFzcXVleiwgSm9zZSBTdGV2ZW4iLCJpZHBfYWNjZXNzX3Rva2VuIjoiZXlKMGVYQWlPaUpLVjFRaUxDSnViMjVqWlNJNkltNTFURzV6ZVc1WFFYSTFOa2hNYTFCblRXMUViWFF0UW14YVVsWjBXRFV0TUdSbVlYVk1WRTgxY3pnaUxDSmhiR2NpT2lKU1V6STFOaUlzSW5nMWRDSTZJbEJqV0RrNFIxZzBNakJVTVZnMmMwSkVhM3BvVVcxeFozZE5WU0lzSW10cFpDSTZJbEJqV0RrNFIxZzBNakJVTVZnMmMwSkVhM3BvVVcxeFozZE5WU0o5LmV5SmhkV1FpT2lJd01EQXdNREF3TXkwd01EQXdMVEF3TURBdFl6QXdNQzB3TURBd01EQXdNREF3TURBaUxDSnBjM01pT2lKb2RIUndjem92TDNOMGN5NTNhVzVrYjNkekxtNWxkQzh3T0RJM01XWTBNaTA0TVdWbUxUUTFaRFl0T0RGaFl5MDBPVGMzTm1NMFltVTJNVFV2SWl3aWFXRjBJam94TnpZNU1EazNORGt5TENKdVltWWlPakUzTmprd09UYzBPVElzSW1WNGNDSTZNVGMyT1RFd01UZzRNU3dpWVdOamRDSTZNQ3dpWVdOeUlqb2lNU0lzSW1GamNuTWlPbHNpY0RFaVhTd2lZV2x2SWpvaVFXVlJRVWN2T0dKQlFVRkJUVTQ0YmpFdllqWk9kMVZTTmpGMFpGSlZXSGhNUzJOak5WQnNVREpyYUdvcmVEbDFlWFZXTkVGYU5WRjZUSEo1U0dSTlVVeGpOSHBpVFV0UE9GQTJXRGREVEZVd1luVjFUMGczTml0WlVIUTBOamx1Unk5Q1ZEVjZiMDF5WkRkbmFXTnlXVk12VW5ac1VYaHVTWHBETkc5bE9HMXFTSFUyUkdodmVUUm1RakJGWlcwNGVTdFdLMGhRVEdoSWRraElhVlZUVFdFMWRYRlhaRlJvVTJrNE1WVndlakZzYUUxWFJVaFlZMGhaUjFORGRESkhVR0puWVRoUFNtSjRaVEJNVm5kaFpWTm9MMVZPYkdkU1VHdEdURlZLWlZwWWFURkNVVFJzVldjNU1YSXdTM1ZIY1dNeGMxTkZaSEp4SzJoWlVtTlZNMWRNUkRJd1VqVTJSRVl2WkhkbU1WVjZUVVZqUkRFMlZVa3hZelpXVjBjdlQweElSRzFyUVRkUFMzTkVOMFpGWkZWVlZXdERSbEU5SWl3aVlXMXlJanBiSW5CM1pDSXNJbTFtWVNKZExDSmhjSEJmWkdsemNHeGhlVzVoYldVaU9pSkVZV3hwTFZCeVpDSXNJbUZ3Y0dsa0lqb2laR1prTURrNVlqQXRaV05pT1MwME0yVTFMV0kzWWpjdE5USTVObUk0TUdFME5qSXdJaXdpWVhCd2FXUmhZM0lpT2lJeElpd2labUZ0YVd4NVgyNWhiV1VpT2lKV2FXRnVZU0JXWld4aGMzRjFaWG9pTENKbmFYWmxibDl1WVcxbElqb2lTbTl6WlNCVGRHVjJaVzRpTENKcFpIUjVjQ0k2SW5WelpYSWlMQ0pwY0dGa1pISWlPaUl6T0M0NUxqSXlNQzR4TXpJaUxDSnVZVzFsSWpvaVZtbGhibUVnVm1Wc1lYTnhkV1Y2TENCS2IzTmxJRk4wWlhabGJpSXNJbTlwWkNJNkltVXdNbU0wTmpaakxXVTVaRGd0TkdGa01pMDVaVGhrTFdReFltUTJObUV6TkRNd01pSXNJbTl1Y0hKbGJWOXphV1FpT2lKVExURXROUzB5TVMweU5EZzVPVGM1T1RRd0xUSTFOVEl3TVRnM016RXRNVGN3TWpjeE9UTTFPUzB5TVRrNE1DSXNJbkJzWVhSbUlqb2lPQ0lzSW5CMWFXUWlPaUl4TURBek1qQXdNVUV4UWpCQ016azBJaXdpY21naU9pSXhMa0ZVVVVGUmFEaHVRMDh0UWpGclYwSnlSV3d6WWtWMmJVWlJUVUZCUVVGQlFVRkJRWGRCUVVGQlFVRkJRVUZDVVVGUmF6QkJRUzRpTENKelkzQWlPaUpOWVdsc0xsSmxZV1FnVFdGcGJDNVRaVzVrSUc5d1pXNXBaQ0J3Y205bWFXeGxJRlZ6WlhJdVVtVmhaQ0JsYldGcGJDSXNJbk5wWkNJNklqQXdNVEkxTnpaaExXTmhOVFF0TVdVeVl5MWlZbVEwTFdFNU4yVTBNekUzT1dNeE15SXNJbk5wWjI1cGJsOXpkR0YwWlNJNld5SnJiWE5wSWwwc0luTjFZaUk2SW5GaFNsbFhNelEzT0RWcFdFUktVbDlyYVZCa1NuSm5VWGhoVGs5d1RsaHRhVmhFV0dVM1NVTktaMWtpTENKMFpXNWhiblJmY21WbmFXOXVYM05qYjNCbElqb2lVMEVpTENKMGFXUWlPaUl3T0RJM01XWTBNaTA0TVdWbUxUUTFaRFl0T0RGaFl5MDBPVGMzTm1NMFltVTJNVFVpTENKMWJtbHhkV1ZmYm1GdFpTSTZJbXAyYVdGdVlVQnphMkZ1WkdsaExtTnZiUzVqYnlJc0luVndiaUk2SW1wMmFXRnVZVUJ6YTJGdVpHbGhMbU52YlM1amJ5SXNJblYwYVNJNkluSlVaMVpmZUVWTVJHdFBSMmx3Y210R01tZDVRVUVpTENKMlpYSWlPaUl4TGpBaUxDSjNhV1J6SWpwYkltSTNPV1ppWmpSa0xUTmxaamt0TkRZNE9TMDRNVFF6TFRjMllqRTVOR1U0TlRVd09TSmRMQ0o0YlhOZllXTmtJam94TnpVeU5UZzVNVEk0TENKNGJYTmZZV04wWDJaamRDSTZJak1nT1NJc0luaHRjMTltZEdRaU9pSXRkalJ3UW10NmRXRlFYMjVSUmpkVVZVWnlRVkZtYkdSNlIzTlpjRWxwT1dnMGFrdDZhbU5SVFZaQlFtUllUbXhaV0U0d1RGZFNlbUpZVFNJc0luaHRjMTlwWkhKbGJDSTZJakVnTWpBaUxDSjRiWE5mYzNRaU9uc2ljM1ZpSWpvaWMzUkNiazAzV25FME1td3hVa1l5ZEV0RU1GaEJVbVpoVGtOUlFXOW9WbTFmVUZWWFltSnJSbDlST0NKOUxDSjRiWE5mYzNWaVgyWmpkQ0k2SWpFd0lETWlMQ0o0YlhOZmRHTmtkQ0k2TVRNNU16WXdNek0wTVN3aWVHMXpYM1J1ZEY5bVkzUWlPaUkySURNaWZRLkEyZl9aRHNVcmp3UFh1NFVRMkYxN2tLNzVXTE1lN3lWX09YNHFKYk1zNTQxQmFmdk1GU3pOQnJILVJsR1FTdjEybjlrRm0yTGJ6bzdoMnJzR0JiRWsyOFQzdmtlTW95TVNPVFdfaldELUFHSVZOVVdaYnc3emVZWHVZYmEydUtfblR5cGpwQVNoV3hBNlJkMUV5QUhGZjVQakIxOTlYRGgySkp2bWJfZzVHazhJY2VEZ3QzcEVRRWF0QUdzZzVZRjN0ZlctLTdGT05EY3NTQjJjS2pMdXJwUl8tUG90LVF6TV9CaV9CeHhBZU1tNlAtb2JGRzB4WGRlRnFkUW9lS2pIVFEzN2EzeE9MMkZ2TFg4ZUhjN2x1SWstUkFBQnlmOXhhMnlxS0NkWGFiQkVSejRzeWhCRkpuMzdCeDc1cUlsZk1rQUlTX2NlemZZYndnSEJJWmZEZyIsInN1YiI6Ijg4MjBkNmI2LTcyNWItNDA0NC1hZGNiLWEzZTE4YTM4ZTRmYyIsImdpdmVuX25hbWUiOiJKb3NlIFN0ZXZlbiIsImZhbWlseV9uYW1lIjoiVmlhbmEgVmVsYXNxdWV6IiwiZW1haWwiOiJqdmlhbmFAc2thbmRpYS5jb20uY28iLCJub25jZSI6IjAxOWJlNjcyLTA4NWYtNzkxNi04MmZjLTk0MTA4OTRjODMyNSIsImF6cCI6IjBlZmE1YWE3LTg5ZGItNDkxNi1iZmU0LTA1MzcyOGVlZjYzZCIsInZlciI6IjEuMCIsImlhdCI6MTc2OTExOTg5OH0.TrBEO5lXpR34n7aA7J5LniTPw36mpwR51latCn7whw0s496hSXf7NJl-822mSGlmhShjQXiiIZCodQa-3nh2A4V1ecGDeCdqh_m-BCqlSsEO8LPEQ3-F-tm74J4iiO6NUm7FDQf3tK0jfxHlpFZJaP45T22389B3xVsPmnvDezHxsltOjtFJtv2sN2csF3CgNiJVvQv6xaX_cs7R4PpTxELCVOyUdjJ3NthE7kMKFvFQgz8Okq_buR7-O8ylRq35Ixxqp8He3nCJ3OWuZEj3xGLBCocGwlc8Vwt4_03Fu94UoU_XHmMD9RsjDA4nJY-o43Dkeldyj_1O5Deo7fhjtg`),e.originalFetch(t,{...n,headers:r})}catch(e){return Promise.reject(e)}},this._isEnabled=!0,console.log(`Fetch interceptor initialized with test Authorization header (Native implementation).`)}destroy(){this._isEnabled&&(window.fetch=this.originalFetch,this._isEnabled=!1,console.log(`Fetch interceptor destroyed (Native implementation).`))}};let ar=new ir;var $=class extends A{constructor(...e){super(...e),this._chatController=new rr(this),this.backendUrl=``,this.appName=`Lit-Chat-App`,this.conversationUrl=``,this.agentAvatar=``,this.disclaimer=`Agent puede cometer errores. Verifica la información importante.`,this.emptyText=`¿En qué puedo ayudarte hoy?`,this.placeholder=`Enviar un mensaje a Agent`,this.headerTitle=`Agent`,this.hideHeader=!1,this.interceptor=!1,this._historyOpen=!1,this._inspectorOpen=!1,this._inspectorEnabled=!1}static#e=this.styles=Ze;get controller(){return this._chatController}firstUpdated(){this.dispatchEvent(new CustomEvent(`controller-ready`,{detail:this._chatController}))}connectedCallback(){super.connectedCallback(),this.addEventListener(`a2uiaction`,this._handleA2UIAction)}disconnectedCallback(){this.removeEventListener(`a2uiaction`,this._handleA2UIAction),super.disconnectedCallback()}willUpdate(e){e.has(`interceptor`)&&(this.interceptor?this.enableFetchInterceptor():ar.destroy()),(e.has(`backendUrl`)||e.has(`appName`)||e.has(`conversationUrl`))&&(this._chatController.initialize({backendUrl:this.backendUrl,appName:this.appName,conversationUrl:this.conversationUrl,inspector:this.hasAttribute(`inspector`)||this.inspector}),this._inspectorEnabled=this.hasAttribute(`inspector`)||this.inspector)}enableFetchInterceptor(){console.warn(`Fetch interceptor is only available in development mode.`)}_handleSend(e){this._chatController.sendMessage(e.detail.content)}_handleNewThread(){this._chatController.startNewThread()}setAppContext(e){this._chatController.setAppContext(e)}setAppState(e){this._chatController.setAppState(e)}setAppLocation(e){this._chatController.setAppLocation(e)}setAppUI(e){this._chatController.setAppUI(e)}setAppFocus(e){this._chatController.setAppFocus(e)}_toggleHistory(){this._historyOpen=!this._historyOpen,this._historyOpen&&this._chatController.refreshConversations()}_handleSelectThread(e){console.log(`Selected conversation:`,e.detail.conversation),this._chatController.loadConversation(e.detail.conversation.id),this._historyOpen=!1}_toggleInspector(){this._inspectorOpen=!this._inspectorOpen}render(){return C`
932
+ `}_handleEdit(e){this._editedData=JSON.stringify(e,null,2),this._isEditing=!0}_handleCancelEdit(){this._isEditing=!1}_handleSave(e){try{let t=JSON.parse(this._editedData),n=e===`context`?`context-update`:`state-update`;this.dispatchEvent(new CustomEvent(n,{detail:t,bubbles:!0,composed:!0})),this._isEditing=!1}catch(e){alert(`Invalid JSON: `+e.message)}}};N([M()],q.prototype,`_activeTab`,void 0),N([M()],q.prototype,`_context`,void 0),N([M()],q.prototype,`_appState`,void 0),N([M()],q.prototype,`_messages`,void 0),N([M()],q.prototype,`_stream`,void 0),N([M()],q.prototype,`_isEditing`,void 0),N([M()],q.prototype,`_editedData`,void 0),q=N([A(`agent-inspector-window`)],q);var Zn={thread:`thr`,message:`msg`,toolCall:`tc`,workflow:`wf`,task:`tsk`,attachment:`atc`,sdkHiddenContext:`shcx`};function Qn(e){return`${Zn[e]}_${crypto.randomUUID().replace(/-/g,``).slice(0,8)}`}var $n=class e extends EventTarget{constructor(){super(),this._context=null,this._visibleTargetIds=new Set,this._executePlanHandler=null}static getInstance(){return e._instance||=new e,e._instance}registerPortal(e,t){console.log(`Registering app context`,e),this._context=e,t?.executePlan&&(this._executePlanHandler=t.executePlan),this.dispatchEvent(new CustomEvent(`portal-registered`,{detail:e}))}setVisibleTargets(e){this._visibleTargetIds=new Set(e),this.dispatchEvent(new CustomEvent(`targets-updated`,{detail:e}))}async executePlan(e){if(e.type===`click`){let t=e.targetId;if(console.log(`ChatPortalService: Waiting for click target "${t}"...`),!await this._waitForTarget(t))return{status:`error`,details:`Target "${t}" not found or not visible after timeout.`}}return this._executePlanHandler?this._executePlanHandler(e):this._context?(console.log(`Executing plan (simplified):`,e),{status:`ok`}):(console.warn(`No portal registered. Cannot execute plan.`),{status:`error`,details:`No portal registered`})}_waitForTarget(e,t=1e4){return this._visibleTargetIds.has(e)?Promise.resolve(!0):new Promise(n=>{let r=setTimeout(()=>{this.removeEventListener(`targets-updated`,i),n(!1)},t),i=()=>{this._visibleTargetIds.has(e)&&(clearTimeout(r),this.removeEventListener(`targets-updated`,i),n(!0))};this.addEventListener(`targets-updated`,i)})}get context(){return this._context}get specs(){return this._context}};let J=$n.getInstance();var er=class{constructor(e){this.service=e}onRunFinishedEvent(e){K.addEvent(`onRunFinishedEvent`,e.event)}onRunStartedEvent(e){K.addEvent(`onRunStartedEvent`,e.event),this.service.addPlaceholderMessage()}onRunErrorEvent(e){K.addEvent(`onRunErrorEvent`,e.event),console.error(`ChatSubscriber: Run Error`,e.event)}onStepStartedEvent(e){K.addEvent(`onStepStartedEvent`,e.event)}onStepFinishedEvent(e){K.addEvent(`onStepFinishedEvent`,e.event)}onTextMessageStartEvent(e){K.addEvent(`onTextMessageStartEvent`,e.event),this.service.prepareMessageForStreaming(e.event.messageId)}onTextMessageContentEvent(e){K.addEvent(`onTextMessageContentEvent`,e.event);let t=e.event.delta||``;this.service.appendMessageContent(e.event.messageId,t)}onTextMessageEndEvent(e){K.addEvent(`onTextMessageEndEvent`,e.event)}onMessagesSnapshotEvent(e){K.addEvent(`onMessagesSnapshotEvent`,e.event);let t=e.event.messages.map(e=>({...e,createdAt:e.createdAt||Date.now()}));this.service.setMessages(t)}onToolCallStartEvent(e){K.addEvent(`onToolCallStartEvent`,e.event)}onToolCallArgsEvent(e){K.addEvent(`onToolCallArgsEvent`,e.event)}async onToolCallEndEvent(e){if(K.addEvent(`onToolCallEndEvent`,e.event),e.toolCallName===`executePlan`){console.log(`ChatSubscriber: Received executePlan tool call`,e.toolCallArgs);let t=await J.executePlan(e.toolCallArgs);console.log(`ChatSubscriber: executePlan result`,t)}if(e.toolCallName===`navigate_user`){console.log(`ChatSubscriber: Received navigate_user tool call`,e.toolCallArgs);let t=await J.executePlan({type:`navigate`,toPath:e.toolCallArgs.path,reason:e.toolCallArgs.reason});console.log(`ChatSubscriber: navigate_user result`,t)}if(e.toolCallName===`click_element`){console.log(`ChatSubscriber: Received click_element tool call`,e.toolCallArgs);let t=await J.executePlan({type:`click`,targetId:e.toolCallArgs.target_id,reason:e.toolCallArgs.reason});console.log(`ChatSubscriber: click_element result`,t)}}onToolCallResultEvent(e){K.addEvent(`onToolCallResultEvent`,e.event)}onStateSnapshotEvent(e){K.addEvent(`onStateSnapshotEvent`,e.event)}onStateDeltaEvent(e){K.addEvent(`onStateDeltaEvent`,e.event)}onActivitySnapshotEvent(e){K.addEvent(`onActivitySnapshotEvent`,e.event),e.event.activityType==`a2ui`&&e.event.content.surfaceUpdate?this.service.addA2UIMessage(e.event):e.event.activityType==`a2ui`&&e.event.content.beginRendering?P.processMessages([e.event.content]):(e.event.activityType==`navigation`||e.event.activityType==`click`)&&J.executePlan(e.event.content)}onActivityDeltaEvent(e){K.addEvent(`onActivityDeltaEvent`,e.event)}onCustomEvent(e){K.addEvent(`onCustomEvent`,e.event)}async onClientToolCall(e){K.addEvent(`onClientToolCall`,e.event),e.toolName===`executePlan`&&(console.log(`ChatSubscriber: Received executePlan client tool call`,e.args),await J.executePlan(e.args))}onEvent(e){K.addEvent(`onEvent:${e.event.type}`,e.event)}onRawEvent(e){K.addEvent(`onRawEvent`,e.event)}},tr=class{constructor(){this.baseUrl=`/api/conversations`}initialize(e){this.baseUrl=`${e}/api/conversations`}async getConversations(){let e=await fetch(`${this.baseUrl}`);if(!e.ok)throw Error(`Failed to fetch conversations: ${e.statusText}`);return e.json()}async getConversation(e){let t=await fetch(`${this.baseUrl}/${e}`);if(!t.ok)throw Error(`Failed to fetch conversation: ${t.statusText}`);return t.json()}async createConversation(e){let t={...e,title:e.title||`Nueva conversación`},n=await fetch(this.baseUrl,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(`Failed to create conversation: ${n.statusText}`);return n.json()}async updateConversation(e,t){let n=await fetch(`${this.baseUrl}/${e}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw Error(`Failed to update conversation: ${n.statusText}`);return n.json()}async deleteConversation(e){let t=await fetch(`${this.baseUrl}/${e}`,{method:`DELETE`});if(!t.ok)throw Error(`Failed to delete conversation: ${t.statusText}`)}};let Y=new tr;var X=`thread-placeholder`,Z=`site-operator-thread-id`,nr=`/ag_ui`;let Q=new class extends EventTarget{get isRunning(){return this.agent?.isRunning||!1}get messages(){return this.agent?.messages||[]}get suggestedPrompts(){return this._suggestedPrompts}get showPrompts(){return this._showPrompts}constructor(){super(),this._conversations=[],this._appContext=null,this._appState={v:`1.1`,location:{path:``},ui:{visibleClickTargetIds:[]}},this._suggestedPrompts=[],this._showPrompts=!1,this.subscriber=new er(this),J.addEventListener(`portal-registered`,e=>{let t=e.detail;console.log(`ChatService: Portal context detected`,t),this.setAppContext(t)})}async initialize(e){let t=localStorage.getItem(Z);this.agent=new r.HttpAgent({url:`${e.backendUrl}${nr}`,threadId:t||X}),Y.initialize(e.backendUrl),J.context?this._appContext=J.context:this._appContext={v:`1.1`,site:{name:e.appName,locale:window.navigator.language||window.navigator.languages[0]||`en`}},t&&await this.loadConversation(t),K.setContext(this._appContext),K.setState(this._appState),K.setMessages(this.agent?.messages||[])}async loadConversation(e){try{let t=await Y.getConversation(e);this.agent&&(this.agent.threadId=t.id,this.agent.messages=t.messages||[],localStorage.setItem(Z,t.id)),this.notify()}catch(e){console.error(`Failed to load conversation`,e),this.agent&&(this.agent.threadId=X,this.agent.messages=[],localStorage.removeItem(Z)),this.notify()}}get conversations(){return this._conversations}setAppContext(e){this._appContext=e,K.setContext(this._appContext),this.notify()}setAppState(e){this._appState=e,K.setState(this._appState),e.ui?.visibleClickTargetIds&&J.setVisibleTargets(e.ui.visibleClickTargetIds),this.notify()}updateAppState(e){this._appState={...this._appState,...e},this.notify()}setAppLocation(e){this._appState.location=e,this.notify()}setAppUI(e){this._appState.ui=e,e?.visibleClickTargetIds&&J.setVisibleTargets(e.visibleClickTargetIds),this.notify()}setAppFocus(e){this._appState.focus=e,this.notify()}setSuggestedPrompts(e){this._suggestedPrompts=e.map(e=>({...e,caption:e.caption.slice(0,50)})),this._showPrompts=!0,this.notify()}hideSuggestedPrompts(){this._showPrompts=!1,this.notify()}async sendMessage(e,t=`user`){if(!this.agent){console.error(`ChatService not initialized. Call initialize() first.`);return}let n=Qn(`message`),r=Date.now(),i;switch(t){case`activity`:i={id:n,role:`activity`,activityType:`message`,content:{text:e},createdAt:r};break;case`tool`:i={id:n,role:`tool`,content:e,toolCallId:Qn(`toolCall`),createdAt:r};break;case`user`:i={id:n,role:`user`,content:e,createdAt:r};break;case`assistant`:i={id:n,role:`assistant`,content:e,createdAt:r};break;case`system`:i={id:n,role:`system`,content:e,createdAt:r};break;case`developer`:i={id:n,role:`developer`,content:e,createdAt:r};break}this.notify();try{this.agent?.threadId==X&&await this._ensureConversation(),this.agent.addMessage(i),this.agent.state={appContext:this._appContext,appState:this._appState},await this.agent.runAgent({tools:[]},this.subscriber)}catch(e){console.error(`Failed to send message`,e)}finally{this._showPrompts=!1,this.notify()}}async _ensureConversation(){if(!this.agent)throw Error(`Agent not initialized`);if(this.agent?.threadId==X){let e=await Y.createConversation({appContext:this._appContext||void 0});this.agent.threadId=e.id,localStorage.setItem(Z,e.id)}}addPlaceholderMessage(){if(!this.agent)throw Error(`Agent not initialized`);let e={id:`thinking-placeholder`,role:`assistant`,content:``,createdAt:Date.now(),isThinking:!0};this.agent.messages=[...this.agent.messages,e],this.notify()}prepareMessageForStreaming(e){if(!this.agent)throw Error(`Agent not initialized`);this.agent.messages=this.agent.messages.map(t=>t.id===`thinking-placeholder`&&this.isRunning?{...t,id:e,isThinking:!1}:t),this.notify()}appendMessageContent(e,t){if(!this.agent)throw Error(`Agent not initialized`);this.agent.messages=this.agent.messages.map(n=>n.id===e&&typeof n.content==`string`?{...n,content:(n.content||``)+t}:n),this.notify()}setMessages(e){if(!this.agent)throw Error(`Agent not initialized`);let t=this.agent.messages.filter(e=>e.role===`activity`),n=new Set(e.map(e=>e.id)),r=t.filter(e=>!n.has(e.id));console.log(`ChatService: setMessages - Preserving activities`,r.length),this.agent.messages=[...e,...r],this.agent.messages.sort((e,t)=>(e.createdAt||0)-(t.createdAt||0)),this.notify()}addA2UIMessage(e){if(!this.agent)throw Error(`Agent not initialized`);let t=e.content;if(typeof t==`string`)try{t=JSON.parse(t)}catch(e){console.error(`ChatService: Failed to parse activity content string`,e)}let n={id:e.messageId,role:`activity`,activityType:e.activityType,content:e.content,createdAt:Date.now()},r=this.agent.messages.filter(t=>t.id!==e.messageId);this.agent.messages=[...r,n],this.notify()}async startNewThread(){localStorage.removeItem(Z),this.agent&&(this.agent.threadId=X,this.agent.messages=[],this.agent.isRunning=!1),this._suggestedPrompts.length>0&&(this._showPrompts=!0),this.notify()}async refreshConversations(){try{this._conversations=(await Y.getConversations()).map(e=>({id:e.id,title:e.title})),this.notify()}catch(e){console.error(`Failed to refresh conversations`,e)}}notify(){K.setMessages(this.agent?.messages||[]),K.setState(this._appState),this.dispatchEvent(new CustomEvent(`state-change`))}};var rr=class{constructor(e){this._onStateChange=()=>{this._host.requestUpdate()},this._host=e,this._host.addController(this)}initialize(e){return Q.initialize(e)}hostConnected(){Q.addEventListener(`state-change`,this._onStateChange)}hostDisconnected(){Q.removeEventListener(`state-change`,this._onStateChange)}get isRunning(){return Q.isRunning}get messages(){return Q.messages}get conversations(){return Q.conversations}get suggestedPrompts(){return Q.suggestedPrompts}get showPrompts(){return Q.showPrompts}sendMessage(e,t=`user`){return Q.sendMessage(e,t)}startNewThread(){return Q.startNewThread()}loadConversation(e){return Q.loadConversation(e)}setAppContext(e){return Q.setAppContext(e)}setAppState(e){return Q.setAppState(e)}setAppLocation(e){return Q.setAppLocation(e)}setAppUI(e){return Q.setAppUI(e)}setAppFocus(e){return Q.setAppFocus(e)}setSuggestedPrompts(e){return Q.setSuggestedPrompts(e)}hideSuggestedPrompts(){return Q.hideSuggestedPrompts()}refreshConversations(){return Q.refreshConversations()}},ir=class{constructor(){this.originalFetch=window.fetch.bind(window),this._isEnabled=!1}get isEnabled(){return this._isEnabled}init(){if(this._isEnabled)return;let e=this;window.fetch=async function(t,n){try{let r=new Headers(n?.headers||{});return r.has(`Authorization`)||r.append(`Authorization`,`Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6InhmcDRfR0tObWNBMHl3UUNrZ1BXVkJjTHZmRDVfZXZKOWg3bUhGbExBVWMiLCJ0eXAiOiJKV1QifQ.eyJhdWQiOiIwZWZhNWFhNy04OWRiLTQ5MTYtYmZlNC0wNTM3MjhlZWY2M2QiLCJpc3MiOiJodHRwczovL3NrY290ZXN0LmIyY2xvZ2luLmNvbS8wZGI2ZGJjMy02OTA4LTQ1MTctYTdmMi04MWVhNjg1YTI1ZTIvdjIuMC8iLCJleHAiOjE3NjkxMjA3OTgsIm5iZiI6MTc2OTExOTg5OCwibmFtZSI6IlZpYW5hIFZlbGFzcXVleiwgSm9zZSBTdGV2ZW4iLCJpZHBfYWNjZXNzX3Rva2VuIjoiZXlKMGVYQWlPaUpLVjFRaUxDSnViMjVqWlNJNkltNTFURzV6ZVc1WFFYSTFOa2hNYTFCblRXMUViWFF0UW14YVVsWjBXRFV0TUdSbVlYVk1WRTgxY3pnaUxDSmhiR2NpT2lKU1V6STFOaUlzSW5nMWRDSTZJbEJqV0RrNFIxZzBNakJVTVZnMmMwSkVhM3BvVVcxeFozZE5WU0lzSW10cFpDSTZJbEJqV0RrNFIxZzBNakJVTVZnMmMwSkVhM3BvVVcxeFozZE5WU0o5LmV5SmhkV1FpT2lJd01EQXdNREF3TXkwd01EQXdMVEF3TURBdFl6QXdNQzB3TURBd01EQXdNREF3TURBaUxDSnBjM01pT2lKb2RIUndjem92TDNOMGN5NTNhVzVrYjNkekxtNWxkQzh3T0RJM01XWTBNaTA0TVdWbUxUUTFaRFl0T0RGaFl5MDBPVGMzTm1NMFltVTJNVFV2SWl3aWFXRjBJam94TnpZNU1EazNORGt5TENKdVltWWlPakUzTmprd09UYzBPVElzSW1WNGNDSTZNVGMyT1RFd01UZzRNU3dpWVdOamRDSTZNQ3dpWVdOeUlqb2lNU0lzSW1GamNuTWlPbHNpY0RFaVhTd2lZV2x2SWpvaVFXVlJRVWN2T0dKQlFVRkJUVTQ0YmpFdllqWk9kMVZTTmpGMFpGSlZXSGhNUzJOak5WQnNVREpyYUdvcmVEbDFlWFZXTkVGYU5WRjZUSEo1U0dSTlVVeGpOSHBpVFV0UE9GQTJXRGREVEZVd1luVjFUMGczTml0WlVIUTBOamx1Unk5Q1ZEVjZiMDF5WkRkbmFXTnlXVk12VW5ac1VYaHVTWHBETkc5bE9HMXFTSFUyUkdodmVUUm1RakJGWlcwNGVTdFdLMGhRVEdoSWRraElhVlZUVFdFMWRYRlhaRlJvVTJrNE1WVndlakZzYUUxWFJVaFlZMGhaUjFORGRESkhVR0puWVRoUFNtSjRaVEJNVm5kaFpWTm9MMVZPYkdkU1VHdEdURlZLWlZwWWFURkNVVFJzVldjNU1YSXdTM1ZIY1dNeGMxTkZaSEp4SzJoWlVtTlZNMWRNUkRJd1VqVTJSRVl2WkhkbU1WVjZUVVZqUkRFMlZVa3hZelpXVjBjdlQweElSRzFyUVRkUFMzTkVOMFpGWkZWVlZXdERSbEU5SWl3aVlXMXlJanBiSW5CM1pDSXNJbTFtWVNKZExDSmhjSEJmWkdsemNHeGhlVzVoYldVaU9pSkVZV3hwTFZCeVpDSXNJbUZ3Y0dsa0lqb2laR1prTURrNVlqQXRaV05pT1MwME0yVTFMV0kzWWpjdE5USTVObUk0TUdFME5qSXdJaXdpWVhCd2FXUmhZM0lpT2lJeElpd2labUZ0YVd4NVgyNWhiV1VpT2lKV2FXRnVZU0JXWld4aGMzRjFaWG9pTENKbmFYWmxibDl1WVcxbElqb2lTbTl6WlNCVGRHVjJaVzRpTENKcFpIUjVjQ0k2SW5WelpYSWlMQ0pwY0dGa1pISWlPaUl6T0M0NUxqSXlNQzR4TXpJaUxDSnVZVzFsSWpvaVZtbGhibUVnVm1Wc1lYTnhkV1Y2TENCS2IzTmxJRk4wWlhabGJpSXNJbTlwWkNJNkltVXdNbU0wTmpaakxXVTVaRGd0TkdGa01pMDVaVGhrTFdReFltUTJObUV6TkRNd01pSXNJbTl1Y0hKbGJWOXphV1FpT2lKVExURXROUzB5TVMweU5EZzVPVGM1T1RRd0xUSTFOVEl3TVRnM016RXRNVGN3TWpjeE9UTTFPUzB5TVRrNE1DSXNJbkJzWVhSbUlqb2lPQ0lzSW5CMWFXUWlPaUl4TURBek1qQXdNVUV4UWpCQ016azBJaXdpY21naU9pSXhMa0ZVVVVGUmFEaHVRMDh0UWpGclYwSnlSV3d6WWtWMmJVWlJUVUZCUVVGQlFVRkJRWGRCUVVGQlFVRkJRVUZDVVVGUmF6QkJRUzRpTENKelkzQWlPaUpOWVdsc0xsSmxZV1FnVFdGcGJDNVRaVzVrSUc5d1pXNXBaQ0J3Y205bWFXeGxJRlZ6WlhJdVVtVmhaQ0JsYldGcGJDSXNJbk5wWkNJNklqQXdNVEkxTnpaaExXTmhOVFF0TVdVeVl5MWlZbVEwTFdFNU4yVTBNekUzT1dNeE15SXNJbk5wWjI1cGJsOXpkR0YwWlNJNld5SnJiWE5wSWwwc0luTjFZaUk2SW5GaFNsbFhNelEzT0RWcFdFUktVbDlyYVZCa1NuSm5VWGhoVGs5d1RsaHRhVmhFV0dVM1NVTktaMWtpTENKMFpXNWhiblJmY21WbmFXOXVYM05qYjNCbElqb2lVMEVpTENKMGFXUWlPaUl3T0RJM01XWTBNaTA0TVdWbUxUUTFaRFl0T0RGaFl5MDBPVGMzTm1NMFltVTJNVFVpTENKMWJtbHhkV1ZmYm1GdFpTSTZJbXAyYVdGdVlVQnphMkZ1WkdsaExtTnZiUzVqYnlJc0luVndiaUk2SW1wMmFXRnVZVUJ6YTJGdVpHbGhMbU52YlM1amJ5SXNJblYwYVNJNkluSlVaMVpmZUVWTVJHdFBSMmx3Y210R01tZDVRVUVpTENKMlpYSWlPaUl4TGpBaUxDSjNhV1J6SWpwYkltSTNPV1ppWmpSa0xUTmxaamt0TkRZNE9TMDRNVFF6TFRjMllqRTVOR1U0TlRVd09TSmRMQ0o0YlhOZllXTmtJam94TnpVeU5UZzVNVEk0TENKNGJYTmZZV04wWDJaamRDSTZJak1nT1NJc0luaHRjMTltZEdRaU9pSXRkalJ3UW10NmRXRlFYMjVSUmpkVVZVWnlRVkZtYkdSNlIzTlpjRWxwT1dnMGFrdDZhbU5SVFZaQlFtUllUbXhaV0U0d1RGZFNlbUpZVFNJc0luaHRjMTlwWkhKbGJDSTZJakVnTWpBaUxDSjRiWE5mYzNRaU9uc2ljM1ZpSWpvaWMzUkNiazAzV25FME1td3hVa1l5ZEV0RU1GaEJVbVpoVGtOUlFXOW9WbTFmVUZWWFltSnJSbDlST0NKOUxDSjRiWE5mYzNWaVgyWmpkQ0k2SWpFd0lETWlMQ0o0YlhOZmRHTmtkQ0k2TVRNNU16WXdNek0wTVN3aWVHMXpYM1J1ZEY5bVkzUWlPaUkySURNaWZRLkEyZl9aRHNVcmp3UFh1NFVRMkYxN2tLNzVXTE1lN3lWX09YNHFKYk1zNTQxQmFmdk1GU3pOQnJILVJsR1FTdjEybjlrRm0yTGJ6bzdoMnJzR0JiRWsyOFQzdmtlTW95TVNPVFdfaldELUFHSVZOVVdaYnc3emVZWHVZYmEydUtfblR5cGpwQVNoV3hBNlJkMUV5QUhGZjVQakIxOTlYRGgySkp2bWJfZzVHazhJY2VEZ3QzcEVRRWF0QUdzZzVZRjN0ZlctLTdGT05EY3NTQjJjS2pMdXJwUl8tUG90LVF6TV9CaV9CeHhBZU1tNlAtb2JGRzB4WGRlRnFkUW9lS2pIVFEzN2EzeE9MMkZ2TFg4ZUhjN2x1SWstUkFBQnlmOXhhMnlxS0NkWGFiQkVSejRzeWhCRkpuMzdCeDc1cUlsZk1rQUlTX2NlemZZYndnSEJJWmZEZyIsInN1YiI6Ijg4MjBkNmI2LTcyNWItNDA0NC1hZGNiLWEzZTE4YTM4ZTRmYyIsImdpdmVuX25hbWUiOiJKb3NlIFN0ZXZlbiIsImZhbWlseV9uYW1lIjoiVmlhbmEgVmVsYXNxdWV6IiwiZW1haWwiOiJqdmlhbmFAc2thbmRpYS5jb20uY28iLCJub25jZSI6IjAxOWJlNjcyLTA4NWYtNzkxNi04MmZjLTk0MTA4OTRjODMyNSIsImF6cCI6IjBlZmE1YWE3LTg5ZGItNDkxNi1iZmU0LTA1MzcyOGVlZjYzZCIsInZlciI6IjEuMCIsImlhdCI6MTc2OTExOTg5OH0.TrBEO5lXpR34n7aA7J5LniTPw36mpwR51latCn7whw0s496hSXf7NJl-822mSGlmhShjQXiiIZCodQa-3nh2A4V1ecGDeCdqh_m-BCqlSsEO8LPEQ3-F-tm74J4iiO6NUm7FDQf3tK0jfxHlpFZJaP45T22389B3xVsPmnvDezHxsltOjtFJtv2sN2csF3CgNiJVvQv6xaX_cs7R4PpTxELCVOyUdjJ3NthE7kMKFvFQgz8Okq_buR7-O8ylRq35Ixxqp8He3nCJ3OWuZEj3xGLBCocGwlc8Vwt4_03Fu94UoU_XHmMD9RsjDA4nJY-o43Dkeldyj_1O5Deo7fhjtg`),e.originalFetch(t,{...n,headers:r})}catch(e){return Promise.reject(e)}},this._isEnabled=!0,console.log(`Fetch interceptor initialized with test Authorization header (Native implementation).`)}destroy(){this._isEnabled&&(window.fetch=this.originalFetch,this._isEnabled=!1,console.log(`Fetch interceptor destroyed (Native implementation).`))}};let ar=new ir;var $=class extends k{constructor(...e){super(...e),this._chatController=new rr(this),this.backendUrl=``,this.appName=`Lit-Chat-App`,this.conversationUrl=``,this.agentAvatar=``,this.disclaimer=`Agent puede cometer errores. Verifica la información importante.`,this.emptyText=`¿En qué puedo ayudarte hoy?`,this.placeholder=`Enviar un mensaje a Agent`,this.headerTitle=`Agent`,this.hideHeader=!1,this.interceptor=!1,this._historyOpen=!1,this._inspectorOpen=!1,this._inspectorEnabled=!1}static#e=this.styles=Qe;get controller(){return this._chatController}firstUpdated(){this.dispatchEvent(new CustomEvent(`controller-ready`,{detail:this._chatController}))}connectedCallback(){super.connectedCallback(),this.addEventListener(`a2uiaction`,this._handleA2UIAction)}disconnectedCallback(){this.removeEventListener(`a2uiaction`,this._handleA2UIAction),super.disconnectedCallback()}willUpdate(e){e.has(`interceptor`)&&(this.interceptor?this.enableFetchInterceptor():ar.destroy()),(e.has(`backendUrl`)||e.has(`appName`)||e.has(`conversationUrl`))&&(this._chatController.initialize({backendUrl:this.backendUrl,appName:this.appName,conversationUrl:this.conversationUrl,inspector:this.hasAttribute(`inspector`)||this.inspector}),this._inspectorEnabled=this.hasAttribute(`inspector`)||this.inspector)}enableFetchInterceptor(){console.warn(`Fetch interceptor is only available in development mode.`)}_handleSend(e){this._chatController.sendMessage(e.detail.content)}_handleNewThread(){this._chatController.startNewThread()}setAppContext(e){this._chatController.setAppContext(e)}setAppState(e){this._chatController.setAppState(e)}setAppLocation(e){this._chatController.setAppLocation(e)}setAppUI(e){this._chatController.setAppUI(e)}setAppFocus(e){this._chatController.setAppFocus(e)}setSuggestedPrompts(e){this._chatController.setSuggestedPrompts(e)}_toggleHistory(){this._historyOpen=!this._historyOpen,this._historyOpen&&this._chatController.refreshConversations()}_handleSelectThread(e){console.log(`Selected conversation:`,e.detail.conversation),this._chatController.loadConversation(e.detail.conversation.id),this._historyOpen=!1}_toggleInspector(){this._inspectorOpen=!this._inspectorOpen}render(){return S`
891
933
  <div class="chat-layout">
892
- ${this.hideHeader?``:C`
934
+ ${this.hideHeader?``:S`
893
935
  <agent-chat-header
894
936
  .title="${this.headerTitle}"
895
937
  @new-thread="${this._handleNewThread}"
@@ -911,16 +953,17 @@
911
953
  ?isRunning="${this._chatController.isRunning}"
912
954
  .disclaimer="${this.disclaimer}"
913
955
  .placeholder="${this.placeholder}"
956
+ .prompts="${this._chatController.showPrompts?this._chatController.suggestedPrompts:[]}"
914
957
  @send="${this._handleSend}">
915
958
  </agent-chat-composer>
916
959
 
917
- ${this._inspectorEnabled?C`
960
+ ${this._inspectorEnabled?S`
918
961
  <button class="inspector-toggle" @click="${this._toggleInspector}" title="Inspector">
919
- ${st}
962
+ ${ct}
920
963
  </button>
921
964
  `:``}
922
965
 
923
- ${this._inspectorOpen?C`
966
+ ${this._inspectorOpen?S`
924
967
  <agent-inspector-window
925
968
  @close="${this._toggleInspector}"
926
969
  @context-update="${this._handleContextUpdate}"
@@ -928,5 +971,5 @@
928
971
  ></agent-inspector-window>
929
972
  `:``}
930
973
  </div>
931
- `}_handleContextUpdate(e){this.setAppContext(e.detail)}_handleA2UIAction(e){let{action:t}=e.detail;if(t){if(console.log(`AgentChat: A2UI Action received:`,t),t.name===`decision`){this._handleAuthDecision(t);return}this._handleGenericUrlAction(t)}}_handleAuthDecision(e){let t=e.context||[],n=t.find(e=>e.key===`userDecision`)?.value?.literalString,r=t.find(e=>[`url`,`href`,`link`,`uri`].includes(e.key?.toLowerCase()))?.value?.literalString;if(console.log(`AgentChat: Specialized decision handler: ${n}`,e),n===`deny`){console.log(`AgentChat: User denied the request.`),this._chatController.sendMessage(`User selected "Deny" for action "${e.name}".`,`tool`);return}if(n===`approve`)if(r){console.log(`AgentChat: User selected "Approve". Opening auth URL: ${r}`);let t=window.open(r,`_blank`);if(t){let n=setInterval(()=>{t.closed&&(clearInterval(n),console.log(`AgentChat: Auth tab closed. Notifying approval.`),this._chatController.sendMessage(`User approved the request "${e.name}" and completed authentication.`,`tool`))},1e3)}else console.error(`AgentChat: Failed to open auth tab.`)}else console.log(`AgentChat: User approved (no URL provided).`),this._chatController.sendMessage(`User selected "Approve" for action "${e.name}".`,`tool`)}_handleGenericUrlAction(e){let t=e.context?.find(e=>[`url`,`href`,`link`,`uri`].includes(e.key?.toLowerCase())),n=t?.value?.literalString||t?.value?.path;n?(console.log(`AgentChat: Opening generic URL: ${n}`),window.open(n,`_blank`)):console.warn(`AgentChat: A2UI Action received without recognizable purpose:`,e)}_handleStateUpdate(e){this.setAppState(e.detail)}};P([M({type:String,attribute:`backend-url`})],$.prototype,`backendUrl`,void 0),P([M({type:String,attribute:`app-name`})],$.prototype,`appName`,void 0),P([M({type:String,attribute:`conversation-url`})],$.prototype,`conversationUrl`,void 0),P([M({type:String,attribute:`agent-avatar`})],$.prototype,`agentAvatar`,void 0),P([M({type:String,attribute:`disclaimer`})],$.prototype,`disclaimer`,void 0),P([M({type:String,attribute:`empty-text`})],$.prototype,`emptyText`,void 0),P([M({type:String,attribute:`placeholder`})],$.prototype,`placeholder`,void 0),P([M({type:String,attribute:`header-title`})],$.prototype,`headerTitle`,void 0),P([M({type:Boolean,attribute:`hide-header`})],$.prototype,`hideHeader`,void 0),P([M({type:Boolean,attribute:`interceptor`})],$.prototype,`interceptor`,void 0),P([N()],$.prototype,`_historyOpen`,void 0),P([N()],$.prototype,`_inspectorOpen`,void 0),P([N()],$.prototype,`_inspectorEnabled`,void 0),$=P([j(`agent-chat`)],$);function or(e,t={}){let n=document.createElement(`agent-chat`);return Object.keys(t).forEach(e=>{e in n&&(n[e]=t[e])}),e.appendChild(n),n}function sr(){}Object.defineProperty(e,`AgentChat`,{enumerable:!0,get:function(){return $}}),e.ChatController=rr,e.ChatPortalService=$n,e.ConversationService=tr,e.FetchInterceptorService=ir,e.chatPortalService=J,e.conversationService=Y,e.fetchInterceptorService=ar,e.mount=or,e.register=sr});
974
+ `}_handleContextUpdate(e){this.setAppContext(e.detail)}_handleA2UIAction(e){let{action:t}=e.detail;if(t){if(console.log(`AgentChat: A2UI Action received:`,t),t.name===`decision`){this._handleAuthDecision(t);return}this._handleGenericUrlAction(t)}}_handleAuthDecision(e){let t=e.context||[],n=t.find(e=>e.key===`userDecision`)?.value?.literalString,r=t.find(e=>[`url`,`href`,`link`,`uri`].includes(e.key?.toLowerCase()))?.value?.literalString;if(console.log(`AgentChat: Specialized decision handler: ${n}`,e),n===`deny`){console.log(`AgentChat: User denied the request.`),this._chatController.sendMessage(`User selected "Deny" for action "${e.name}".`,`tool`);return}if(n===`approve`)if(r){console.log(`AgentChat: User selected "Approve". Opening auth URL: ${r}`);let t=window.open(r,`_blank`);if(t){let n=setInterval(()=>{t.closed&&(clearInterval(n),console.log(`AgentChat: Auth tab closed. Notifying approval.`),this._chatController.sendMessage(`User approved the request "${e.name}" and completed authentication.`,`tool`))},1e3)}else console.error(`AgentChat: Failed to open auth tab.`)}else console.log(`AgentChat: User approved (no URL provided).`),this._chatController.sendMessage(`User selected "Approve" for action "${e.name}".`,`tool`)}_handleGenericUrlAction(e){let t=e.context?.find(e=>[`url`,`href`,`link`,`uri`].includes(e.key?.toLowerCase())),n=t?.value?.literalString||t?.value?.path;n?(console.log(`AgentChat: Opening generic URL: ${n}`),window.open(n,`_blank`)):console.warn(`AgentChat: A2UI Action received without recognizable purpose:`,e)}_handleStateUpdate(e){this.setAppState(e.detail)}};N([j({type:String,attribute:`backend-url`})],$.prototype,`backendUrl`,void 0),N([j({type:String,attribute:`app-name`})],$.prototype,`appName`,void 0),N([j({type:String,attribute:`conversation-url`})],$.prototype,`conversationUrl`,void 0),N([j({type:String,attribute:`agent-avatar`})],$.prototype,`agentAvatar`,void 0),N([j({type:String,attribute:`disclaimer`})],$.prototype,`disclaimer`,void 0),N([j({type:String,attribute:`empty-text`})],$.prototype,`emptyText`,void 0),N([j({type:String,attribute:`placeholder`})],$.prototype,`placeholder`,void 0),N([j({type:String,attribute:`header-title`})],$.prototype,`headerTitle`,void 0),N([j({type:Boolean,attribute:`hide-header`})],$.prototype,`hideHeader`,void 0),N([j({type:Boolean,attribute:`interceptor`})],$.prototype,`interceptor`,void 0),N([M()],$.prototype,`_historyOpen`,void 0),N([M()],$.prototype,`_inspectorOpen`,void 0),N([M()],$.prototype,`_inspectorEnabled`,void 0),$=N([A(`agent-chat`)],$);function or(e,t={}){let n=document.createElement(`agent-chat`);return Object.keys(t).forEach(e=>{e in n&&(n[e]=t[e])}),e.appendChild(n),n}function sr(){}Object.defineProperty(e,`AgentChat`,{enumerable:!0,get:function(){return $}}),e.ChatController=rr,e.ChatPortalService=$n,e.ConversationService=tr,e.FetchInterceptorService=ir,e.chatPortalService=J,e.conversationService=Y,e.fetchInterceptorService=ar,e.mount=or,e.register=sr});
932
975
  //# sourceMappingURL=site-operator.umd.js.map