@lambforge/agent-chat 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/agent-chat.js +124 -39
- package/dist/agent-chat.js.map +4 -4
- package/dist/index.cjs +297 -18
- package/dist/index.cjs.map +4 -4
- package/dist/index.mjs +294 -15
- package/dist/index.mjs.map +4 -4
- package/package.json +3 -3
- package/types/index.d.ts +19 -0
package/dist/agent-chat.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(()=>{var
|
|
1
|
+
(()=>{var ga=Object.create;var kt=Object.defineProperty;var $o=Object.getOwnPropertyDescriptor;var va=Object.getOwnPropertyNames;var ba=Object.getPrototypeOf,ya=Object.prototype.hasOwnProperty;var x=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(n){throw t=[n],n}};var xe=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},M=(r,e)=>{for(var t in e)kt(r,t,{get:e[t],enumerable:!0})},_o=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of va(e))!ya.call(r,o)&&o!==t&&kt(r,o,{get:()=>e[o],enumerable:!(n=$o(e,o))||n.enumerable});return r};var yn=(r,e,t)=>(t=r!=null?ga(ba(r)):{},_o(e||!r||!r.__esModule?kt(t,"default",{value:r,enumerable:!0}):t,r)),C=r=>_o(kt({},"__esModule",{value:!0}),r),q=(r,e,t,n)=>{for(var o=n>1?void 0:n?$o(e,t):e,i=r.length-1,s;i>=0;i--)(s=r[i])&&(o=(n?s(e,t,o):s(o))||o);return n&&o&&kt(e,t,o),o};var Kr={};M(Kr,{_$LH:()=>ht,html:()=>Si,noChange:()=>A,nothing:()=>E,render:()=>Te,svg:()=>Ai});function Ve(r,e,t=r,n){var o,i,s,a;if(e===A)return e;let l=n!==void 0?(o=t._$Co)===null||o===void 0?void 0:o[n]:t._$Cl,c=Ht(e)?void 0:e._$litDirective$;return l?.constructor!==c&&((i=l?._$AO)===null||i===void 0||i.call(l,!1),c===void 0?l=void 0:(l=new c(r),l._$AT(r,t,n)),n!==void 0?((s=(a=t)._$Co)!==null&&s!==void 0?s:a._$Co=[])[n]=l:t._$Cl=l),l!==void 0&&(e=Ve(r,l._$AS(r,e.values),l,n)),e}var Nn,Dr,pt,fi,_e,qn,tl,dt,qt,Ht,xi,wi,Nt,hi,mi,Be,gi,vi,$i,_i,Si,Ai,A,E,bi,ut,Ei,zt,Nr,ft,Ye,qr,rl,Hr,zr,Wr,ht,yi,Te,U=x(()=>{Dr=window,pt=Dr.trustedTypes,fi=pt?pt.createPolicy("lit-html",{createHTML:r=>r}):void 0,_e=`lit$${(Math.random()+"").slice(9)}$`,qn="?"+_e,tl=`<${qn}>`,dt=document,qt=(r="")=>dt.createComment(r),Ht=r=>r===null||typeof r!="object"&&typeof r!="function",xi=Array.isArray,wi=r=>xi(r)||typeof r?.[Symbol.iterator]=="function",Nt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,hi=/-->/g,mi=/>/g,Be=RegExp(`>|[
|
|
2
2
|
\f\r](?:([^\\s"'>=/]+)([
|
|
3
3
|
\f\r]*=[
|
|
4
4
|
\f\r]*(?:[^
|
|
5
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
5
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),gi=/'/g,vi=/"/g,$i=/^(?:script|style|textarea|title)$/i,_i=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),Si=_i(1),Ai=_i(2),A=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),bi=new WeakMap,ut=dt.createTreeWalker(dt,129,null,!1),Ei=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":"",s=Nt;for(let l=0;l<t;l++){let c=r[l],u,p,f=-1,d=0;for(;d<c.length&&(s.lastIndex=d,p=s.exec(c),p!==null);)d=s.lastIndex,s===Nt?p[1]==="!--"?s=hi:p[1]!==void 0?s=mi:p[2]!==void 0?($i.test(p[2])&&(o=RegExp("</"+p[2],"g")),s=Be):p[3]!==void 0&&(s=Be):s===Be?p[0]===">"?(s=o??Nt,f=-1):p[1]===void 0?f=-2:(f=s.lastIndex-p[2].length,u=p[1],s=p[3]===void 0?Be:p[3]==='"'?vi:gi):s===vi||s===gi?s=Be:s===hi||s===mi?s=Nt:(s=Be,o=void 0);let g=s===Be&&r[l+1].startsWith("/>")?" ":"";i+=s===Nt?c+tl:f>=0?(n.push(u),c.slice(0,f)+"$lit$"+c.slice(f)+_e+g):c+_e+(f===-2?(n.push(void 0),l):g)}let a=i+(r[t]||"<?>")+(e===2?"</svg>":"");if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return[fi!==void 0?fi.createHTML(a):a,n]},zt=class r{constructor({strings:e,_$litType$:t},n){let o;this.parts=[];let i=0,s=0,a=e.length-1,l=this.parts,[c,u]=Ei(e,t);if(this.el=r.createElement(c,n),ut.currentNode=this.el.content,t===2){let p=this.el.content,f=p.firstChild;f.remove(),p.append(...f.childNodes)}for(;(o=ut.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes()){let p=[];for(let f of o.getAttributeNames())if(f.endsWith("$lit$")||f.startsWith(_e)){let d=u[s++];if(p.push(f),d!==void 0){let g=o.getAttribute(d.toLowerCase()+"$lit$").split(_e),h=/([.?@])?(.*)/.exec(d);l.push({type:1,index:i,name:h[2],strings:g,ctor:h[1]==="."?qr:h[1]==="?"?Hr:h[1]==="@"?zr:Ye})}else l.push({type:6,index:i})}for(let f of p)o.removeAttribute(f)}if($i.test(o.tagName)){let p=o.textContent.split(_e),f=p.length-1;if(f>0){o.textContent=pt?pt.emptyScript:"";for(let d=0;d<f;d++)o.append(p[d],qt()),ut.nextNode(),l.push({type:2,index:++i});o.append(p[f],qt())}}}else if(o.nodeType===8)if(o.data===qn)l.push({type:2,index:i});else{let p=-1;for(;(p=o.data.indexOf(_e,p+1))!==-1;)l.push({type:7,index:i}),p+=_e.length-1}i++}}static createElement(e,t){let n=dt.createElement("template");return n.innerHTML=e,n}};Nr=class{constructor(e,t){this.u=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(e){var t;let{el:{content:n},parts:o}=this._$AD,i=((t=e?.creationScope)!==null&&t!==void 0?t:dt).importNode(n,!0);ut.currentNode=i;let s=ut.nextNode(),a=0,l=0,c=o[0];for(;c!==void 0;){if(a===c.index){let u;c.type===2?u=new ft(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new Wr(s,this,e)),this.u.push(u),c=o[++l]}a!==c?.index&&(s=ut.nextNode(),a++)}return i}p(e){let t=0;for(let n of this.u)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},ft=class r{constructor(e,t,n,o){var i;this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=o,this._$Cm=(i=o?.isConnected)===null||i===void 0||i}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cm}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=Ve(this,e,t),Ht(e)?e===E||e==null||e===""?(this._$AH!==E&&this._$AR(),this._$AH=E):e!==this._$AH&&e!==A&&this.g(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):wi(e)?this.k(e):this.g(e)}O(e,t=this._$AB){return this._$AA.parentNode.insertBefore(e,t)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}g(e){this._$AH!==E&&Ht(this._$AH)?this._$AA.nextSibling.data=e:this.T(dt.createTextNode(e)),this._$AH=e}$(e){var t;let{values:n,_$litType$:o}=e,i=typeof o=="number"?this._$AC(e):(o.el===void 0&&(o.el=zt.createElement(o.h,this.options)),o);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===i)this._$AH.p(n);else{let s=new Nr(i,this),a=s.v(this.options);s.p(n),this.T(a),this._$AH=s}}_$AC(e){let t=bi.get(e.strings);return t===void 0&&bi.set(e.strings,t=new zt(e)),t}k(e){xi(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,o=0;for(let i of e)o===t.length?t.push(n=new r(this.O(qt()),this.O(qt()),this,this.options)):n=t[o],n._$AI(i),o++;o<t.length&&(this._$AR(n&&n._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,t);e&&e!==this._$AB;){let o=e.nextSibling;e.remove(),e=o}}setConnected(e){var t;this._$AM===void 0&&(this._$Cm=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}},Ye=class{constructor(e,t,n,o,i){this.type=1,this._$AH=E,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=E}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,n,o){let i=this.strings,s=!1;if(i===void 0)e=Ve(this,e,t,0),s=!Ht(e)||e!==this._$AH&&e!==A,s&&(this._$AH=e);else{let a=e,l,c;for(e=i[0],l=0;l<i.length-1;l++)c=Ve(this,a[n+l],t,l),c===A&&(c=this._$AH[l]),s||(s=!Ht(c)||c!==this._$AH[l]),c===E?e=E:e!==E&&(e+=(c??"")+i[l+1]),this._$AH[l]=c}s&&!o&&this.j(e)}j(e){e===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},qr=class extends Ye{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===E?void 0:e}},rl=pt?pt.emptyScript:"",Hr=class extends Ye{constructor(){super(...arguments),this.type=4}j(e){e&&e!==E?this.element.setAttribute(this.name,rl):this.element.removeAttribute(this.name)}},zr=class extends Ye{constructor(e,t,n,o,i){super(e,t,n,o,i),this.type=5}_$AI(e,t=this){var n;if((e=(n=Ve(this,e,t,0))!==null&&n!==void 0?n:E)===A)return;let o=this._$AH,i=e===E&&o!==E||e.capture!==o.capture||e.once!==o.once||e.passive!==o.passive,s=e!==E&&(o===E||i);i&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,n;typeof this._$AH=="function"?this._$AH.call((n=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}},Wr=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){Ve(this,e)}},ht={P:"$lit$",A:_e,M:qn,C:1,L:Ei,R:Nr,D:wi,V:Ve,I:ft,H:Ye,N:Hr,U:zr,B:qr,F:Wr},yi=Dr.litHtmlPolyfillSupport;yi?.(zt,ft),((Nn=Dr.litHtmlVersions)!==null&&Nn!==void 0?Nn:Dr.litHtmlVersions=[]).push("2.5.0");Te=(r,e,t)=>{var n,o;let i=(n=t?.renderBefore)!==null&&n!==void 0?n:e,s=i._$litPart$;if(s===void 0){let a=(o=t?.renderBefore)!==null&&o!==void 0?o:null;i._$litPart$=s=new ft(e.insertBefore(qt(),a),a,void 0,t??{})}return s._$AI(r),s}});var ki=xe(mt=>{"use strict";var nl=mt&&mt.__setFunctionName||function(r,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(r,"name",{configurable:!0,value:t?"".concat(t," ",e):e})};Object.defineProperty(mt,"__esModule",{value:!0});mt.Component=void 0;var Ci=(U(),C(Kr)),ol=(r,e,t)=>(window.customElements.define(r,e,t),e),il=(r,e,t)=>{let{kind:n,elements:o}=e;return{kind:n,elements:o,finisher(i){window.customElements.define(r,i,t)}}},sl=r=>typeof r=="function",al=(r,e={})=>t=>{var n,o;if(!((n=window._excluded_components)===null||n===void 0)&&n.includes(e.selector))return t;if(!r||r&&r.indexOf("-")<=0)throw new Error(`You need at least 1 dash in the custom element name! ${t}`);e.styles=e.styles||[],e.components=e.components||[];let i=t.prototype.OnInit||function(){},s=t.prototype.OnDestroy||function(){},a=t.prototype.OnUpdate||function(){},l=t.prototype.OnUpdateFirst||function(){},c=t.prototype.connectedCallback||function(){},u=t.prototype.disconnectedCallback||function(){},p=t.prototype.update||function(){},f=t.prototype.firstUpdated||function(){};e.template||(e.template=t.prototype.render||(()=>(0,Ci.html)``)),e.style&&e.styles.push(e.style);let d=(o=class extends t{static is(){return r}getTemplateResult(){return this}OnInit(){if(e.container&&((0,Ci.render)(e.template.call(this),e.container),e.style)){let h=document.createElement("style");h.type="text/css",h.styleSheet?h.styleSheet.cssText=e.style.toString():h.appendChild(document.createTextNode(e.style.toString())),e.container.prepend(h)}return i.call(this)}disconnectedCallback(){var h;s.call(this),u.call(this),(h=this._registry)===null||h===void 0||h.unsubscribe(),this._registry=null}connectedCallback(){var h,m;if(c.call(this),i.call(this),sl(e.registry)&&(this._registry=e.registry.call(this)),!((h=e.modifiers)===null||h===void 0)&&h.length)for(let w of e.modifiers){if(!w)throw new Error(`Provided null value inside modifiers for component "${e.selector}"`);if(!w.options)throw new Error(`Missing options for attribute inside ${e.selector}`);if(!(!((m=w.options)===null||m===void 0)&&m.selector))throw new Error(`Missing attribute selector inside component "${e.selector}"`);if(!this._registry&&typeof w.options.registry=="function"&&(this._registry=w.options.registry.call(this)),!this._registry)throw new Error(`Missing attribute registry for attribute "${w.options.selector}" and no default registry specified inside component "${e.selector}"`);this._registry.define(w.options.selector,w)}}render(){return e.template.call(this)}update(){p.call(this),a.call(this)}firstUpdated(){f.call(this),l.call(this)}},nl(o,"ModifiedClass"),o.styles=e.styles,o),g=window.customElements.get(r);return g?(console.error(`** IMPORTANT!!! **
|
|
6
6
|
------------------------------------------
|
|
7
7
|
< ${r} > </${r}> Component re-defined multiple times and it is already registered inside customElements registry
|
|
8
8
|
Possible Solutions:
|
|
@@ -12,28 +12,28 @@ Possible Solutions:
|
|
|
12
12
|
|
|
13
13
|
** If this is Server Side Rendering you can ignore this message **
|
|
14
14
|
------------------------------------------
|
|
15
|
-
`),
|
|
16
|
-
`),rr.content.appendChild(nr)),e.add(tr),t.delete(tr),window.ShadyCSS.prepareTemplateStyles(rr,tr),ao&&window.ShadyCSS.nativeShadow&&(nr=rr.content.querySelector("style"))!==null&&rr.content.appendChild(nr)})(K,Me),c.removeChild(u),(m=window.ShadyCSS)===null||m===void 0?void 0:m.nativeShadow){var je=Me.content.querySelector("style");je!==null&&c.appendChild(je.cloneNode(!0))}b.insertBefore(c,be),this._$AA=ie,this._$AB=be}else d.call(this,f,v)},p._$AC=function(f){var v,h=(v=this.options)===null||v===void 0?void 0:v.scope,m=a.get(h);m===void 0&&a.set(h,m=new Map);var b=m.get(f.strings);return b===void 0&&m.set(f.strings,b=new n(f,this.options)),b}}})}))});var qr,zt,Rn,Ei,ft,Mn,Ci,Nr,Vt,jn=y(()=>{qr=window,zt=qr.ShadowRoot&&(qr.ShadyCSS===void 0||qr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Rn=Symbol(),Ei=new WeakMap,ft=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Rn)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(zt&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Ei.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Ei.set(t,e))}return e}toString(){return this.cssText}},Mn=r=>new ft(typeof r=="string"?r:r+"",void 0,Rn),Ci=(r,...e)=>{let t=r.length===1?r[0]:e.reduce(((n,o,i)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+r[i+1]),r[0]);return new ft(t,r,Rn)},Nr=(r,e)=>{zt?r.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((t=>{let n=document.createElement("style"),o=qr.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}))},Vt=zt?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Mn(t)})(r):r});var Ln,Fr,Ti,sl,Oi,Hr,Dn,Un,pe,Wr=y(()=>{jn();jn();Fr=window,Ti=Fr.trustedTypes,sl=Ti?Ti.emptyScript:"",Oi=Fr.reactiveElementPolyfillSupport,Hr={toAttribute(r,e){switch(e){case Boolean:r=r?sl:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Dn=(r,e)=>e!==r&&(e==e||r==r),Un={attribute:!0,type:String,converter:Hr,reflect:!1,hasChanged:Dn},pe=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach(((t,n)=>{let o=this._$Ep(n,t);o!==void 0&&(this._$Ev.set(o,n),e.push(o))})),e}static createProperty(e,t=Un){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let n=typeof e=="symbol"?Symbol():"__"+e,o=this.getPropertyDescriptor(e,n,t);o!==void 0&&Object.defineProperty(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(o){let i=this[e];this[t]=o,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Un}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let t=this.properties,n=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let o of n)this.createProperty(o,t[o])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let o of n)t.unshift(Vt(o))}else e!==void 0&&t.push(Vt(e));return t}static _$Ep(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}u(){var e;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach((t=>t(this)))}addController(e){var t,n;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;let t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return Nr(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach((t=>{var n;return(n=t.hostConnected)===null||n===void 0?void 0:n.call(t)}))}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach((t=>{var n;return(n=t.hostDisconnected)===null||n===void 0?void 0:n.call(t)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=Un){var o;let i=this.constructor._$Ep(e,n);if(i!==void 0&&n.reflect===!0){let s=(((o=n.converter)===null||o===void 0?void 0:o.toAttribute)!==void 0?n.converter:Hr).toAttribute(t,n.type);this._$El=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$El=null}}_$AK(e,t){var n;let o=this.constructor,i=o._$Ev.get(e);if(i!==void 0&&this._$El!==i){let s=o.getPropertyOptions(i),a=typeof s.converter=="function"?{fromAttribute:s.converter}:((n=s.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?s.converter:Hr;this._$El=i,this[i]=a.fromAttribute(t,s.type),this._$El=null}}requestUpdate(e,t,n){let o=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Dn)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((o,i)=>this[i]=o)),this._$Ei=void 0);let t=!1,n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach((o=>{var i;return(i=o.hostUpdate)===null||i===void 0?void 0:i.call(o)})),this.update(n)):this._$Ek()}catch(o){throw t=!1,this._$Ek(),o}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach((n=>{var o;return(o=n.hostUpdated)===null||o===void 0?void 0:o.call(n)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach(((t,n)=>this._$EO(n,this[n],t))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};pe.finalized=!0,pe.elementProperties=new Map,pe.elementStyles=[],pe.shadowRootOptions={mode:"open"},Oi?.({ReactiveElement:pe}),((Ln=Fr.reactiveElementVersions)!==null&&Ln!==void 0?Ln:Fr.reactiveElementVersions=[]).push("1.5.0")});var qn,Nn,Ii,ke,ki,Pi,Ri=y(()=>{Wr();Wr();L();L();Ii=pe,ke=class extends pe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let n=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=n.firstChild),n}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ce(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return A}};ke.finalized=!0,ke._$litElement$=!0,(qn=globalThis.litElementHydrateSupport)===null||qn===void 0||qn.call(globalThis,{LitElement:ke});ki=globalThis.litElementPolyfillSupport;ki?.({LitElement:ke});Pi={_$AK:(r,e,t)=>{r._$AK(e,t)},_$AL:r=>r._$AL};((Nn=globalThis.litElementVersions)!==null&&Nn!==void 0?Nn:globalThis.litElementVersions=[]).push("3.2.2")});var al,ll,Q,Ie=y(()=>{al=(r,e,t)=>{Object.defineProperty(e,t,r)},ll=(r,e)=>({kind:"method",placement:"prototype",key:e.key,descriptor:r}),Q=({finisher:r,descriptor:e})=>(t,n)=>{var o;if(n===void 0){let i=(o=t.originalKey)!==null&&o!==void 0?o:t.key,s=e!=null?{kind:"method",placement:"prototype",key:i,descriptor:e(t.key)}:{...t,key:i};return r!=null&&(s.finisher=function(a){r(a,i)}),s}{let i=t.constructor;e!==void 0&&Object.defineProperty(t,n,e(n)),r?.(i,n)}}});var cl,Mi=y(()=>{cl=r=>e=>typeof e=="function"?((t,n)=>(customElements.define(t,n),n))(r,e):((t,n)=>{let{kind:o,elements:i}=n;return{kind:o,elements:i,finisher(s){customElements.define(t,s)}}})(r,e)});function Fn(r){return(e,t)=>t!==void 0?((n,o,i)=>{o.constructor.createProperty(i,n)})(r,e,t):ul(r,e)}var ul,Hn=y(()=>{ul=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}}});function pl(r){return Fn({...r,state:!0})}var ji=y(()=>{Hn();});function fl(r){return Q({finisher:(e,t)=>{Object.assign(e.prototype[t],r)}})}var Li=y(()=>{Ie();});function dl(r,e){return Q({descriptor:t=>{let n={get(){var o,i;return(i=(o=this.renderRoot)===null||o===void 0?void 0:o.querySelector(r))!==null&&i!==void 0?i:null},enumerable:!0,configurable:!0};if(e){let o=typeof t=="symbol"?Symbol():"__"+t;n.get=function(){var i,s;return this[o]===void 0&&(this[o]=(s=(i=this.renderRoot)===null||i===void 0?void 0:i.querySelector(r))!==null&&s!==void 0?s:null),this[o]}}return n}})}var Ui=y(()=>{Ie();});function hl(r){return Q({descriptor:e=>({get(){var t,n;return(n=(t=this.renderRoot)===null||t===void 0?void 0:t.querySelectorAll(r))!==null&&n!==void 0?n:[]},enumerable:!0,configurable:!0})})}var Di=y(()=>{Ie();});function ml(r){return Q({descriptor:e=>({async get(){var t;return await this.updateComplete,(t=this.renderRoot)===null||t===void 0?void 0:t.querySelector(r)},enumerable:!0,configurable:!0})})}var qi=y(()=>{Ie();});function zn(r){let{slot:e,selector:t}=r??{};return Q({descriptor:n=>({get(){var o;let i="slot"+(e?`[name=${e}]`:":not([name])"),s=(o=this.renderRoot)===null||o===void 0?void 0:o.querySelector(i),a=s!=null?vl(s,r):[];return t?a.filter((l=>l.matches(t))):a},enumerable:!0,configurable:!0})})}var Wn,vl,Vn=y(()=>{Ie();vl=((Wn=window.HTMLSlotElement)===null||Wn===void 0?void 0:Wn.prototype.assignedElements)!=null?(r,e)=>r.assignedElements(e):(r,e)=>r.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE))});function gl(r,e,t){let n,o=r;return typeof r=="object"?(o=r.slot,n=r):n={flatten:e},t?zn({slot:o,flatten:e,selector:t}):Q({descriptor:i=>({get(){var s,a;let l="slot"+(o?`[name=${o}]`:":not([name])"),c=(s=this.renderRoot)===null||s===void 0?void 0:s.querySelector(l);return(a=c?.assignedNodes(n))!==null&&a!==void 0?a:[]},enumerable:!0,configurable:!0})})}var Ni=y(()=>{Ie();Vn();});var Fi={};R(Fi,{CSSResult:()=>ft,LitElement:()=>ke,ReactiveElement:()=>pe,UpdatingElement:()=>Ii,_$LE:()=>Pi,_$LH:()=>lt,adoptStyles:()=>Nr,css:()=>Ci,customElement:()=>cl,decorateProperty:()=>Q,defaultConverter:()=>Hr,eventOptions:()=>fl,getCompatibleStyle:()=>Vt,html:()=>li,legacyPrototypeMethod:()=>al,noChange:()=>A,notEqual:()=>Dn,nothing:()=>E,property:()=>Fn,query:()=>dl,queryAll:()=>hl,queryAssignedElements:()=>zn,queryAssignedNodes:()=>gl,queryAsync:()=>ml,render:()=>Ce,standardPrototypeMethod:()=>ll,state:()=>pl,supportsAdoptingStyleSheets:()=>zt,svg:()=>ci,unsafeCSS:()=>Mn});var Hi=y(()=>{Wr();L();Ri();Ie();Mi();Hn();ji();Li();Ui();Di();qi();Vn();Ni();console.warn("The main 'lit-element' module entrypoint is deprecated. Please update your imports to use the 'lit' package: 'lit' and 'lit/decorators.ts' or import from 'lit-element/lit-element.ts'. See https://lit.dev/msg/deprecated-import-path for more information.")});var Wi={};R(Wi,{classMap:()=>yl});var yl,zi=y(()=>{L();q();yl=T(class extends j{constructor(r){var e;if(super(r),r.type!==O.ATTRIBUTE||r.name!=="class"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter((e=>r[e])).join(" ")+" "}update(r,[e]){var t,n;if(this.nt===void 0){this.nt=new Set,r.strings!==void 0&&(this.st=new Set(r.strings.join(" ").split(/\s/).filter((i=>i!==""))));for(let i in e)e[i]&&!(!((t=this.st)===null||t===void 0)&&t.has(i))&&this.nt.add(i);return this.render(e)}let o=r.element.classList;this.nt.forEach((i=>{i in e||(o.remove(i),this.nt.delete(i))}));for(let i in e){let s=!!e[i];s===this.nt.has(i)||!((n=this.st)===null||n===void 0)&&n.has(i)||(s?(o.add(i),this.nt.add(i)):(o.remove(i),this.nt.delete(i)))}return A}})});var Vi,dt,ht,Bn=y(()=>{Vi=async(r,e)=>{for await(let t of r)if(await e(t)===!1)return},dt=class{constructor(e){this.Y=e}disconnect(){this.Y=void 0}reconnect(e){this.Y=e}deref(){return this.Y}},ht=class{constructor(){this.Z=void 0,this.q=void 0}get(){return this.Z}pause(){var e;(e=this.Z)!==null&&e!==void 0||(this.Z=new Promise((t=>this.q=t)))}resume(){var e;(e=this.q)===null||e===void 0||e.call(this),this.Z=this.q=void 0}}});var Bi={};R(Bi,{AsyncReplaceDirective:()=>mt,asyncReplace:()=>bl});var mt,bl,Kn=y(()=>{L();pt();Bn();q();mt=class extends $e{constructor(){super(...arguments),this._$CK=new dt(this),this._$CX=new ht}render(e,t){return A}update(e,[t,n]){if(this.isConnected||this.disconnected(),t===this._$CJ)return;this._$CJ=t;let o=0,{_$CK:i,_$CX:s}=this;return Vi(t,(async a=>{for(;s.get();)await s.get();let l=i.deref();if(l!==void 0){if(l._$CJ!==t)return!1;n!==void 0&&(a=n(a,o)),l.commitValue(a,o),o++}return!0})),A}commitValue(e,t){this.setValue(e)}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},bl=T(mt)});var Ki={};R(Ki,{asyncAppend:()=>xl});var xl,Yi=y(()=>{q();Kn();ye();xl=T(class extends mt{constructor(r){if(super(r),r.type!==O.CHILD)throw Error("asyncAppend can only be used in child expressions")}update(r,e){return this._$Ctt=r,super.update(r,e)}commitValue(r,e){e===0&&Ft(this._$Ctt);let t=ne(this._$Ctt);ue(t,r)}})});var Gi={};R(Gi,{cache:()=>wl});var wl,Ji=y(()=>{L();q();ye();wl=T(class extends j{constructor(r){super(r),this.et=new WeakMap}render(r){return[r]}update(r,[e]){if(Oe(this.it)&&(!Oe(e)||this.it.strings!==e.strings)){let t=ut(r).pop(),n=this.et.get(this.it.strings);if(n===void 0){let o=document.createDocumentFragment();n=Ce(E,o),n.setConnected(!1),this.et.set(this.it.strings,n)}ge(n,[t]),ne(n,void 0,t)}if(Oe(e)){if(!Oe(this.it)||this.it.strings!==e.strings){let t=this.et.get(e.strings);if(t!==void 0){let n=ut(t).pop();Ft(r),ne(r,void 0,n),ge(r,[n])}}this.it=e}else this.it=void 0;return this.render(e)}})});var Zi={};R(Zi,{guard:()=>Sl});var _l,Sl,Xi=y(()=>{L();q();_l={},Sl=T(class extends j{constructor(){super(...arguments),this.ot=_l}render(r,e){return e()}update(r,[e,t]){if(Array.isArray(e)){if(Array.isArray(this.ot)&&this.ot.length===e.length&&e.every(((n,o)=>n===this.ot[o])))return A}else if(this.ot===e)return A;return this.ot=Array.isArray(e)?Array.from(e):e,this.render(e,t)}})});var Qi={};R(Qi,{ifDefined:()=>$l});var $l,es=y(()=>{L();$l=r=>r??E});var ts={};R(ts,{live:()=>Al});var Al,rs=y(()=>{L();q();ye();Al=T(class extends j{constructor(r){if(super(r),r.type!==O.PROPERTY&&r.type!==O.ATTRIBUTE&&r.type!==O.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Be(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(r,[e]){if(e===A||e===E)return e;let t=r.element,n=r.name;if(r.type===O.PROPERTY){if(e===t[n])return A}else if(r.type===O.BOOLEAN_ATTRIBUTE){if(!!e===t.hasAttribute(n))return A}else if(r.type===O.ATTRIBUTE&&t.getAttribute(n)===e+"")return A;return ge(r),e}})});var ns={};R(ns,{createRef:()=>El,ref:()=>Cl});var El,Gn,Yn,Cl,os=y(()=>{L();pt();q();El=()=>new Gn,Gn=class{},Yn=new WeakMap,Cl=T(class extends $e{render(r){return E}update(r,[e]){var t;let n=e!==this.Y;return n&&this.Y!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=e,this.dt=(t=r.options)===null||t===void 0?void 0:t.host,this.rt(this.ct=r.element)),E}rt(r){var e;if(typeof this.Y=="function"){let t=(e=this.dt)!==null&&e!==void 0?e:globalThis,n=Yn.get(t);n===void 0&&(n=new WeakMap,Yn.set(t,n)),n.get(this.Y)!==void 0&&this.Y.call(this.dt,void 0),n.set(this.Y,r),r!==void 0&&this.Y.call(this.dt,r)}else this.Y.value=r}get lt(){var r,e,t;return typeof this.Y=="function"?(e=Yn.get((r=this.dt)!==null&&r!==void 0?r:globalThis))===null||e===void 0?void 0:e.get(this.Y):(t=this.Y)===null||t===void 0?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}})});var ss={};R(ss,{repeat:()=>Tl});var is,Tl,as=y(()=>{L();q();ye();is=(r,e,t)=>{let n=new Map;for(let o=e;o<=t;o++)n.set(r[o],o);return n},Tl=T(class extends j{constructor(r){if(super(r),r.type!==O.CHILD)throw Error("repeat() can only be used in text expressions")}ht(r,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);let o=[],i=[],s=0;for(let a of r)o[s]=n?n(a,s):s,i[s]=t(a,s),s++;return{values:i,keys:o}}render(r,e,t){return this.ht(r,e,t).values}update(r,[e,t,n]){var o;let i=ut(r),{values:s,keys:a}=this.ht(e,t,n);if(!Array.isArray(i))return this.ut=a,s;let l=(o=this.ut)!==null&&o!==void 0?o:this.ut=[],c=[],u,p,d=0,f=i.length-1,v=0,h=s.length-1;for(;d<=f&&v<=h;)if(i[d]===null)d++;else if(i[f]===null)f--;else if(l[d]===a[v])c[v]=ue(i[d],s[v]),d++,v++;else if(l[f]===a[h])c[h]=ue(i[f],s[h]),f--,h--;else if(l[d]===a[h])c[h]=ue(i[d],s[h]),ne(r,c[h+1],i[d]),d++,h--;else if(l[f]===a[v])c[v]=ue(i[f],s[v]),ne(r,i[d],i[f]),f--,v++;else if(u===void 0&&(u=is(a,v,h),p=is(l,d,f)),u.has(l[d]))if(u.has(l[f])){let m=p.get(a[v]),b=m!==void 0?i[m]:null;if(b===null){let K=ne(r,i[d]);ue(K,s[v]),c[v]=K}else c[v]=ue(b,s[v]),ne(r,i[d],b),i[m]=null;v++}else Nt(i[f]),f--;else Nt(i[d]),d++;for(;v<=h;){let m=ne(r,c[h+1]);ue(m,s[v]),c[v++]=m}for(;d<=f;){let m=i[d++];m!==null&&Nt(m)}return this.ut=a,ge(r,c),A}})});var ls={};R(ls,{styleMap:()=>Ol});var Ol,cs=y(()=>{L();q();Ol=T(class extends j{constructor(r){var e;if(super(r),r.type!==O.ATTRIBUTE||r.name!=="style"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce(((e,t)=>{let n=r[t];return n==null?e:e+`${t=t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`}),"")}update(r,[e]){let{style:t}=r.element;if(this.vt===void 0){this.vt=new Set;for(let n in e)this.vt.add(n);return this.render(e)}this.vt.forEach((n=>{e[n]==null&&(this.vt.delete(n),n.includes("-")?t.removeProperty(n):t[n]="")}));for(let n in e){let o=e[n];o!=null&&(this.vt.add(n),n.includes("-")?t.setProperty(n,o):t[n]=o)}return A}})});var us={};R(us,{templateContent:()=>kl});var kl,ps=y(()=>{L();q();kl=T(class extends j{constructor(r){if(super(r),r.type!==O.CHILD)throw Error("templateContent can only be used in child bindings")}render(r){return this.ft===r?A:(this.ft=r,document.importNode(r.content,!0))}})});var fs={};R(fs,{UnsafeHTMLDirective:()=>Pe,unsafeHTML:()=>Il});var Pe,Il,Jn=y(()=>{L();q();Pe=class extends j{constructor(e){if(super(e),this.it=E,e.type!==O.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===E||e==null)return this._t=void 0,this.it=e;if(e===A)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};Pe.directiveName="unsafeHTML",Pe.resultType=1;Il=T(Pe)});var ds={};R(ds,{unsafeSVG:()=>Pl});var Bt,Pl,hs=y(()=>{q();Jn();Bt=class extends Pe{};Bt.directiveName="unsafeSVG",Bt.resultType=2;Pl=T(Bt)});var vs={};R(vs,{UntilDirective:()=>zr,until:()=>Rl});var ms,zr,Rl,gs=y(()=>{L();ye();pt();Bn();q();ms=r=>!qt(r)&&typeof r.then=="function",zr=class extends $e{constructor(){super(...arguments),this._$Cwt=1073741823,this._$Cyt=[],this._$CK=new dt(this),this._$CX=new ht}render(...e){var t;return(t=e.find((n=>!ms(n))))!==null&&t!==void 0?t:A}update(e,t){let n=this._$Cyt,o=n.length;this._$Cyt=t;let i=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<t.length&&!(a>this._$Cwt);a++){let l=t[a];if(!ms(l))return this._$Cwt=a,l;a<o&&l===n[a]||(this._$Cwt=1073741823,o=0,Promise.resolve(l).then((async c=>{for(;s.get();)await s.get();let u=i.deref();if(u!==void 0){let p=u._$Cyt.indexOf(l);p>-1&&p<u._$Cwt&&(u._$Cwt=p,u.setValue(c))}})))}return A}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Rl=T(zr)});var ys={};R(ys,{choose:()=>Ml});var Ml,bs=y(()=>{Ml=(r,e,t)=>{for(let n of e)if(n[0]===r)return(0,n[1])();return t?.()}});var xs={};R(xs,{join:()=>jl});function*jl(r,e){let t=typeof e=="function";if(r!==void 0){let n=-1;for(let o of r)n>-1&&(yield t?e(n):e),n++,yield o}}var ws=y(()=>{});var _s={};R(_s,{keyed:()=>Ll});var Ll,Ss=y(()=>{L();q();ye();Ll=T(class extends j{constructor(){super(...arguments),this.key=E}render(r,e){return this.key=r,e}update(r,[e,t]){return e!==this.key&&(ge(r),this.key=e),t}})});var $s={};R($s,{map:()=>Ul});function*Ul(r,e){if(r!==void 0){let t=0;for(let n of r)yield e(n,t++)}}var As=y(()=>{});var Es={};R(Es,{range:()=>Dl});function*Dl(r,e,t=1){let n=e===void 0?0:r;e!=null||(e=r);for(let o=n;t>0?o<e:e<o;o+=t)yield o}var Cs=y(()=>{});var Ts={};R(Ts,{when:()=>ql});function ql(r,e,t){return r?e():t?.()}var Os=y(()=>{});var Kt=xe($=>{"use strict";var Nl=$&&$.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,o)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),k=$&&$.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Nl(e,r,t)};Object.defineProperty($,"__esModule",{value:!0});k(vi(),$);k(xi(),$);k((L(),C(Lr)),$);k((q(),C(Tn)),$);k((Pn(),C(Si)),$);k(($i(),C(il)),$);k(Ai(),$);k((ye(),C(yi)),$);k((pt(),C(On)),$);k((Hi(),C(Fi)),$);k((zi(),C(Wi)),$);k((Yi(),C(Ki)),$);k((Kn(),C(Bi)),$);k((Ji(),C(Gi)),$);k((Xi(),C(Zi)),$);k((es(),C(Qi)),$);k((rs(),C(ts)),$);k((os(),C(ns)),$);k((as(),C(ss)),$);k((cs(),C(ls)),$);k((ps(),C(us)),$);k((Jn(),C(fs)),$);k((hs(),C(ds)),$);k((gs(),C(vs)),$);k((bs(),C(ys)),$);k((ws(),C(xs)),$);k((Ss(),C(_s)),$);k((As(),C($s)),$);k((Cs(),C(Es)),$);k((Os(),C(Ts)),$)});var ks=xe(fe=>{"use strict";var Yt=fe&&fe.__decorate||function(r,e,t,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(s=r[a])&&(i=(o<3?s(i):o>3?s(e,t,i):s(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},Vr=fe&&fe.__metadata||function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Fl=fe&&fe.__awaiter||function(r,e,t,n){function o(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function a(u){try{c(n.next(u))}catch(p){s(p)}}function l(u){try{c(n.throw(u))}catch(p){s(p)}}function c(u){u.done?i(u.value):o(u.value).then(a,l)}c((n=n.apply(r,e||[])).next())})};Object.defineProperty(fe,"__esModule",{value:!0});fe.Renderer=void 0;var W=Kt();function Hl(r){return function(e){if(!window.customElements.get(r.selector))return(0,W.Component)(r)(e)}}var Ke=class extends W.LitElement{constructor(){super(...arguments),this.options={state:{},render:(e,t,n)=>(0,W.html)` ${e} `,style:(0,W.css)``,styles:[],deepCloneState:!1,loading:()=>(0,W.html)``,error:e=>(0,W.html)`${e?.message}`},this.loading=!0,this.state={}}OnUpdateFirst(){var e,t,n;return Fl(this,void 0,void 0,function*(){!((e=this.options)===null||e===void 0)&&e.style&&(0,W.adoptStyles)(this.shadowRoot,[this.options.style]),!((n=(t=this.options)===null||t===void 0?void 0:t.styles)===null||n===void 0)&&n.length&&(0,W.adoptStyles)(this.shadowRoot,this.options.styles),this.options.state=yield this.options.state,this.options.state&&(this.isObservable(this.options.state)?this.subscription=this.options.state.subscribe(o=>{this.state=o,this.loading=!1,this.dispatchEvent(new CustomEvent("onData",{detail:o}))},o=>{this.state=null,this.error=o,this.loading=!1,this.dispatchEvent(new CustomEvent("onError",{detail:o}))}):(this.loading=!1,this.state=this.options.state),yield this.updateComplete,yield new Promise(requestAnimationFrame),this.dispatchEvent(new CustomEvent("loaded")))})}isObservable(e){return this.isFunction(e.lift)&&this.isFunction(e.subscribe)}isFunction(e){return typeof e=="function"}OnDestroy(){this.subscription&&this.subscription.unsubscribe()}renderContent(){if(!this.error&&this.options.render){let e=this.options.render(this.options.deepCloneState?JSON.parse(JSON.stringify(this.state)):this.state,t=>this.state=Object.assign({},t),this.shadowRoot);return e?.strings?e:(0,W.html)``}return this.state}};fe.Renderer=Ke;Yt([(0,W.property)({type:Object}),Vr("design:type",Object)],Ke.prototype,"options",void 0);Yt([(0,W.property)({type:Boolean}),Vr("design:type",Object)],Ke.prototype,"loading",void 0);Yt([(0,W.property)({type:Object}),Vr("design:type",Error)],Ke.prototype,"error",void 0);Yt([(0,W.property)(),Vr("design:type",Object)],Ke.prototype,"state",void 0);fe.Renderer=Ke=Yt([Hl({selector:"r-renderer",template(){return(0,W.html)`
|
|
15
|
+
`),g):(typeof d=="function"?ol(r,d,{extends:e.extends}):il(r,d,{extends:e.extends}),d)},ll=r=>al(r.selector,r);mt.Component=ll});var Ii=xe(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0})});var Pi=xe(Ie=>{"use strict";var cl=Ie&&Ie.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,o)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Oi=Ie&&Ie.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&cl(e,r,t)};Object.defineProperty(Ie,"__esModule",{value:!0});Oi(ki(),Ie);Oi(Ii(),Ie)});var Hn={};M(Hn,{Directive:()=>L,PartType:()=>T,directive:()=>k});var T,k,L,D=x(()=>{T={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},k=r=>(...e)=>({_$litDirective$:r,values:e}),L=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}});var Ri={};M(Ri,{TemplateResultType:()=>pl,clearPart:()=>Bt,getCommittedValue:()=>gt,getDirectiveClass:()=>fl,insertPart:()=>se,isDirectiveResult:()=>dl,isPrimitive:()=>Wt,isSingleExpression:()=>Ge,isTemplateResult:()=>Oe,removePart:()=>Kt,setChildPartValue:()=>pe,setCommittedValue:()=>ve});var ul,Wt,pl,Oe,dl,fl,Ge,ji,se,pe,hl,ve,gt,Kt,Bt,be=x(()=>{U();({I:ul}=ht),Wt=r=>r===null||typeof r!="object"&&typeof r!="function",pl={HTML:1,SVG:2},Oe=(r,e)=>e===void 0?r?._$litType$!==void 0:r?._$litType$===e,dl=r=>r?._$litDirective$!==void 0,fl=r=>r?._$litDirective$,Ge=r=>r.strings===void 0,ji=()=>document.createComment(""),se=(r,e,t)=>{var n;let o=r._$AA.parentNode,i=e===void 0?r._$AB:e._$AA;if(t===void 0){let s=o.insertBefore(ji(),i),a=o.insertBefore(ji(),i);t=new ul(s,a,r,r.options)}else{let s=t._$AB.nextSibling,a=t._$AM,l=a!==r;if(l){let c;(n=t._$AQ)===null||n===void 0||n.call(t,r),t._$AM=r,t._$AP!==void 0&&(c=r._$AU)!==a._$AU&&t._$AP(c)}if(s!==i||l){let c=t._$AA;for(;c!==s;){let u=c.nextSibling;o.insertBefore(c,i),c=u}}}return t},pe=(r,e,t=r)=>(r._$AI(e,t),r),hl={},ve=(r,e=hl)=>r._$AH=e,gt=r=>r._$AH,Kt=r=>{var e;(e=r._$AP)===null||e===void 0||e.call(r,!1,!0);let t=r._$AA,n=r._$AB.nextSibling;for(;t!==n;){let o=t.nextSibling;t.remove(),t=o}},Bt=r=>{r._$AR()}});var zn={};M(zn,{AsyncDirective:()=>Se,Directive:()=>L,PartType:()=>T,directive:()=>k});function ml(r){this._$AN!==void 0?(Br(this),this._$AM=r,Mi(this)):this._$AM=r}function gl(r,e=!1,t=0){let n=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(n))for(let i=t;i<n.length;i++)Vt(n[i],!1),Br(n[i]);else n!=null&&(Vt(n,!1),Br(n));else Vt(this,r)}var Vt,Br,Mi,vl,Se,vt=x(()=>{be();D();D();Vt=(r,e)=>{var t,n;let o=r._$AN;if(o===void 0)return!1;for(let i of o)(n=(t=i)._$AO)===null||n===void 0||n.call(t,e,!1),Vt(i,e);return!0},Br=r=>{let e,t;do{if((e=r._$AM)===void 0)break;t=e._$AN,t.delete(r),r=e}while(t?.size===0)},Mi=r=>{for(let e;e=r._$AM;r=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(r))break;t.add(r),vl(e)}};vl=r=>{var e,t,n,o;r.type==T.CHILD&&((e=(n=r)._$AP)!==null&&e!==void 0||(n._$AP=gl),(t=(o=r)._$AQ)!==null&&t!==void 0||(o._$AQ=ml))},Se=class extends L{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),Mi(this),this.isConnected=e._$AU}_$AO(e,t=!0){var n,o;e!==this.isConnected&&(this.isConnected=e,e?(n=this.reconnected)===null||n===void 0||n.call(this):(o=this.disconnected)===null||o===void 0||o.call(this)),t&&(Vt(this,e),Br(this))}setValue(e){if(Ge(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}});var Li=xe(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.async=void 0;var bl=(D(),C(Hn)),yl=(vt(),C(zn)),xl=(U(),C(Kr)),Wn=class extends yl.AsyncDirective{render(e){return"then"in e?(Promise.resolve(e).then(t=>this.setValue(t)),""):(this.observable!==e&&(this.unsubscribe(),this.observable=e,this.isConnected&&this.subscribe(e)),xl.noChange)}subscribe(e){this.subscription=e.subscribe(t=>{this.setValue(t)})}disconnected(){this.unsubscribe()}unsubscribe(){this.subscription&&this.subscription.unsubscribe()}reconnected(){this.subscribe(this.observable)}};Vr.async=(0,bl.directive)(Wn)});var Di={};M(Di,{digestForTemplateResult:()=>Fi,hydrate:()=>Kn});var wl,$l,Ui,Yt,_l,Kn,Sl,Al,El,Fi,Bn=x(()=>{U();D();be();({R:wl,D:$l,V:Ui,I:Yt,F:_l}=ht),Kn=(r,e,t={})=>{if(e._$litPart$!==void 0)throw Error("container already contains a live render");let n,o,i=[],s=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT,null,!1),a;for(;(a=s.nextNode())!==null;){let l=a.data;if(l.startsWith("lit-part")){if(i.length===0&&n!==void 0)throw Error("there must be only one root part per container");o=Sl(r,a,i,t),n!=null||(n=o)}else if(l.startsWith("lit-node"))El(a,i,t);else if(l.startsWith("/lit-part")){if(i.length===1&&o!==n)throw Error("internal error");o=Al(a,o,i)}}console.assert(n!==void 0,"there should be exactly one root part in a render container"),e._$litPart$=n},Sl=(r,e,t,n)=>{let o,i;if(t.length===0)i=new Yt(e,null,void 0,n),o=r;else{let s=t[t.length-1];if(s.type==="template-instance")i=new Yt(e,null,s.instance,n),s.instance.u.push(i),o=s.result.values[s.instancePartIndex++],s.templatePartIndex++;else if(s.type==="iterable"){i=new Yt(e,null,s.part,n);let a=s.iterator.next();if(a.done)throw o=void 0,s.done=!0,Error("Unhandled shorter than expected iterable");o=a.value,s.part._$AH.push(i)}else i=new Yt(e,null,s.part,n)}if(o=Ui(i,o),o===A)t.push({part:i,type:"leaf"});else if(Wt(o))t.push({part:i,type:"leaf"}),i._$AH=o;else if(Oe(o)){let s="lit-part "+Fi(o);if(e.data!==s)throw Error("Hydration value mismatch: Unexpected TemplateResult rendered to part");{let a=Yt.prototype._$AC(o),l=new wl(a,i);t.push({type:"template-instance",instance:l,part:i,templatePartIndex:0,instancePartIndex:0,result:o}),i._$AH=l}}else $l(o)?(t.push({part:i,type:"iterable",value:o,iterator:o[Symbol.iterator](),done:!1}),i._$AH=[]):(t.push({part:i,type:"leaf"}),i._$AH=o??"");return i},Al=(r,e,t)=>{if(e===void 0)throw Error("unbalanced part marker");e._$AB=r;let n=t.pop();if(n.type==="iterable"&&!n.iterator.next().done)throw Error("unexpected longer than expected iterable");if(t.length>0)return t[t.length-1].part},El=(r,e,t)=>{var n;let o=/lit-node (\d+)/.exec(r.data),i=parseInt(o[1]),s=(n=r.previousElementSibling)!==null&&n!==void 0?n:r.parentElement;if(s===null)throw Error("could not find node for attribute parts");s.removeAttribute("defer-hydration");let a=e[e.length-1];if(a.type!=="template-instance")throw Error("internal error");{let l=a.instance;for(;;){let c=l._$AD.parts[a.templatePartIndex];if(c===void 0||c.type!==T.ATTRIBUTE&&c.type!==T.ELEMENT||c.index!==i)break;if(c.type===T.ATTRIBUTE){let u=new c.ctor(s,c.name,c.strings,a.instance,t),p=Ge(u)?a.result.values[a.instancePartIndex]:a.result.values,f=!(u.type===T.EVENT||u.type===T.PROPERTY);u._$AI(p,u,a.instancePartIndex,f),a.instancePartIndex+=c.strings.length-1,l.u.push(u)}else{let u=new _l(s,a.instance,t);Ui(u,a.result.values[a.instancePartIndex++]),l.u.push(u)}a.templatePartIndex++}}},Fi=r=>{let e=new Uint32Array(2).fill(5381);for(let t of r.strings)for(let n=0;n<t.length;n++)e[n%2]=33*e[n%2]^t.charCodeAt(n);return btoa(String.fromCharCode(...new Uint8Array(e.buffer)))}});var Cl={};var Ni=x(()=>{U();Bn();globalThis.litElementHydrateSupport=({LitElement:r})=>{let e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),"observedAttributes").get;Object.defineProperty(r,"observedAttributes",{get(){return[...e.call(this),"defer-hydration"]}});let t=r.prototype.attributeChangedCallback;r.prototype.attributeChangedCallback=function(s,a,l){s==="defer-hydration"&&l===null&&n.call(this),t.call(this,s,a,l)};let n=r.prototype.connectedCallback;r.prototype.connectedCallback=function(){this.hasAttribute("defer-hydration")||n.call(this)};let o=r.prototype.createRenderRoot;r.prototype.createRenderRoot=function(){return this.shadowRoot?(this._$AG=!0,this.shadowRoot):o.call(this)};let i=Object.getPrototypeOf(r.prototype).update;r.prototype.update=function(s){let a=this.render();i.call(this,s),this._$AG?(this._$AG=!1,Kn(a,this.renderRoot,this.renderOptions)):Te(a,this.renderRoot,this.renderOptions)}}});var qi=xe(()=>{(function(r){typeof define=="function"&&define.amd?define(r):r()})((function(){"use strict";var r,e=new Set,t=new Map;(r=globalThis.litHtmlPolyfillSupport)!==null&&r!==void 0||(globalThis.litHtmlPolyfillSupport=function(n,o){if(window.ShadyCSS!==void 0&&(!window.ShadyCSS.nativeShadow||window.ShadyCSS.ApplyShim)){var i=function(d){return d!==void 0&&!e.has(d)},s=function(d){var g=t.get(d);return g===void 0&&t.set(d,g=[]),g},a=new Map,l=n.createElement;n.createElement=function(d,g){var h=l.call(n,d,g),m=g?.scope;if(m!==void 0&&(window.ShadyCSS.nativeShadow||window.ShadyCSS.prepareTemplateDom(h,m),i(m))){var w=s(m),Z=h.content.querySelectorAll("style");w.push.apply(w,Array.from(Z).map((function(le){var ye;return(ye=le.parentNode)===null||ye===void 0||ye.removeChild(le),le.textContent})))}return h};var c=document.createDocumentFragment(),u=document.createComment(""),p=o.prototype,f=p._$AI;p._$AI=function(d,g){var h,m;g===void 0&&(g=this);var w=this._$AA.parentNode,Z=(h=this.options)===null||h===void 0?void 0:h.scope;if(w instanceof ShadowRoot&&i(Z)){var le=this._$AA,ye=this._$AB;c.appendChild(u),this._$AA=u,this._$AB=null,f.call(this,d,g);var Me=d?._$litType$?this._$AH._$AD.el:document.createElement("template");if((function(sr,ar){var lr,xo=s(sr),wo=xo.length!==0;wo&&((lr=document.createElement("style")).textContent=xo.join(`
|
|
16
|
+
`),ar.content.appendChild(lr)),e.add(sr),t.delete(sr),window.ShadyCSS.prepareTemplateStyles(ar,sr),wo&&window.ShadyCSS.nativeShadow&&(lr=ar.content.querySelector("style"))!==null&&ar.content.appendChild(lr)})(Z,Me),c.removeChild(u),(m=window.ShadyCSS)===null||m===void 0?void 0:m.nativeShadow){var Le=Me.content.querySelector("style");Le!==null&&c.appendChild(Le.cloneNode(!0))}w.insertBefore(c,ye),this._$AA=le,this._$AB=ye}else f.call(this,d,g)},p._$AC=function(d){var g,h=(g=this.options)===null||g===void 0?void 0:g.scope,m=a.get(h);m===void 0&&a.set(h,m=new Map);var w=m.get(d.strings);return w===void 0&&m.set(d.strings,w=new n(d,this.options)),w}}})}))});var Yr,Gt,Vn,Hi,bt,Yn,zi,Gr,Jt,Gn=x(()=>{Yr=window,Gt=Yr.ShadowRoot&&(Yr.ShadyCSS===void 0||Yr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Vn=Symbol(),Hi=new WeakMap,bt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Vn)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(Gt&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Hi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Hi.set(t,e))}return e}toString(){return this.cssText}},Yn=r=>new bt(typeof r=="string"?r:r+"",void 0,Vn),zi=(r,...e)=>{let t=r.length===1?r[0]:e.reduce(((n,o,i)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+r[i+1]),r[0]);return new bt(t,r,Vn)},Gr=(r,e)=>{Gt?r.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((t=>{let n=document.createElement("style"),o=Yr.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}))},Jt=Gt?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Yn(t)})(r):r});var Jn,Jr,Wi,kl,Ki,Zr,Xn,Zn,de,Xr=x(()=>{Gn();Gn();Jr=window,Wi=Jr.trustedTypes,kl=Wi?Wi.emptyScript:"",Ki=Jr.reactiveElementPolyfillSupport,Zr={toAttribute(r,e){switch(e){case Boolean:r=r?kl:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Xn=(r,e)=>e!==r&&(e==e||r==r),Zn={attribute:!0,type:String,converter:Zr,reflect:!1,hasChanged:Xn},de=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach(((t,n)=>{let o=this._$Ep(n,t);o!==void 0&&(this._$Ev.set(o,n),e.push(o))})),e}static createProperty(e,t=Zn){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let n=typeof e=="symbol"?Symbol():"__"+e,o=this.getPropertyDescriptor(e,n,t);o!==void 0&&Object.defineProperty(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(o){let i=this[e];this[t]=o,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Zn}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let t=this.properties,n=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let o of n)this.createProperty(o,t[o])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let o of n)t.unshift(Jt(o))}else e!==void 0&&t.push(Jt(e));return t}static _$Ep(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}u(){var e;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach((t=>t(this)))}addController(e){var t,n;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;let t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return Gr(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach((t=>{var n;return(n=t.hostConnected)===null||n===void 0?void 0:n.call(t)}))}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach((t=>{var n;return(n=t.hostDisconnected)===null||n===void 0?void 0:n.call(t)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=Zn){var o;let i=this.constructor._$Ep(e,n);if(i!==void 0&&n.reflect===!0){let s=(((o=n.converter)===null||o===void 0?void 0:o.toAttribute)!==void 0?n.converter:Zr).toAttribute(t,n.type);this._$El=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$El=null}}_$AK(e,t){var n;let o=this.constructor,i=o._$Ev.get(e);if(i!==void 0&&this._$El!==i){let s=o.getPropertyOptions(i),a=typeof s.converter=="function"?{fromAttribute:s.converter}:((n=s.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?s.converter:Zr;this._$El=i,this[i]=a.fromAttribute(t,s.type),this._$El=null}}requestUpdate(e,t,n){let o=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Xn)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((o,i)=>this[i]=o)),this._$Ei=void 0);let t=!1,n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach((o=>{var i;return(i=o.hostUpdate)===null||i===void 0?void 0:i.call(o)})),this.update(n)):this._$Ek()}catch(o){throw t=!1,this._$Ek(),o}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach((n=>{var o;return(o=n.hostUpdated)===null||o===void 0?void 0:o.call(n)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach(((t,n)=>this._$EO(n,this[n],t))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};de.finalized=!0,de.elementProperties=new Map,de.elementStyles=[],de.shadowRootOptions={mode:"open"},Ki?.({ReactiveElement:de}),((Jn=Jr.reactiveElementVersions)!==null&&Jn!==void 0?Jn:Jr.reactiveElementVersions=[]).push("1.5.0")});var Qn,eo,Vi,Pe,Bi,Yi,Gi=x(()=>{Xr();Xr();U();U();Vi=de,Pe=class extends de{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let n=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=n.firstChild),n}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Te(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return A}};Pe.finalized=!0,Pe._$litElement$=!0,(Qn=globalThis.litElementHydrateSupport)===null||Qn===void 0||Qn.call(globalThis,{LitElement:Pe});Bi=globalThis.litElementPolyfillSupport;Bi?.({LitElement:Pe});Yi={_$AK:(r,e,t)=>{r._$AK(e,t)},_$AL:r=>r._$AL};((eo=globalThis.litElementVersions)!==null&&eo!==void 0?eo:globalThis.litElementVersions=[]).push("3.2.2")});var Tl,Il,ne,je=x(()=>{Tl=(r,e,t)=>{Object.defineProperty(e,t,r)},Il=(r,e)=>({kind:"method",placement:"prototype",key:e.key,descriptor:r}),ne=({finisher:r,descriptor:e})=>(t,n)=>{var o;if(n===void 0){let i=(o=t.originalKey)!==null&&o!==void 0?o:t.key,s=e!=null?{kind:"method",placement:"prototype",key:i,descriptor:e(t.key)}:{...t,key:i};return r!=null&&(s.finisher=function(a){r(a,i)}),s}{let i=t.constructor;e!==void 0&&Object.defineProperty(t,n,e(n)),r?.(i,n)}}});var Ol,Ji=x(()=>{Ol=r=>e=>typeof e=="function"?((t,n)=>(customElements.define(t,n),n))(r,e):((t,n)=>{let{kind:o,elements:i}=n;return{kind:o,elements:i,finisher(s){customElements.define(t,s)}}})(r,e)});function to(r){return(e,t)=>t!==void 0?((n,o,i)=>{o.constructor.createProperty(i,n)})(r,e,t):Pl(r,e)}var Pl,ro=x(()=>{Pl=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}}});function jl(r){return to({...r,state:!0})}var Zi=x(()=>{ro();});function Rl(r){return ne({finisher:(e,t)=>{Object.assign(e.prototype[t],r)}})}var Xi=x(()=>{je();});function Ml(r,e){return ne({descriptor:t=>{let n={get(){var o,i;return(i=(o=this.renderRoot)===null||o===void 0?void 0:o.querySelector(r))!==null&&i!==void 0?i:null},enumerable:!0,configurable:!0};if(e){let o=typeof t=="symbol"?Symbol():"__"+t;n.get=function(){var i,s;return this[o]===void 0&&(this[o]=(s=(i=this.renderRoot)===null||i===void 0?void 0:i.querySelector(r))!==null&&s!==void 0?s:null),this[o]}}return n}})}var Qi=x(()=>{je();});function Ll(r){return ne({descriptor:e=>({get(){var t,n;return(n=(t=this.renderRoot)===null||t===void 0?void 0:t.querySelectorAll(r))!==null&&n!==void 0?n:[]},enumerable:!0,configurable:!0})})}var es=x(()=>{je();});function Ul(r){return ne({descriptor:e=>({async get(){var t;return await this.updateComplete,(t=this.renderRoot)===null||t===void 0?void 0:t.querySelector(r)},enumerable:!0,configurable:!0})})}var ts=x(()=>{je();});function oo(r){let{slot:e,selector:t}=r??{};return ne({descriptor:n=>({get(){var o;let i="slot"+(e?`[name=${e}]`:":not([name])"),s=(o=this.renderRoot)===null||o===void 0?void 0:o.querySelector(i),a=s!=null?Fl(s,r):[];return t?a.filter((l=>l.matches(t))):a},enumerable:!0,configurable:!0})})}var no,Fl,io=x(()=>{je();Fl=((no=window.HTMLSlotElement)===null||no===void 0?void 0:no.prototype.assignedElements)!=null?(r,e)=>r.assignedElements(e):(r,e)=>r.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE))});function Dl(r,e,t){let n,o=r;return typeof r=="object"?(o=r.slot,n=r):n={flatten:e},t?oo({slot:o,flatten:e,selector:t}):ne({descriptor:i=>({get(){var s,a;let l="slot"+(o?`[name=${o}]`:":not([name])"),c=(s=this.renderRoot)===null||s===void 0?void 0:s.querySelector(l);return(a=c?.assignedNodes(n))!==null&&a!==void 0?a:[]},enumerable:!0,configurable:!0})})}var rs=x(()=>{je();io();});var ns={};M(ns,{CSSResult:()=>bt,LitElement:()=>Pe,ReactiveElement:()=>de,UpdatingElement:()=>Vi,_$LE:()=>Yi,_$LH:()=>ht,adoptStyles:()=>Gr,css:()=>zi,customElement:()=>Ol,decorateProperty:()=>ne,defaultConverter:()=>Zr,eventOptions:()=>Rl,getCompatibleStyle:()=>Jt,html:()=>Si,legacyPrototypeMethod:()=>Tl,noChange:()=>A,notEqual:()=>Xn,nothing:()=>E,property:()=>to,query:()=>Ml,queryAll:()=>Ll,queryAssignedElements:()=>oo,queryAssignedNodes:()=>Dl,queryAsync:()=>Ul,render:()=>Te,standardPrototypeMethod:()=>Il,state:()=>jl,supportsAdoptingStyleSheets:()=>Gt,svg:()=>Ai,unsafeCSS:()=>Yn});var os=x(()=>{Xr();U();Gi();je();Ji();ro();Zi();Xi();Qi();es();ts();io();rs();console.warn("The main 'lit-element' module entrypoint is deprecated. Please update your imports to use the 'lit' package: 'lit' and 'lit/decorators.ts' or import from 'lit-element/lit-element.ts'. See https://lit.dev/msg/deprecated-import-path for more information.")});var is={};M(is,{classMap:()=>Nl});var Nl,ss=x(()=>{U();D();Nl=k(class extends L{constructor(r){var e;if(super(r),r.type!==T.ATTRIBUTE||r.name!=="class"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter((e=>r[e])).join(" ")+" "}update(r,[e]){var t,n;if(this.nt===void 0){this.nt=new Set,r.strings!==void 0&&(this.st=new Set(r.strings.join(" ").split(/\s/).filter((i=>i!==""))));for(let i in e)e[i]&&!(!((t=this.st)===null||t===void 0)&&t.has(i))&&this.nt.add(i);return this.render(e)}let o=r.element.classList;this.nt.forEach((i=>{i in e||(o.remove(i),this.nt.delete(i))}));for(let i in e){let s=!!e[i];s===this.nt.has(i)||!((n=this.st)===null||n===void 0)&&n.has(i)||(s?(o.add(i),this.nt.add(i)):(o.remove(i),this.nt.delete(i)))}return A}})});var as,yt,xt,so=x(()=>{as=async(r,e)=>{for await(let t of r)if(await e(t)===!1)return},yt=class{constructor(e){this.Y=e}disconnect(){this.Y=void 0}reconnect(e){this.Y=e}deref(){return this.Y}},xt=class{constructor(){this.Z=void 0,this.q=void 0}get(){return this.Z}pause(){var e;(e=this.Z)!==null&&e!==void 0||(this.Z=new Promise((t=>this.q=t)))}resume(){var e;(e=this.q)===null||e===void 0||e.call(this),this.Z=this.q=void 0}}});var ls={};M(ls,{AsyncReplaceDirective:()=>wt,asyncReplace:()=>ql});var wt,ql,ao=x(()=>{U();vt();so();D();wt=class extends Se{constructor(){super(...arguments),this._$CK=new yt(this),this._$CX=new xt}render(e,t){return A}update(e,[t,n]){if(this.isConnected||this.disconnected(),t===this._$CJ)return;this._$CJ=t;let o=0,{_$CK:i,_$CX:s}=this;return as(t,(async a=>{for(;s.get();)await s.get();let l=i.deref();if(l!==void 0){if(l._$CJ!==t)return!1;n!==void 0&&(a=n(a,o)),l.commitValue(a,o),o++}return!0})),A}commitValue(e,t){this.setValue(e)}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},ql=k(wt)});var cs={};M(cs,{asyncAppend:()=>Hl});var Hl,us=x(()=>{D();ao();be();Hl=k(class extends wt{constructor(r){if(super(r),r.type!==T.CHILD)throw Error("asyncAppend can only be used in child expressions")}update(r,e){return this._$Ctt=r,super.update(r,e)}commitValue(r,e){e===0&&Bt(this._$Ctt);let t=se(this._$Ctt);pe(t,r)}})});var ps={};M(ps,{cache:()=>zl});var zl,ds=x(()=>{U();D();be();zl=k(class extends L{constructor(r){super(r),this.et=new WeakMap}render(r){return[r]}update(r,[e]){if(Oe(this.it)&&(!Oe(e)||this.it.strings!==e.strings)){let t=gt(r).pop(),n=this.et.get(this.it.strings);if(n===void 0){let o=document.createDocumentFragment();n=Te(E,o),n.setConnected(!1),this.et.set(this.it.strings,n)}ve(n,[t]),se(n,void 0,t)}if(Oe(e)){if(!Oe(this.it)||this.it.strings!==e.strings){let t=this.et.get(e.strings);if(t!==void 0){let n=gt(t).pop();Bt(r),se(r,void 0,n),ve(r,[n])}}this.it=e}else this.it=void 0;return this.render(e)}})});var fs={};M(fs,{guard:()=>Kl});var Wl,Kl,hs=x(()=>{U();D();Wl={},Kl=k(class extends L{constructor(){super(...arguments),this.ot=Wl}render(r,e){return e()}update(r,[e,t]){if(Array.isArray(e)){if(Array.isArray(this.ot)&&this.ot.length===e.length&&e.every(((n,o)=>n===this.ot[o])))return A}else if(this.ot===e)return A;return this.ot=Array.isArray(e)?Array.from(e):e,this.render(e,t)}})});var ms={};M(ms,{ifDefined:()=>Bl});var Bl,gs=x(()=>{U();Bl=r=>r??E});var vs={};M(vs,{live:()=>Vl});var Vl,bs=x(()=>{U();D();be();Vl=k(class extends L{constructor(r){if(super(r),r.type!==T.PROPERTY&&r.type!==T.ATTRIBUTE&&r.type!==T.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Ge(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(r,[e]){if(e===A||e===E)return e;let t=r.element,n=r.name;if(r.type===T.PROPERTY){if(e===t[n])return A}else if(r.type===T.BOOLEAN_ATTRIBUTE){if(!!e===t.hasAttribute(n))return A}else if(r.type===T.ATTRIBUTE&&t.getAttribute(n)===e+"")return A;return ve(r),e}})});var ys={};M(ys,{createRef:()=>Yl,ref:()=>Gl});var Yl,co,lo,Gl,xs=x(()=>{U();vt();D();Yl=()=>new co,co=class{},lo=new WeakMap,Gl=k(class extends Se{render(r){return E}update(r,[e]){var t;let n=e!==this.Y;return n&&this.Y!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=e,this.dt=(t=r.options)===null||t===void 0?void 0:t.host,this.rt(this.ct=r.element)),E}rt(r){var e;if(typeof this.Y=="function"){let t=(e=this.dt)!==null&&e!==void 0?e:globalThis,n=lo.get(t);n===void 0&&(n=new WeakMap,lo.set(t,n)),n.get(this.Y)!==void 0&&this.Y.call(this.dt,void 0),n.set(this.Y,r),r!==void 0&&this.Y.call(this.dt,r)}else this.Y.value=r}get lt(){var r,e,t;return typeof this.Y=="function"?(e=lo.get((r=this.dt)!==null&&r!==void 0?r:globalThis))===null||e===void 0?void 0:e.get(this.Y):(t=this.Y)===null||t===void 0?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}})});var $s={};M($s,{repeat:()=>Jl});var ws,Jl,_s=x(()=>{U();D();be();ws=(r,e,t)=>{let n=new Map;for(let o=e;o<=t;o++)n.set(r[o],o);return n},Jl=k(class extends L{constructor(r){if(super(r),r.type!==T.CHILD)throw Error("repeat() can only be used in text expressions")}ht(r,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);let o=[],i=[],s=0;for(let a of r)o[s]=n?n(a,s):s,i[s]=t(a,s),s++;return{values:i,keys:o}}render(r,e,t){return this.ht(r,e,t).values}update(r,[e,t,n]){var o;let i=gt(r),{values:s,keys:a}=this.ht(e,t,n);if(!Array.isArray(i))return this.ut=a,s;let l=(o=this.ut)!==null&&o!==void 0?o:this.ut=[],c=[],u,p,f=0,d=i.length-1,g=0,h=s.length-1;for(;f<=d&&g<=h;)if(i[f]===null)f++;else if(i[d]===null)d--;else if(l[f]===a[g])c[g]=pe(i[f],s[g]),f++,g++;else if(l[d]===a[h])c[h]=pe(i[d],s[h]),d--,h--;else if(l[f]===a[h])c[h]=pe(i[f],s[h]),se(r,c[h+1],i[f]),f++,h--;else if(l[d]===a[g])c[g]=pe(i[d],s[g]),se(r,i[f],i[d]),d--,g++;else if(u===void 0&&(u=ws(a,g,h),p=ws(l,f,d)),u.has(l[f]))if(u.has(l[d])){let m=p.get(a[g]),w=m!==void 0?i[m]:null;if(w===null){let Z=se(r,i[f]);pe(Z,s[g]),c[g]=Z}else c[g]=pe(w,s[g]),se(r,i[f],w),i[m]=null;g++}else Kt(i[d]),d--;else Kt(i[f]),f++;for(;g<=h;){let m=se(r,c[h+1]);pe(m,s[g]),c[g++]=m}for(;f<=d;){let m=i[f++];m!==null&&Kt(m)}return this.ut=a,ve(r,c),A}})});var Ss={};M(Ss,{styleMap:()=>Zl});var Zl,As=x(()=>{U();D();Zl=k(class extends L{constructor(r){var e;if(super(r),r.type!==T.ATTRIBUTE||r.name!=="style"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce(((e,t)=>{let n=r[t];return n==null?e:e+`${t=t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`}),"")}update(r,[e]){let{style:t}=r.element;if(this.vt===void 0){this.vt=new Set;for(let n in e)this.vt.add(n);return this.render(e)}this.vt.forEach((n=>{e[n]==null&&(this.vt.delete(n),n.includes("-")?t.removeProperty(n):t[n]="")}));for(let n in e){let o=e[n];o!=null&&(this.vt.add(n),n.includes("-")?t.setProperty(n,o):t[n]=o)}return A}})});var Es={};M(Es,{templateContent:()=>Xl});var Xl,Cs=x(()=>{U();D();Xl=k(class extends L{constructor(r){if(super(r),r.type!==T.CHILD)throw Error("templateContent can only be used in child bindings")}render(r){return this.ft===r?A:(this.ft=r,document.importNode(r.content,!0))}})});var ks={};M(ks,{UnsafeHTMLDirective:()=>Re,unsafeHTML:()=>Ql});var Re,Ql,uo=x(()=>{U();D();Re=class extends L{constructor(e){if(super(e),this.it=E,e.type!==T.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===E||e==null)return this._t=void 0,this.it=e;if(e===A)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};Re.directiveName="unsafeHTML",Re.resultType=1;Ql=k(Re)});var Ts={};M(Ts,{unsafeSVG:()=>ec});var Zt,ec,Is=x(()=>{D();uo();Zt=class extends Re{};Zt.directiveName="unsafeSVG",Zt.resultType=2;ec=k(Zt)});var Ps={};M(Ps,{UntilDirective:()=>Qr,until:()=>tc});var Os,Qr,tc,js=x(()=>{U();be();vt();so();D();Os=r=>!Wt(r)&&typeof r.then=="function",Qr=class extends Se{constructor(){super(...arguments),this._$Cwt=1073741823,this._$Cyt=[],this._$CK=new yt(this),this._$CX=new xt}render(...e){var t;return(t=e.find((n=>!Os(n))))!==null&&t!==void 0?t:A}update(e,t){let n=this._$Cyt,o=n.length;this._$Cyt=t;let i=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<t.length&&!(a>this._$Cwt);a++){let l=t[a];if(!Os(l))return this._$Cwt=a,l;a<o&&l===n[a]||(this._$Cwt=1073741823,o=0,Promise.resolve(l).then((async c=>{for(;s.get();)await s.get();let u=i.deref();if(u!==void 0){let p=u._$Cyt.indexOf(l);p>-1&&p<u._$Cwt&&(u._$Cwt=p,u.setValue(c))}})))}return A}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},tc=k(Qr)});var Rs={};M(Rs,{choose:()=>rc});var rc,Ms=x(()=>{rc=(r,e,t)=>{for(let n of e)if(n[0]===r)return(0,n[1])();return t?.()}});var Ls={};M(Ls,{join:()=>nc});function*nc(r,e){let t=typeof e=="function";if(r!==void 0){let n=-1;for(let o of r)n>-1&&(yield t?e(n):e),n++,yield o}}var Us=x(()=>{});var Fs={};M(Fs,{keyed:()=>oc});var oc,Ds=x(()=>{U();D();be();oc=k(class extends L{constructor(){super(...arguments),this.key=E}render(r,e){return this.key=r,e}update(r,[e,t]){return e!==this.key&&(ve(r),this.key=e),t}})});var Ns={};M(Ns,{map:()=>ic});function*ic(r,e){if(r!==void 0){let t=0;for(let n of r)yield e(n,t++)}}var qs=x(()=>{});var Hs={};M(Hs,{range:()=>sc});function*sc(r,e,t=1){let n=e===void 0?0:r;e!=null||(e=r);for(let o=n;t>0?o<e:e<o;o+=t)yield o}var zs=x(()=>{});var Ws={};M(Ws,{when:()=>ac});function ac(r,e,t){return r?e():t?.()}var Ks=x(()=>{});var Xt=xe(S=>{"use strict";var lc=S&&S.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,o)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),I=S&&S.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&lc(e,r,t)};Object.defineProperty(S,"__esModule",{value:!0});I(Pi(),S);I(Li(),S);I((U(),C(Kr)),S);I((D(),C(Hn)),S);I((Bn(),C(Di)),S);I((Ni(),C(Cl)),S);I(qi(),S);I((be(),C(Ri)),S);I((vt(),C(zn)),S);I((os(),C(ns)),S);I((ss(),C(is)),S);I((us(),C(cs)),S);I((ao(),C(ls)),S);I((ds(),C(ps)),S);I((hs(),C(fs)),S);I((gs(),C(ms)),S);I((bs(),C(vs)),S);I((xs(),C(ys)),S);I((_s(),C($s)),S);I((As(),C(Ss)),S);I((Cs(),C(Es)),S);I((uo(),C(ks)),S);I((Is(),C(Ts)),S);I((js(),C(Ps)),S);I((Ms(),C(Rs)),S);I((Us(),C(Ls)),S);I((Ds(),C(Fs)),S);I((qs(),C(Ns)),S);I((zs(),C(Hs)),S);I((Ks(),C(Ws)),S)});var Bs=xe(fe=>{"use strict";var Qt=fe&&fe.__decorate||function(r,e,t,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(s=r[a])&&(i=(o<3?s(i):o>3?s(e,t,i):s(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},en=fe&&fe.__metadata||function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},cc=fe&&fe.__awaiter||function(r,e,t,n){function o(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function a(u){try{c(n.next(u))}catch(p){s(p)}}function l(u){try{c(n.throw(u))}catch(p){s(p)}}function c(u){u.done?i(u.value):o(u.value).then(a,l)}c((n=n.apply(r,e||[])).next())})};Object.defineProperty(fe,"__esModule",{value:!0});fe.Renderer=void 0;var K=Xt();function uc(r){return function(e){if(!window.customElements.get(r.selector))return(0,K.Component)(r)(e)}}var Je=class extends K.LitElement{constructor(){super(...arguments),this.options={state:{},render:(e,t,n)=>(0,K.html)` ${e} `,style:(0,K.css)``,styles:[],deepCloneState:!1,loading:()=>(0,K.html)``,error:e=>(0,K.html)`${e?.message}`},this.loading=!0,this.state={}}OnUpdateFirst(){var e,t,n;return cc(this,void 0,void 0,function*(){!((e=this.options)===null||e===void 0)&&e.style&&(0,K.adoptStyles)(this.shadowRoot,[this.options.style]),!((n=(t=this.options)===null||t===void 0?void 0:t.styles)===null||n===void 0)&&n.length&&(0,K.adoptStyles)(this.shadowRoot,this.options.styles),this.options.state=yield this.options.state,this.options.state&&(this.isObservable(this.options.state)?this.subscription=this.options.state.subscribe(o=>{this.state=o,this.loading=!1,this.dispatchEvent(new CustomEvent("onData",{detail:o}))},o=>{this.state=null,this.error=o,this.loading=!1,this.dispatchEvent(new CustomEvent("onError",{detail:o}))}):(this.loading=!1,this.state=this.options.state),yield this.updateComplete,yield new Promise(requestAnimationFrame),this.dispatchEvent(new CustomEvent("loaded")))})}isObservable(e){return this.isFunction(e.lift)&&this.isFunction(e.subscribe)}isFunction(e){return typeof e=="function"}OnDestroy(){this.subscription&&this.subscription.unsubscribe()}renderContent(){if(!this.error&&this.options.render){let e=this.options.render(this.options.deepCloneState?JSON.parse(JSON.stringify(this.state)):this.state,t=>this.state=Object.assign({},t),this.shadowRoot);return e?.strings?e:(0,K.html)``}return this.state}};fe.Renderer=Je;Qt([(0,K.property)({type:Object}),en("design:type",Object)],Je.prototype,"options",void 0);Qt([(0,K.property)({type:Boolean}),en("design:type",Object)],Je.prototype,"loading",void 0);Qt([(0,K.property)({type:Object}),en("design:type",Error)],Je.prototype,"error",void 0);Qt([(0,K.property)(),en("design:type",Object)],Je.prototype,"state",void 0);fe.Renderer=Je=Qt([uc({selector:"r-renderer",template(){return(0,K.html)`
|
|
17
17
|
${this.loading?"":this.renderContent()}
|
|
18
|
-
${this.loading?(0,
|
|
19
|
-
${this.isFunction(this.options.loading)?this.options.loading():(0,
|
|
18
|
+
${this.loading?(0,K.html)`
|
|
19
|
+
${this.isFunction(this.options.loading)?this.options.loading():(0,K.html)``}
|
|
20
20
|
`:""}
|
|
21
|
-
${this.error?(0,
|
|
22
|
-
${this.isFunction(this.options.error)?this.options.error(this.error):(0,
|
|
21
|
+
${this.error?(0,K.html)`
|
|
22
|
+
${this.isFunction(this.options.error)?this.options.error(this.error):(0,K.html)` ${this.error} `}
|
|
23
23
|
`:""}
|
|
24
|
-
`}})],
|
|
24
|
+
`}})],Je)});var Vs=xe(Ze=>{"use strict";var pc=Ze&&Ze.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,o)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),dc=Ze&&Ze.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&pc(e,r,t)};Object.defineProperty(Ze,"__esModule",{value:!0});dc(Bs(),Ze)});var Gs=xe(he=>{"use strict";var fc=he&&he.__awaiter||function(r,e,t,n){function o(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function a(u){try{c(n.next(u))}catch(p){s(p)}}function l(u){try{c(n.throw(u))}catch(p){s(p)}}function c(u){u.done?i(u.value):o(u.value).then(a,l)}c((n=n.apply(r,e||[])).next())})};Object.defineProperty(he,"__esModule",{value:!0});he.Component=he.Partial=he.DefineDependencies=void 0;Vs();var Ys=Xt(),hc=(...r)=>e=>{for(let[t,n]of r.entries())Object.defineProperty(r,t,{get:()=>e?.has(n)?e.get(n):n});return r};he.DefineDependencies=hc;function mc(){var r;return fc(this,void 0,void 0,function*(){yield this.updateComplete,yield new Promise(requestAnimationFrame),(r=this.OnRendererLoaded)===null||r===void 0||r.call(this)})}var gc=r=>(e=[])=>(t=()=>({}))=>(n=()=>null)=>(o=()=>null)=>(i=()=>t)=>(0,Ys.Component)(Object.assign(Object.assign({},r),{template(){return(0,Ys.html)`
|
|
25
25
|
<r-renderer
|
|
26
26
|
style="display: contents;"
|
|
27
|
-
@loaded=${
|
|
27
|
+
@loaded=${mc.bind(this)}
|
|
28
28
|
.options=${{state:t.bind(this).call(this,e),loading:n.bind(this),style:r.style,styles:r.styles,error:o.bind(this),deepCloneState:r.deepCloneState,render:(s,a,l)=>(this.shadowRoot.append(l),i(e).bind(this).call(this,s,a,l))}}
|
|
29
29
|
></r-renderer>
|
|
30
|
-
`}}));
|
|
30
|
+
`}}));he.Partial=gc;function vc({Settings:r,Providers:e,State:t,Render:n,Loading:o,Error:i}){return(0,he.Partial)(r)(e)(t)(o)(i)(n)}he.Component=vc});var xn=function(r,e){return xn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])},xn(r,e)};function Y(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");xn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function So(r,e,t,n){function o(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function a(u){try{c(n.next(u))}catch(p){s(p)}}function l(u){try{c(n.throw(u))}catch(p){s(p)}}function c(u){u.done?i(u.value):o(u.value).then(a,l)}c((n=n.apply(r,e||[])).next())})}function cr(r,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(u){return l([c,u])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(t=0)),t;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,o=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1],i=c;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(c);break}i[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(r,t)}catch(u){c=[6,u],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function we(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function H(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return i}function z(r,e,t){if(t||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return r.concat(i||Array.prototype.slice.call(e))}function Ue(r){return this instanceof Ue?(this.v=r,this):new Ue(r)}function Ao(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(d){return function(g){return Promise.resolve(g).then(d,p)}}function a(d,g){n[d]&&(o[d]=function(h){return new Promise(function(m,w){i.push([d,h,m,w])>1||l(d,h)})},g&&(o[d]=g(o[d])))}function l(d,g){try{c(n[d](g))}catch(h){f(i[0][3],h)}}function c(d){d.value instanceof Ue?Promise.resolve(d.value.v).then(u,p):f(i[0][2],d)}function u(d){l("next",d)}function p(d){l("throw",d)}function f(d,g){d(g),i.shift(),i.length&&l(i[0][0],i[0][1])}}function Eo(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof we=="function"?we(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=r[i]&&function(s){return new Promise(function(a,l){s=r[i](s),o(a,l,s.done,s.value)})}}function o(i,s,a,l){Promise.resolve(l).then(function(c){i({value:c,done:a})},s)}}function b(r){return typeof r=="function"}function ur(r){var e=function(n){Error.call(n),n.stack=new Error().stack},t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var pr=ur(function(r){return function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription:
|
|
31
31
|
`+t.map(function(n,o){return o+1+") "+n.toString()}).join(`
|
|
32
|
-
`):"",this.name="UnsubscriptionError",this.errors=t}});function Ue(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}var Z=(function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var e,t,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=we(s),l=a.next();!l.done;l=a.next()){var c=l.value;c.remove(this)}}catch(h){e={error:h}}finally{try{l&&!l.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else s.remove(this);var u=this.initialTeardown;if(g(u))try{u()}catch(h){i=h instanceof sr?h.errors:[h]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var d=we(p),f=d.next();!f.done;f=d.next()){var v=f.value;try{ho(v)}catch(h){i=i??[],h instanceof sr?i=H(H([],F(i)),F(h.errors)):i.push(h)}}}catch(h){n={error:h}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}if(i)throw new sr(i)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)ho(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Ue(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&Ue(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=(function(){var e=new r;return e.closed=!0,e})(),r})();var cn=Z.EMPTY;function ar(r){return r instanceof Z||r&&"closed"in r&&g(r.remove)&&g(r.add)&&g(r.unsubscribe)}function ho(r){g(r)?r():r.unsubscribe()}var se={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Qe={setTimeout:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var o=Qe.delegate;return o?.setTimeout?o.setTimeout.apply(o,H([r,e],F(t))):setTimeout.apply(void 0,H([r,e],F(t)))},clearTimeout:function(r){var e=Qe.delegate;return(e?.clearTimeout||clearTimeout)(r)},delegate:void 0};function lr(r){Qe.setTimeout(function(){var e=se.onUnhandledError;if(e)e(r);else throw r})}function ae(){}var mo=(function(){return un("C",void 0,void 0)})();function vo(r){return un("E",void 0,r)}function go(r){return un("N",r,void 0)}function un(r,e,t){return{kind:r,value:e,error:t}}var De=null;function et(r){if(se.useDeprecatedSynchronousErrorHandling){var e=!De;if(e&&(De={errorThrown:!1,error:null}),r(),e){var t=De,n=t.errorThrown,o=t.error;if(De=null,n)throw o}}else r()}function yo(r){se.useDeprecatedSynchronousErrorHandling&&De&&(De.errorThrown=!0,De.error=r)}var _t=(function(r){z(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,ar(t)&&t.add(n)):n.destination=sa,n}return e.create=function(t,n,o){return new qe(t,n,o)},e.prototype.next=function(t){this.isStopped?fn(go(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?fn(vo(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?fn(mo,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(Z);var na=Function.prototype.bind;function pn(r,e){return na.call(r,e)}var oa=(function(){function r(e){this.partialObserver=e}return r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){cr(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){cr(n)}else cr(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){cr(t)}},r})(),qe=(function(r){z(e,r);function e(t,n,o){var i=r.call(this)||this,s;if(g(t)||!t)s={next:t??void 0,error:n??void 0,complete:o??void 0};else{var a;i&&se.useDeprecatedNextContext?(a=Object.create(t),a.unsubscribe=function(){return i.unsubscribe()},s={next:t.next&&pn(t.next,a),error:t.error&&pn(t.error,a),complete:t.complete&&pn(t.complete,a)}):s=t}return i.destination=new oa(s),i}return e})(_t);function cr(r){se.useDeprecatedSynchronousErrorHandling?yo(r):lr(r)}function ia(r){throw r}function fn(r,e){var t=se.onStoppedNotification;t&&Qe.setTimeout(function(){return t(r,e)})}var sa={closed:!0,next:ae,error:ia,complete:ae};var tt=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function X(r){return r}function dn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return hn(r)}function hn(r){return r.length===0?X:r.length===1?r[0]:function(t){return r.reduce(function(n,o){return o(n)},t)}}var _=(function(){function r(e){e&&(this._subscribe=e)}return r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,n){var o=this,i=la(e)?e:new qe(e,t,n);return et(function(){var s=o,a=s.operator,l=s.source;i.add(a?a.call(i,l):l?o._subscribe(i):o._trySubscribe(i))}),i},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var n=this;return t=bo(t),new t(function(o,i){var s=new qe({next:function(a){try{e(a)}catch(l){i(l),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[tt]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return hn(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=bo(e),new e(function(n,o){var i;t.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},r.create=function(e){return new r(e)},r})();function bo(r){var e;return(e=r??se.Promise)!==null&&e!==void 0?e:Promise}function aa(r){return r&&g(r.next)&&g(r.error)&&g(r.complete)}function la(r){return r&&r instanceof _t||aa(r)&&ar(r)}function ca(r){return g(r?.lift)}function w(r){return function(e){if(ca(e))return e.lift(function(t){try{return r(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function S(r,e,t,n,o){return new ua(r,e,t,n,o)}var ua=(function(r){z(e,r);function e(t,n,o,i,s,a){var l=r.call(this,t)||this;return l.onFinalize=s,l.shouldUnsubscribe=a,l._next=n?function(c){try{n(c)}catch(u){t.error(u)}}:r.prototype._next,l._error=i?function(c){try{i(c)}catch(u){t.error(u)}finally{this.unsubscribe()}}:r.prototype._error,l._complete=o?function(){try{o()}catch(c){t.error(c)}finally{this.unsubscribe()}}:r.prototype._complete,l}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;r.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e})(_t);var xo=ir(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var te=(function(r){z(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var n=new wo(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new xo},e.prototype.next=function(t){var n=this;et(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=we(n.currentObservers),a=s.next();!a.done;a=s.next()){var l=a.value;l.next(t)}}catch(c){o={error:c}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},e.prototype.error=function(t){var n=this;et(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var o=n.observers;o.length;)o.shift().error(t)}})},e.prototype.complete=function(){var t=this;et(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?cn:(this.currentObservers=null,a.push(t),new Z(function(){n.currentObservers=null,Ue(a,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?t.error(i):s&&t.complete()},e.prototype.asObservable=function(){var t=new _;return t.source=this,t},e.create=function(t,n){return new wo(t,n)},e})(_);var wo=(function(r){z(e,r);function e(t,n){var o=r.call(this)||this;return o.destination=t,o.source=n,o}return e.prototype.next=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,t)},e.prototype.error=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&o!==void 0?o:cn},e})(te);var St={now:function(){return(St.delegate||Date).now()},delegate:void 0};var _o=(function(r){z(e,r);function e(t,n,o){t===void 0&&(t=1/0),n===void 0&&(n=1/0),o===void 0&&(o=St);var i=r.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return e.prototype.next=function(t){var n=this,o=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,l=n._windowTime;o||(i.push(t),!s&&i.push(a.now()+l)),this._trimBuffer(),r.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(t),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),l=0;l<a.length&&!t.closed;l+=i?1:2)t.next(a[l]);return this._checkFinalizedStatuses(t),n},e.prototype._trimBuffer=function(){var t=this,n=t._bufferSize,o=t._timestampProvider,i=t._buffer,s=t._infiniteTimeWindow,a=(s?1:2)*n;if(n<1/0&&a<i.length&&i.splice(0,i.length-a),!s){for(var l=o.now(),c=0,u=1;u<i.length&&i[u]<=l;u+=2)c=u;c&&i.splice(0,c+1)}},e})(te);var So=(function(r){z(e,r);function e(t,n){return r.call(this)||this}return e.prototype.schedule=function(t,n){return n===void 0&&(n=0),this},e})(Z);var $t={setInterval:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var o=$t.delegate;return o?.setInterval?o.setInterval.apply(o,H([r,e],F(t))):setInterval.apply(void 0,H([r,e],F(t)))},clearInterval:function(r){var e=$t.delegate;return(e?.clearInterval||clearInterval)(r)},delegate:void 0};var $o=(function(r){z(e,r);function e(t,n){var o=r.call(this,t,n)||this;return o.scheduler=t,o.work=n,o.pending=!1,o}return e.prototype.schedule=function(t,n){var o;if(n===void 0&&(n=0),this.closed)return this;this.state=t;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,n)),this.pending=!0,this.delay=n,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(s,this.id,n),this},e.prototype.requestAsyncId=function(t,n,o){return o===void 0&&(o=0),$t.setInterval(t.flush.bind(t,this),o)},e.prototype.recycleAsyncId=function(t,n,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return n;n!=null&&$t.clearInterval(n)},e.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(t,n);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,n){var o=!1,i;try{this.work(t)}catch(s){o=!0,i=s||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),i},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,o=t.scheduler,i=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Ue(i,this),n!=null&&(this.id=this.recycleAsyncId(o,n,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e})(So);var mn=(function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return r.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},r.now=St.now,r})();var Ao=(function(r){z(e,r);function e(t,n){n===void 0&&(n=mn.now);var o=r.call(this,t,n)||this;return o.actions=[],o._active=!1,o}return e.prototype.flush=function(t){var n=this.actions;if(this._active){n.push(t);return}var o;this._active=!0;do if(o=t.execute(t.state,t.delay))break;while(t=n.shift());if(this._active=!1,o){for(;t=n.shift();)t.unsubscribe();throw o}},e})(mn);var pa=new Ao($o),Eo=pa;var le=new _(function(r){return r.complete()});function ur(r){return r&&g(r.schedule)}function vn(r){return r[r.length-1]}function pr(r){return g(vn(r))?r.pop():void 0}function me(r){return ur(vn(r))?r.pop():void 0}function Co(r,e){return typeof vn(r)=="number"?r.pop():e}var fr=(function(r){return r&&typeof r.length=="number"&&typeof r!="function"});function dr(r){return g(r?.then)}function hr(r){return g(r[tt])}function mr(r){return Symbol.asyncIterator&&g(r?.[Symbol.asyncIterator])}function vr(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function fa(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var gr=fa();function yr(r){return g(r?.[gr])}function br(r){return po(this,arguments,function(){var t,n,o,i;return or(this,function(s){switch(s.label){case 0:t=r.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Le(t.read())];case 3:return n=s.sent(),o=n.value,i=n.done,i?[4,Le(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Le(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function xr(r){return g(r?.getReader)}function I(r){if(r instanceof _)return r;if(r!=null){if(hr(r))return da(r);if(fr(r))return ha(r);if(dr(r))return ma(r);if(mr(r))return To(r);if(yr(r))return va(r);if(xr(r))return ga(r)}throw vr(r)}function da(r){return new _(function(e){var t=r[tt]();if(g(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function ha(r){return new _(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}function ma(r){return new _(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,lr)})}function va(r){return new _(function(e){var t,n;try{for(var o=we(r),i=o.next();!i.done;i=o.next()){var s=i.value;if(e.next(s),e.closed)return}}catch(a){t={error:a}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}e.complete()})}function To(r){return new _(function(e){ya(r,e).catch(function(t){return e.error(t)})})}function ga(r){return To(br(r))}function ya(r,e){var t,n,o,i;return uo(this,void 0,void 0,function(){var s,a;return or(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),t=fo(r),l.label=1;case 1:return[4,t.next()];case 2:if(n=l.sent(),!!n.done)return[3,4];if(s=n.value,e.next(s),e.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=l.sent(),o={error:a},[3,11];case 6:return l.trys.push([6,,9,10]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function Y(r,e,t,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=e.schedule(function(){t(),o?r.add(this.schedule(null,n)):this.unsubscribe()},n);if(r.add(i),!o)return i}function wr(r,e){return e===void 0&&(e=0),w(function(t,n){t.subscribe(S(n,function(o){return Y(n,r,function(){return n.next(o)},e)},function(){return Y(n,r,function(){return n.complete()},e)},function(o){return Y(n,r,function(){return n.error(o)},e)}))})}function _r(r,e){return e===void 0&&(e=0),w(function(t,n){n.add(r.schedule(function(){return t.subscribe(n)},e))})}function Oo(r,e){return I(r).pipe(_r(e),wr(e))}function ko(r,e){return I(r).pipe(_r(e),wr(e))}function Io(r,e){return new _(function(t){var n=0;return e.schedule(function(){n===r.length?t.complete():(t.next(r[n++]),t.closed||this.schedule())})})}function Po(r,e){return new _(function(t){var n;return Y(t,e,function(){n=r[gr](),Y(t,e,function(){var o,i,s;try{o=n.next(),i=o.value,s=o.done}catch(a){t.error(a);return}s?t.complete():t.next(i)},0,!0)}),function(){return g(n?.return)&&n.return()}})}function Sr(r,e){if(!r)throw new Error("Iterable cannot be null");return new _(function(t){Y(t,e,function(){var n=r[Symbol.asyncIterator]();Y(t,e,function(){n.next().then(function(o){o.done?t.complete():t.next(o.value)})},0,!0)})})}function Ro(r,e){return Sr(br(r),e)}function Mo(r,e){if(r!=null){if(hr(r))return Oo(r,e);if(fr(r))return Io(r,e);if(dr(r))return ko(r,e);if(mr(r))return Sr(r,e);if(yr(r))return Po(r,e);if(xr(r))return Ro(r,e)}throw vr(r)}function V(r,e){return e?Mo(r,e):I(r)}function P(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r);return V(r,t)}function At(r,e){var t=g(r)?r:function(){return r},n=function(o){return o.error(t())};return new _(e?function(o){return e.schedule(n,0,o)}:n)}function Et(r){return!!r&&(r instanceof _||g(r.lift)&&g(r.subscribe))}function jo(r){return r instanceof Date&&!isNaN(r)}function M(r,e){return w(function(t,n){var o=0;t.subscribe(S(n,function(i){n.next(r.call(e,i,o++))}))})}var ba=Array.isArray;function xa(r,e){return ba(e)?r.apply(void 0,H([],F(e))):r(e)}function Lo(r){return M(function(e){return xa(r,e)})}var wa=Array.isArray,_a=Object.getPrototypeOf,Sa=Object.prototype,$a=Object.keys;function Uo(r){if(r.length===1){var e=r[0];if(wa(e))return{args:e,keys:null};if(Aa(e)){var t=$a(e);return{args:t.map(function(n){return e[n]}),keys:t}}}return{args:r,keys:null}}function Aa(r){return r&&typeof r=="object"&&_a(r)===Sa}function Do(r,e){return r.reduce(function(t,n,o){return t[n]=e[o],t},{})}function gn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r),n=pr(r),o=Uo(r),i=o.args,s=o.keys;if(i.length===0)return V([],t);var a=new _(Ea(i,t,s?function(l){return Do(s,l)}:X));return n?a.pipe(Lo(n)):a}function Ea(r,e,t){return t===void 0&&(t=X),function(n){qo(e,function(){for(var o=r.length,i=new Array(o),s=o,a=o,l=function(u){qo(e,function(){var p=V(r[u],e),d=!1;p.subscribe(S(n,function(f){i[u]=f,d||(d=!0,a--),a||n.next(t(i.slice()))},function(){--s||n.complete()}))},n)},c=0;c<o;c++)l(c)},n)}}function qo(r,e,t){r?Y(t,r,e):e()}function No(r,e,t,n,o,i,s,a){var l=[],c=0,u=0,p=!1,d=function(){p&&!l.length&&!c&&e.complete()},f=function(h){return c<n?v(h):l.push(h)},v=function(h){i&&e.next(h),c++;var m=!1;I(t(h,u++)).subscribe(S(e,function(b){o?.(b),i?f(b):e.next(b)},function(){m=!0},void 0,function(){if(m)try{c--;for(var b=function(){var K=l.shift();s?Y(e,s,function(){return v(K)}):v(K)};l.length&&c<n;)b();d()}catch(K){e.error(K)}}))};return r.subscribe(S(e,f,function(){p=!0,d()})),function(){a?.()}}function re(r,e,t){return t===void 0&&(t=1/0),g(e)?re(function(n,o){return M(function(i,s){return e(n,i,o,s)})(I(r(n,o)))},t):(typeof e=="number"&&(t=e),w(function(n,o){return No(n,o,r,t)}))}function $r(r){return r===void 0&&(r=1/0),re(X,r)}function Fo(){return $r(1)}function Ae(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Fo()(V(r,me(r)))}function Ct(r){return new _(function(e){I(r()).subscribe(e)})}function Ar(r,e,t){r===void 0&&(r=0),t===void 0&&(t=Eo);var n=-1;return e!=null&&(ur(e)?t=e:n=e),new _(function(o){var i=jo(r)?+r-t.now():r;i<0&&(i=0);var s=0;return t.schedule(function(){o.closed||(o.next(s++),0<=n?this.schedule(void 0,n):o.complete())},i)})}function Ee(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r),n=Co(r,1/0),o=r;return o.length?o.length===1?I(o[0]):$r(n)(V(o,t)):le}var yn=new _(ae);function ve(r,e){return w(function(t,n){var o=0;t.subscribe(S(n,function(i){return r.call(e,i,o++)&&n.next(i)}))})}function G(r){return w(function(e,t){var n=null,o=!1,i;n=e.subscribe(S(t,void 0,void 0,function(s){i=I(r(s,G(r)(e))),n?(n.unsubscribe(),n=null,i.subscribe(t)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(t))})}function Ho(r,e,t,n,o){return function(i,s){var a=t,l=e,c=0;i.subscribe(S(s,function(u){var p=c++;l=a?r(l,u,p):(a=!0,u),n&&s.next(l)},o&&(function(){a&&s.next(l),s.complete()})))}}function Tt(r,e){return g(e)?re(r,e,1):re(r,1)}function Ne(r){return r<=0?function(){return le}:w(function(e,t){var n=0;e.subscribe(S(t,function(o){++n<=r&&(t.next(o),r<=n&&t.complete())}))})}function rt(){return w(function(r,e){r.subscribe(S(e,ae))})}function bn(r,e){return e===void 0&&(e=X),r=r??Ca,w(function(t,n){var o,i=!0;t.subscribe(S(n,function(s){var a=e(s);(i||!r(o,a))&&(i=!1,o=a,n.next(s))}))})}function Ca(r,e){return r===e}function xn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return function(t){return Ae(t,P.apply(void 0,H([],F(r))))}}function Er(r,e){return e?function(t){return t.pipe(Er(function(n,o){return I(r(n,o)).pipe(M(function(i,s){return e(n,i,o,s)}))}))}:w(function(t,n){var o=0,i=null,s=!1;t.subscribe(S(n,function(a){i||(i=S(n,void 0,function(){i=null,s&&n.complete()}),I(r(a,o++)).subscribe(i))},function(){s=!0,!i&&n.complete()}))})}function Ot(r){return w(function(e,t){try{e.subscribe(t)}finally{t.add(r)}})}function wn(r,e){return w(Ho(r,e,arguments.length>=2,!0))}function kt(r){r===void 0&&(r={});var e=r.connector,t=e===void 0?function(){return new te}:e,n=r.resetOnError,o=n===void 0?!0:n,i=r.resetOnComplete,s=i===void 0?!0:i,a=r.resetOnRefCountZero,l=a===void 0?!0:a;return function(c){var u,p,d,f=0,v=!1,h=!1,m=function(){p?.unsubscribe(),p=void 0},b=function(){m(),u=d=void 0,v=h=!1},K=function(){var ie=u;b(),ie?.unsubscribe()};return w(function(ie,be){f++,!h&&!v&&m();var Me=d=d??t();be.add(function(){f--,f===0&&!h&&!v&&(p=_n(K,l))}),Me.subscribe(be),!u&&f>0&&(u=new qe({next:function(je){return Me.next(je)},error:function(je){h=!0,m(),p=_n(b,o,je),Me.error(je)},complete:function(){v=!0,m(),p=_n(b,s),Me.complete()}}),I(ie).subscribe(u))})(c)}}function _n(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];if(e===!0){r();return}if(e!==!1){var o=new qe({next:function(){o.unsubscribe(),r()}});return I(e.apply(void 0,H([],F(t)))).subscribe(o)}}function nt(r,e,t){var n,o,i,s,a=!1;return r&&typeof r=="object"?(n=r.bufferSize,s=n===void 0?1/0:n,o=r.windowTime,e=o===void 0?1/0:o,i=r.refCount,a=i===void 0?!1:i,t=r.scheduler):s=r??1/0,kt({connector:function(){return new _o(s,e,t)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:a})}function Sn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r);return w(function(n,o){(t?Ae(r,n,t):Ae(r,n)).subscribe(o)})}function B(r,e){return w(function(t,n){var o=null,i=0,s=!1,a=function(){return s&&!o&&n.complete()};t.subscribe(S(n,function(l){o?.unsubscribe();var c=0,u=i++;I(r(l,u)).subscribe(o=S(n,function(p){return n.next(e?e(l,p,u,c++):p)},function(){o=null,a()}))},function(){s=!0,a()}))})}function Fe(r){return w(function(e,t){I(r).subscribe(S(t,function(){return t.complete()},ae)),!t.closed&&e.subscribe(t)})}function It(r,e){return e===void 0&&(e=!1),w(function(t,n){var o=0;t.subscribe(S(n,function(i){var s=r(i,o++);(s||e)&&n.next(i),!s&&n.complete()}))})}function _e(r,e,t){var n=g(r)||e||t?{next:r,error:e,complete:t}:r;return n?w(function(o,i){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var a=!0;o.subscribe(S(i,function(l){var c;(c=n.next)===null||c===void 0||c.call(n,l),i.next(l)},function(){var l;a=!1,(l=n.complete)===null||l===void 0||l.call(n),i.complete()},function(l){var c;a=!1,(c=n.error)===null||c===void 0||c.call(n,l),i.error(l)},function(){var l,c;a&&((l=n.unsubscribe)===null||l===void 0||l.call(n)),(c=n.finalize)===null||c===void 0||c.call(n)}))}):X}function $n(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=pr(r);return w(function(n,o){for(var i=r.length,s=new Array(i),a=r.map(function(){return!1}),l=!1,c=function(p){I(r[p]).subscribe(S(o,function(d){s[p]=d,!l&&!a[p]&&(a[p]=!0,(l=a.every(X))&&(a=null))},ae))},u=0;u<i;u++)c(u);n.subscribe(S(o,function(p){if(l){var d=H([p],F(s));o.next(t?t.apply(void 0,H([],F(d))):d)}}))})}var Pt=`id name type description instructions tools isActive modelName mcpLambdaId mcpLambdaName createdAt updatedAt
|
|
33
|
-
embed { published identity allowedOrigins welcome suggestions showToolDetails maxMessagesPerConversation retentionDays publishedAt }`,Vo="id name description welcome suggestions",An=`token expiresAt agents { ${Vo} }`,Wo="id agentId title messageCount lastSeq answering lastMessageAt createdAt",Ta="id role text toolCalls { name status } createdAt",zo="conversationId seq type runId data createdAt",ce={listAgents:`query ($projectId: String!) { listProjectAgents(projectId: $projectId) { ${Pt} } }`,getAgent:`query ($id: String!) { getProjectAgent(id: $id) { ${Pt} } }`,createAgent:`mutation ($projectId: String!, $payload: CreateProjectAgentInput!) { createProjectAgent(projectId: $projectId, payload: $payload) { ${Pt} } }`,updateAgent:`mutation ($id: String!, $payload: UpdateProjectAgentInput!) { updateProjectAgent(id: $id, payload: $payload) { ${Pt} } }`,deleteAgent:"mutation ($id: String!) { deleteProjectAgent(id: $id) }",updateEmbed:`mutation ($agentId: String!, $embed: AgentEmbedInput!) { updateAgentEmbed(agentId: $agentId, embed: $embed) { ${Pt} } }`,createSession:`mutation ($subject: String!, $agents: [String], $claims: JSON, $ttlSeconds: Int, $origin: String) { createAgentSession(subject: $subject, agents: $agents, claims: $claims, ttlSeconds: $ttlSeconds, origin: $origin) { ${An} } }`,exchangeSession:`mutation ($projectId: String!, $token: String!, $agents: [String]) { exchangeAgentSession(projectId: $projectId, token: $token, agents: $agents) { ${An} } }`,anonymousSession:`mutation ($deviceId: String!, $turnstileToken: String!, $agents: [String]) { createAnonymousAgentSession(deviceId: $deviceId, turnstileToken: $turnstileToken, agents: $agents) { ${An} } }`,sessionAgents:`query { sessionAgents { ${Vo} } }`,conversations:`query ($agent: String) { agentConversations(agent: $agent) { ${Wo} } }`,conversation:`query ($id: String!) { agentConversation(id: $id) { ${Wo} messages { ${Ta} } } }`,events:`query ($conversationId: String!, $afterSeq: Int) { agentConversationEvents(conversationId: $conversationId, afterSeq: $afterSeq) { ${zo} } }`,send:"mutation ($agent: String!, $conversationId: String, $text: String!, $credential: String) { sendAgentMessage(agent: $agent, conversationId: $conversationId, text: $text, credential: $credential) { conversationId runId seq } }",abort:"mutation ($conversationId: String!) { abortAgentRun(conversationId: $conversationId) }",liveEvents:`subscription ($conversationId: String!) { agentEvents(conversationId: $conversationId) { ${zo} } }`};var Oa=["limit-reached","cap-reached","agent-unavailable","session-expired","credential-expired","aborted","internal"],U=class extends Error{constructor(t,n,o){super(t);this.code=n;this.status=o;this.name="LambforgeError"}};function Rt(r,e){let t=r?.[0]??{},n=String(t.message??"Request failed"),o=n.match(/^([a-z-]+):/)?.[1];return o&&Oa.includes(o)?new U(n,o,e):n==="session-expired"?new U(n,"session-expired",e):t.extensions?.code==="UNAUTHENTICATED"||/not authorized|unauthorized|invalid sign-in token/i.test(n)?new U(n,"unauthorized",e):new U(n,"bad-request",e)}var Cr="https://api.lambforge.com",ka=r=>`${r.replace(/\/+$/,"")}/graphql`,Bo=r=>`${r.replace(/\/+$/,"").replace(/^http/,"ws")}/subscriptions`;function Mt(r,e,t,n,o){return new _(i=>{let s=new AbortController,a=r.fetch??globalThis.fetch;if(!a){i.error(new U("No fetch available","network"));return}return a(ka(r.url),{method:"POST",headers:{"content-type":"application/json",...e?{authorization:e}:{}},body:JSON.stringify({query:t,variables:n}),signal:s.signal}).then(async l=>{let c;try{c=await l.json()}catch{throw new U(`Lambforge answered ${l.status}`,l.status===401?"unauthorized":"network",l.status)}if(c.errors?.length)throw Rt(c.errors,l.status);if(!c.data||!(o in c.data))throw new U(`Lambforge answered ${l.status} without ${o}`,"network",l.status);i.next(c.data[o]),i.complete()}).catch(l=>{s.signal.aborted||i.error(l instanceof U?l:new U(String(l?.message??l),"network"))}),()=>s.abort()})}var Ko=["graphql-ws","graphql-transport-ws"];function Yo(r){return new _(e=>{let n=!1,o=new r.WebSocket(r.url,Ko),i=()=>o.protocol==="graphql-transport-ws",s=l=>{o.readyState===1&&o.send(JSON.stringify(l))},a=l=>{if(!n){n=!0,e.error(l);try{o.close(1e3)}catch{}}};return o.onopen=()=>s({type:"connection_init",payload:r.connectionParams}),o.onmessage=l=>{let c;try{c=JSON.parse(String(l.data))}catch{return}switch(c.type){case"connection_ack":s({id:"1",type:i()?"subscribe":"start",payload:{query:r.query,variables:r.variables}}),r.onStarted?.();return;case"ping":s({type:"pong"});return;case"next":case"data":{let u=c.payload;if(u?.errors?.length){a(Rt(u.errors));return}u?.data&&e.next(u.data[r.field]);return}case"error":a(Rt(Array.isArray(c.payload)?c.payload:[c.payload]));return;case"connection_error":a(new U(String(c.payload?.message??"connection refused"),"unauthorized"));return;case"complete":if(n)return;n=!0,e.complete(),o.close(1e3);return;default:return}},o.onclose=l=>{if(n)return;let c=l?.code===4401||l?.code===4403;a(new U(`connection closed${l?.code?` (${l.code}${l.reason?` ${l.reason}`:""})`:""}`,c?"unauthorized":"network"))},o.onerror=()=>{},()=>{n||(n=!0,s({id:"1",type:i()?"complete":"stop"})),o.onmessage=o.onclose=o.onerror=o.onopen=null;try{o.close(1e3)}catch{}}})}var Tr=r=>Ct(()=>{let e=r();return Et(e)?e.pipe(Ne(1)):V(Promise.resolve(e))}),Ia=6e4,Go="lambforge.agents.device",Pa=15e3,He=class{constructor(e){this.options=e;this.current=null;this.pending$=null;if([e.getToken,e.exchange,e.anonymous].filter(Boolean).length!==1)throw new U("AgentClient: give exactly one of getToken, exchange or anonymous","bad-request");if(e.anonymous&&!e.anonymous.publishableKey.startsWith("lfp_"))throw new U("AgentClient: anonymous visitors need a publishable key (lfp_...)","bad-request");this.endpoint={url:e.url??Cr,fetch:e.fetch}}token$(){return this.current&&Date.now()<this.current.renewAt?P(this.current.token):(this.pending$||(this.pending$=this.session$().pipe(_e(e=>{let t=e.expiresAt?Date.parse(e.expiresAt):NaN;this.current={token:e.token,renewAt:Number.isFinite(t)?Math.max(Date.now()+3e4,t-Ia):Date.now()+50*6e4}}),M(e=>e.token),Ot(()=>this.pending$=null),nt(1))),this.pending$)}invalidate(){this.current=null}credential$(){let e=this.options,t=e.credential===!1?null:e.credential??(e.exchange?e.exchange.idToken:null);return t?Tr(t).pipe(M(n=>n||void 0)):P(void 0)}session$(){let e=this.options;if(e.getToken)return Tr(e.getToken).pipe(M(n=>typeof n=="string"?{token:n}:n));if(e.exchange){let{projectId:n,idToken:o,agents:i}=e.exchange;return Tr(o).pipe(B(s=>Mt(this.endpoint,null,ce.exchangeSession,{projectId:n,token:s,agents:i},"exchangeAgentSession")))}let t=e.anonymous;return Tr(t.turnstileToken).pipe(B(n=>Mt(this.endpoint,t.publishableKey,ce.anonymousSession,{deviceId:t.deviceId??Jo(),turnstileToken:n,agents:t.agents},"createAnonymousAgentSession")))}call$(e,t,n){let o=()=>this.token$().pipe(B(i=>Mt(this.endpoint,i,e,t,n)));return o().pipe(G(i=>i?.code!=="session-expired"&&i?.code!=="unauthorized"?At(()=>i):(this.invalidate(),o())))}agents(){return this.call$(ce.sessionAgents,{},"sessionAgents")}conversations(e){return this.call$(ce.conversations,{agent:e},"agentConversations")}agent(e){return{conversation:t=>new Or(this,e,t??null),conversations:()=>this.conversations(e)}}events(e,t=0){return new _(n=>{let o=t,i=new Map,s=new Z,a=!1,l=!1,c=()=>{for(;i.has(o+1);){let m=i.get(o+1);i.delete(o+1),o=m.seq,n.next(m)}},u=m=>{if(m){if(m.type==="delta"){n.next(m);return}m.seq<=o||(i.set(m.seq,m),c(),i.size&&p())}},p=()=>{if(a){l=!0;return}a=!0,s.add(this.call$(ce.events,{conversationId:e,afterSeq:o},"agentConversationEvents").subscribe({next:m=>{m.forEach(b=>i.set(b.seq,b)),c(),i.size&&!m.length&&(o=Math.min(...i.keys())-1,c())},error:m=>{a=!1,n.error(m)},complete:()=>{a=!1,l&&(l=!1,p())}}))},d=this.webSocket();if(!d)return p(),s.add(Ar(this.options.pollIntervalMs??1500,this.options.pollIntervalMs??1500).subscribe(()=>p())),s;let f=0,v=!1,h=()=>{s.add(this.token$().pipe(B(m=>Yo({url:Bo(this.endpoint.url),WebSocket:d,connectionParams:{agentSession:m},query:ce.liveEvents,variables:{conversationId:e},field:"agentEvents",onStarted:()=>{f=0,v=!1,p()}}))).subscribe({next:u,error:m=>{if(m?.code==="unauthorized"&&!v){v=!0,this.invalidate(),h();return}if(m?.code!=="network"){n.error(m);return}let b=Math.min(Pa,1e3*2**f++);s.add(Ar(b*(.75+Math.random()/2)).subscribe(h))},complete:()=>n.complete()}))};return h(),s})}webSocket(){return this.options.WebSocket===!1?null:this.options.WebSocket??(globalThis.WebSocket||null)}},Or=class{constructor(e,t,n){this.client=e;this.agent=t;this.id=n}send(e,t={}){return(t.credential!==void 0?P(t.credential):this.client.credential$()).pipe(B(o=>this.client.call$(ce.send,{agent:this.agent,conversationId:this.id,text:e,credential:o},"sendAgentMessage"))).pipe(_e(o=>this.id=o.conversationId),B(o=>this.client.events(o.conversationId,Math.max(0,o.seq-2)).pipe(It(i=>!((i.type==="done"||i.type==="error")&&i.runId===o.runId),!0))))}events(e){return this.id?e===void 0?this.history().pipe(B(t=>this.client.events(this.id,t.lastSeq??0))):this.client.events(this.id,e):At(()=>new U("No conversation yet - send a message first","bad-request"))}history(){return this.id?this.client.call$(ce.conversation,{id:this.id},"agentConversation"):At(()=>new U("No conversation yet - send a message first","bad-request"))}abort(){return this.id?this.client.call$(ce.abort,{conversationId:this.id},"abortAgentRun"):P(!1)}};function Jo(){let r=globalThis.localStorage;try{let t=r?.getItem(Go);if(t&&/^[A-Za-z0-9_-]{16,128}$/.test(t))return t}catch{}let e=globalThis.crypto.randomUUID().replace(/-/g,"");try{r?.setItem(Go,e)}catch{}return e}var Xs=an(Rs()),x=an(Kt());var oe=an(Kt()),Jl=/^(https?:|mailto:)/i,Zn=/^\s*[-*+]\s+/,Br=/^\s*\d+[.)]\s+/,Zl=/^```\s*([\w+-]*)\s*$/,Ms=/^(#{1,6})\s+(.*)$/;function Gt(r){let e=[],t=String(r??"").replace(/\r\n?/g,`
|
|
32
|
+
`):"",this.name="UnsubscriptionError",this.errors=t}});function Fe(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}var Q=(function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var e,t,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=we(s),l=a.next();!l.done;l=a.next()){var c=l.value;c.remove(this)}}catch(h){e={error:h}}finally{try{l&&!l.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else s.remove(this);var u=this.initialTeardown;if(b(u))try{u()}catch(h){i=h instanceof pr?h.errors:[h]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var f=we(p),d=f.next();!d.done;d=f.next()){var g=d.value;try{Co(g)}catch(h){i=i??[],h instanceof pr?i=z(z([],H(i)),H(h.errors)):i.push(h)}}}catch(h){n={error:h}}finally{try{d&&!d.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}}if(i)throw new pr(i)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)Co(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Fe(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&Fe(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=(function(){var e=new r;return e.closed=!0,e})(),r})();var wn=Q.EMPTY;function dr(r){return r instanceof Q||r&&"closed"in r&&b(r.remove)&&b(r.add)&&b(r.unsubscribe)}function Co(r){b(r)?r():r.unsubscribe()}var ce={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var ot={setTimeout:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var o=ot.delegate;return o?.setTimeout?o.setTimeout.apply(o,z([r,e],H(t))):setTimeout.apply(void 0,z([r,e],H(t)))},clearTimeout:function(r){var e=ot.delegate;return(e?.clearTimeout||clearTimeout)(r)},delegate:void 0};function fr(r){ot.setTimeout(function(){var e=ce.onUnhandledError;if(e)e(r);else throw r})}function ue(){}var ko=(function(){return $n("C",void 0,void 0)})();function To(r){return $n("E",void 0,r)}function Io(r){return $n("N",r,void 0)}function $n(r,e,t){return{kind:r,value:e,error:t}}var De=null;function it(r){if(ce.useDeprecatedSynchronousErrorHandling){var e=!De;if(e&&(De={errorThrown:!1,error:null}),r(),e){var t=De,n=t.errorThrown,o=t.error;if(De=null,n)throw o}}else r()}function Oo(r){ce.useDeprecatedSynchronousErrorHandling&&De&&(De.errorThrown=!0,De.error=r)}var Tt=(function(r){Y(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,dr(t)&&t.add(n)):n.destination=_a,n}return e.create=function(t,n,o){return new Ne(t,n,o)},e.prototype.next=function(t){this.isStopped?Sn(Io(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?Sn(To(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?Sn(ko,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(Q);var xa=Function.prototype.bind;function _n(r,e){return xa.call(r,e)}var wa=(function(){function r(e){this.partialObserver=e}return r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){hr(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){hr(n)}else hr(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){hr(t)}},r})(),Ne=(function(r){Y(e,r);function e(t,n,o){var i=r.call(this)||this,s;if(b(t)||!t)s={next:t??void 0,error:n??void 0,complete:o??void 0};else{var a;i&&ce.useDeprecatedNextContext?(a=Object.create(t),a.unsubscribe=function(){return i.unsubscribe()},s={next:t.next&&_n(t.next,a),error:t.error&&_n(t.error,a),complete:t.complete&&_n(t.complete,a)}):s=t}return i.destination=new wa(s),i}return e})(Tt);function hr(r){ce.useDeprecatedSynchronousErrorHandling?Oo(r):fr(r)}function $a(r){throw r}function Sn(r,e){var t=ce.onStoppedNotification;t&&ot.setTimeout(function(){return t(r,e)})}var _a={closed:!0,next:ue,error:$a,complete:ue};var st=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ee(r){return r}function An(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return En(r)}function En(r){return r.length===0?ee:r.length===1?r[0]:function(t){return r.reduce(function(n,o){return o(n)},t)}}var $=(function(){function r(e){e&&(this._subscribe=e)}return r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,n){var o=this,i=Aa(e)?e:new Ne(e,t,n);return it(function(){var s=o,a=s.operator,l=s.source;i.add(a?a.call(i,l):l?o._subscribe(i):o._trySubscribe(i))}),i},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var n=this;return t=Po(t),new t(function(o,i){var s=new Ne({next:function(a){try{e(a)}catch(l){i(l),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[st]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return En(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=Po(e),new e(function(n,o){var i;t.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},r.create=function(e){return new r(e)},r})();function Po(r){var e;return(e=r??ce.Promise)!==null&&e!==void 0?e:Promise}function Sa(r){return r&&b(r.next)&&b(r.error)&&b(r.complete)}function Aa(r){return r&&r instanceof Tt||Sa(r)&&dr(r)}function Ea(r){return b(r?.lift)}function y(r){return function(e){if(Ea(e))return e.lift(function(t){try{return r(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function _(r,e,t,n,o){return new Ca(r,e,t,n,o)}var Ca=(function(r){Y(e,r);function e(t,n,o,i,s,a){var l=r.call(this,t)||this;return l.onFinalize=s,l.shouldUnsubscribe=a,l._next=n?function(c){try{n(c)}catch(u){t.error(u)}}:r.prototype._next,l._error=i?function(c){try{i(c)}catch(u){t.error(u)}finally{this.unsubscribe()}}:r.prototype._error,l._complete=o?function(){try{o()}catch(c){t.error(c)}finally{this.unsubscribe()}}:r.prototype._complete,l}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;r.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e})(Tt);var jo=ur(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var oe=(function(r){Y(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var n=new Ro(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new jo},e.prototype.next=function(t){var n=this;it(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=we(n.currentObservers),a=s.next();!a.done;a=s.next()){var l=a.value;l.next(t)}}catch(c){o={error:c}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},e.prototype.error=function(t){var n=this;it(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var o=n.observers;o.length;)o.shift().error(t)}})},e.prototype.complete=function(){var t=this;it(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?wn:(this.currentObservers=null,a.push(t),new Q(function(){n.currentObservers=null,Fe(a,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?t.error(i):s&&t.complete()},e.prototype.asObservable=function(){var t=new $;return t.source=this,t},e.create=function(t,n){return new Ro(t,n)},e})($);var Ro=(function(r){Y(e,r);function e(t,n){var o=r.call(this)||this;return o.destination=t,o.source=n,o}return e.prototype.next=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,t)},e.prototype.error=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&o!==void 0?o:wn},e})(oe);var It={now:function(){return(It.delegate||Date).now()},delegate:void 0};var Mo=(function(r){Y(e,r);function e(t,n,o){t===void 0&&(t=1/0),n===void 0&&(n=1/0),o===void 0&&(o=It);var i=r.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return e.prototype.next=function(t){var n=this,o=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,l=n._windowTime;o||(i.push(t),!s&&i.push(a.now()+l)),this._trimBuffer(),r.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(t),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),l=0;l<a.length&&!t.closed;l+=i?1:2)t.next(a[l]);return this._checkFinalizedStatuses(t),n},e.prototype._trimBuffer=function(){var t=this,n=t._bufferSize,o=t._timestampProvider,i=t._buffer,s=t._infiniteTimeWindow,a=(s?1:2)*n;if(n<1/0&&a<i.length&&i.splice(0,i.length-a),!s){for(var l=o.now(),c=0,u=1;u<i.length&&i[u]<=l;u+=2)c=u;c&&i.splice(0,c+1)}},e})(oe);var Lo=(function(r){Y(e,r);function e(t,n){return r.call(this)||this}return e.prototype.schedule=function(t,n){return n===void 0&&(n=0),this},e})(Q);var Ot={setInterval:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var o=Ot.delegate;return o?.setInterval?o.setInterval.apply(o,z([r,e],H(t))):setInterval.apply(void 0,z([r,e],H(t)))},clearInterval:function(r){var e=Ot.delegate;return(e?.clearInterval||clearInterval)(r)},delegate:void 0};var Uo=(function(r){Y(e,r);function e(t,n){var o=r.call(this,t,n)||this;return o.scheduler=t,o.work=n,o.pending=!1,o}return e.prototype.schedule=function(t,n){var o;if(n===void 0&&(n=0),this.closed)return this;this.state=t;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,n)),this.pending=!0,this.delay=n,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(s,this.id,n),this},e.prototype.requestAsyncId=function(t,n,o){return o===void 0&&(o=0),Ot.setInterval(t.flush.bind(t,this),o)},e.prototype.recycleAsyncId=function(t,n,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return n;n!=null&&Ot.clearInterval(n)},e.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(t,n);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,n){var o=!1,i;try{this.work(t)}catch(s){o=!0,i=s||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),i},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,o=t.scheduler,i=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Fe(i,this),n!=null&&(this.id=this.recycleAsyncId(o,n,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e})(Lo);var Cn=(function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return r.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},r.now=It.now,r})();var Fo=(function(r){Y(e,r);function e(t,n){n===void 0&&(n=Cn.now);var o=r.call(this,t,n)||this;return o.actions=[],o._active=!1,o}return e.prototype.flush=function(t){var n=this.actions;if(this._active){n.push(t);return}var o;this._active=!0;do if(o=t.execute(t.state,t.delay))break;while(t=n.shift());if(this._active=!1,o){for(;t=n.shift();)t.unsubscribe();throw o}},e})(Cn);var ka=new Fo(Uo),Do=ka;var ie=new $(function(r){return r.complete()});function mr(r){return r&&b(r.schedule)}function kn(r){return r[r.length-1]}function gr(r){return b(kn(r))?r.pop():void 0}function me(r){return mr(kn(r))?r.pop():void 0}function No(r,e){return typeof kn(r)=="number"?r.pop():e}var vr=(function(r){return r&&typeof r.length=="number"&&typeof r!="function"});function br(r){return b(r?.then)}function yr(r){return b(r[st])}function xr(r){return Symbol.asyncIterator&&b(r?.[Symbol.asyncIterator])}function wr(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Ta(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var $r=Ta();function _r(r){return b(r?.[$r])}function Sr(r){return Ao(this,arguments,function(){var t,n,o,i;return cr(this,function(s){switch(s.label){case 0:t=r.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Ue(t.read())];case 3:return n=s.sent(),o=n.value,i=n.done,i?[4,Ue(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Ue(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function Ar(r){return b(r?.getReader)}function j(r){if(r instanceof $)return r;if(r!=null){if(yr(r))return Ia(r);if(vr(r))return Oa(r);if(br(r))return Pa(r);if(xr(r))return qo(r);if(_r(r))return ja(r);if(Ar(r))return Ra(r)}throw wr(r)}function Ia(r){return new $(function(e){var t=r[st]();if(b(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Oa(r){return new $(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}function Pa(r){return new $(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,fr)})}function ja(r){return new $(function(e){var t,n;try{for(var o=we(r),i=o.next();!i.done;i=o.next()){var s=i.value;if(e.next(s),e.closed)return}}catch(a){t={error:a}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}e.complete()})}function qo(r){return new $(function(e){Ma(r,e).catch(function(t){return e.error(t)})})}function Ra(r){return qo(Sr(r))}function Ma(r,e){var t,n,o,i;return So(this,void 0,void 0,function(){var s,a;return cr(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),t=Eo(r),l.label=1;case 1:return[4,t.next()];case 2:if(n=l.sent(),!!n.done)return[3,4];if(s=n.value,e.next(s),e.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=l.sent(),o={error:a},[3,11];case 6:return l.trys.push([6,,9,10]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function X(r,e,t,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=e.schedule(function(){t(),o?r.add(this.schedule(null,n)):this.unsubscribe()},n);if(r.add(i),!o)return i}function Er(r,e){return e===void 0&&(e=0),y(function(t,n){t.subscribe(_(n,function(o){return X(n,r,function(){return n.next(o)},e)},function(){return X(n,r,function(){return n.complete()},e)},function(o){return X(n,r,function(){return n.error(o)},e)}))})}function Cr(r,e){return e===void 0&&(e=0),y(function(t,n){n.add(r.schedule(function(){return t.subscribe(n)},e))})}function Ho(r,e){return j(r).pipe(Cr(e),Er(e))}function zo(r,e){return j(r).pipe(Cr(e),Er(e))}function Wo(r,e){return new $(function(t){var n=0;return e.schedule(function(){n===r.length?t.complete():(t.next(r[n++]),t.closed||this.schedule())})})}function Ko(r,e){return new $(function(t){var n;return X(t,e,function(){n=r[$r](),X(t,e,function(){var o,i,s;try{o=n.next(),i=o.value,s=o.done}catch(a){t.error(a);return}s?t.complete():t.next(i)},0,!0)}),function(){return b(n?.return)&&n.return()}})}function kr(r,e){if(!r)throw new Error("Iterable cannot be null");return new $(function(t){X(t,e,function(){var n=r[Symbol.asyncIterator]();X(t,e,function(){n.next().then(function(o){o.done?t.complete():t.next(o.value)})},0,!0)})})}function Bo(r,e){return kr(Sr(r),e)}function Vo(r,e){if(r!=null){if(yr(r))return Ho(r,e);if(vr(r))return Wo(r,e);if(br(r))return zo(r,e);if(xr(r))return kr(r,e);if(_r(r))return Ko(r,e);if(Ar(r))return Bo(r,e)}throw wr(r)}function V(r,e){return e?Vo(r,e):j(r)}function O(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r);return V(r,t)}function at(r,e){var t=b(r)?r:function(){return r},n=function(o){return o.error(t())};return new $(e?function(o){return e.schedule(n,0,o)}:n)}function Pt(r){return!!r&&(r instanceof $||b(r.lift)&&b(r.subscribe))}function Yo(r){return r instanceof Date&&!isNaN(r)}function P(r,e){return y(function(t,n){var o=0;t.subscribe(_(n,function(i){n.next(r.call(e,i,o++))}))})}var La=Array.isArray;function Ua(r,e){return La(e)?r.apply(void 0,z([],H(e))):r(e)}function Go(r){return P(function(e){return Ua(r,e)})}var Fa=Array.isArray,Da=Object.getPrototypeOf,Na=Object.prototype,qa=Object.keys;function Jo(r){if(r.length===1){var e=r[0];if(Fa(e))return{args:e,keys:null};if(Ha(e)){var t=qa(e);return{args:t.map(function(n){return e[n]}),keys:t}}}return{args:r,keys:null}}function Ha(r){return r&&typeof r=="object"&&Da(r)===Na}function Zo(r,e){return r.reduce(function(t,n,o){return t[n]=e[o],t},{})}function Tn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r),n=gr(r),o=Jo(r),i=o.args,s=o.keys;if(i.length===0)return V([],t);var a=new $(za(i,t,s?function(l){return Zo(s,l)}:ee));return n?a.pipe(Go(n)):a}function za(r,e,t){return t===void 0&&(t=ee),function(n){Xo(e,function(){for(var o=r.length,i=new Array(o),s=o,a=o,l=function(u){Xo(e,function(){var p=V(r[u],e),f=!1;p.subscribe(_(n,function(d){i[u]=d,f||(f=!0,a--),a||n.next(t(i.slice()))},function(){--s||n.complete()}))},n)},c=0;c<o;c++)l(c)},n)}}function Xo(r,e,t){r?X(t,r,e):e()}function Qo(r,e,t,n,o,i,s,a){var l=[],c=0,u=0,p=!1,f=function(){p&&!l.length&&!c&&e.complete()},d=function(h){return c<n?g(h):l.push(h)},g=function(h){i&&e.next(h),c++;var m=!1;j(t(h,u++)).subscribe(_(e,function(w){o?.(w),i?d(w):e.next(w)},function(){m=!0},void 0,function(){if(m)try{c--;for(var w=function(){var Z=l.shift();s?X(e,s,function(){return g(Z)}):g(Z)};l.length&&c<n;)w();f()}catch(Z){e.error(Z)}}))};return r.subscribe(_(e,d,function(){p=!0,f()})),function(){a?.()}}function te(r,e,t){return t===void 0&&(t=1/0),b(e)?te(function(n,o){return P(function(i,s){return e(n,i,o,s)})(j(r(n,o)))},t):(typeof e=="number"&&(t=e),y(function(n,o){return Qo(n,o,r,t)}))}function Tr(r){return r===void 0&&(r=1/0),te(ee,r)}function ei(){return Tr(1)}function Ee(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return ei()(V(r,me(r)))}function Ce(r){return new $(function(e){j(r()).subscribe(e)})}function Ir(r,e,t){r===void 0&&(r=0),t===void 0&&(t=Do);var n=-1;return e!=null&&(mr(e)?t=e:n=e),new $(function(o){var i=Yo(r)?+r-t.now():r;i<0&&(i=0);var s=0;return t.schedule(function(){o.closed||(o.next(s++),0<=n?this.schedule(void 0,n):o.complete())},i)})}function ke(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r),n=No(r,1/0),o=r;return o.length?o.length===1?j(o[0]):Tr(n)(V(o,t)):ie}var In=new $(ue);function ge(r,e){return y(function(t,n){var o=0;t.subscribe(_(n,function(i){return r.call(e,i,o++)&&n.next(i)}))})}function G(r){return y(function(e,t){var n=null,o=!1,i;n=e.subscribe(_(t,void 0,void 0,function(s){i=j(r(s,G(r)(e))),n?(n.unsubscribe(),n=null,i.subscribe(t)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(t))})}function Or(r,e,t,n,o){return function(i,s){var a=t,l=e,c=0;i.subscribe(_(s,function(u){var p=c++;l=a?r(l,u,p):(a=!0,u),n&&s.next(l)},o&&(function(){a&&s.next(l),s.complete()})))}}function ti(r,e){return y(Or(r,e,arguments.length>=2,!1,!0))}var Wa=function(r,e){return r.push(e),r};function On(){return y(function(r,e){ti(Wa,[])(r).subscribe(e)})}function qe(r,e){return b(e)?te(r,e,1):te(r,1)}function He(r){return r<=0?function(){return ie}:y(function(e,t){var n=0;e.subscribe(_(t,function(o){++n<=r&&(t.next(o),r<=n&&t.complete())}))})}function ze(){return y(function(r,e){r.subscribe(_(e,ue))})}function Pn(r,e){return e===void 0&&(e=ee),r=r??Ka,y(function(t,n){var o,i=!0;t.subscribe(_(n,function(s){var a=e(s);(i||!r(o,a))&&(i=!1,o=a,n.next(s))}))})}function Ka(r,e){return r===e}function jn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return function(t){return Ee(t,O.apply(void 0,z([],H(r))))}}function Pr(r,e){return e?function(t){return t.pipe(Pr(function(n,o){return j(r(n,o)).pipe(P(function(i,s){return e(n,i,o,s)}))}))}:y(function(t,n){var o=0,i=null,s=!1;t.subscribe(_(n,function(a){i||(i=_(n,void 0,function(){i=null,s&&n.complete()}),j(r(a,o++)).subscribe(i))},function(){s=!0,!i&&n.complete()}))})}function jt(r){return y(function(e,t){try{e.subscribe(t)}finally{t.add(r)}})}function Rn(r,e){return y(Or(r,e,arguments.length>=2,!0))}function Rt(r){r===void 0&&(r={});var e=r.connector,t=e===void 0?function(){return new oe}:e,n=r.resetOnError,o=n===void 0?!0:n,i=r.resetOnComplete,s=i===void 0?!0:i,a=r.resetOnRefCountZero,l=a===void 0?!0:a;return function(c){var u,p,f,d=0,g=!1,h=!1,m=function(){p?.unsubscribe(),p=void 0},w=function(){m(),u=f=void 0,g=h=!1},Z=function(){var le=u;w(),le?.unsubscribe()};return y(function(le,ye){d++,!h&&!g&&m();var Me=f=f??t();ye.add(function(){d--,d===0&&!h&&!g&&(p=Mn(Z,l))}),Me.subscribe(ye),!u&&d>0&&(u=new Ne({next:function(Le){return Me.next(Le)},error:function(Le){h=!0,m(),p=Mn(w,o,Le),Me.error(Le)},complete:function(){g=!0,m(),p=Mn(w,s),Me.complete()}}),j(le).subscribe(u))})(c)}}function Mn(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];if(e===!0){r();return}if(e!==!1){var o=new Ne({next:function(){o.unsubscribe(),r()}});return j(e.apply(void 0,z([],H(t)))).subscribe(o)}}function lt(r,e,t){var n,o,i,s,a=!1;return r&&typeof r=="object"?(n=r.bufferSize,s=n===void 0?1/0:n,o=r.windowTime,e=o===void 0?1/0:o,i=r.refCount,a=i===void 0?!1:i,t=r.scheduler):s=r??1/0,Rt({connector:function(){return new Mo(s,e,t)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:a})}function Ln(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r);return y(function(n,o){(t?Ee(r,n,t):Ee(r,n)).subscribe(o)})}function W(r,e){return y(function(t,n){var o=null,i=0,s=!1,a=function(){return s&&!o&&n.complete()};t.subscribe(_(n,function(l){o?.unsubscribe();var c=0,u=i++;j(r(l,u)).subscribe(o=_(n,function(p){return n.next(e?e(l,p,u,c++):p)},function(){o=null,a()}))},function(){s=!0,a()}))})}function We(r){return y(function(e,t){j(r).subscribe(_(t,function(){return t.complete()},ue)),!t.closed&&e.subscribe(t)})}function Mt(r,e){return e===void 0&&(e=!1),y(function(t,n){var o=0;t.subscribe(_(n,function(i){var s=r(i,o++);(s||e)&&n.next(i),!s&&n.complete()}))})}function $e(r,e,t){var n=b(r)||e||t?{next:r,error:e,complete:t}:r;return n?y(function(o,i){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var a=!0;o.subscribe(_(i,function(l){var c;(c=n.next)===null||c===void 0||c.call(n,l),i.next(l)},function(){var l;a=!1,(l=n.complete)===null||l===void 0||l.call(n),i.complete()},function(l){var c;a=!1,(c=n.error)===null||c===void 0||c.call(n,l),i.error(l)},function(){var l,c;a&&((l=n.unsubscribe)===null||l===void 0||l.call(n)),(c=n.finalize)===null||c===void 0||c.call(n)}))}):ee}function Un(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=gr(r);return y(function(n,o){for(var i=r.length,s=new Array(i),a=r.map(function(){return!1}),l=!1,c=function(p){j(r[p]).subscribe(_(o,function(f){s[p]=f,!l&&!a[p]&&(a[p]=!0,(l=a.every(ee))&&(a=null))},ue))},u=0;u<i;u++)c(u);n.subscribe(_(o,function(p){if(l){var f=z([p],H(s));o.next(t?t.apply(void 0,z([],H(f))):f)}}))})}var Ba=["limit-reached","cap-reached","agent-unavailable","session-expired","credential-expired","aborted","internal","attachments-off","attachments-unsupported","attachment-invalid","attachment-too-large","attachment-limit","attachment-missing","attachment-not-uploaded"],R=class extends Error{constructor(t,n,o){super(t);this.code=n;this.status=o;this.name="LambforgeError"}};function Lt(r,e){let t=r?.[0]??{},n=String(t.message??"Request failed"),o=n.match(/^([a-z-]+):/)?.[1];return o&&Ba.includes(o)?new R(n,o,e):n==="session-expired"?new R(n,"session-expired",e):t.extensions?.code==="UNAUTHENTICATED"||/not authorized|unauthorized|invalid sign-in token/i.test(n)?new R(n,"unauthorized",e):new R(n,"bad-request",e)}var Rr=["image/png","image/jpeg","image/webp","image/gif","application/pdf","text/plain","text/csv","text/markdown","application/json","application/yaml"],jr=1024*1024,ct={imageBytes:5*jr,pdfBytes:10*jr,textBytes:1*jr,perMessage:5,bytesPerMessage:15*jr},Va={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",pdf:"application/pdf",txt:"text/plain",csv:"text/csv",md:"text/markdown",markdown:"text/markdown",json:"application/json",yaml:"application/yaml",yml:"application/yaml"},Mr=r=>Va[String(r??"").split(".").pop()?.toLowerCase()??""];function Fn(r){if(r.length>ct.perMessage)return"attachment-limit";let e=0;for(let t of r){let n=t.type||Mr(t.name);if(!n||!Rr.includes(n))return"attachment-invalid";let o=n.startsWith("image/")?ct.imageBytes:n==="application/pdf"?ct.pdfBytes:ct.textBytes;if(t.size>o)return"attachment-too-large";e+=t.size}return e>ct.bytesPerMessage?"attachment-limit":null}var Ya=r=>typeof Blob<"u"&&r instanceof Blob,Ga=r=>{let e=r.replace(/^data:[^,]*;base64,/,""),t=globalThis.Buffer;if(t)return new Uint8Array(t.from(e,"base64"));let n=atob(e),o=new Uint8Array(n.length);for(let i=0;i<n.length;i++)o[i]=n.charCodeAt(i);return o};function ri(r){if(Ya(r))return{body:r,size:r.size,type:r.type||void 0};if(typeof r=="string"){let e=Ga(r),t=r.match(/^data:([^;,]+)[;,]/)?.[1];return{body:e,size:e.byteLength,type:t}}if(r instanceof ArrayBuffer)return{body:new Uint8Array(r),size:r.byteLength};if(r instanceof Uint8Array)return{body:r,size:r.byteLength};throw new R("Attachment data must be a Blob, File, ArrayBuffer, Uint8Array / Buffer or base64 string","bad-request")}function ni(r,e,t,n){return Ce(()=>{let o=n??globalThis.fetch;if(!o)throw new R("No fetch available","network");return o(r.uploadUrl,{method:r.method||"PUT",headers:{"Content-Type":r.contentType},body:e.body})}).pipe(P(o=>{if(o.status<200||o.status>=300)throw new R(`Uploading ${t} failed (${o.status})`,"network",o.status);return r}))}var Ut=`id name type description instructions tools isActive modelName mcpLambdaId mcpLambdaName createdAt updatedAt
|
|
33
|
+
embed { published identity allowedOrigins welcome suggestions showToolDetails maxMessagesPerConversation maxMessageLength allowAttachments allowFeedback retentionDays publishedAt }`,ai="id name description welcome suggestions allowAttachments allowFeedback",Dn=`token expiresAt agents { ${ai} }`,oi="id agentId title messageCount lastSeq answering lastMessageAt createdAt",Ja="id role text attachments { id name mimeType size } toolCalls { name status } feedback { rating comment } createdAt",ii="conversationId seq type runId data createdAt",Ft="id projectId name title description instructions examples projectDefault knowledge version usedBy updatedAt",si="id name title description builtIn items usedByAgents usedBySkills updatedAt",Za="id collection title text label updatedAt",re={listAgents:`query ($projectId: String!) { listProjectAgents(projectId: $projectId) { ${Ut} } }`,getAgent:`query ($id: String!) { getProjectAgent(id: $id) { ${Ut} } }`,createAgent:`mutation ($projectId: String!, $payload: CreateProjectAgentInput!) { createProjectAgent(projectId: $projectId, payload: $payload) { ${Ut} } }`,updateAgent:`mutation ($id: String!, $payload: UpdateProjectAgentInput!) { updateProjectAgent(id: $id, payload: $payload) { ${Ut} } }`,deleteAgent:"mutation ($id: String!) { deleteProjectAgent(id: $id) }",updateEmbed:`mutation ($agentId: String!, $embed: AgentEmbedInput!) { updateAgentEmbed(agentId: $agentId, embed: $embed) { ${Ut} } }`,createSession:`mutation ($subject: String!, $agents: [String], $claims: JSON, $ttlSeconds: Int, $origin: String) { createAgentSession(subject: $subject, agents: $agents, claims: $claims, ttlSeconds: $ttlSeconds, origin: $origin) { ${Dn} } }`,exchangeSession:`mutation ($projectId: String!, $token: String!, $agents: [String]) { exchangeAgentSession(projectId: $projectId, token: $token, agents: $agents) { ${Dn} } }`,anonymousSession:`mutation ($deviceId: String!, $turnstileToken: String!, $agents: [String]) { createAnonymousAgentSession(deviceId: $deviceId, turnstileToken: $turnstileToken, agents: $agents) { ${Dn} } }`,sessionAgents:`query { sessionAgents { ${ai} } }`,conversations:`query ($agent: String) { agentConversations(agent: $agent) { ${oi} } }`,conversation:`query ($id: String!) { agentConversation(id: $id) { ${oi} messages { ${Ja} } } }`,events:`query ($conversationId: String!, $afterSeq: Int) { agentConversationEvents(conversationId: $conversationId, afterSeq: $afterSeq) { ${ii} } }`,send:"mutation ($agent: String!, $conversationId: String, $text: String!, $credential: String, $attachments: [String!]) { sendAgentMessage(agent: $agent, conversationId: $conversationId, text: $text, credential: $credential, attachments: $attachments) { conversationId runId seq } }",uploadAttachment:"mutation ($agent: String!, $name: String!, $mimeType: String!, $size: Int!) { createAgentAttachmentUpload(agent: $agent, name: $name, mimeType: $mimeType, size: $size) { id uploadUrl method contentType expiresAt maxBytes } }",rate:"mutation ($conversationId: String!, $messageId: String!, $rating: String, $comment: String) { rateAgentMessage(conversationId: $conversationId, messageId: $messageId, rating: $rating, comment: $comment) }",abort:"mutation ($conversationId: String!) { abortAgentRun(conversationId: $conversationId) }",liveEvents:`subscription ($conversationId: String!) { agentEvents(conversationId: $conversationId) { ${ii} } }`,skills:`query ($projectId: String!) { projectSkills(projectId: $projectId) { ${Ft} } }`,skill:`query ($id: String!) { projectSkill(id: $id) { ${Ft} } }`,skillVersions:"query ($id: String!) { projectSkillVersions(id: $id) { id skillId name title description instructions examples projectDefault knowledge version createdAt } }",createSkill:`mutation ($projectId: String!, $skill: SkillInput!) { createProjectSkill(projectId: $projectId, skill: $skill) { ${Ft} } }`,updateSkill:`mutation ($id: String!, $skill: SkillInput!) { updateProjectSkill(id: $id, skill: $skill) { ${Ft} } }`,restoreSkill:`mutation ($id: String!, $version: Int!) { restoreProjectSkillVersion(id: $id, version: $version) { ${Ft} } }`,deleteSkill:"mutation ($id: String!) { deleteProjectSkill(id: $id) }",setAgentSkills:"mutation ($agentId: String!, $skills: [AgentSkillInput!]!, $useProjectSkills: Boolean) { setAgentSkills(agentId: $agentId, skills: $skills, useProjectSkills: $useProjectSkills) }",collections:`query ($projectId: String!) { knowledgeCollections(projectId: $projectId) { ${si} } }`,createCollection:`mutation ($projectId: String!, $collection: KnowledgeCollectionInput!) { createKnowledgeCollection(projectId: $projectId, collection: $collection) { ${si} } }`,updateCollection:"mutation ($projectId: String!, $name: String!, $collection: KnowledgeCollectionInput!) { updateKnowledgeCollection(projectId: $projectId, name: $name, collection: $collection) }",deleteCollection:"mutation ($projectId: String!, $name: String!) { deleteKnowledgeCollection(projectId: $projectId, name: $name) }",items:`query ($projectId: String!, $collection: String!) { knowledgeItems(projectId: $projectId, collection: $collection) { ${Za} } }`,addItems:"mutation ($projectId: String!, $collection: String!, $items: [KnowledgeItemInput!]!) { addKnowledgeItems(projectId: $projectId, collection: $collection, items: $items) }",syncItems:"mutation ($projectId: String!, $collection: String!, $items: [KnowledgeItemInput!]!, $prune: Boolean) { syncKnowledgeItems(projectId: $projectId, collection: $collection, items: $items, prune: $prune) { added updated removed unchanged } }",updateItem:"mutation ($projectId: String!, $id: String!, $item: KnowledgeItemInput!) { updateKnowledgeItem(projectId: $projectId, id: $id, item: $item) }",deleteItem:"mutation ($projectId: String!, $id: String!) { deleteKnowledgeItem(projectId: $projectId, id: $id) }",search:"query ($projectId: String!, $query: String!, $collections: [String!]!, $limit: Int) { searchKnowledge(projectId: $projectId, query: $query, collections: $collections, limit: $limit) { id collection title text score } }",setAgentKnowledge:"mutation ($agentId: String!, $collections: [String!]!) { setAgentKnowledge(agentId: $agentId, collections: $collections) }"};var Lr="https://api.lambforge.com",Xa=r=>`${r.replace(/\/+$/,"")}/graphql`,li=r=>`${r.replace(/\/+$/,"").replace(/^http/,"ws")}/subscriptions`;function Dt(r,e,t,n,o){return new $(i=>{let s=new AbortController,a=r.fetch??globalThis.fetch;if(!a){i.error(new R("No fetch available","network"));return}return a(Xa(r.url),{method:"POST",headers:{"content-type":"application/json",...e?{authorization:e}:{}},body:JSON.stringify({query:t,variables:n}),signal:s.signal}).then(async l=>{let c;try{c=await l.json()}catch{throw new R(`Lambforge answered ${l.status}`,l.status===401?"unauthorized":"network",l.status)}if(c.errors?.length)throw Lt(c.errors,l.status);if(!c.data||!(o in c.data))throw new R(`Lambforge answered ${l.status} without ${o}`,"network",l.status);i.next(c.data[o]),i.complete()}).catch(l=>{s.signal.aborted||i.error(l instanceof R?l:new R(String(l?.message??l),"network"))}),()=>s.abort()})}var ci=["graphql-ws","graphql-transport-ws"];function ui(r){return new $(e=>{let n=!1,o=new r.WebSocket(r.url,ci),i=()=>o.protocol==="graphql-transport-ws",s=l=>{o.readyState===1&&o.send(JSON.stringify(l))},a=l=>{if(!n){n=!0,e.error(l);try{o.close(1e3)}catch{}}};return o.onopen=()=>s({type:"connection_init",payload:r.connectionParams}),o.onmessage=l=>{let c;try{c=JSON.parse(String(l.data))}catch{return}switch(c.type){case"connection_ack":s({id:"1",type:i()?"subscribe":"start",payload:{query:r.query,variables:r.variables}}),r.onStarted?.();return;case"ping":s({type:"pong"});return;case"next":case"data":{let u=c.payload;if(u?.errors?.length){a(Lt(u.errors));return}u?.data&&e.next(u.data[r.field]);return}case"error":a(Lt(Array.isArray(c.payload)?c.payload:[c.payload]));return;case"connection_error":a(new R(String(c.payload?.message??"connection refused"),"unauthorized"));return;case"complete":if(n)return;n=!0,e.complete(),o.close(1e3);return;default:return}},o.onclose=l=>{if(n)return;let c=l?.code===4401||l?.code===4403;a(new R(`connection closed${l?.code?` (${l.code}${l.reason?` ${l.reason}`:""})`:""}`,c?"unauthorized":"network"))},o.onerror=()=>{},()=>{n||(n=!0,s({id:"1",type:i()?"complete":"stop"})),o.onmessage=o.onclose=o.onerror=o.onopen=null;try{o.close(1e3)}catch{}}})}var Ur=r=>Ce(()=>{let e=r();return Pt(e)?e.pipe(He(1)):V(Promise.resolve(e))}),Qa=6e4,pi="lambforge.agents.device",el=15e3,Ke=class{constructor(e){this.options=e;this.current=null;this.pending$=null;if([e.getToken,e.exchange,e.anonymous].filter(Boolean).length!==1)throw new R("AgentClient: give exactly one of getToken, exchange or anonymous","bad-request");if(e.anonymous&&!e.anonymous.publishableKey.startsWith("lfp_"))throw new R("AgentClient: anonymous visitors need a publishable key (lfp_...)","bad-request");this.endpoint={url:e.url??Lr,fetch:e.fetch}}token$(){return this.current&&Date.now()<this.current.renewAt?O(this.current.token):(this.pending$||(this.pending$=this.session$().pipe($e(e=>{let t=e.expiresAt?Date.parse(e.expiresAt):NaN;this.current={token:e.token,renewAt:Number.isFinite(t)?Math.max(Date.now()+3e4,t-Qa):Date.now()+50*6e4}}),P(e=>e.token),jt(()=>this.pending$=null),lt(1))),this.pending$)}invalidate(){this.current=null}credential$(){let e=this.options,t=e.credential===!1?null:e.credential??(e.exchange?e.exchange.idToken:null);return t?Ur(t).pipe(P(n=>n||void 0)):O(void 0)}session$(){let e=this.options;if(e.getToken)return Ur(e.getToken).pipe(P(n=>typeof n=="string"?{token:n}:n));if(e.exchange){let{projectId:n,idToken:o,agents:i}=e.exchange;return Ur(o).pipe(W(s=>Dt(this.endpoint,null,re.exchangeSession,{projectId:n,token:s,agents:i},"exchangeAgentSession")))}let t=e.anonymous;return Ur(t.turnstileToken).pipe(W(n=>Dt(this.endpoint,t.publishableKey,re.anonymousSession,{deviceId:t.deviceId??di(),turnstileToken:n,agents:t.agents},"createAnonymousAgentSession")))}call$(e,t,n){let o=()=>this.token$().pipe(W(i=>Dt(this.endpoint,i,e,t,n)));return o().pipe(G(i=>i?.code!=="session-expired"&&i?.code!=="unauthorized"?at(()=>i):(this.invalidate(),o())))}uploadAttachment(e,t){return Ce(()=>{let n=ri(t.data),o=t.mimeType||n.type||Mr(t.name);if(!o)throw new R(`Attachment ${t.name}: give its mimeType`,"bad-request");return this.call$(re.uploadAttachment,{agent:e,name:t.name,mimeType:o,size:n.size},"createAgentAttachmentUpload").pipe(W(i=>ni(i,n,t.name,this.options.fetch)))})}agents(){return this.call$(re.sessionAgents,{},"sessionAgents")}conversations(e){return this.call$(re.conversations,{agent:e},"agentConversations")}agent(e){return{conversation:t=>new Fr(this,e,t??null),conversations:()=>this.conversations(e)}}events(e,t=0){return new $(n=>{let o=t,i=new Map,s=new Q,a=!1,l=!1,c=()=>{for(;i.has(o+1);){let m=i.get(o+1);i.delete(o+1),o=m.seq,n.next(m)}},u=m=>{if(m){if(m.type==="delta"){n.next(m);return}m.seq<=o||(i.set(m.seq,m),c(),i.size&&p())}},p=()=>{if(a){l=!0;return}a=!0,s.add(this.call$(re.events,{conversationId:e,afterSeq:o},"agentConversationEvents").subscribe({next:m=>{m.forEach(w=>i.set(w.seq,w)),c(),i.size&&!m.length&&(o=Math.min(...i.keys())-1,c())},error:m=>{a=!1,n.error(m)},complete:()=>{a=!1,l&&(l=!1,p())}}))},f=this.webSocket();if(!f)return p(),s.add(Ir(this.options.pollIntervalMs??1500,this.options.pollIntervalMs??1500).subscribe(()=>p())),s;let d=0,g=!1,h=()=>{s.add(this.token$().pipe(W(m=>ui({url:li(this.endpoint.url),WebSocket:f,connectionParams:{agentSession:m},query:re.liveEvents,variables:{conversationId:e},field:"agentEvents",onStarted:()=>{d=0,g=!1,p()}}))).subscribe({next:u,error:m=>{if(m?.code==="unauthorized"&&!g){g=!0,this.invalidate(),h();return}if(m?.code!=="network"){n.error(m);return}let w=Math.min(el,1e3*2**d++);s.add(Ir(w*(.75+Math.random()/2)).subscribe(h))},complete:()=>n.complete()}))};return h(),s})}webSocket(){return this.options.WebSocket===!1?null:this.options.WebSocket??(globalThis.WebSocket||null)}},Fr=class{constructor(e,t,n){this.client=e;this.agent=t;this.id=n}send(e,t={}){let n=t.credential!==void 0?O(t.credential):this.client.credential$();return(t.attachments?.length?V(t.attachments).pipe(qe(i=>this.client.uploadAttachment(this.agent,i)),P(i=>i.id),On()):O([])).pipe(W(i=>n.pipe(P(s=>({credential:s,attachments:[...t.attachmentIds??[],...i]})))),W(({credential:i,attachments:s})=>this.client.call$(re.send,{agent:this.agent,conversationId:this.id,text:e,credential:i,...s.length?{attachments:s}:{}},"sendAgentMessage"))).pipe($e(i=>this.id=i.conversationId),W(i=>this.client.events(i.conversationId,Math.max(0,i.seq-2)).pipe(Mt(s=>!((s.type==="done"||s.type==="error")&&s.runId===i.runId),!0))))}events(e){return this.id?e===void 0?this.history().pipe(W(t=>this.client.events(this.id,t.lastSeq??0))):this.client.events(this.id,e):at(()=>new R("No conversation yet - send a message first","bad-request"))}history(){return this.id?this.client.call$(re.conversation,{id:this.id},"agentConversation"):at(()=>new R("No conversation yet - send a message first","bad-request"))}rate(e,t,n){return this.id?this.client.call$(re.rate,{conversationId:this.id,messageId:e,rating:t,...t==="down"&&n?{comment:n}:{}},"rateAgentMessage"):at(()=>new R("No conversation yet - send a message first","bad-request"))}abort(){return this.id?this.client.call$(re.abort,{conversationId:this.id},"abortAgentRun"):O(!1)}};function di(){let r=globalThis.localStorage;try{let t=r?.getItem(pi);if(t&&/^[A-Za-z0-9_-]{16,128}$/.test(t))return t}catch{}let e=globalThis.crypto.randomUUID().replace(/-/g,"");try{r?.setItem(pi,e)}catch{}return e}var ma=yn(Gs()),v=yn(Xt());var ae=yn(Xt()),bc=/^(https?:|mailto:)/i,po=/^\s*[-*+]\s+/,tn=/^\s*\d+[.)]\s+/,yc=/^```\s*([\w+-]*)\s*$/,Js=/^(#{1,6})\s+(.*)$/;function er(r){let e=[],t=String(r??"").replace(/\r\n?/g,`
|
|
34
34
|
`).split(`
|
|
35
|
-
`),n=0;for(;n<t.length;){let o=t[n],i=o.match(
|
|
36
|
-
`)}</code></pre>`);continue}let s=o.match(Ms);if(s){e.push(oe.html`<p><strong class="h">${Ge(s[2])}</strong></p>`),n++;continue}if(Zn.test(o)||Br.test(o)){let l=Br.test(o),c=l?Br:Zn,u=[];for(;n<t.length&&c.test(t[n]);)u.push(oe.html`<li>${Ge(t[n++].replace(c,""))}</li>`);e.push(l?oe.html`<ol>${u}</ol>`:oe.html`<ul>${u}</ul>`);continue}if(!o.trim()){n++;continue}let a=[];for(;n<t.length&&t[n].trim()&&!/^```/.test(t[n])&&!Ms.test(t[n])&&!Zn.test(t[n])&&!Br.test(t[n]);)a.push(t[n++]);e.push(oe.html`<p>${a.map((l,c)=>c?oe.html`<br />${Ge(l)}`:Ge(l))}</p>`)}return e}var Xl=/(`[^`]+`)|(\*\*[^*]+\*\*)|(__[^_]+__)|(\*[^*\s][^*]*\*)|(\[[^\]]+\]\([^)\s]+\))|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?'"])/;function Ge(r){let e=[],t=r;for(;t;){let n=t.match(Xl);if(!n||n.index===void 0){e.push(t);break}n.index&&e.push(t.slice(0,n.index));let o=n[0];if(n[1])e.push(oe.html`<code>${o.slice(1,-1)}</code>`);else if(n[2]||n[3])e.push(oe.html`<strong>${Ge(o.slice(2,-2))}</strong>`);else if(n[4])e.push(oe.html`<em>${Ge(o.slice(1,-1))}</em>`);else if(n[5]){let[,i,s]=o.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/)??[];e.push(js(i,s))}else e.push(js(o,o));t=t.slice(n.index+o.length)}return e}function js(r,e){return Jl.test(e)?oe.html`<a href=${e} target="_blank" rel="noopener noreferrer nofollow">${r}</a>`:r}var vt=function(){return vt=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o])}return r},vt.apply(this,arguments)};function J(r,e){if(typeof e=="function")return Jt(r,function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return vt(vt({},e.apply(void 0,n)),{type:r})});var t=e?e._as:"empty";switch(t){case"empty":return Jt(r,function(){return{type:r}});case"fsa":return Jt(r,function(n,o){return n instanceof Error?{error:!0,meta:o,payload:n,type:r}:{error:!1,meta:o,payload:n,type:r}});case"payload":return Jt(r,function(n){return{payload:n,type:r}});case"props":return Jt(r,function(n){return vt(vt({},n),{type:r})});default:throw new Error("Unexpected config.")}}function he(){return{_as:"payload",_p:void 0}}function Jt(r,e){return Object.defineProperty(e,"type",{value:r,writable:!1})}var Ql=function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),o=0,e=0;e<t;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n};function ee(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=r.pop(),n=r.reduce(function(o,i){return Ql(o,[i.type])},[]);return{reducer:t,types:n}}function Ls(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=new Map,o=0,i=e;o<i.length;o++)for(var s=i[o],a=0,l=s.types;a<l.length;a++){var c=l[a];n.has(c)?console.warn(c+" already specified in an 'on' call."):n.set(c,s.reducer)}return function(u,p){u===void 0&&(u=r);var d=n.get(p.type);return d?d(u,p):u}}var Kr=J("[chat] shown",he()),Yr=J("[chat] connecting"),gt=J("[chat] failed",he()),Zt=J("[chat] verifying",he()),Xt=J("[chat] agents loaded",he()),Je=J("[chat] pick agent",he()),Gr=J("[chat] history loaded",he()),yt=J("[chat] new conversation"),bt=J("[chat] send",he()),Xn=J("[chat] resume",he()),Jr=J("[chat] event",he()),Zr=J("[chat] run ended"),Ze=J("[chat] stop",he());var Qt;(function(r){r.switchMap="switchMap",r.mergeMap="mergeMap",r.concatMap="concatMap",r.exhaustMap="exhaustMap"})(Qt||(Qt={}));var Us=r=>r!==null&&typeof r=="object";var Ds=r=>r.reduce((e,t)=>(...n)=>e(t(...n))),Xe=dn(G(r=>P(r))),Xr=r=>r.pipe(Xe),Qr=r=>Et(r)?r:r instanceof Promise?V(r):P(r);function qs([r,e,t]){function n(o,i){return t.length>0?Ds(t)(e)(o,i):e(o,i)}return wn(n,r)}var Ns={switchMap:B,mergeMap:re,concatMap:Tt,exhaustMap:Er};function Fs(r={},e={},t){var n;let o=r&&r.reducer$&&r.reducer$.pipe(Xe)||P((m,b)=>m),i=new te,s=m=>Ee(r&&r.actionStream$&&r.actionStream$.pipe(Xe)||le,t).pipe(ve(Us),M(Qr),u(Xr),_e(i),m,M(Qr)),a=(r&&r.initialState$&&r.initialState$.pipe(Xe)||P({})).pipe(kt()),l=r&&r.middleware$&&r.middleware$.pipe(Xe)||P([]),c=((n=r?.destroy$)===null||n===void 0?void 0:n.pipe(Xe))||yn,u=Ns[e&&e.actionFlatOp||Qt.concatMap],p=Ns[e&&e.stateFlatOp||Qt.switchMap],d=m=>m.pipe(p(Xr),M(Qr),p(Xr)),f=e&&e.bufferSize||1,v=e&&e.windowTime;return{reducer$:o,actions$:i,actionStream$:s,initialState$:a,middleware$:l,destroy$:c,flattenState$:d,shareReplayConfig:{refCount:!1,bufferSize:f,windowTime:v}}}var Qn="@@redux-devtools/JUMP_TO_STATE";function Hs(r){if(!r)return;let e=r===!0?{}:r;return e.enabled===!1?void 0:e}function Ws(r){return(e,t)=>t?.type===Qn?t.state:r(e,t)}function zs(r,e={}){var t,n;let o=globalThis.__REDUX_DEVTOOLS_EXTENSION__;if(e.enabled===!1||!o)return()=>{};let i=o.connect(Object.assign({name:(t=e.name)!==null&&t!==void 0?t:"RxDI Store",maxAge:(n=e.maxAge)!==null&&n!==void 0?n:50},e.extensionOptions)),s=new Z,a;s.add(r.state$.subscribe(c=>{a=c})),i.init(a),s.add(r.state$.pipe($n(r.actions$),ve(([,c])=>c.type!==Qn)).subscribe(([c,u])=>i.send(u,c)));let l=i.subscribe(c=>{var u;if(c.type!=="DISPATCH")return;let p=(u=c.payload)===null||u===void 0?void 0:u.type;(p==="JUMP_TO_ACTION"||p==="JUMP_TO_STATE")&&c.state?r.dispatch({type:Qn,state:JSON.parse(c.state)}):p==="COMMIT"&&i.init(a)});return()=>{var c;s.unsubscribe(),typeof l=="function"&&l(),(c=i.unsubscribe)===null||c===void 0||c.call(i)}}var en=class{constructor(e,t){var n,o,i,s;this.config=e,this.options=t,this._dispatch$=new te,this.dispatch=m=>{this._dispatch$.next(m)};let a=Hs((n=this.config)===null||n===void 0?void 0:n.devTools);a&&(this.config=Object.assign(Object.assign({},this.config),{reducer$:((i=(o=this.config)===null||o===void 0?void 0:o.reducer$)!==null&&i!==void 0?i:P(m=>m)).pipe(M(m=>Ws(m)))}));let{reducer$:l,actions$:c,actionStream$:u,middleware$:p,initialState$:d,destroy$:f,flattenState$:v,shareReplayConfig:h}=Fs(this.config,this.options,this._dispatch$);if(this.state$=gn([d,l,p]).pipe(M(qs),Tt(u),Sn(d),v,Fe(f),nt(h)),this.state$.subscribe(),this.actions$=c.pipe(nt(h)),!((s=this.config)===null||s===void 0)&&s.epic$&&this.config.epic$(this.actions$,this.state$).pipe(Fe(f)).subscribe({next:m=>this.dispatch(m),error:m=>console.error("[Epic] Error:",m)}),a){let m=zs(this,a);f.subscribe(()=>m())}}};function eo(r={},e={}){return new en(r,e)}function Re(...r){let e=new Set(r.map(t=>t.type));return t=>t.pipe(ve(n=>e.has(n.type)))}function xt(r={dispatch:!0}){return e=>(t,n)=>{let o=e(t,n);return r.dispatch===!1?o.pipe(rt(),G(i=>(console.error("[Effect] Error:",i),P()))):o.pipe(G(i=>(console.error("[Effect] Error:",i),P())))}}function Vs(...r){return(e,t)=>Ee(...r.map(n=>n(e,t)))}var ec=r=>r?.code||"internal",to=r=>P(gt(ec(r)));function tc(r,e){let t=e.agents.length?r.filter(o=>e.agents.includes(o.id)||e.agents.includes(o.name)):r,n=t.find(o=>o.id===e.agent||o.name===e.agent)??t[0];return{agents:t,agentId:n?.id??null}}var tn=class{constructor(e){this.ctx=e;this.connect$=xt()((e,t)=>t.pipe(ve(n=>n.shown),Ne(1),B(()=>{let n=this.ctx.client;return n?Ae(P(Yr()),n.agents().pipe(Ne(1),M(o=>Xt(tc(o,this.ctx))),G(to))):P(gt("unauthorized"))})));this.select$=xt()(e=>Ee(e.pipe(Re(Xt),M(({payload:t})=>t.agentId)),e.pipe(Re(Je),M(({payload:t})=>t))).pipe(ve(t=>!!t),B(t=>{let n=this.ctx.client;return n.conversations(t).pipe(Ne(1),B(o=>{let i=o?.[0];return i?n.agent(t).conversation(i.id).history().pipe(re(s=>V([Gr({agentId:t,detail:s}),...s.answering?[Xn({agentId:t,conversationId:s.id,afterSeq:s.lastSeq??0})]:[]]))):le}),G(to))})));this.run$=xt()(e=>Ee(e.pipe(Re(bt),M(({payload:t})=>{let{agentId:n,conversationId:o,text:i}=t,s=this.conversation(n,o);return{c:s,events:s.send(i)}})),e.pipe(Re(Xn),M(({payload:t})=>{let{agentId:n,conversationId:o,afterSeq:i}=t,s=this.conversation(n,o);return{c:s,events:s.events(i)}}))).pipe(B(({c:t,events:n})=>this.follow$(t,n).pipe(Fe(e.pipe(Re(Ze,Je,yt))),xn(Zr())))));this.abort$=xt()(e=>e.pipe(Re(Ze),re(({payload:t})=>{let{agentId:n,conversationId:o}=t;return!o||!this.ctx.client?le:this.conversation(n,o).abort().pipe(rt(),G(()=>le))})));this.failures$=xt()(e=>e.pipe(Re(gt),_e(({payload:t})=>this.ctx.emit("error",{code:t})),rt()))}conversation(e,t){return this.ctx.client.agent(e).conversation(t??void 0)}follow$(e,t){let n=new Set;return t.pipe(It(o=>o.type!=="done"&&o.type!=="error",!0),_e(o=>{o.type==="message"&&o.data?.role==="assistant"&&!n.has(o.data.id)&&(n.add(o.data.id),this.ctx.emit("answer",{text:o.data.text,agent:e.agent,conversationId:o.conversationId})),o.type==="error"&&this.ctx.emit("error",{code:o.data?.code??"internal"})}),M(o=>Jr(o)),G(to))}};var rn={shown:!1,agents:[],agentId:null,conversationId:null,messages:[],answering:!1,live:null,notice:null};function ro(r){let e=(r.toolCalls??[]).map(t=>t?.name).filter(t=>!!t);return{id:r.id,role:r.role,text:r.text??"",tools:Array.from(new Set(e))}}var rc=/^local:/,Bs={conversationId:null,messages:[],answering:!1,live:null,notice:null},Ks=Ls(rn,ee(Kr,(r,{payload:e})=>r.shown||!e?r:{...r,shown:!0}),ee(Yr,r=>({...r,notice:{kind:"busy",what:"connecting"}})),ee(gt,(r,{payload:e})=>({...r,answering:!1,live:null,notice:{kind:"error",code:e}})),ee(Zt,(r,{payload:e})=>({...r,notice:e?{kind:"busy",what:"verifying"}:r.notice?.kind==="busy"&&r.notice.what==="verifying"?null:r.notice})),ee(Xt,(r,{payload:e})=>({...r,agents:e.agents,agentId:e.agentId,notice:e.agentId?null:{kind:"error",code:"agent-unavailable"}})),ee(Je,(r,{payload:e})=>({...r,...Bs,agentId:e})),ee(Gr,(r,{payload:e})=>e.agentId!==r.agentId?r:{...r,conversationId:e.detail.id,messages:(e.detail.messages??[]).map(ro),answering:!!e.detail.answering,live:null,notice:e.detail.answering?{kind:"busy",what:"thinking"}:null}),ee(yt,r=>({...r,...Bs})),ee(bt,(r,{payload:e})=>({...r,messages:[...r.messages,{id:`local:${r.messages.length}`,role:"user",text:e.text,tools:[]}],answering:!0,notice:{kind:"busy",what:"thinking"}})),ee(Jr,(r,{payload:e})=>nc(r,e)),ee(Zr,r=>({...r,answering:!1,live:null,notice:r.notice?.kind==="busy"?null:r.notice})),ee(Ze,r=>({...r,answering:!1,live:null,notice:{kind:"info",what:"stopped"}})));function nc(r,e){let t=r.conversationId??e.conversationId;if(e.conversationId!==t)return r;if(e.type==="error")return{...r,conversationId:t,live:null,notice:{kind:"error",code:e.data?.code??"internal"}};if(e.type==="delta")return oc({...r,conversationId:t},e);if(e.type!=="message"||!e.data?.id)return{...r,conversationId:t};let n=ro(e.data);if(r.messages.some(a=>a.id===n.id))return{...r,conversationId:t};let o=[...r.messages],i=n.role==="user"?o.findIndex(a=>rc.test(a.id)&&a.text===n.text):-1;i>=0?o[i]=n:o.push(n);let s=n.role==="assistant"?null:r.live;return{...r,conversationId:t,messages:o,live:s}}function oc(r,e){if(!r.answering||!e.runId)return r;let t=Number(e.data?.segment)||0,n=typeof e.data?.text=="string"?e.data.text:"",o=r.live?.runId===e.runId?r.live:null;return o&&t<o.segment||o&&t===o.segment&&n.length<o.text.length?r:{...r,live:{runId:e.runId,segment:t,text:n}}}var nn=class{constructor(e,t={}){this.destroy$=new te;let n=new tn(e);this.store=eo({reducer$:P(Ks),initialState$:P({...rn,...t}),epic$:Vs(n.select$,n.run$,n.abort$,n.failures$,n.connect$),destroy$:this.destroy$}),this.state$=this.store.state$.pipe(bn())}dispatch(e){this.store.dispatch(e)}destroy(){this.destroy$.next(),this.destroy$.complete()}};var Ys={title:"Chat",open:"Open chat",close:"Close chat",newChat:"New conversation",placeholder:"Type a message",send:"Send",stop:"Stop",thinking:"Thinking",connecting:"Connecting",pickAgent:"Assistant",usedTools:"Used",verifying:"Checking that you are human",errors:{"limit-reached":"This conversation is full - start a new one.","cap-reached":"The assistant is not available right now - try again later.","agent-unavailable":"This assistant is not available.","session-expired":"Your session ended - reload the page.","credential-expired":"Please sign in again.",aborted:"Stopped.",internal:"Something went wrong - try again.",unauthorized:"This chat is not allowed here.","bad-request":"That did not work - try again.",network:"No connection - try again.",default:"Something went wrong - try again."}},ic={title:"\u0427\u0430\u0442",open:"\u041E\u0442\u0432\u043E\u0440\u0438 \u0447\u0430\u0442\u0430",close:"\u0417\u0430\u0442\u0432\u043E\u0440\u0438 \u0447\u0430\u0442\u0430",newChat:"\u041D\u043E\u0432 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440",placeholder:"\u041D\u0430\u043F\u0438\u0448\u0435\u0442\u0435 \u0441\u044A\u043E\u0431\u0449\u0435\u043D\u0438\u0435",send:"\u0418\u0437\u043F\u0440\u0430\u0442\u0438",stop:"\u0421\u043F\u0440\u0438",thinking:"\u041C\u0438\u0441\u043B\u044F",connecting:"\u0421\u0432\u044A\u0440\u0437\u0432\u0430\u043D\u0435",pickAgent:"\u0410\u0441\u0438\u0441\u0442\u0435\u043D\u0442",usedTools:"\u0418\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u043D\u043E",verifying:"\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430, \u0447\u0435 \u0441\u0442\u0435 \u0447\u043E\u0432\u0435\u043A",errors:{"limit-reached":"\u0420\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u044A\u0442 \u0435 \u043F\u044A\u043B\u0435\u043D - \u0437\u0430\u043F\u043E\u0447\u043D\u0435\u0442\u0435 \u043D\u043E\u0432.","cap-reached":"\u0410\u0441\u0438\u0441\u0442\u0435\u043D\u0442\u044A\u0442 \u043D\u0435 \u0435 \u0434\u043E\u0441\u0442\u044A\u043F\u0435\u043D \u0432 \u043C\u043E\u043C\u0435\u043D\u0442\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043F\u043E-\u043A\u044A\u0441\u043D\u043E.","agent-unavailable":"\u0422\u043E\u0437\u0438 \u0430\u0441\u0438\u0441\u0442\u0435\u043D\u0442 \u043D\u0435 \u0435 \u0434\u043E\u0441\u0442\u044A\u043F\u0435\u043D.","session-expired":"\u0421\u0435\u0441\u0438\u044F\u0442\u0430 \u0438\u0437\u0442\u0435\u0447\u0435 - \u043F\u0440\u0435\u0437\u0430\u0440\u0435\u0434\u0435\u0442\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430\u0442\u0430.","credential-expired":"\u041C\u043E\u043B\u044F, \u0432\u043B\u0435\u0437\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",aborted:"\u0421\u043F\u0440\u044F\u043D\u043E.",internal:"\u041D\u0435\u0449\u043E \u0441\u0435 \u043E\u0431\u044A\u0440\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",unauthorized:"\u0422\u043E\u0437\u0438 \u0447\u0430\u0442 \u043D\u0435 \u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D \u0442\u0443\u043A.","bad-request":"\u041D\u0435 \u0441\u0435 \u043F\u043E\u043B\u0443\u0447\u0438 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",network:"\u041D\u044F\u043C\u0430 \u0432\u0440\u044A\u0437\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",default:"\u041D\u0435\u0449\u043E \u0441\u0435 \u043E\u0431\u044A\u0440\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E."}},Gs={en:Ys,bg:ic};function no(r,e={}){let t=String(r||"en").toLowerCase().split("-")[0],n=Gs[t]??Ys;return{...n,...e,errors:{...n.errors,...e.errors??{}}}}var Js=`
|
|
35
|
+
`),n=0;for(;n<t.length;){let o=t[n],i=o.match(yc);if(i){let l=[];for(n++;n<t.length&&!/^```\s*$/.test(t[n]);)l.push(t[n++]);n++,e.push(ae.html`<pre><code data-lang=${i[1]||""}>${l.join(`
|
|
36
|
+
`)}</code></pre>`);continue}let s=o.match(Js);if(s){e.push(ae.html`<p><strong class="h">${Xe(s[2])}</strong></p>`),n++;continue}if(po.test(o)||tn.test(o)){let l=tn.test(o),c=l?tn:po,u=[];for(;n<t.length&&c.test(t[n]);)u.push(ae.html`<li>${Xe(t[n++].replace(c,""))}</li>`);e.push(l?ae.html`<ol>${u}</ol>`:ae.html`<ul>${u}</ul>`);continue}if(!o.trim()){n++;continue}let a=[];for(;n<t.length&&t[n].trim()&&!/^```/.test(t[n])&&!Js.test(t[n])&&!po.test(t[n])&&!tn.test(t[n]);)a.push(t[n++]);e.push(ae.html`<p>${a.map((l,c)=>c?ae.html`<br />${Xe(l)}`:Xe(l))}</p>`)}return e}var xc=/(`[^`]+`)|(\*\*[^*]+\*\*)|(__[^_]+__)|(\*[^*\s][^*]*\*)|(\[[^\]]+\]\([^)\s]+\))|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?'"])/;function Xe(r){let e=[],t=r;for(;t;){let n=t.match(xc);if(!n||n.index===void 0){e.push(t);break}n.index&&e.push(t.slice(0,n.index));let o=n[0];if(n[1])e.push(ae.html`<code>${o.slice(1,-1)}</code>`);else if(n[2]||n[3])e.push(ae.html`<strong>${Xe(o.slice(2,-2))}</strong>`);else if(n[4])e.push(ae.html`<em>${Xe(o.slice(1,-1))}</em>`);else if(n[5]){let[,i,s]=o.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/)??[];e.push(Zs(i,s))}else e.push(Zs(o,o));t=t.slice(n.index+o.length)}return e}function Zs(r,e){return bc.test(e)?ae.html`<a href=${e} target="_blank" rel="noopener noreferrer nofollow">${r}</a>`:r}var $t=function(){return $t=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o])}return r},$t.apply(this,arguments)};function N(r,e){if(typeof e=="function")return tr(r,function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return $t($t({},e.apply(void 0,n)),{type:r})});var t=e?e._as:"empty";switch(t){case"empty":return tr(r,function(){return{type:r}});case"fsa":return tr(r,function(n,o){return n instanceof Error?{error:!0,meta:o,payload:n,type:r}:{error:!1,meta:o,payload:n,type:r}});case"payload":return tr(r,function(n){return{payload:n,type:r}});case"props":return tr(r,function(n){return $t($t({},n),{type:r})});default:throw new Error("Unexpected config.")}}function J(){return{_as:"payload",_p:void 0}}function tr(r,e){return Object.defineProperty(e,"type",{value:r,writable:!1})}var wc=function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),o=0,e=0;e<t;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n};function B(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=r.pop(),n=r.reduce(function(o,i){return wc(o,[i.type])},[]);return{reducer:t,types:n}}function Xs(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=new Map,o=0,i=e;o<i.length;o++)for(var s=i[o],a=0,l=s.types;a<l.length;a++){var c=l[a];n.has(c)?console.warn(c+" already specified in an 'on' call."):n.set(c,s.reducer)}return function(u,p){u===void 0&&(u=r);var f=n.get(p.type);return f?f(u,p):u}}var rn=N("[chat] shown",J()),nn=N("[chat] connecting"),_t=N("[chat] failed",J()),rr=N("[chat] verifying",J()),nr=N("[chat] agents loaded",J()),Qe=N("[chat] pick agent",J()),on=N("[chat] history loaded",J()),St=N("[chat] new conversation"),At=N("[chat] send",J()),sn=N("[chat] add files",J()),an=N("[chat] remove file",J()),fo=N("[chat] resume",J()),ln=N("[chat] event",J()),cn=N("[chat] run ended"),et=N("[chat] stop",J()),Et=N("[chat] rate",J()),un=N("[chat] rate failed",J()),Ct=N("[chat] close comment");var or;(function(r){r.switchMap="switchMap",r.mergeMap="mergeMap",r.concatMap="concatMap",r.exhaustMap="exhaustMap"})(or||(or={}));var Qs=r=>r!==null&&typeof r=="object";var ea=r=>r.reduce((e,t)=>(...n)=>e(t(...n))),tt=An(G(r=>O(r))),pn=r=>r.pipe(tt),dn=r=>Pt(r)?r:r instanceof Promise?V(r):O(r);function ta([r,e,t]){function n(o,i){return t.length>0?ea(t)(e)(o,i):e(o,i)}return Rn(n,r)}var ra={switchMap:W,mergeMap:te,concatMap:qe,exhaustMap:Pr};function na(r={},e={},t){var n;let o=r&&r.reducer$&&r.reducer$.pipe(tt)||O((m,w)=>m),i=new oe,s=m=>ke(r&&r.actionStream$&&r.actionStream$.pipe(tt)||ie,t).pipe(ge(Qs),P(dn),u(pn),$e(i),m,P(dn)),a=(r&&r.initialState$&&r.initialState$.pipe(tt)||O({})).pipe(Rt()),l=r&&r.middleware$&&r.middleware$.pipe(tt)||O([]),c=((n=r?.destroy$)===null||n===void 0?void 0:n.pipe(tt))||In,u=ra[e&&e.actionFlatOp||or.concatMap],p=ra[e&&e.stateFlatOp||or.switchMap],f=m=>m.pipe(p(pn),P(dn),p(pn)),d=e&&e.bufferSize||1,g=e&&e.windowTime;return{reducer$:o,actions$:i,actionStream$:s,initialState$:a,middleware$:l,destroy$:c,flattenState$:f,shareReplayConfig:{refCount:!1,bufferSize:d,windowTime:g}}}var ho="@@redux-devtools/JUMP_TO_STATE";function oa(r){if(!r)return;let e=r===!0?{}:r;return e.enabled===!1?void 0:e}function ia(r){return(e,t)=>t?.type===ho?t.state:r(e,t)}function sa(r,e={}){var t,n;let o=globalThis.__REDUX_DEVTOOLS_EXTENSION__;if(e.enabled===!1||!o)return()=>{};let i=o.connect(Object.assign({name:(t=e.name)!==null&&t!==void 0?t:"RxDI Store",maxAge:(n=e.maxAge)!==null&&n!==void 0?n:50},e.extensionOptions)),s=new Q,a;s.add(r.state$.subscribe(c=>{a=c})),i.init(a),s.add(r.state$.pipe(Un(r.actions$),ge(([,c])=>c.type!==ho)).subscribe(([c,u])=>i.send(u,c)));let l=i.subscribe(c=>{var u;if(c.type!=="DISPATCH")return;let p=(u=c.payload)===null||u===void 0?void 0:u.type;(p==="JUMP_TO_ACTION"||p==="JUMP_TO_STATE")&&c.state?r.dispatch({type:ho,state:JSON.parse(c.state)}):p==="COMMIT"&&i.init(a)});return()=>{var c;s.unsubscribe(),typeof l=="function"&&l(),(c=i.unsubscribe)===null||c===void 0||c.call(i)}}var fn=class{constructor(e,t){var n,o,i,s;this.config=e,this.options=t,this._dispatch$=new oe,this.dispatch=m=>{this._dispatch$.next(m)};let a=oa((n=this.config)===null||n===void 0?void 0:n.devTools);a&&(this.config=Object.assign(Object.assign({},this.config),{reducer$:((i=(o=this.config)===null||o===void 0?void 0:o.reducer$)!==null&&i!==void 0?i:O(m=>m)).pipe(P(m=>ia(m)))}));let{reducer$:l,actions$:c,actionStream$:u,middleware$:p,initialState$:f,destroy$:d,flattenState$:g,shareReplayConfig:h}=na(this.config,this.options,this._dispatch$);if(this.state$=Tn([f,l,p]).pipe(P(ta),qe(u),Ln(f),g,We(d),lt(h)),this.state$.subscribe(),this.actions$=c.pipe(lt(h)),!((s=this.config)===null||s===void 0)&&s.epic$&&this.config.epic$(this.actions$,this.state$).pipe(We(d)).subscribe({next:m=>this.dispatch(m),error:m=>console.error("[Epic] Error:",m)}),a){let m=sa(this,a);d.subscribe(()=>m())}}};function mo(r={},e={}){return new fn(r,e)}function Ae(...r){let e=new Set(r.map(t=>t.type));return t=>t.pipe(ge(n=>e.has(n.type)))}function rt(r={dispatch:!0}){return e=>(t,n)=>{let o=e(t,n);return r.dispatch===!1?o.pipe(ze(),G(i=>(console.error("[Effect] Error:",i),O()))):o.pipe(G(i=>(console.error("[Effect] Error:",i),O())))}}function aa(...r){return(e,t)=>ke(...r.map(n=>n(e,t)))}var $c=r=>r?.code||"internal",go=r=>O(_t($c(r)));function _c(r,e){let t=e.agents.length?r.filter(o=>e.agents.includes(o.id)||e.agents.includes(o.name)):r,n=t.find(o=>o.id===e.agent||o.name===e.agent)??t[0];return{agents:t,agentId:n?.id??null}}var hn=class{constructor(e){this.ctx=e;this.connect$=rt()((e,t)=>t.pipe(ge(n=>n.shown),He(1),W(()=>{let n=this.ctx.client;return n?Ee(O(nn()),n.agents().pipe(He(1),P(o=>nr(_c(o,this.ctx))),G(go))):O(_t("unauthorized"))})));this.select$=rt()(e=>ke(e.pipe(Ae(nr),P(({payload:t})=>t.agentId)),e.pipe(Ae(Qe),P(({payload:t})=>t))).pipe(ge(t=>!!t),W(t=>{let n=this.ctx.client;return n.conversations(t).pipe(He(1),W(o=>{let i=o?.[0];return i?n.agent(t).conversation(i.id).history().pipe(te(s=>V([on({agentId:t,detail:s}),...s.answering?[fo({agentId:t,conversationId:s.id,afterSeq:s.lastSeq??0})]:[]]))):ie}),G(go))})));this.run$=rt()(e=>ke(e.pipe(Ae(At),P(({payload:t})=>{let{agentId:n,conversationId:o,text:i,files:s}=t,a=this.conversation(n,o),l=(s??[]).map(c=>({name:c.name,mimeType:c.type||void 0,data:c}));return{c:a,events:l.length?a.send(i,{attachments:l}):a.send(i)}})),e.pipe(Ae(fo),P(({payload:t})=>{let{agentId:n,conversationId:o,afterSeq:i}=t,s=this.conversation(n,o);return{c:s,events:s.events(i)}}))).pipe(W(({c:t,events:n})=>this.follow$(t,n).pipe(We(e.pipe(Ae(et,Qe,St))),jn(cn())))));this.abort$=rt()(e=>e.pipe(Ae(et),te(({payload:t})=>{let{agentId:n,conversationId:o}=t;return!o||!this.ctx.client?ie:this.conversation(n,o).abort().pipe(ze(),G(()=>ie))})));this.rate$=rt()(e=>e.pipe(Ae(Et),te(({payload:t})=>{let{agentId:n,conversationId:o,messageId:i,rating:s,comment:a,previous:l}=t;return this.ctx.client?this.conversation(n,o).rate(i,s,a).pipe(ze(),G(()=>O(un({messageId:i,previous:l})))):ie})));this.failures$=rt()(e=>e.pipe(Ae(_t),$e(({payload:t})=>this.ctx.emit("error",{code:t})),ze()))}conversation(e,t){return this.ctx.client.agent(e).conversation(t??void 0)}follow$(e,t){let n=new Set;return t.pipe(Mt(o=>o.type!=="done"&&o.type!=="error",!0),$e(o=>{o.type==="message"&&o.data?.role==="assistant"&&!n.has(o.data.id)&&(n.add(o.data.id),this.ctx.emit("answer",{text:o.data.text,agent:e.agent,conversationId:o.conversationId})),o.type==="error"&&this.ctx.emit("error",{code:o.data?.code??"internal"})}),P(o=>ln(o)),G(go))}};var mn={shown:!1,agents:[],agentId:null,conversationId:null,messages:[],answering:!1,live:null,notice:null,files:[],commentFor:null};function vo(r){let e=(r.toolCalls??[]).map(t=>t?.name).filter(t=>!!t);return{id:r.id,role:r.role,text:r.text??"",tools:Array.from(new Set(e)),attachments:(r.attachments??[]).map(t=>t.name),feedback:r.feedback?.rating??null}}var Sc=/^local:/,la={conversationId:null,messages:[],answering:!1,live:null,notice:null,files:[],commentFor:null},ca=Xs(mn,B(rn,(r,{payload:e})=>r.shown||!e?r:{...r,shown:!0}),B(nn,r=>({...r,notice:{kind:"busy",what:"connecting"}})),B(_t,(r,{payload:e})=>({...r,answering:!1,live:null,notice:{kind:"error",code:e}})),B(rr,(r,{payload:e})=>({...r,notice:e?{kind:"busy",what:"verifying"}:r.notice?.kind==="busy"&&r.notice.what==="verifying"?null:r.notice})),B(nr,(r,{payload:e})=>({...r,agents:e.agents,agentId:e.agentId,notice:e.agentId?null:{kind:"error",code:"agent-unavailable"}})),B(Qe,(r,{payload:e})=>({...r,...la,agentId:e})),B(on,(r,{payload:e})=>e.agentId!==r.agentId?r:{...r,conversationId:e.detail.id,messages:(e.detail.messages??[]).map(vo),answering:!!e.detail.answering,live:null,notice:e.detail.answering?{kind:"busy",what:"thinking"}:null}),B(St,r=>({...r,...la})),B(At,(r,{payload:e})=>({...r,messages:[...r.messages,{id:`local:${r.messages.length}`,role:"user",text:e.text,tools:[],attachments:(e.files??[]).map(t=>t.name),feedback:null}],files:[],answering:!0,notice:{kind:"busy",what:"thinking"}})),B(sn,(r,{payload:e})=>{if(!r.agents.find(i=>i.id===r.agentId)?.allowAttachments)return{...r,notice:{kind:"error",code:"attachments-off"}};let n=[...r.files,...e],o=Fn(n);return o?{...r,notice:{kind:"error",code:o}}:{...r,files:n,notice:r.notice?.kind==="error"?null:r.notice}}),B(an,(r,{payload:e})=>({...r,files:r.files.filter((t,n)=>n!==e),notice:r.notice?.kind==="error"?null:r.notice})),B(ln,(r,{payload:e})=>Ac(r,e)),B(cn,r=>({...r,answering:!1,live:null,notice:r.notice?.kind==="busy"?null:r.notice})),B(Et,(r,{payload:e})=>({...r,messages:r.messages.map(t=>t.id===e.messageId?{...t,feedback:e.rating}:t),commentFor:e.rating==="down"&&e.comment===void 0&&e.previous!=="down"?e.messageId:null})),B(un,(r,{payload:e})=>({...r,messages:r.messages.map(t=>t.id===e.messageId?{...t,feedback:e.previous}:t),commentFor:r.commentFor===e.messageId?null:r.commentFor})),B(Ct,r=>({...r,commentFor:null})),B(et,r=>({...r,answering:!1,live:null,notice:{kind:"info",what:"stopped"}})));function Ac(r,e){let t=r.conversationId??e.conversationId;if(e.conversationId!==t)return r;if(e.type==="error")return{...r,conversationId:t,live:null,notice:{kind:"error",code:e.data?.code??"internal"}};if(e.type==="delta")return Ec({...r,conversationId:t},e);if(e.type!=="message"||!e.data?.id)return{...r,conversationId:t};let n=vo(e.data);if(r.messages.some(a=>a.id===n.id))return{...r,conversationId:t};let o=[...r.messages],i=n.role==="user"?o.findIndex(a=>Sc.test(a.id)&&a.text===n.text):-1;i>=0?o[i]=n:o.push(n);let s=n.role==="assistant"?null:r.live;return{...r,conversationId:t,messages:o,live:s}}function Ec(r,e){if(!r.answering||!e.runId)return r;let t=Number(e.data?.segment)||0,n=typeof e.data?.text=="string"?e.data.text:"",o=r.live?.runId===e.runId?r.live:null;return o&&t<o.segment||o&&t===o.segment&&n.length<o.text.length?r:{...r,live:{runId:e.runId,segment:t,text:n}}}var gn=class{constructor(e,t={}){this.destroy$=new oe;let n=new hn(e);this.store=mo({reducer$:O(ca),initialState$:O({...mn,...t}),epic$:aa(n.select$,n.run$,n.abort$,n.rate$,n.failures$,n.connect$),destroy$:this.destroy$}),this.state$=this.store.state$.pipe(Pn())}dispatch(e){this.store.dispatch(e)}destroy(){this.destroy$.next(),this.destroy$.complete()}};var ua={title:"Chat",open:"Open chat",close:"Close chat",newChat:"New conversation",placeholder:"Type a message",send:"Send",stop:"Stop",thinking:"Thinking",connecting:"Connecting",pickAgent:"Assistant",usedTools:"Used",verifying:"Checking that you are human",attach:"Attach files",attached:"Attached files",removeFile:"Remove",filesOnly:"Please look at the attached files.",helpful:"Helpful",notHelpful:"Not helpful",whatWentWrong:"What was wrong? (optional)",sendFeedback:"Send",skipFeedback:"Skip",thanks:"Thanks for the feedback",errors:{"limit-reached":"This conversation is full - start a new one.","cap-reached":"The assistant is not available right now - try again later.","agent-unavailable":"This assistant is not available.","session-expired":"Your session ended - reload the page.","credential-expired":"Please sign in again.",aborted:"Stopped.",internal:"Something went wrong - try again.",unauthorized:"This chat is not allowed here.","bad-request":"That did not work - try again.",network:"No connection - try again.","attachments-off":"This assistant does not take files.","attachments-unsupported":"This assistant cannot read that kind of file.","attachment-invalid":"Only images, PDF and text files can be attached.","attachment-too-large":"That file is too large (images 5 MB, PDF 10 MB, text 1 MB).","attachment-limit":"At most 5 files and 15 MB in one message.","attachment-missing":"A file was lost - attach it again.","attachment-not-uploaded":"A file did not finish uploading - attach it again.",default:"Something went wrong - try again."}},Cc={title:"\u0427\u0430\u0442",open:"\u041E\u0442\u0432\u043E\u0440\u0438 \u0447\u0430\u0442\u0430",close:"\u0417\u0430\u0442\u0432\u043E\u0440\u0438 \u0447\u0430\u0442\u0430",newChat:"\u041D\u043E\u0432 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440",placeholder:"\u041D\u0430\u043F\u0438\u0448\u0435\u0442\u0435 \u0441\u044A\u043E\u0431\u0449\u0435\u043D\u0438\u0435",send:"\u0418\u0437\u043F\u0440\u0430\u0442\u0438",stop:"\u0421\u043F\u0440\u0438",thinking:"\u041C\u0438\u0441\u043B\u044F",connecting:"\u0421\u0432\u044A\u0440\u0437\u0432\u0430\u043D\u0435",pickAgent:"\u0410\u0441\u0438\u0441\u0442\u0435\u043D\u0442",usedTools:"\u0418\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u043D\u043E",verifying:"\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430, \u0447\u0435 \u0441\u0442\u0435 \u0447\u043E\u0432\u0435\u043A",attach:"\u041F\u0440\u0438\u043A\u0430\u0447\u0438 \u0444\u0430\u0439\u043B\u043E\u0432\u0435",attached:"\u041F\u0440\u0438\u043A\u0430\u0447\u0435\u043D\u0438 \u0444\u0430\u0439\u043B\u043E\u0432\u0435",removeFile:"\u041F\u0440\u0435\u043C\u0430\u0445\u043D\u0438",filesOnly:"\u041C\u043E\u043B\u044F, \u0440\u0430\u0437\u0433\u043B\u0435\u0434\u0430\u0439\u0442\u0435 \u043F\u0440\u0438\u043A\u0430\u0447\u0435\u043D\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u043E\u0432\u0435.",helpful:"\u041F\u043E\u043B\u0435\u0437\u043D\u043E",notHelpful:"\u041D\u0435 \u0435 \u043F\u043E\u043B\u0435\u0437\u043D\u043E",whatWentWrong:"\u041A\u0430\u043A\u0432\u043E \u043D\u0435 \u0431\u0435\u0448\u0435 \u043D\u0430\u0440\u0435\u0434? (\u043F\u043E \u0436\u0435\u043B\u0430\u043D\u0438\u0435)",sendFeedback:"\u0418\u0437\u043F\u0440\u0430\u0442\u0438",skipFeedback:"\u041F\u0440\u043E\u043F\u0443\u0441\u043D\u0438",thanks:"\u0411\u043B\u0430\u0433\u043E\u0434\u0430\u0440\u0438\u043C \u0437\u0430 \u043E\u0442\u0437\u0438\u0432\u0430",errors:{"limit-reached":"\u0420\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u044A\u0442 \u0435 \u043F\u044A\u043B\u0435\u043D - \u0437\u0430\u043F\u043E\u0447\u043D\u0435\u0442\u0435 \u043D\u043E\u0432.","cap-reached":"\u0410\u0441\u0438\u0441\u0442\u0435\u043D\u0442\u044A\u0442 \u043D\u0435 \u0435 \u0434\u043E\u0441\u0442\u044A\u043F\u0435\u043D \u0432 \u043C\u043E\u043C\u0435\u043D\u0442\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043F\u043E-\u043A\u044A\u0441\u043D\u043E.","agent-unavailable":"\u0422\u043E\u0437\u0438 \u0430\u0441\u0438\u0441\u0442\u0435\u043D\u0442 \u043D\u0435 \u0435 \u0434\u043E\u0441\u0442\u044A\u043F\u0435\u043D.","session-expired":"\u0421\u0435\u0441\u0438\u044F\u0442\u0430 \u0438\u0437\u0442\u0435\u0447\u0435 - \u043F\u0440\u0435\u0437\u0430\u0440\u0435\u0434\u0435\u0442\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430\u0442\u0430.","credential-expired":"\u041C\u043E\u043B\u044F, \u0432\u043B\u0435\u0437\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",aborted:"\u0421\u043F\u0440\u044F\u043D\u043E.",internal:"\u041D\u0435\u0449\u043E \u0441\u0435 \u043E\u0431\u044A\u0440\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",unauthorized:"\u0422\u043E\u0437\u0438 \u0447\u0430\u0442 \u043D\u0435 \u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D \u0442\u0443\u043A.","bad-request":"\u041D\u0435 \u0441\u0435 \u043F\u043E\u043B\u0443\u0447\u0438 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",network:"\u041D\u044F\u043C\u0430 \u0432\u0440\u044A\u0437\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.","attachments-off":"\u0422\u043E\u0437\u0438 \u0430\u0441\u0438\u0441\u0442\u0435\u043D\u0442 \u043D\u0435 \u043F\u0440\u0438\u0435\u043C\u0430 \u0444\u0430\u0439\u043B\u043E\u0432\u0435.","attachments-unsupported":"\u0422\u043E\u0437\u0438 \u0430\u0441\u0438\u0441\u0442\u0435\u043D\u0442 \u043D\u0435 \u043C\u043E\u0436\u0435 \u0434\u0430 \u0447\u0435\u0442\u0435 \u0442\u0430\u043A\u044A\u0432 \u0444\u0430\u0439\u043B.","attachment-invalid":"\u041C\u043E\u0436\u0435 \u0434\u0430 \u043F\u0440\u0438\u043A\u0430\u0447\u0438\u0442\u0435 \u0441\u0430\u043C\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F, PDF \u0438 \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u0438 \u0444\u0430\u0439\u043B\u043E\u0432\u0435.","attachment-too-large":"\u0424\u0430\u0439\u043B\u044A\u0442 \u0435 \u0442\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C (\u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F 5 MB, PDF 10 MB, \u0442\u0435\u043A\u0441\u0442 1 MB).","attachment-limit":"\u041D\u0430\u0439-\u043C\u043D\u043E\u0433\u043E 5 \u0444\u0430\u0439\u043B\u0430 \u0438 15 MB \u0432 \u0435\u0434\u043D\u043E \u0441\u044A\u043E\u0431\u0449\u0435\u043D\u0438\u0435.","attachment-missing":"\u0424\u0430\u0439\u043B \u0441\u0435 \u0438\u0437\u0433\u0443\u0431\u0438 - \u043F\u0440\u0438\u043A\u0430\u0447\u0435\u0442\u0435 \u0433\u043E \u043E\u0442\u043D\u043E\u0432\u043E.","attachment-not-uploaded":"\u0424\u0430\u0439\u043B \u043D\u0435 \u0441\u0435 \u043A\u0430\u0447\u0438 \u0434\u043E\u043A\u0440\u0430\u0439 - \u043F\u0440\u0438\u043A\u0430\u0447\u0435\u0442\u0435 \u0433\u043E \u043E\u0442\u043D\u043E\u0432\u043E.",default:"\u041D\u0435\u0449\u043E \u0441\u0435 \u043E\u0431\u044A\u0440\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E."}},pa={en:ua,bg:Cc};function bo(r,e={}){let t=String(r||"en").toLowerCase().split("-")[0],n=pa[t]??ua;return{...n,...e,errors:{...n.errors,...e.errors??{}}}}var da=`
|
|
37
37
|
:host {
|
|
38
38
|
--_accent: var(--lf-chat-accent, #4f46e5);
|
|
39
39
|
--_accent-fg: var(--lf-chat-accent-fg, #ffffff);
|
|
@@ -163,6 +163,26 @@ header select {
|
|
|
163
163
|
@keyframes lf-caret { 50% { opacity: 0; } }
|
|
164
164
|
@media (prefers-reduced-motion: reduce) { .msg.live > :last-child::after { animation: none; } }
|
|
165
165
|
.tools { font-size: 12px; color: var(--_muted); margin-top: 4px; }
|
|
166
|
+
.rate { display: flex; align-items: center; gap: 2px; margin-top: -6px; }
|
|
167
|
+
.thumb {
|
|
168
|
+
border: 0; background: transparent; color: var(--_muted);
|
|
169
|
+
width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; cursor: pointer;
|
|
170
|
+
}
|
|
171
|
+
.thumb svg { width: 14px; height: 14px; }
|
|
172
|
+
.thumb:hover, .thumb:focus-visible { background: var(--_bot-bg); color: var(--_fg); }
|
|
173
|
+
.thumb.on { color: var(--_accent); }
|
|
174
|
+
.thanks { font-size: 12px; color: var(--_muted); margin-left: 4px; }
|
|
175
|
+
.comment { display: flex; gap: 6px; align-items: center; max-width: 85%; }
|
|
176
|
+
.comment input {
|
|
177
|
+
flex: 1; min-width: 0; font: inherit; font-size: 13px; color: var(--_fg); background: var(--_bg);
|
|
178
|
+
border: 1px solid var(--_border); border-radius: 8px; padding: 6px 8px;
|
|
179
|
+
}
|
|
180
|
+
.comment button {
|
|
181
|
+
border: 1px solid var(--_border); background: transparent; color: var(--_fg);
|
|
182
|
+
border-radius: 8px; padding: 5px 9px; font-size: 13px; cursor: pointer;
|
|
183
|
+
}
|
|
184
|
+
.comment button[type='submit'] { border-color: var(--_accent); color: var(--_accent); }
|
|
185
|
+
.comment .skip { color: var(--_muted); }
|
|
166
186
|
|
|
167
187
|
.welcome { color: var(--_muted); }
|
|
168
188
|
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
@@ -206,8 +226,28 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
|
|
|
206
226
|
padding: 0 14px; height: 40px; font-weight: 600;
|
|
207
227
|
}
|
|
208
228
|
.send:disabled { opacity: 0.5; cursor: default; }
|
|
229
|
+
.attach { flex: none; height: 40px; }
|
|
230
|
+
.attach:disabled { opacity: 0.5; cursor: default; }
|
|
231
|
+
.files {
|
|
232
|
+
list-style: none; margin: 0; padding: 8px 12px 0; display: flex; flex-wrap: wrap; gap: 6px;
|
|
233
|
+
border-top: 1px solid var(--_border);
|
|
234
|
+
}
|
|
235
|
+
.file {
|
|
236
|
+
display: inline-flex; align-items: center; gap: 2px; max-width: 100%;
|
|
237
|
+
border: 1px solid var(--_border); border-radius: 999px; padding: 2px 2px 2px 10px; font-size: 13px;
|
|
238
|
+
}
|
|
239
|
+
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
|
|
240
|
+
.file-remove {
|
|
241
|
+
border: 0; background: transparent; color: var(--_muted); width: 22px; height: 22px;
|
|
242
|
+
border-radius: 999px; display: grid; place-items: center; padding: 0;
|
|
243
|
+
}
|
|
244
|
+
.file-remove:hover, .file-remove:focus-visible { background: var(--_bot-bg); color: var(--_fg); }
|
|
245
|
+
.file-remove svg { width: 14px; height: 14px; }
|
|
246
|
+
.files + form { border-top: 0; }
|
|
247
|
+
.msg-files { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
|
|
248
|
+
.msg-file { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,0.2); }
|
|
209
249
|
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
210
|
-
`;var
|
|
250
|
+
`;var fa="https://lambforge.com/agent-turnstile.html",kc="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit";var vn=null;function Tc(r){let e=r.defaultView;return e?.turnstile?Promise.resolve(e.turnstile):(vn||(vn=new Promise((t,n)=>{let o=r.createElement("script");o.src=kc,o.async=!0,o.onload=()=>e.turnstile?t(e.turnstile):n(new Error("turnstile did not load")),o.onerror=()=>{vn=null,n(new Error("turnstile did not load"))},r.head.append(o)})),vn)}function yo(r){let e=r.host.ownerDocument;if(r.sitekey)return Tc(e).then(o=>new Promise((i,s)=>{let a=e.createElement("div");r.host.append(a);let l,c=()=>{try{l&&o.remove(l)}catch{}a.remove()};l=o.render(a,{sitekey:r.sitekey,appearance:"interaction-only",callback:u=>{c(),i(u)},"error-callback":()=>{c(),s(new Error("turnstile failed"))}})}));let t=new URL(r.hostedUrl||fa),n=e.defaultView;return t.searchParams.set("origin",n.location.origin),new Promise((o,i)=>{let s=e.createElement("iframe");s.title="Bot check",s.src=t.href;let a=setTimeout(()=>c(new Error("turnstile timed out")),12e4),l=u=>{if(u.origin!==t.origin||u.source!==s.contentWindow)return;let p=u.data;p?.type==="lambforge-turnstile"&&(p.token?c(null,p.token):c(new Error(p.error||"turnstile failed")))},c=(u,p)=>{clearTimeout(a),n.removeEventListener("message",l),s.remove(),u?i(u):o(p)};n.addEventListener("message",l),r.host.append(s)})}var ir="lambforge-agent-chat",Ic=v.svg`<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>`,ha=v.svg`<path d="M18 6 6 18M6 6l12 12"/>`,Oc=v.svg`<path d="M12 5v14M5 12h14"/>`,Pc=v.svg`<path d="M7 10v12M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"/>`,jc=v.svg`<path d="M17 14V2M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"/>`,Rc=v.svg`<path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/>`,Mc=[...Rr,".md",".csv",".yaml",".yml",".json",".txt"].join(","),nt=r=>v.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${r}</svg>`,F=class extends v.LitElement{constructor(){super(...arguments);this.open=!1;this.mode="drawer";this.position="bottom-right";this.theme="light";this.agent="";this.agents="";this.locale="";this.heading="";this.url="";this.publishableKey="";this.tokenUrl="";this.turnstileSitekey="";this.turnstileUrl="";this.strings={};this.lastSize=""}get shown(){return this.mode!=="drawer"||this.open}get t(){return bo(this.locale||this.ownerDocument.documentElement.lang||"en",this.strings)}connect(){return Ce(()=>{let t=new gn({client:this.resolveClient(),agent:this.agent,agents:this.agents.split(",").map(n=>n.trim()).filter(Boolean),emit:(n,o)=>this.emit(n,o)},{shown:this.shown});return this.store=t,t.state$.pipe(jt(()=>{t.destroy(),this.store===t&&(this.store=void 0)}))})}dispatch(t){this.store?.dispatch(t)}OnUpdate(){this.shown&&this.dispatch(rn(!0))}resolveClient(){if(this.client)return this.client;let t=this.url||void 0;if(this.getToken){let n=this.getToken;this.client=new Ke({url:t,getToken:()=>n()})}else if(this.tokenUrl){let n=this.tokenUrl;this.client=new Ke({url:t,getToken:()=>fetch(n,{credentials:"include",headers:{accept:"application/json"}}).then(o=>{if(!o.ok)throw new Error(`token-url answered ${o.status}`);return o.json()})})}else if(this.publishableKey)this.client=new Ke({url:t,anonymous:{publishableKey:this.publishableKey,turnstileToken:()=>this.verifyHuman()}});else return console.error(`[${ir}] give it a session: token-url, publishable-key, .getToken or .client`),null;return this.client}verifyHuman(){return this.dispatch(rr(!0)),this.turnstileBox().then(t=>yo({host:t,sitekey:this.turnstileSitekey||null,hostedUrl:this.turnstileUrl||null})).finally(()=>this.dispatch(rr(!1)))}async turnstileBox(){for(let t=0;t<100;t++){let n=this.shadowRoot?.querySelector(".turnstile");if(n)return n;await new Promise(o=>setTimeout(o,20))}throw new Error("turnstile: the chat is not rendered")}send(t){return([n])=>{let o=n.files,i=String(t??"").trim()||(o.length?this.t.filesOnly:"");!i||n.answering||!n.agentId||this.dispatch(At({agentId:n.agentId,conversationId:n.conversationId,text:i,...o.length?{files:o}:{}}))}}attach(t){let n=Array.from(t??[]);n.length&&this.dispatch(sn(n))}detach(t){this.dispatch(an(t))}onPaste(t,n){let o=Array.from(t.clipboardData?.files??[]);!n||!o.length||(t.preventDefault(),this.attach(o))}stopAnswer(){return([t])=>{t.agentId&&this.dispatch(et({agentId:t.agentId,conversationId:t.conversationId}))}}pick(t){this.dispatch(Qe(t))}startOver(){this.dispatch(St()),this.focusInput()}setOpen(t){t!==this.open&&(this.open=t,this.emit("open-change",{open:t}),t?this.focusInput():this.shadowRoot?.querySelector(".launcher")?.focus())}focusInput(){this.updateComplete.then(()=>requestAnimationFrame(()=>this.shadowRoot?.querySelector("textarea")?.focus()))}submit(t,n){if(t.preventDefault(),n.answering)return this.stopAnswer()([n]);let o=this.shadowRoot?.querySelector("textarea");o&&(this.send(o.value)([n]),o.value="",this.autosize(o))}onInputKey(t,n){t.key==="Enter"&&!t.shiftKey&&!t.isComposing&&(t.preventDefault(),n.answering||this.submit(t,n))}autosize(t){t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,140)}px`}onPanelKey(t){if(t.key==="Escape"&&this.mode==="drawer"){t.stopPropagation(),this.setOpen(!1);return}if(t.key!=="Tab"||this.mode==="inline")return;let n=this.shadowRoot?.querySelector(".panel"),o=Array.from(n?.querySelectorAll("button:not([disabled]), select, textarea, a[href]")??[]).filter(l=>!l.closest("[hidden]"));if(!o.length)return;let i=o[0],s=o[o.length-1],a=this.shadowRoot?.activeElement;t.shiftKey&&a===i?(t.preventDefault(),s.focus()):!t.shiftKey&&a===s&&(t.preventDefault(),i.focus())}emit(t,n){this.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0}))}noticeText(t){if(!t)return"";let n=this.t;return t.kind==="busy"?n[t.what]:t.kind==="info"?n.errors.aborted:n.errors[t.code]??n.errors.default}view(t){let n=this.t,o=this.mode==="drawer",i=t.agents.find(p=>p.id===t.agentId)??null,s=this.heading||i?.name||n.title,a=!!i?.allowAttachments,l=t.live?.text?t.live:null,c=l&&t.notice?.kind==="busy"?null:t.notice,u=`${t.messages.length}:${l?.text.length??0}`;if(u!==this.lastSize){let p=u.split(":")[0]!==this.lastSize.split(":")[0];this.lastSize=u,(p||this.atBottom())&&this.updateComplete.then(()=>requestAnimationFrame(()=>this.scrollDown()))}return v.html`
|
|
211
251
|
<button
|
|
212
252
|
class="launcher"
|
|
213
253
|
part="launcher"
|
|
@@ -218,7 +258,7 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
|
|
|
218
258
|
?hidden=${!o}
|
|
219
259
|
@click=${()=>this.setOpen(!this.open)}
|
|
220
260
|
>
|
|
221
|
-
<slot name="launcher">${
|
|
261
|
+
<slot name="launcher">${nt(Ic)}</slot>
|
|
222
262
|
</button>
|
|
223
263
|
<section
|
|
224
264
|
class="panel"
|
|
@@ -227,7 +267,7 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
|
|
|
227
267
|
aria-label=${s}
|
|
228
268
|
aria-modal=${String(o)}
|
|
229
269
|
?hidden=${!this.shown}
|
|
230
|
-
@keydown=${
|
|
270
|
+
@keydown=${p=>this.onPanelKey(p)}
|
|
231
271
|
>
|
|
232
272
|
<header part="header">
|
|
233
273
|
<span class="title">${s}</span>
|
|
@@ -236,15 +276,15 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
|
|
|
236
276
|
part="picker"
|
|
237
277
|
aria-label=${n.pickAgent}
|
|
238
278
|
?hidden=${t.agents.length<2}
|
|
239
|
-
@change=${
|
|
279
|
+
@change=${p=>this.pick(p.target.value)}
|
|
240
280
|
>
|
|
241
|
-
${t.agents.map(
|
|
281
|
+
${t.agents.map(p=>v.html`<option value=${p.id} ?selected=${p.id===t.agentId}>${p.name}</option>`)}
|
|
242
282
|
</select>
|
|
243
283
|
<button class="icon new" part="new" type="button" title=${n.newChat} aria-label=${n.newChat} @click=${()=>this.startOver()}>
|
|
244
|
-
${
|
|
284
|
+
${nt(Oc)}
|
|
245
285
|
</button>
|
|
246
286
|
<button class="icon close" part="close" type="button" title=${n.close} aria-label=${n.close} @click=${()=>this.setOpen(!1)}>
|
|
247
|
-
${
|
|
287
|
+
${nt(ha)}
|
|
248
288
|
</button>
|
|
249
289
|
</header>
|
|
250
290
|
<div
|
|
@@ -253,39 +293,84 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
|
|
|
253
293
|
role="log"
|
|
254
294
|
aria-live="polite"
|
|
255
295
|
aria-relevant="additions"
|
|
256
|
-
aria-busy=${String(!!
|
|
296
|
+
aria-busy=${String(!!l)}
|
|
257
297
|
>
|
|
258
|
-
${t.messages.length?t.messages.map(
|
|
259
|
-
${
|
|
298
|
+
${t.messages.length?t.messages.map(p=>this.bubble(p,t)):this.intro(t)}
|
|
299
|
+
${l?v.html`<div class="msg assistant live" part="message assistant live">${er(l.text)}</div>`:""}
|
|
260
300
|
</div>
|
|
261
|
-
<div class="turnstile" ?hidden=${
|
|
301
|
+
<div class="turnstile" ?hidden=${c?.kind!=="busy"||c.what!=="verifying"}></div>
|
|
262
302
|
<div
|
|
263
|
-
class="status ${
|
|
303
|
+
class="status ${c?.kind==="error"?"error":""} ${c?.kind==="busy"?"dots":""}"
|
|
264
304
|
part="status"
|
|
265
305
|
role="status"
|
|
266
|
-
>${this.noticeText(
|
|
267
|
-
|
|
306
|
+
>${this.noticeText(c)}</div>
|
|
307
|
+
${a&&t.files.length?v.html`<ul class="files" part="files" aria-label=${n.attached}>
|
|
308
|
+
${t.files.map((p,f)=>v.html`<li class="file" part="file">
|
|
309
|
+
<span class="file-name" title=${p.name}>${p.name}</span>
|
|
310
|
+
<button type="button" class="file-remove" aria-label=${`${n.removeFile}: ${p.name}`} @click=${()=>this.detach(f)}>
|
|
311
|
+
${nt(ha)}
|
|
312
|
+
</button>
|
|
313
|
+
</li>`)}
|
|
314
|
+
</ul>`:""}
|
|
315
|
+
<form part="composer" @submit=${p=>this.submit(p,t)}>
|
|
316
|
+
${a?v.html`<input
|
|
317
|
+
class="file-input"
|
|
318
|
+
type="file"
|
|
319
|
+
multiple
|
|
320
|
+
accept=${Mc}
|
|
321
|
+
hidden
|
|
322
|
+
@change=${p=>{let f=p.target;this.attach(f.files),f.value=""}}
|
|
323
|
+
/>
|
|
324
|
+
<button
|
|
325
|
+
class="icon attach"
|
|
326
|
+
part="attach"
|
|
327
|
+
type="button"
|
|
328
|
+
title=${n.attach}
|
|
329
|
+
aria-label=${n.attach}
|
|
330
|
+
?disabled=${t.answering}
|
|
331
|
+
@click=${()=>this.shadowRoot?.querySelector(".file-input")?.click()}
|
|
332
|
+
>
|
|
333
|
+
${nt(Rc)}
|
|
334
|
+
</button>`:""}
|
|
268
335
|
<label class="sr-only" for="lf-input">${n.placeholder}</label>
|
|
269
336
|
<textarea
|
|
270
337
|
id="lf-input"
|
|
271
338
|
part="input"
|
|
272
339
|
rows="1"
|
|
273
340
|
placeholder=${n.placeholder}
|
|
274
|
-
@keydown=${
|
|
275
|
-
@input=${
|
|
341
|
+
@keydown=${p=>this.onInputKey(p,t)}
|
|
342
|
+
@input=${p=>this.autosize(p.target)}
|
|
343
|
+
@paste=${p=>this.onPaste(p,a&&!t.answering)}
|
|
276
344
|
></textarea>
|
|
277
345
|
<button class="send" part="send" type="submit" aria-label=${t.answering?n.stop:n.send}>
|
|
278
346
|
${t.answering?n.stop:n.send}
|
|
279
347
|
</button>
|
|
280
348
|
</form>
|
|
281
349
|
</section>
|
|
282
|
-
`}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
350
|
+
`}rateAnswer(t,n,o){return([i])=>{if(!i.agentId||!i.conversationId)return;let s=o===void 0&&t.feedback===n?null:n;this.dispatch(Et({agentId:i.agentId,conversationId:i.conversationId,messageId:t.id,rating:s,...o!==void 0?{comment:o}:{},previous:t.feedback}))}}sendComment(t,n,o){t.preventDefault();let s=t.target.querySelector("input")?.value.trim()??"";if(!s){this.dispatch(Ct());return}this.rateAnswer(n,"down",s)([o])}feedback(t,n){if(n.agents.find(s=>s.id===n.agentId)?.allowFeedback===!1||t.id.startsWith("local:")||!n.conversationId)return"";let i=this.t;return v.html`
|
|
351
|
+
<div class="rate" part="rate">
|
|
352
|
+
<button type="button" class="thumb ${t.feedback==="up"?"on":""}" part="thumb-up"
|
|
353
|
+
title=${i.helpful} aria-label=${i.helpful} aria-pressed=${t.feedback==="up"?"true":"false"}
|
|
354
|
+
@click=${()=>this.rateAnswer(t,"up")([n])}>${nt(Pc)}</button>
|
|
355
|
+
<button type="button" class="thumb ${t.feedback==="down"?"on":""}" part="thumb-down"
|
|
356
|
+
title=${i.notHelpful} aria-label=${i.notHelpful} aria-pressed=${t.feedback==="down"?"true":"false"}
|
|
357
|
+
@click=${()=>this.rateAnswer(t,"down")([n])}>${nt(jc)}</button>
|
|
358
|
+
${t.feedback&&n.commentFor!==t.id?v.html`<span class="thanks" aria-live="polite">${i.thanks}</span>`:""}
|
|
359
|
+
</div>
|
|
360
|
+
${n.commentFor===t.id?v.html`<form class="comment" part="feedback-comment" @submit=${s=>this.sendComment(s,t,n)}>
|
|
361
|
+
<input type="text" maxlength="1000" placeholder=${i.whatWentWrong} aria-label=${i.whatWentWrong}
|
|
362
|
+
@keydown=${s=>s.key==="Escape"&&this.dispatch(Ct())} />
|
|
363
|
+
<button type="submit">${i.sendFeedback}</button>
|
|
364
|
+
<button type="button" class="skip" @click=${()=>this.dispatch(Ct())}>${i.skipFeedback}</button>
|
|
365
|
+
</form>`:""}
|
|
366
|
+
`}bubble(t,n){return t.role==="user"?v.html`<div class="msg user" part="message user">${t.text}${t.attachments?.length?v.html`<div class="msg-files">${t.attachments.map(o=>v.html`<span class="msg-file">${o}</span>`)}</div>`:""}</div>`:v.html`<div class="msg assistant" part="message assistant">
|
|
367
|
+
${er(t.text)}
|
|
368
|
+
${t.tools.length?v.html`<div class="tools">${this.t.usedTools}: ${t.tools.join(", ")}</div>`:""}
|
|
369
|
+
</div>
|
|
370
|
+
${this.feedback(t,n)}`}intro(t){let n=t.agents.find(o=>o.id===t.agentId);return!n?.welcome&&!n?.suggestions?.length?"":v.html`
|
|
371
|
+
${n.welcome?v.html`<div class="msg assistant welcome">${er(n.welcome)}</div>`:""}
|
|
372
|
+
${n.suggestions?.length?v.html`<div class="suggestions">
|
|
373
|
+
${n.suggestions.map(o=>v.html`<button type="button" part="suggestion" @click=${()=>this.send(o)([t])}>${o}</button>`)}
|
|
289
374
|
</div>`:""}
|
|
290
|
-
`}atBottom(){let t=this.shadowRoot?.querySelector(".messages");return!t||t.scrollHeight-t.scrollTop-t.clientHeight<80}scrollDown(){let t=this.shadowRoot?.querySelector(".messages");t&&(t.scrollTop=t.scrollHeight)}};
|
|
375
|
+
`}atBottom(){let t=this.shadowRoot?.querySelector(".messages");return!t||t.scrollHeight-t.scrollTop-t.clientHeight<80}scrollDown(){let t=this.shadowRoot?.querySelector(".messages");t&&(t.scrollTop=t.scrollHeight)}};q([(0,v.property)({type:Boolean,reflect:!0})],F.prototype,"open",2),q([(0,v.property)({reflect:!0})],F.prototype,"mode",2),q([(0,v.property)({reflect:!0})],F.prototype,"position",2),q([(0,v.property)({reflect:!0})],F.prototype,"theme",2),q([(0,v.property)()],F.prototype,"agent",2),q([(0,v.property)()],F.prototype,"agents",2),q([(0,v.property)()],F.prototype,"locale",2),q([(0,v.property)({attribute:"title"})],F.prototype,"heading",2),q([(0,v.property)()],F.prototype,"url",2),q([(0,v.property)({attribute:"publishable-key"})],F.prototype,"publishableKey",2),q([(0,v.property)({attribute:"token-url"})],F.prototype,"tokenUrl",2),q([(0,v.property)({attribute:"turnstile-sitekey"})],F.prototype,"turnstileSitekey",2),q([(0,v.property)({attribute:"turnstile-url"})],F.prototype,"turnstileUrl",2),q([(0,v.property)({attribute:!1})],F.prototype,"client",2),q([(0,v.property)({attribute:!1})],F.prototype,"getToken",2),q([(0,v.property)({attribute:!1})],F.prototype,"strings",2),F=q([(0,ma.Component)({Settings:{selector:ir,styles:[(0,v.unsafeCSS)(da)]},Loading:()=>v.html``,Error:()=>v.html``,State(){return this.connect()},Render:()=>function(r){return this.view(r)}})],F);var bn=document.currentScript,Lc={key:"publishable-key",tokenUrl:"token-url",agent:"agent",agents:"agents",url:"url",mode:"mode",position:"position",locale:"locale",title:"title",theme:"theme",open:"open",turnstileSitekey:"turnstile-sitekey",turnstileUrl:"turnstile-url"};if(bn&&(bn.dataset.key||bn.dataset.tokenUrl)){let r=()=>{let e=document.createElement(ir);for(let[t,n]of Object.entries(Lc)){let o=bn.dataset[t];o!==void 0&&e.setAttribute(n,o)}document.body.append(e)};document.body?r():document.addEventListener("DOMContentLoaded",r,{once:!0})}})();
|
|
291
376
|
//# sourceMappingURL=agent-chat.js.map
|