@lambforge/agent-chat 0.0.5 → 0.0.7
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 +9 -0
- package/dist/agent-chat.js +94 -35
- package/dist/agent-chat.js.map +4 -4
- package/dist/index.cjs +212 -24
- package/dist/index.cjs.map +4 -4
- package/dist/index.mjs +209 -21
- package/dist/index.mjs.map +4 -4
- package/package.json +3 -3
- package/types/index.d.ts +11 -0
package/dist/agent-chat.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(()=>{var
|
|
1
|
+
(()=>{var pa=Object.create;var At=Object.defineProperty;var yo=Object.getOwnPropertyDescriptor;var fa=Object.getOwnPropertyNames;var da=Object.getPrototypeOf,ha=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}},j=(r,e)=>{for(var t in e)At(r,t,{get:e[t],enumerable:!0})},bo=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of fa(e))!ha.call(r,o)&&o!==t&&At(r,o,{get:()=>e[o],enumerable:!(n=yo(e,o))||n.enumerable});return r};var mn=(r,e,t)=>(t=r!=null?pa(da(r)):{},bo(e||!r||!r.__esModule?At(t,"default",{value:r,enumerable:!0}):t,r)),C=r=>bo(At({},"__esModule",{value:!0}),r),F=(r,e,t,n)=>{for(var o=n>1?void 0:n?yo(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&&At(e,t,o),o};var zr={};j(zr,{_$LH:()=>pt,html:()=>bi,noChange:()=>S,nothing:()=>E,render:()=>Te,svg:()=>xi});function Ve(r,e,t=r,n){var o,i,s,a;if(e===S)return e;let l=n!==void 0?(o=t._$Co)===null||o===void 0?void 0:o[n]:t._$Cl,c=Dt(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 Ln,Lr,lt,li,$e,Un,Ga,ct,Ut,Dt,mi,vi,Lt,ci,ui,Be,pi,fi,gi,yi,bi,xi,S,E,di,at,wi,Nt,Ur,ut,Ke,Dr,Ja,Nr,Fr,qr,pt,hi,Te,U=x(()=>{Lr=window,lt=Lr.trustedTypes,li=lt?lt.createPolicy("lit-html",{createHTML:r=>r}):void 0,$e=`lit$${(Math.random()+"").slice(9)}$`,Un="?"+$e,Ga=`<${Un}>`,ct=document,Ut=(r="")=>ct.createComment(r),Dt=r=>r===null||typeof r!="object"&&typeof r!="function",mi=Array.isArray,vi=r=>mi(r)||typeof r?.[Symbol.iterator]=="function",Lt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ci=/-->/g,ui=/>/g,Be=RegExp(`>|[
|
|
2
2
|
\f\r](?:([^\\s"'>=/]+)([
|
|
3
3
|
\f\r]*=[
|
|
4
4
|
\f\r]*(?:[^
|
|
5
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
5
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),pi=/'/g,fi=/"/g,gi=/^(?:script|style|textarea|title)$/i,yi=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),bi=yi(1),xi=yi(2),S=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),di=new WeakMap,at=ct.createTreeWalker(ct,129,null,!1),wi=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":"",s=Lt;for(let l=0;l<t;l++){let c=r[l],u,p,d=-1,f=0;for(;f<c.length&&(s.lastIndex=f,p=s.exec(c),p!==null);)f=s.lastIndex,s===Lt?p[1]==="!--"?s=ci:p[1]!==void 0?s=ui:p[2]!==void 0?(gi.test(p[2])&&(o=RegExp("</"+p[2],"g")),s=Be):p[3]!==void 0&&(s=Be):s===Be?p[0]===">"?(s=o??Lt,d=-1):p[1]===void 0?d=-2:(d=s.lastIndex-p[2].length,u=p[1],s=p[3]===void 0?Be:p[3]==='"'?fi:pi):s===fi||s===pi?s=Be:s===ci||s===ui?s=Lt:(s=Be,o=void 0);let v=s===Be&&r[l+1].startsWith("/>")?" ":"";i+=s===Lt?c+Ga:d>=0?(n.push(u),c.slice(0,d)+"$lit$"+c.slice(d)+$e+v):c+$e+(d===-2?(n.push(void 0),l):v)}let a=i+(r[t]||"<?>")+(e===2?"</svg>":"");if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return[li!==void 0?li.createHTML(a):a,n]},Nt=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]=wi(e,t);if(this.el=r.createElement(c,n),at.currentNode=this.el.content,t===2){let p=this.el.content,d=p.firstChild;d.remove(),p.append(...d.childNodes)}for(;(o=at.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes()){let p=[];for(let d of o.getAttributeNames())if(d.endsWith("$lit$")||d.startsWith($e)){let f=u[s++];if(p.push(d),f!==void 0){let v=o.getAttribute(f.toLowerCase()+"$lit$").split($e),h=/([.?@])?(.*)/.exec(f);l.push({type:1,index:i,name:h[2],strings:v,ctor:h[1]==="."?Dr:h[1]==="?"?Nr:h[1]==="@"?Fr:Ke})}else l.push({type:6,index:i})}for(let d of p)o.removeAttribute(d)}if(gi.test(o.tagName)){let p=o.textContent.split($e),d=p.length-1;if(d>0){o.textContent=lt?lt.emptyScript:"";for(let f=0;f<d;f++)o.append(p[f],Ut()),at.nextNode(),l.push({type:2,index:++i});o.append(p[d],Ut())}}}else if(o.nodeType===8)if(o.data===Un)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=ct.createElement("template");return n.innerHTML=e,n}};Ur=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:ct).importNode(n,!0);at.currentNode=i;let s=at.nextNode(),a=0,l=0,c=o[0];for(;c!==void 0;){if(a===c.index){let u;c.type===2?u=new ut(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new qr(s,this,e)),this.u.push(u),c=o[++l]}a!==c?.index&&(s=at.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++}},ut=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),Dt(e)?e===E||e==null||e===""?(this._$AH!==E&&this._$AR(),this._$AH=E):e!==this._$AH&&e!==S&&this.g(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):vi(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&&Dt(this._$AH)?this._$AA.nextSibling.data=e:this.T(ct.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=Nt.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 Ur(i,this),a=s.v(this.options);s.p(n),this.T(a),this._$AH=s}}_$AC(e){let t=di.get(e.strings);return t===void 0&&di.set(e.strings,t=new Nt(e)),t}k(e){mi(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(Ut()),this.O(Ut()),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))}},Ke=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=!Dt(e)||e!==this._$AH&&e!==S,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===S&&(c=this._$AH[l]),s||(s=!Dt(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??"")}},Dr=class extends Ke{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===E?void 0:e}},Ja=lt?lt.emptyScript:"",Nr=class extends Ke{constructor(){super(...arguments),this.type=4}j(e){e&&e!==E?this.element.setAttribute(this.name,Ja):this.element.removeAttribute(this.name)}},Fr=class extends Ke{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)===S)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)}},qr=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)}},pt={P:"$lit$",A:$e,M:Un,C:1,L:wi,R:Ur,D:vi,V:Ve,I:ut,H:Ke,N:Nr,U:Fr,B:Dr,F:qr},hi=Lr.litHtmlPolyfillSupport;hi?.(Nt,ut),((Ln=Lr.litHtmlVersions)!==null&&Ln!==void 0?Ln:Lr.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 ut(e.insertBefore(Ut(),a),a,void 0,t??{})}return s._$AI(r),s}});var $i=xe(ft=>{"use strict";var Za=ft&&ft.__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(ft,"__esModule",{value:!0});ft.Component=void 0;var _i=(U(),C(zr)),Xa=(r,e,t)=>(window.customElements.define(r,e,t),e),Qa=(r,e,t)=>{let{kind:n,elements:o}=e;return{kind:n,elements:o,finisher(i){window.customElements.define(r,i,t)}}},el=r=>typeof r=="function",tl=(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(){},d=t.prototype.firstUpdated||function(){};e.template||(e.template=t.prototype.render||(()=>(0,_i.html)``)),e.style&&e.styles.push(e.style);let f=(o=class extends t{static is(){return r}getTemplateResult(){return this}OnInit(){if(e.container&&((0,_i.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),el(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(){d.call(this),l.call(this)}},Za(o,"ModifiedClass"),o.styles=e.styles,o),v=window.customElements.get(r);return v?(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,8 +12,8 @@ Possible Solutions:
|
|
|
12
12
|
|
|
13
13
|
** If this is Server Side Rendering you can ignore this message **
|
|
14
14
|
------------------------------------------
|
|
15
|
-
`),v):(typeof f=="function"?
|
|
16
|
-
`),tr.content.appendChild(rr)),e.add(er),t.delete(er),window.ShadyCSS.prepareTemplateStyles(tr,er),ao&&window.ShadyCSS.nativeShadow&&(rr=tr.content.querySelector("style"))!==null&&tr.content.appendChild(rr)})(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=l.get(h);m===void 0&&l.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 Dr,zt,Rn,Ei,ft,Mn,Ci,qr,Vt,jn=y(()=>{Dr=window,zt=Dr.ShadowRoot&&(Dr.ShadyCSS===void 0||Dr.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)},qr=(r,e)=>{zt?r.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((t=>{let n=document.createElement("style"),o=Dr.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,Nr,Ti,sl,Oi,Fr,Dn,Un,pe,Hr=y(()=>{jn();jn();Nr=window,Ti=Nr.trustedTypes,sl=Ti?Ti.emptyScript:"",Oi=Nr.reactiveElementPolyfillSupport,Fr={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:Fr,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 qr(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:Fr).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),l=typeof s.converter=="function"?{fromAttribute:s.converter}:((n=s.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?s.converter:Fr;this._$El=i,this[i]=l.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=Nr.reactiveElementVersions)!==null&&Ln!==void 0?Ln:Nr.reactiveElementVersions=[]).push("1.5.0")});var qn,Nn,Pi,ke,ki,Ii,Ri=y(()=>{Hr();Hr();L();L();Pi=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});Ii={_$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,Pe=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(l){r(l,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(()=>{Pe();});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(()=>{Pe();});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(()=>{Pe();});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(()=>{Pe();});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),l=s!=null?vl(s,r):[];return t?l.filter((a=>a.matches(t))):l},enumerable:!0,configurable:!0})})}var Wn,vl,Vn=y(()=>{Pe();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,l;let a="slot"+(o?`[name=${o}]`:":not([name])"),c=(s=this.renderRoot)===null||s===void 0?void 0:s.querySelector(a);return(l=c?.assignedNodes(n))!==null&&l!==void 0?l:[]},enumerable:!0,configurable:!0})})}var Ni=y(()=>{Pe();Vn();});var Fi={};R(Fi,{CSSResult:()=>ft,LitElement:()=>ke,ReactiveElement:()=>pe,UpdatingElement:()=>Pi,_$LE:()=>Ii,_$LH:()=>lt,adoptStyles:()=>qr,css:()=>Ci,customElement:()=>cl,decorateProperty:()=>Q,defaultConverter:()=>Fr,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(()=>{Hr();L();Ri();Pe();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 l=>{for(;s.get();)await s.get();let a=i.deref();if(a!==void 0){if(a._$CJ!==t)return!1;n!==void 0&&(l=n(l,o)),a.commitValue(l,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 l of r)o[s]=n?n(l,s):s,i[s]=t(l,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:l}=this.ht(e,t,n);if(!Array.isArray(i))return this.ut=l,s;let a=(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(a[d]===l[v])c[v]=ue(i[d],s[v]),d++,v++;else if(a[f]===l[h])c[h]=ue(i[f],s[h]),f--,h--;else if(a[d]===l[h])c[h]=ue(i[d],s[h]),ne(r,c[h+1],i[d]),d++,h--;else if(a[f]===l[v])c[v]=ue(i[f],s[v]),ne(r,i[d],i[f]),f--,v++;else if(u===void 0&&(u=is(l,v,h),p=is(a,d,f)),u.has(a[d]))if(u.has(a[f])){let m=p.get(l[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=l,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:()=>Ie,unsafeHTML:()=>Pl});var Ie,Pl,Jn=y(()=>{L();q();Ie=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:[]}}};Ie.directiveName="unsafeHTML",Ie.resultType=1;Pl=T(Ie)});var ds={};R(ds,{unsafeSVG:()=>Il});var Bt,Il,hs=y(()=>{q();Jn();Bt=class extends Ie{};Bt.directiveName="unsafeSVG",Bt.resultType=2;Il=T(Bt)});var vs={};R(vs,{UntilDirective:()=>Wr,until:()=>Rl});var ms,Wr,Rl,gs=y(()=>{L();ye();pt();Bn();q();ms=r=>!qt(r)&&typeof r.then=="function",Wr=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 l=0;l<t.length&&!(l>this._$Cwt);l++){let a=t[l];if(!ms(a))return this._$Cwt=l,a;l<o&&a===n[l]||(this._$Cwt=1073741823,o=0,Promise.resolve(a).then((async c=>{for(;s.get();)await s.get();let u=i.deref();if(u!==void 0){let p=u._$Cyt.indexOf(a);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(Wr)});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(jr)),$);k((q(),C(Tn)),$);k((In(),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 l=r.length-1;l>=0;l--)(s=r[l])&&(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},zr=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 l(u){try{c(n.next(u))}catch(p){s(p)}}function a(u){try{c(n.throw(u))}catch(p){s(p)}}function c(u){u.done?i(u.value):o(u.value).then(l,a)}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}),zr("design:type",Object)],Ke.prototype,"options",void 0);Yt([(0,W.property)({type:Boolean}),zr("design:type",Object)],Ke.prototype,"loading",void 0);Yt([(0,W.property)({type:Object}),zr("design:type",Error)],Ke.prototype,"error",void 0);Yt([(0,W.property)(),zr("design:type",Object)],Ke.prototype,"state",void 0);fe.Renderer=Ke=Yt([Hl({selector:"r-renderer",template(){return(0,W.html)`
|
|
15
|
+
`),v):(typeof f=="function"?Xa(r,f,{extends:e.extends}):Qa(r,f,{extends:e.extends}),f)},rl=r=>tl(r.selector,r);ft.Component=rl});var Si=xe(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0})});var Ci=xe(Oe=>{"use strict";var nl=Oe&&Oe.__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]})),Ei=Oe&&Oe.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&nl(e,r,t)};Object.defineProperty(Oe,"__esModule",{value:!0});Ei($i(),Oe);Ei(Si(),Oe)});var Dn={};j(Dn,{Directive:()=>L,PartType:()=>O,directive:()=>T});var O,T,L,N=x(()=>{O={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},T=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 Oi={};j(Oi,{TemplateResultType:()=>il,clearPart:()=>zt,getCommittedValue:()=>dt,getDirectiveClass:()=>al,insertPart:()=>ie,isDirectiveResult:()=>sl,isPrimitive:()=>Ft,isSingleExpression:()=>Ye,isTemplateResult:()=>ke,removePart:()=>qt,setChildPartValue:()=>pe,setCommittedValue:()=>ge});var ol,Ft,il,ke,sl,al,Ye,Ti,ie,pe,ll,ge,dt,qt,zt,ye=x(()=>{U();({I:ol}=pt),Ft=r=>r===null||typeof r!="object"&&typeof r!="function",il={HTML:1,SVG:2},ke=(r,e)=>e===void 0?r?._$litType$!==void 0:r?._$litType$===e,sl=r=>r?._$litDirective$!==void 0,al=r=>r?._$litDirective$,Ye=r=>r.strings===void 0,Ti=()=>document.createComment(""),ie=(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(Ti(),i),a=o.insertBefore(Ti(),i);t=new ol(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),ll={},ge=(r,e=ll)=>r._$AH=e,dt=r=>r._$AH,qt=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}},zt=r=>{r._$AR()}});var Nn={};j(Nn,{AsyncDirective:()=>Ae,Directive:()=>L,PartType:()=>O,directive:()=>T});function cl(r){this._$AN!==void 0?(Hr(this),this._$AM=r,ki(this)):this._$AM=r}function ul(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++)Ht(n[i],!1),Hr(n[i]);else n!=null&&(Ht(n,!1),Hr(n));else Ht(this,r)}var Ht,Hr,ki,pl,Ae,ht=x(()=>{ye();N();N();Ht=(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),Ht(i,e);return!0},Hr=r=>{let e,t;do{if((e=r._$AM)===void 0)break;t=e._$AN,t.delete(r),r=e}while(t?.size===0)},ki=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),pl(e)}};pl=r=>{var e,t,n,o;r.type==O.CHILD&&((e=(n=r)._$AP)!==null&&e!==void 0||(n._$AP=ul),(t=(o=r)._$AQ)!==null&&t!==void 0||(o._$AQ=cl))},Ae=class extends L{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ki(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&&(Ht(this,e),Hr(this))}setValue(e){if(Ye(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 Pi=xe(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.async=void 0;var fl=(N(),C(Dn)),dl=(ht(),C(Nn)),hl=(U(),C(zr)),Fn=class extends dl.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)),hl.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)}};Wr.async=(0,fl.directive)(Fn)});var Mi={};j(Mi,{digestForTemplateResult:()=>Ri,hydrate:()=>qn});var ml,vl,Ii,Wt,gl,qn,yl,bl,xl,Ri,zn=x(()=>{U();N();ye();({R:ml,D:vl,V:Ii,I:Wt,F:gl}=pt),qn=(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=yl(r,a,i,t),n!=null||(n=o)}else if(l.startsWith("lit-node"))xl(a,i,t);else if(l.startsWith("/lit-part")){if(i.length===1&&o!==n)throw Error("internal error");o=bl(a,o,i)}}console.assert(n!==void 0,"there should be exactly one root part in a render container"),e._$litPart$=n},yl=(r,e,t,n)=>{let o,i;if(t.length===0)i=new Wt(e,null,void 0,n),o=r;else{let s=t[t.length-1];if(s.type==="template-instance")i=new Wt(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 Wt(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 Wt(e,null,s.part,n)}if(o=Ii(i,o),o===S)t.push({part:i,type:"leaf"});else if(Ft(o))t.push({part:i,type:"leaf"}),i._$AH=o;else if(ke(o)){let s="lit-part "+Ri(o);if(e.data!==s)throw Error("Hydration value mismatch: Unexpected TemplateResult rendered to part");{let a=Wt.prototype._$AC(o),l=new ml(a,i);t.push({type:"template-instance",instance:l,part:i,templatePartIndex:0,instancePartIndex:0,result:o}),i._$AH=l}}else vl(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},bl=(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},xl=(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!==O.ATTRIBUTE&&c.type!==O.ELEMENT||c.index!==i)break;if(c.type===O.ATTRIBUTE){let u=new c.ctor(s,c.name,c.strings,a.instance,t),p=Ye(u)?a.result.values[a.instancePartIndex]:a.result.values,d=!(u.type===O.EVENT||u.type===O.PROPERTY);u._$AI(p,u,a.instancePartIndex,d),a.instancePartIndex+=c.strings.length-1,l.u.push(u)}else{let u=new gl(s,a.instance,t);Ii(u,a.result.values[a.instancePartIndex++]),l.u.push(u)}a.templatePartIndex++}}},Ri=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 wl={};var ji=x(()=>{U();zn();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,qn(a,this.renderRoot,this.renderOptions)):Te(a,this.renderRoot,this.renderOptions)}}});var Li=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(f){return f!==void 0&&!e.has(f)},s=function(f){var v=t.get(f);return v===void 0&&t.set(f,v=[]),v},a=new Map,l=n.createElement;n.createElement=function(f,v){var h=l.call(n,f,v),m=v?.scope;if(m!==void 0&&(window.ShadyCSS.nativeShadow||window.ShadyCSS.prepareTemplateDom(h,m),i(m))){var w=s(m),G=h.content.querySelectorAll("style");w.push.apply(w,Array.from(G).map((function(ae){var be;return(be=ae.parentNode)===null||be===void 0||be.removeChild(ae),ae.textContent})))}return h};var c=document.createDocumentFragment(),u=document.createComment(""),p=o.prototype,d=p._$AI;p._$AI=function(f,v){var h,m;v===void 0&&(v=this);var w=this._$AA.parentNode,G=(h=this.options)===null||h===void 0?void 0:h.scope;if(w instanceof ShadowRoot&&i(G)){var ae=this._$AA,be=this._$AB;c.appendChild(u),this._$AA=u,this._$AB=null,d.call(this,f,v);var je=f?._$litType$?this._$AH._$AD.el:document.createElement("template");if((function(nr,or){var ir,vo=s(nr),go=vo.length!==0;go&&((ir=document.createElement("style")).textContent=vo.join(`
|
|
16
|
+
`),or.content.appendChild(ir)),e.add(nr),t.delete(nr),window.ShadyCSS.prepareTemplateStyles(or,nr),go&&window.ShadyCSS.nativeShadow&&(ir=or.content.querySelector("style"))!==null&&or.content.appendChild(ir)})(G,je),c.removeChild(u),(m=window.ShadyCSS)===null||m===void 0?void 0:m.nativeShadow){var Le=je.content.querySelector("style");Le!==null&&c.appendChild(Le.cloneNode(!0))}w.insertBefore(c,be),this._$AA=ae,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 w=m.get(f.strings);return w===void 0&&m.set(f.strings,w=new n(f,this.options)),w}}})}))});var Br,Bt,Hn,Ui,mt,Wn,Di,Vr,Vt,Bn=x(()=>{Br=window,Bt=Br.ShadowRoot&&(Br.ShadyCSS===void 0||Br.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Hn=Symbol(),Ui=new WeakMap,mt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Hn)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(Bt&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Ui.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Ui.set(t,e))}return e}toString(){return this.cssText}},Wn=r=>new mt(typeof r=="string"?r:r+"",void 0,Hn),Di=(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 mt(t,r,Hn)},Vr=(r,e)=>{Bt?r.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((t=>{let n=document.createElement("style"),o=Br.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}))},Vt=Bt?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Wn(t)})(r):r});var Vn,Kr,Ni,_l,Fi,Yr,Yn,Kn,fe,Gr=x(()=>{Bn();Bn();Kr=window,Ni=Kr.trustedTypes,_l=Ni?Ni.emptyScript:"",Fi=Kr.reactiveElementPolyfillSupport,Yr={toAttribute(r,e){switch(e){case Boolean:r=r?_l: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}},Yn=(r,e)=>e!==r&&(e==e||r==r),Kn={attribute:!0,type:String,converter:Yr,reflect:!1,hasChanged:Yn},fe=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=Kn){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)||Kn}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 Vr(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=Kn){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:Yr).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:Yr;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||Yn)(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){}};fe.finalized=!0,fe.elementProperties=new Map,fe.elementStyles=[],fe.shadowRootOptions={mode:"open"},Fi?.({ReactiveElement:fe}),((Vn=Kr.reactiveElementVersions)!==null&&Vn!==void 0?Vn:Kr.reactiveElementVersions=[]).push("1.5.0")});var Gn,Jn,zi,Pe,qi,Hi,Wi=x(()=>{Gr();Gr();U();U();zi=fe,Pe=class extends fe{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 S}};Pe.finalized=!0,Pe._$litElement$=!0,(Gn=globalThis.litElementHydrateSupport)===null||Gn===void 0||Gn.call(globalThis,{LitElement:Pe});qi=globalThis.litElementPolyfillSupport;qi?.({LitElement:Pe});Hi={_$AK:(r,e,t)=>{r._$AK(e,t)},_$AL:r=>r._$AL};((Jn=globalThis.litElementVersions)!==null&&Jn!==void 0?Jn:globalThis.litElementVersions=[]).push("3.2.2")});var $l,Al,ee,Ie=x(()=>{$l=(r,e,t)=>{Object.defineProperty(e,t,r)},Al=(r,e)=>({kind:"method",placement:"prototype",key:e.key,descriptor:r}),ee=({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 Sl,Bi=x(()=>{Sl=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 Zn(r){return(e,t)=>t!==void 0?((n,o,i)=>{o.constructor.createProperty(i,n)})(r,e,t):El(r,e)}var El,Xn=x(()=>{El=(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 Cl(r){return Zn({...r,state:!0})}var Vi=x(()=>{Xn();});function Tl(r){return ee({finisher:(e,t)=>{Object.assign(e.prototype[t],r)}})}var Ki=x(()=>{Ie();});function Ol(r,e){return ee({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 Yi=x(()=>{Ie();});function kl(r){return ee({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 Gi=x(()=>{Ie();});function Pl(r){return ee({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 Ji=x(()=>{Ie();});function eo(r){let{slot:e,selector:t}=r??{};return ee({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?Il(s,r):[];return t?a.filter((l=>l.matches(t))):a},enumerable:!0,configurable:!0})})}var Qn,Il,to=x(()=>{Ie();Il=((Qn=window.HTMLSlotElement)===null||Qn===void 0?void 0:Qn.prototype.assignedElements)!=null?(r,e)=>r.assignedElements(e):(r,e)=>r.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE))});function Rl(r,e,t){let n,o=r;return typeof r=="object"?(o=r.slot,n=r):n={flatten:e},t?eo({slot:o,flatten:e,selector:t}):ee({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 Zi=x(()=>{Ie();to();});var Xi={};j(Xi,{CSSResult:()=>mt,LitElement:()=>Pe,ReactiveElement:()=>fe,UpdatingElement:()=>zi,_$LE:()=>Hi,_$LH:()=>pt,adoptStyles:()=>Vr,css:()=>Di,customElement:()=>Sl,decorateProperty:()=>ee,defaultConverter:()=>Yr,eventOptions:()=>Tl,getCompatibleStyle:()=>Vt,html:()=>bi,legacyPrototypeMethod:()=>$l,noChange:()=>S,notEqual:()=>Yn,nothing:()=>E,property:()=>Zn,query:()=>Ol,queryAll:()=>kl,queryAssignedElements:()=>eo,queryAssignedNodes:()=>Rl,queryAsync:()=>Pl,render:()=>Te,standardPrototypeMethod:()=>Al,state:()=>Cl,supportsAdoptingStyleSheets:()=>Bt,svg:()=>xi,unsafeCSS:()=>Wn});var Qi=x(()=>{Gr();U();Wi();Ie();Bi();Xn();Vi();Ki();Yi();Gi();Ji();to();Zi();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 es={};j(es,{classMap:()=>Ml});var Ml,ts=x(()=>{U();N();Ml=T(class extends L{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 S}})});var rs,vt,gt,ro=x(()=>{rs=async(r,e)=>{for await(let t of r)if(await e(t)===!1)return},vt=class{constructor(e){this.Y=e}disconnect(){this.Y=void 0}reconnect(e){this.Y=e}deref(){return this.Y}},gt=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 ns={};j(ns,{AsyncReplaceDirective:()=>yt,asyncReplace:()=>jl});var yt,jl,no=x(()=>{U();ht();ro();N();yt=class extends Ae{constructor(){super(...arguments),this._$CK=new vt(this),this._$CX=new gt}render(e,t){return S}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 rs(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})),S}commitValue(e,t){this.setValue(e)}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},jl=T(yt)});var os={};j(os,{asyncAppend:()=>Ll});var Ll,is=x(()=>{N();no();ye();Ll=T(class extends yt{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&&zt(this._$Ctt);let t=ie(this._$Ctt);pe(t,r)}})});var ss={};j(ss,{cache:()=>Ul});var Ul,as=x(()=>{U();N();ye();Ul=T(class extends L{constructor(r){super(r),this.et=new WeakMap}render(r){return[r]}update(r,[e]){if(ke(this.it)&&(!ke(e)||this.it.strings!==e.strings)){let t=dt(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)}ge(n,[t]),ie(n,void 0,t)}if(ke(e)){if(!ke(this.it)||this.it.strings!==e.strings){let t=this.et.get(e.strings);if(t!==void 0){let n=dt(t).pop();zt(r),ie(r,void 0,n),ge(r,[n])}}this.it=e}else this.it=void 0;return this.render(e)}})});var ls={};j(ls,{guard:()=>Nl});var Dl,Nl,cs=x(()=>{U();N();Dl={},Nl=T(class extends L{constructor(){super(...arguments),this.ot=Dl}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 S}else if(this.ot===e)return S;return this.ot=Array.isArray(e)?Array.from(e):e,this.render(e,t)}})});var us={};j(us,{ifDefined:()=>Fl});var Fl,ps=x(()=>{U();Fl=r=>r??E});var fs={};j(fs,{live:()=>ql});var ql,ds=x(()=>{U();N();ye();ql=T(class extends L{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(!Ye(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(r,[e]){if(e===S||e===E)return e;let t=r.element,n=r.name;if(r.type===O.PROPERTY){if(e===t[n])return S}else if(r.type===O.BOOLEAN_ATTRIBUTE){if(!!e===t.hasAttribute(n))return S}else if(r.type===O.ATTRIBUTE&&t.getAttribute(n)===e+"")return S;return ge(r),e}})});var hs={};j(hs,{createRef:()=>zl,ref:()=>Hl});var zl,io,oo,Hl,ms=x(()=>{U();ht();N();zl=()=>new io,io=class{},oo=new WeakMap,Hl=T(class extends Ae{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=oo.get(t);n===void 0&&(n=new WeakMap,oo.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=oo.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 gs={};j(gs,{repeat:()=>Wl});var vs,Wl,ys=x(()=>{U();N();ye();vs=(r,e,t)=>{let n=new Map;for(let o=e;o<=t;o++)n.set(r[o],o);return n},Wl=T(class extends L{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=dt(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]=pe(i[d],s[v]),d++,v++;else if(l[f]===a[h])c[h]=pe(i[f],s[h]),f--,h--;else if(l[d]===a[h])c[h]=pe(i[d],s[h]),ie(r,c[h+1],i[d]),d++,h--;else if(l[f]===a[v])c[v]=pe(i[f],s[v]),ie(r,i[d],i[f]),f--,v++;else if(u===void 0&&(u=vs(a,v,h),p=vs(l,d,f)),u.has(l[d]))if(u.has(l[f])){let m=p.get(a[v]),w=m!==void 0?i[m]:null;if(w===null){let G=ie(r,i[d]);pe(G,s[v]),c[v]=G}else c[v]=pe(w,s[v]),ie(r,i[d],w),i[m]=null;v++}else qt(i[f]),f--;else qt(i[d]),d++;for(;v<=h;){let m=ie(r,c[h+1]);pe(m,s[v]),c[v++]=m}for(;d<=f;){let m=i[d++];m!==null&&qt(m)}return this.ut=a,ge(r,c),S}})});var bs={};j(bs,{styleMap:()=>Bl});var Bl,xs=x(()=>{U();N();Bl=T(class extends L{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 S}})});var ws={};j(ws,{templateContent:()=>Vl});var Vl,_s=x(()=>{U();N();Vl=T(class extends L{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?S:(this.ft=r,document.importNode(r.content,!0))}})});var $s={};j($s,{UnsafeHTMLDirective:()=>Re,unsafeHTML:()=>Kl});var Re,Kl,so=x(()=>{U();N();Re=class extends L{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===S)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;Kl=T(Re)});var As={};j(As,{unsafeSVG:()=>Yl});var Kt,Yl,Ss=x(()=>{N();so();Kt=class extends Re{};Kt.directiveName="unsafeSVG",Kt.resultType=2;Yl=T(Kt)});var Cs={};j(Cs,{UntilDirective:()=>Jr,until:()=>Gl});var Es,Jr,Gl,Ts=x(()=>{U();ye();ht();ro();N();Es=r=>!Ft(r)&&typeof r.then=="function",Jr=class extends Ae{constructor(){super(...arguments),this._$Cwt=1073741823,this._$Cyt=[],this._$CK=new vt(this),this._$CX=new gt}render(...e){var t;return(t=e.find((n=>!Es(n))))!==null&&t!==void 0?t:S}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(!Es(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 S}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Gl=T(Jr)});var Os={};j(Os,{choose:()=>Jl});var Jl,ks=x(()=>{Jl=(r,e,t)=>{for(let n of e)if(n[0]===r)return(0,n[1])();return t?.()}});var Ps={};j(Ps,{join:()=>Zl});function*Zl(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 Is=x(()=>{});var Rs={};j(Rs,{keyed:()=>Xl});var Xl,Ms=x(()=>{U();N();ye();Xl=T(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&&(ge(r),this.key=e),t}})});var js={};j(js,{map:()=>Ql});function*Ql(r,e){if(r!==void 0){let t=0;for(let n of r)yield e(n,t++)}}var Ls=x(()=>{});var Us={};j(Us,{range:()=>ec});function*ec(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 Ds=x(()=>{});var Ns={};j(Ns,{when:()=>tc});function tc(r,e,t){return r?e():t?.()}var Fs=x(()=>{});var Yt=xe(A=>{"use strict";var rc=A&&A.__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=A&&A.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&rc(e,r,t)};Object.defineProperty(A,"__esModule",{value:!0});k(Ci(),A);k(Pi(),A);k((U(),C(zr)),A);k((N(),C(Dn)),A);k((zn(),C(Mi)),A);k((ji(),C(wl)),A);k(Li(),A);k((ye(),C(Oi)),A);k((ht(),C(Nn)),A);k((Qi(),C(Xi)),A);k((ts(),C(es)),A);k((is(),C(os)),A);k((no(),C(ns)),A);k((as(),C(ss)),A);k((cs(),C(ls)),A);k((ps(),C(us)),A);k((ds(),C(fs)),A);k((ms(),C(hs)),A);k((ys(),C(gs)),A);k((xs(),C(bs)),A);k((_s(),C(ws)),A);k((so(),C($s)),A);k((Ss(),C(As)),A);k((Ts(),C(Cs)),A);k((ks(),C(Os)),A);k((Is(),C(Ps)),A);k((Ms(),C(Rs)),A);k((Ls(),C(js)),A);k((Ds(),C(Us)),A);k((Fs(),C(Ns)),A)});var qs=xe(de=>{"use strict";var Gt=de&&de.__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},Zr=de&&de.__metadata||function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},nc=de&&de.__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(de,"__esModule",{value:!0});de.Renderer=void 0;var W=Yt();function oc(r){return function(e){if(!window.customElements.get(r.selector))return(0,W.Component)(r)(e)}}var Ge=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 nc(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}};de.Renderer=Ge;Gt([(0,W.property)({type:Object}),Zr("design:type",Object)],Ge.prototype,"options",void 0);Gt([(0,W.property)({type:Boolean}),Zr("design:type",Object)],Ge.prototype,"loading",void 0);Gt([(0,W.property)({type:Object}),Zr("design:type",Error)],Ge.prototype,"error",void 0);Gt([(0,W.property)(),Zr("design:type",Object)],Ge.prototype,"state",void 0);de.Renderer=Ge=Gt([oc({selector:"r-renderer",template(){return(0,W.html)`
|
|
17
17
|
${this.loading?"":this.renderContent()}
|
|
18
18
|
${this.loading?(0,W.html)`
|
|
19
19
|
${this.isFunction(this.options.loading)?this.options.loading():(0,W.html)``}
|
|
@@ -21,19 +21,19 @@ Possible Solutions:
|
|
|
21
21
|
${this.error?(0,W.html)`
|
|
22
22
|
${this.isFunction(this.options.error)?this.options.error(this.error):(0,W.html)` ${this.error} `}
|
|
23
23
|
`:""}
|
|
24
|
-
`}})],
|
|
24
|
+
`}})],Ge)});var zs=xe(Je=>{"use strict";var ic=Je&&Je.__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]})),sc=Je&&Je.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ic(e,r,t)};Object.defineProperty(Je,"__esModule",{value:!0});sc(qs(),Je)});var Ws=xe(he=>{"use strict";var ac=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;zs();var Hs=Yt(),lc=(...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=lc;function cc(){var r;return ac(this,void 0,void 0,function*(){yield this.updateComplete,yield new Promise(requestAnimationFrame),(r=this.OnRendererLoaded)===null||r===void 0||r.call(this)})}var uc=r=>(e=[])=>(t=()=>({}))=>(n=()=>null)=>(o=()=>null)=>(i=()=>t)=>(0,Hs.Component)(Object.assign(Object.assign({},r),{template(){return(0,Hs.html)`
|
|
25
25
|
<r-renderer
|
|
26
26
|
style="display: contents;"
|
|
27
|
-
@loaded=${
|
|
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,l
|
|
27
|
+
@loaded=${cc.bind(this)}
|
|
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=uc;function pc({Settings:r,Providers:e,State:t,Render:n,Loading:o,Error:i}){return(0,he.Partial)(r)(e)(t)(o)(i)(n)}he.Component=pc});var vn=function(r,e){return vn=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])},vn(r,e)};function V(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");vn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function xo(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 sr(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 q(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 wo(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(f){return function(v){return Promise.resolve(v).then(f,p)}}function a(f,v){n[f]&&(o[f]=function(h){return new Promise(function(m,w){i.push([f,h,m,w])>1||l(f,h)})},v&&(o[f]=v(o[f])))}function l(f,v){try{c(n[f](v))}catch(h){d(i[0][3],h)}}function c(f){f.value instanceof Ue?Promise.resolve(f.value.v).then(u,p):d(i[0][2],f)}function u(f){l("next",f)}function p(f){l("throw",f)}function d(f,v){f(v),i.shift(),i.length&&l(i[0][0],i[0][1])}}function _o(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 y(r){return typeof r=="function"}function ar(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 lr=ar(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 l=we(s),a=l.next();!a.done;a=l.next()){var c=a.value;c.remove(this)}}catch(h){e={error:h}}finally{try{a&&!a.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}else s.remove(this);var u=this.initialTeardown;if(g(u))try{u()}catch(h){i=h instanceof ir?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 ir?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 ir(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 sr(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 ar(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,sr(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){lr(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){lr(n)}else lr(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){lr(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 l;i&&se.useDeprecatedNextContext?(l=Object.create(t),l.unsubscribe=function(){return i.unsubscribe()},s={next:t.next&&pn(t.next,l),error:t.error&&pn(t.error,l),complete:t.complete&&pn(t.complete,l)}):s=t}return i.destination=new oa(s),i}return e})(_t);function lr(r){se.useDeprecatedSynchronousErrorHandling?yo(r):ar(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,l=s.operator,a=s.source;i.add(l?l.call(i,a):a?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(l){try{e(l)}catch(a){i(a),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)&&sr(r)}function ca(r){return g(r?.lift)}function x(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,l){var a=r.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=l,a._next=n?function(c){try{n(c)}catch(u){t.error(u)}}:r.prototype._next,a._error=i?function(c){try{i(c)}catch(u){t.error(u)}finally{this.unsubscribe()}}:r.prototype._error,a._complete=o?function(){try{o()}catch(c){t.error(c)}finally{this.unsubscribe()}}:r.prototype._complete,a}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=or(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),l=s.next();!l.done;l=s.next()){var a=l.value;a.next(t)}}catch(c){o={error:c}}finally{try{l&&!l.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,l=o.observers;return i||s?cn:(this.currentObservers=null,l.push(t),new Z(function(){n.currentObservers=null,Ue(l,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,l=n._timestampProvider,a=n._windowTime;o||(i.push(t),!s&&i.push(l.now()+a)),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,l=s.slice(),a=0;a<l.length&&!t.closed;a+=i?1:2)t.next(l[a]);return this._checkFinalizedStatuses(t),n},e.prototype._trimBuffer=function(){var t=this,n=t._bufferSize,o=t._timestampProvider,i=t._buffer,s=t._infiniteTimeWindow,l=(s?1:2)*n;if(n<1/0&&l<i.length&&i.splice(0,i.length-l),!s){for(var a=o.now(),c=0,u=1;u<i.length&&i[u]<=a;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 cr(r){return r&&g(r.schedule)}function vn(r){return r[r.length-1]}function ur(r){return g(vn(r))?r.pop():void 0}function me(r){return cr(vn(r))?r.pop():void 0}function Co(r,e){return typeof vn(r)=="number"?r.pop():e}var pr=(function(r){return r&&typeof r.length=="number"&&typeof r!="function"});function fr(r){return g(r?.then)}function dr(r){return g(r[tt])}function hr(r){return Symbol.asyncIterator&&g(r?.[Symbol.asyncIterator])}function mr(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 vr=fa();function gr(r){return g(r?.[vr])}function yr(r){return po(this,arguments,function(){var t,n,o,i;return nr(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 br(r){return g(r?.getReader)}function P(r){if(r instanceof _)return r;if(r!=null){if(dr(r))return da(r);if(pr(r))return ha(r);if(fr(r))return ma(r);if(hr(r))return To(r);if(gr(r))return va(r);if(br(r))return ga(r)}throw mr(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,ar)})}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(l){t={error:l}}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(yr(r))}function ya(r,e){var t,n,o,i;return uo(this,void 0,void 0,function(){var s,l;return nr(this,function(a){switch(a.label){case 0:a.trys.push([0,5,6,11]),t=fo(r),a.label=1;case 1:return[4,t.next()];case 2:if(n=a.sent(),!!n.done)return[3,4];if(s=n.value,e.next(s),e.closed)return[2];a.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=a.sent(),o={error:l},[3,11];case 6:return a.trys.push([6,,9,10]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,8];case 7:a.sent(),a.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 xr(r,e){return e===void 0&&(e=0),x(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 wr(r,e){return e===void 0&&(e=0),x(function(t,n){n.add(r.schedule(function(){return t.subscribe(n)},e))})}function Oo(r,e){return P(r).pipe(wr(e),xr(e))}function ko(r,e){return P(r).pipe(wr(e),xr(e))}function Po(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 Io(r,e){return new _(function(t){var n;return Y(t,e,function(){n=r[vr](),Y(t,e,function(){var o,i,s;try{o=n.next(),i=o.value,s=o.done}catch(l){t.error(l);return}s?t.complete():t.next(i)},0,!0)}),function(){return g(n?.return)&&n.return()}})}function _r(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 _r(yr(r),e)}function Mo(r,e){if(r!=null){if(dr(r))return Oo(r,e);if(pr(r))return Po(r,e);if(fr(r))return ko(r,e);if(hr(r))return _r(r,e);if(gr(r))return Io(r,e);if(br(r))return Ro(r,e)}throw mr(r)}function V(r,e){return e?Mo(r,e):P(r)}function I(){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 x(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=ur(r),o=Uo(r),i=o.args,s=o.keys;if(i.length===0)return V([],t);var l=new _(Ea(i,t,s?function(a){return Do(s,a)}:X));return n?l.pipe(Lo(n)):l}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,l=o,a=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,l--),l||n.next(t(i.slice()))},function(){--s||n.complete()}))},n)},c=0;c<o;c++)a(c)},n)}}function qo(r,e,t){r?Y(t,r,e):e()}function No(r,e,t,n,o,i,s,l){var a=[],c=0,u=0,p=!1,d=function(){p&&!a.length&&!c&&e.complete()},f=function(h){return c<n?v(h):a.push(h)},v=function(h){i&&e.next(h),c++;var m=!1;P(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=a.shift();s?Y(e,s,function(){return v(K)}):v(K)};a.length&&c<n;)b();d()}catch(K){e.error(K)}}))};return r.subscribe(S(e,f,function(){p=!0,d()})),function(){l?.()}}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)})(P(r(n,o)))},t):(typeof e=="number"&&(t=e),x(function(n,o){return No(n,o,r,t)}))}function Sr(r){return r===void 0&&(r=1/0),re(X,r)}function Fo(){return Sr(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){P(r()).subscribe(e)})}function $r(r,e,t){r===void 0&&(r=0),t===void 0&&(t=Eo);var n=-1;return e!=null&&(cr(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?P(o[0]):Sr(n)(V(o,t)):le}var yn=new _(ae);function ve(r,e){return x(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 x(function(e,t){var n=null,o=!1,i;n=e.subscribe(S(t,void 0,void 0,function(s){i=P(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 l=t,a=e,c=0;i.subscribe(S(s,function(u){var p=c++;a=l?r(a,u,p):(l=!0,u),n&&s.next(a)},o&&(function(){l&&s.next(a),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}:x(function(e,t){var n=0;e.subscribe(S(t,function(o){++n<=r&&(t.next(o),r<=n&&t.complete())}))})}function rt(){return x(function(r,e){r.subscribe(S(e,ae))})}function bn(r,e){return e===void 0&&(e=X),r=r??Ca,x(function(t,n){var o,i=!0;t.subscribe(S(n,function(s){var l=e(s);(i||!r(o,l))&&(i=!1,o=l,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,I.apply(void 0,H([],F(r))))}}function Ar(r,e){return e?function(t){return t.pipe(Ar(function(n,o){return P(r(n,o)).pipe(M(function(i,s){return e(n,i,o,s)}))}))}:x(function(t,n){var o=0,i=null,s=!1;t.subscribe(S(n,function(l){i||(i=S(n,void 0,function(){i=null,s&&n.complete()}),P(r(l,o++)).subscribe(i))},function(){s=!0,!i&&n.complete()}))})}function Ot(r){return x(function(e,t){try{e.subscribe(t)}finally{t.add(r)}})}function wn(r,e){return x(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,l=r.resetOnRefCountZero,a=l===void 0?!0:l;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 x(function(ie,be){f++,!h&&!v&&m();var Me=d=d??t();be.add(function(){f--,f===0&&!h&&!v&&(p=_n(K,a))}),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()}}),P(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 P(e.apply(void 0,H([],F(t)))).subscribe(o)}}function nt(r,e,t){var n,o,i,s,l=!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,l=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:l})}function Sn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r);return x(function(n,o){(t?Ae(r,n,t):Ae(r,n)).subscribe(o)})}function B(r,e){return x(function(t,n){var o=null,i=0,s=!1,l=function(){return s&&!o&&n.complete()};t.subscribe(S(n,function(a){o?.unsubscribe();var c=0,u=i++;P(r(a,u)).subscribe(o=S(n,function(p){return n.next(e?e(a,p,u,c++):p)},function(){o=null,l()}))},function(){s=!0,l()}))})}function Fe(r){return x(function(e,t){P(r).subscribe(S(t,function(){return t.complete()},ae)),!t.closed&&e.subscribe(t)})}function Pt(r,e){return e===void 0&&(e=!1),x(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?x(function(o,i){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var l=!0;o.subscribe(S(i,function(a){var c;(c=n.next)===null||c===void 0||c.call(n,a),i.next(a)},function(){var a;l=!1,(a=n.complete)===null||a===void 0||a.call(n),i.complete()},function(a){var c;l=!1,(c=n.error)===null||c===void 0||c.call(n,a),i.error(a)},function(){var a,c;l&&((a=n.unsubscribe)===null||a===void 0||a.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=ur(r);return x(function(n,o){for(var i=r.length,s=new Array(i),l=r.map(function(){return!1}),a=!1,c=function(p){P(r[p]).subscribe(S(o,function(d){s[p]=d,!a&&!l[p]&&(l[p]=!0,(a=l.every(X))&&(l=null))},ae))},u=0;u<i;u++)c(u);n.subscribe(S(o,function(p){if(a){var d=H([p],F(s));o.next(t?t.apply(void 0,H([],F(d))):d)}}))})}var It=`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) { ${It} } }`,getAgent:`query ($id: String!) { getProjectAgent(id: $id) { ${It} } }`,createAgent:`mutation ($projectId: String!, $payload: CreateProjectAgentInput!) { createProjectAgent(projectId: $projectId, payload: $payload) { ${It} } }`,updateAgent:`mutation ($id: String!, $payload: UpdateProjectAgentInput!) { updateProjectAgent(id: $id, payload: $payload) { ${It} } }`,deleteAgent:"mutation ($id: String!) { deleteProjectAgent(id: $id) }",updateEmbed:`mutation ($agentId: String!, $embed: AgentEmbedInput!) { updateAgentEmbed(agentId: $agentId, embed: $embed) { ${It} } }`,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 Er="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,l=r.fetch??globalThis.fetch;if(!l){i.error(new U("No fetch available","network"));return}return l(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 a=>{let c;try{c=await a.json()}catch{throw new U(`Lambforge answered ${a.status}`,a.status===401?"unauthorized":"network",a.status)}if(c.errors?.length)throw Rt(c.errors,a.status);if(!c.data||!(o in c.data))throw new U(`Lambforge answered ${a.status} without ${o}`,"network",a.status);i.next(c.data[o]),i.complete()}).catch(a=>{s.signal.aborted||i.error(a instanceof U?a:new U(String(a?.message??a),"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=a=>{o.readyState===1&&o.send(JSON.stringify(a))},l=a=>{if(!n){n=!0,e.error(a);try{o.close(1e3)}catch{}}};return o.onopen=()=>s({type:"connection_init",payload:r.connectionParams}),o.onmessage=a=>{let c;try{c=JSON.parse(String(a.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){l(Rt(u.errors));return}u?.data&&e.next(u.data[r.field]);return}case"error":l(Rt(Array.isArray(c.payload)?c.payload:[c.payload]));return;case"connection_error":l(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=a=>{if(n)return;let c=a?.code===4401||a?.code===4403;l(new U(`connection closed${a?.code?` (${a.code}${a.reason?` ${a.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 Cr=r=>Ct(()=>{let e=r();return Et(e)?e.pipe(Ne(1)):V(Promise.resolve(e))}),Pa=6e4,Go="lambforge.agents.device",Ia=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??Er,fetch:e.fetch}}token$(){return this.current&&Date.now()<this.current.renewAt?I(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-Pa):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?Cr(t).pipe(M(n=>n||void 0)):I(void 0)}session$(){let e=this.options;if(e.getToken)return Cr(e.getToken).pipe(M(n=>typeof n=="string"?{token:n}:n));if(e.exchange){let{projectId:n,idToken:o,agents:i}=e.exchange;return Cr(o).pipe(B(s=>Mt(this.endpoint,null,ce.exchangeSession,{projectId:n,token:s,agents:i},"exchangeAgentSession")))}let t=e.anonymous;return Cr(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 Tr(this,e,t??null),conversations:()=>this.conversations(e)}}events(e,t=0){return new _(n=>{let o=t,i=new Map,s=new Z,l=!1,a=!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=>{!m||m.seq<=o||(i.set(m.seq,m),c(),i.size&&p())},p=()=>{if(l){a=!0;return}l=!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=>{l=!1,n.error(m)},complete:()=>{l=!1,a&&(a=!1,p())}}))},d=this.webSocket();if(!d)return p(),s.add($r(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(Ia,1e3*2**f++);s.add($r(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)}},Tr=class{constructor(e,t,n){this.client=e;this.agent=t;this.id=n}send(e,t={}){return(t.credential!==void 0?I(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(Pt(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"):I(!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()),w=an(Kt());var oe=an(Kt()),Jl=/^(https?:|mailto:)/i,Zn=/^\s*[-*+]\s+/,Vr=/^\s*\d+[.)]\s+/,Zl=/^```\s*([\w+-]*)\s*$/,Ms=/^(#{1,6})\s+(.*)$/;function Br(r){let e=[],t=String(r??"").replace(/\r\n?/g,`
|
|
32
|
+
`):"",this.name="UnsubscriptionError",this.errors=t}});function De(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}var X=(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(y(u))try{u()}catch(h){i=h instanceof lr?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{$o(v)}catch(h){i=i??[],h instanceof lr?i=z(z([],q(i)),q(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 lr(i)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)$o(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)&&De(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&De(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=(function(){var e=new r;return e.closed=!0,e})(),r})();var gn=X.EMPTY;function cr(r){return r instanceof X||r&&"closed"in r&&y(r.remove)&&y(r.add)&&y(r.unsubscribe)}function $o(r){y(r)?r():r.unsubscribe()}var le={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var tt={setTimeout:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var o=tt.delegate;return o?.setTimeout?o.setTimeout.apply(o,z([r,e],q(t))):setTimeout.apply(void 0,z([r,e],q(t)))},clearTimeout:function(r){var e=tt.delegate;return(e?.clearTimeout||clearTimeout)(r)},delegate:void 0};function ur(r){tt.setTimeout(function(){var e=le.onUnhandledError;if(e)e(r);else throw r})}function ce(){}var Ao=(function(){return yn("C",void 0,void 0)})();function So(r){return yn("E",void 0,r)}function Eo(r){return yn("N",r,void 0)}function yn(r,e,t){return{kind:r,value:e,error:t}}var Ne=null;function rt(r){if(le.useDeprecatedSynchronousErrorHandling){var e=!Ne;if(e&&(Ne={errorThrown:!1,error:null}),r(),e){var t=Ne,n=t.errorThrown,o=t.error;if(Ne=null,n)throw o}}else r()}function Co(r){le.useDeprecatedSynchronousErrorHandling&&Ne&&(Ne.errorThrown=!0,Ne.error=r)}var St=(function(r){V(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,cr(t)&&t.add(n)):n.destination=ya,n}return e.create=function(t,n,o){return new Fe(t,n,o)},e.prototype.next=function(t){this.isStopped?xn(Eo(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?xn(So(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?xn(Ao,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})(X);var ma=Function.prototype.bind;function bn(r,e){return ma.call(r,e)}var va=(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){pr(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){pr(n)}else pr(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){pr(t)}},r})(),Fe=(function(r){V(e,r);function e(t,n,o){var i=r.call(this)||this,s;if(y(t)||!t)s={next:t??void 0,error:n??void 0,complete:o??void 0};else{var a;i&&le.useDeprecatedNextContext?(a=Object.create(t),a.unsubscribe=function(){return i.unsubscribe()},s={next:t.next&&bn(t.next,a),error:t.error&&bn(t.error,a),complete:t.complete&&bn(t.complete,a)}):s=t}return i.destination=new va(s),i}return e})(St);function pr(r){le.useDeprecatedSynchronousErrorHandling?Co(r):ur(r)}function ga(r){throw r}function xn(r,e){var t=le.onStoppedNotification;t&&tt.setTimeout(function(){return t(r,e)})}var ya={closed:!0,next:ce,error:ga,complete:ce};var nt=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function Q(r){return r}function wn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return _n(r)}function _n(r){return r.length===0?Q: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=xa(e)?e:new Fe(e,t,n);return rt(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=To(t),new t(function(o,i){var s=new Fe({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[nt]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _n(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=To(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 To(r){var e;return(e=r??le.Promise)!==null&&e!==void 0?e:Promise}function ba(r){return r&&y(r.next)&&y(r.error)&&y(r.complete)}function xa(r){return r&&r instanceof St||ba(r)&&cr(r)}function wa(r){return y(r?.lift)}function b(r){return function(e){if(wa(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 _a(r,e,t,n,o)}var _a=(function(r){V(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})(St);var Oo=ar(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var re=(function(r){V(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 ko(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Oo},e.prototype.next=function(t){var n=this;rt(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;rt(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;rt(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?gn:(this.currentObservers=null,a.push(t),new X(function(){n.currentObservers=null,De(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 ko(t,n)},e})(_);var ko=(function(r){V(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:gn},e})(re);var Et={now:function(){return(Et.delegate||Date).now()},delegate:void 0};var Po=(function(r){V(e,r);function e(t,n,o){t===void 0&&(t=1/0),n===void 0&&(n=1/0),o===void 0&&(o=Et);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})(re);var Io=(function(r){V(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})(X);var Ct={setInterval:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var o=Ct.delegate;return o?.setInterval?o.setInterval.apply(o,z([r,e],q(t))):setInterval.apply(void 0,z([r,e],q(t)))},clearInterval:function(r){var e=Ct.delegate;return(e?.clearInterval||clearInterval)(r)},delegate:void 0};var Ro=(function(r){V(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),Ct.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&&Ct.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,De(i,this),n!=null&&(this.id=this.recycleAsyncId(o,n,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e})(Io);var $n=(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=Et.now,r})();var Mo=(function(r){V(e,r);function e(t,n){n===void 0&&(n=$n.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})($n);var $a=new Mo(Ro),jo=$a;var ue=new _(function(r){return r.complete()});function fr(r){return r&&y(r.schedule)}function An(r){return r[r.length-1]}function dr(r){return y(An(r))?r.pop():void 0}function me(r){return fr(An(r))?r.pop():void 0}function Lo(r,e){return typeof An(r)=="number"?r.pop():e}var hr=(function(r){return r&&typeof r.length=="number"&&typeof r!="function"});function mr(r){return y(r?.then)}function vr(r){return y(r[nt])}function gr(r){return Symbol.asyncIterator&&y(r?.[Symbol.asyncIterator])}function yr(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 Aa(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var br=Aa();function xr(r){return y(r?.[br])}function wr(r){return wo(this,arguments,function(){var t,n,o,i;return sr(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 _r(r){return y(r?.getReader)}function I(r){if(r instanceof _)return r;if(r!=null){if(vr(r))return Sa(r);if(hr(r))return Ea(r);if(mr(r))return Ca(r);if(gr(r))return Uo(r);if(xr(r))return Ta(r);if(_r(r))return Oa(r)}throw yr(r)}function Sa(r){return new _(function(e){var t=r[nt]();if(y(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ea(r){return new _(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}function Ca(r){return new _(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,ur)})}function Ta(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 Uo(r){return new _(function(e){ka(r,e).catch(function(t){return e.error(t)})})}function Oa(r){return Uo(wr(r))}function ka(r,e){var t,n,o,i;return xo(this,void 0,void 0,function(){var s,a;return sr(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),t=_o(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 J(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 $r(r,e){return e===void 0&&(e=0),b(function(t,n){t.subscribe($(n,function(o){return J(n,r,function(){return n.next(o)},e)},function(){return J(n,r,function(){return n.complete()},e)},function(o){return J(n,r,function(){return n.error(o)},e)}))})}function Ar(r,e){return e===void 0&&(e=0),b(function(t,n){n.add(r.schedule(function(){return t.subscribe(n)},e))})}function Do(r,e){return I(r).pipe(Ar(e),$r(e))}function No(r,e){return I(r).pipe(Ar(e),$r(e))}function Fo(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 qo(r,e){return new _(function(t){var n;return J(t,e,function(){n=r[br](),J(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 y(n?.return)&&n.return()}})}function Sr(r,e){if(!r)throw new Error("Iterable cannot be null");return new _(function(t){J(t,e,function(){var n=r[Symbol.asyncIterator]();J(t,e,function(){n.next().then(function(o){o.done?t.complete():t.next(o.value)})},0,!0)})})}function zo(r,e){return Sr(wr(r),e)}function Ho(r,e){if(r!=null){if(vr(r))return Do(r,e);if(hr(r))return Fo(r,e);if(mr(r))return No(r,e);if(gr(r))return Sr(r,e);if(xr(r))return qo(r,e);if(_r(r))return zo(r,e)}throw yr(r)}function B(r,e){return e?Ho(r,e):I(r)}function R(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r);return B(r,t)}function Tt(r,e){var t=y(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 Ot(r){return!!r&&(r instanceof _||y(r.lift)&&y(r.subscribe))}function Wo(r){return r instanceof Date&&!isNaN(r)}function P(r,e){return b(function(t,n){var o=0;t.subscribe($(n,function(i){n.next(r.call(e,i,o++))}))})}var Pa=Array.isArray;function Ia(r,e){return Pa(e)?r.apply(void 0,z([],q(e))):r(e)}function Bo(r){return P(function(e){return Ia(r,e)})}var Ra=Array.isArray,Ma=Object.getPrototypeOf,ja=Object.prototype,La=Object.keys;function Vo(r){if(r.length===1){var e=r[0];if(Ra(e))return{args:e,keys:null};if(Ua(e)){var t=La(e);return{args:t.map(function(n){return e[n]}),keys:t}}}return{args:r,keys:null}}function Ua(r){return r&&typeof r=="object"&&Ma(r)===ja}function Ko(r,e){return r.reduce(function(t,n,o){return t[n]=e[o],t},{})}function Sn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r),n=dr(r),o=Vo(r),i=o.args,s=o.keys;if(i.length===0)return B([],t);var a=new _(Da(i,t,s?function(l){return Ko(s,l)}:Q));return n?a.pipe(Bo(n)):a}function Da(r,e,t){return t===void 0&&(t=Q),function(n){Yo(e,function(){for(var o=r.length,i=new Array(o),s=o,a=o,l=function(u){Yo(e,function(){var p=B(r[u],e),d=!1;p.subscribe($(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 Yo(r,e,t){r?J(t,r,e):e()}function Go(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($(e,function(w){o?.(w),i?f(w):e.next(w)},function(){m=!0},void 0,function(){if(m)try{c--;for(var w=function(){var G=l.shift();s?J(e,s,function(){return v(G)}):v(G)};l.length&&c<n;)w();d()}catch(G){e.error(G)}}))};return r.subscribe($(e,f,function(){p=!0,d()})),function(){a?.()}}function ne(r,e,t){return t===void 0&&(t=1/0),y(e)?ne(function(n,o){return P(function(i,s){return e(n,i,o,s)})(I(r(n,o)))},t):(typeof e=="number"&&(t=e),b(function(n,o){return Go(n,o,r,t)}))}function Er(r){return r===void 0&&(r=1/0),ne(Q,r)}function Jo(){return Er(1)}function Se(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Jo()(B(r,me(r)))}function Ee(r){return new _(function(e){I(r()).subscribe(e)})}function Cr(r,e,t){r===void 0&&(r=0),t===void 0&&(t=jo);var n=-1;return e!=null&&(fr(e)?t=e:n=e),new _(function(o){var i=Wo(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 Ce(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r),n=Lo(r,1/0),o=r;return o.length?o.length===1?I(o[0]):Er(n)(B(o,t)):ue}var En=new _(ce);function ve(r,e){return b(function(t,n){var o=0;t.subscribe($(n,function(i){return r.call(e,i,o++)&&n.next(i)}))})}function Z(r){return b(function(e,t){var n=null,o=!1,i;n=e.subscribe($(t,void 0,void 0,function(s){i=I(r(s,Z(r)(e))),n?(n.unsubscribe(),n=null,i.subscribe(t)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(t))})}function Tr(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 Zo(r,e){return b(Tr(r,e,arguments.length>=2,!1,!0))}var Na=function(r,e){return r.push(e),r};function Cn(){return b(function(r,e){Zo(Na,[])(r).subscribe(e)})}function qe(r,e){return y(e)?ne(r,e,1):ne(r,1)}function ze(r){return r<=0?function(){return ue}:b(function(e,t){var n=0;e.subscribe($(t,function(o){++n<=r&&(t.next(o),r<=n&&t.complete())}))})}function ot(){return b(function(r,e){r.subscribe($(e,ce))})}function Tn(r,e){return e===void 0&&(e=Q),r=r??Fa,b(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 Fa(r,e){return r===e}function On(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return function(t){return Se(t,R.apply(void 0,z([],q(r))))}}function Or(r,e){return e?function(t){return t.pipe(Or(function(n,o){return I(r(n,o)).pipe(P(function(i,s){return e(n,i,o,s)}))}))}:b(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()}),I(r(a,o++)).subscribe(i))},function(){s=!0,!i&&n.complete()}))})}function kt(r){return b(function(e,t){try{e.subscribe(t)}finally{t.add(r)}})}function kn(r,e){return b(Tr(r,e,arguments.length>=2,!0))}function Pt(r){r===void 0&&(r={});var e=r.connector,t=e===void 0?function(){return new re}: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},w=function(){m(),u=d=void 0,v=h=!1},G=function(){var ae=u;w(),ae?.unsubscribe()};return b(function(ae,be){f++,!h&&!v&&m();var je=d=d??t();be.add(function(){f--,f===0&&!h&&!v&&(p=Pn(G,l))}),je.subscribe(be),!u&&f>0&&(u=new Fe({next:function(Le){return je.next(Le)},error:function(Le){h=!0,m(),p=Pn(w,o,Le),je.error(Le)},complete:function(){v=!0,m(),p=Pn(w,s),je.complete()}}),I(ae).subscribe(u))})(c)}}function Pn(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 Fe({next:function(){o.unsubscribe(),r()}});return I(e.apply(void 0,z([],q(t)))).subscribe(o)}}function it(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,Pt({connector:function(){return new Po(s,e,t)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:a})}function In(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r);return b(function(n,o){(t?Se(r,n,t):Se(r,n)).subscribe(o)})}function H(r,e){return b(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++;I(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 He(r){return b(function(e,t){I(r).subscribe($(t,function(){return t.complete()},ce)),!t.closed&&e.subscribe(t)})}function It(r,e){return e===void 0&&(e=!1),b(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=y(r)||e||t?{next:r,error:e,complete:t}:r;return n?b(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)}))}):Q}function Rn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=dr(r);return b(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($(o,function(d){s[p]=d,!l&&!a[p]&&(a[p]=!0,(l=a.every(Q))&&(a=null))},ce))},u=0;u<i;u++)c(u);n.subscribe($(o,function(p){if(l){var d=z([p],q(s));o.next(t?t.apply(void 0,z([],q(d))):d)}}))})}var qa=["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"],M=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&&qa.includes(o)?new M(n,o,e):n==="session-expired"?new M(n,"session-expired",e):t.extensions?.code==="UNAUTHENTICATED"||/not authorized|unauthorized|invalid sign-in token/i.test(n)?new M(n,"unauthorized",e):new M(n,"bad-request",e)}var Pr=["image/png","image/jpeg","image/webp","image/gif","application/pdf","text/plain","text/csv","text/markdown","application/json","application/yaml"],kr=1024*1024,st={imageBytes:5*kr,pdfBytes:10*kr,textBytes:1*kr,perMessage:5,bytesPerMessage:15*kr},za={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"},Ir=r=>za[String(r??"").split(".").pop()?.toLowerCase()??""];function Mn(r){if(r.length>st.perMessage)return"attachment-limit";let e=0;for(let t of r){let n=t.type||Ir(t.name);if(!n||!Pr.includes(n))return"attachment-invalid";let o=n.startsWith("image/")?st.imageBytes:n==="application/pdf"?st.pdfBytes:st.textBytes;if(t.size>o)return"attachment-too-large";e+=t.size}return e>st.bytesPerMessage?"attachment-limit":null}var Ha=r=>typeof Blob<"u"&&r instanceof Blob,Wa=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 Xo(r){if(Ha(r))return{body:r,size:r.size,type:r.type||void 0};if(typeof r=="string"){let e=Wa(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 M("Attachment data must be a Blob, File, ArrayBuffer, Uint8Array / Buffer or base64 string","bad-request")}function Qo(r,e,t,n){return Ee(()=>{let o=n??globalThis.fetch;if(!o)throw new M("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 M(`Uploading ${t} failed (${o.status})`,"network",o.status);return r}))}var Mt=`id name type description instructions tools isActive modelName mcpLambdaId mcpLambdaName createdAt updatedAt
|
|
33
|
+
embed { published identity allowedOrigins welcome suggestions showToolDetails maxMessagesPerConversation maxMessageLength allowAttachments retentionDays publishedAt }`,ri="id name description welcome suggestions allowAttachments",jn=`token expiresAt agents { ${ri} }`,ei="id agentId title messageCount lastSeq answering lastMessageAt createdAt",Ba="id role text attachments { id name mimeType size } toolCalls { name status } createdAt",ti="conversationId seq type runId data createdAt",oe={listAgents:`query ($projectId: String!) { listProjectAgents(projectId: $projectId) { ${Mt} } }`,getAgent:`query ($id: String!) { getProjectAgent(id: $id) { ${Mt} } }`,createAgent:`mutation ($projectId: String!, $payload: CreateProjectAgentInput!) { createProjectAgent(projectId: $projectId, payload: $payload) { ${Mt} } }`,updateAgent:`mutation ($id: String!, $payload: UpdateProjectAgentInput!) { updateProjectAgent(id: $id, payload: $payload) { ${Mt} } }`,deleteAgent:"mutation ($id: String!) { deleteProjectAgent(id: $id) }",updateEmbed:`mutation ($agentId: String!, $embed: AgentEmbedInput!) { updateAgentEmbed(agentId: $agentId, embed: $embed) { ${Mt} } }`,createSession:`mutation ($subject: String!, $agents: [String], $claims: JSON, $ttlSeconds: Int, $origin: String) { createAgentSession(subject: $subject, agents: $agents, claims: $claims, ttlSeconds: $ttlSeconds, origin: $origin) { ${jn} } }`,exchangeSession:`mutation ($projectId: String!, $token: String!, $agents: [String]) { exchangeAgentSession(projectId: $projectId, token: $token, agents: $agents) { ${jn} } }`,anonymousSession:`mutation ($deviceId: String!, $turnstileToken: String!, $agents: [String]) { createAnonymousAgentSession(deviceId: $deviceId, turnstileToken: $turnstileToken, agents: $agents) { ${jn} } }`,sessionAgents:`query { sessionAgents { ${ri} } }`,conversations:`query ($agent: String) { agentConversations(agent: $agent) { ${ei} } }`,conversation:`query ($id: String!) { agentConversation(id: $id) { ${ei} messages { ${Ba} } } }`,events:`query ($conversationId: String!, $afterSeq: Int) { agentConversationEvents(conversationId: $conversationId, afterSeq: $afterSeq) { ${ti} } }`,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 } }",abort:"mutation ($conversationId: String!) { abortAgentRun(conversationId: $conversationId) }",liveEvents:`subscription ($conversationId: String!) { agentEvents(conversationId: $conversationId) { ${ti} } }`};var Rr="https://api.lambforge.com",Va=r=>`${r.replace(/\/+$/,"")}/graphql`,ni=r=>`${r.replace(/\/+$/,"").replace(/^http/,"ws")}/subscriptions`;function jt(r,e,t,n,o){return new _(i=>{let s=new AbortController,a=r.fetch??globalThis.fetch;if(!a){i.error(new M("No fetch available","network"));return}return a(Va(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 M(`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 M(`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 M?l:new M(String(l?.message??l),"network"))}),()=>s.abort()})}var oi=["graphql-ws","graphql-transport-ws"];function ii(r){return new _(e=>{let n=!1,o=new r.WebSocket(r.url,oi),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 M(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 M(`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 Mr=r=>Ee(()=>{let e=r();return Ot(e)?e.pipe(ze(1)):B(Promise.resolve(e))}),Ka=6e4,si="lambforge.agents.device",Ya=15e3,We=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 M("AgentClient: give exactly one of getToken, exchange or anonymous","bad-request");if(e.anonymous&&!e.anonymous.publishableKey.startsWith("lfp_"))throw new M("AgentClient: anonymous visitors need a publishable key (lfp_...)","bad-request");this.endpoint={url:e.url??Rr,fetch:e.fetch}}token$(){return this.current&&Date.now()<this.current.renewAt?R(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-Ka):Date.now()+50*6e4}}),P(e=>e.token),kt(()=>this.pending$=null),it(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?Mr(t).pipe(P(n=>n||void 0)):R(void 0)}session$(){let e=this.options;if(e.getToken)return Mr(e.getToken).pipe(P(n=>typeof n=="string"?{token:n}:n));if(e.exchange){let{projectId:n,idToken:o,agents:i}=e.exchange;return Mr(o).pipe(H(s=>jt(this.endpoint,null,oe.exchangeSession,{projectId:n,token:s,agents:i},"exchangeAgentSession")))}let t=e.anonymous;return Mr(t.turnstileToken).pipe(H(n=>jt(this.endpoint,t.publishableKey,oe.anonymousSession,{deviceId:t.deviceId??ai(),turnstileToken:n,agents:t.agents},"createAnonymousAgentSession")))}call$(e,t,n){let o=()=>this.token$().pipe(H(i=>jt(this.endpoint,i,e,t,n)));return o().pipe(Z(i=>i?.code!=="session-expired"&&i?.code!=="unauthorized"?Tt(()=>i):(this.invalidate(),o())))}uploadAttachment(e,t){return Ee(()=>{let n=Xo(t.data),o=t.mimeType||n.type||Ir(t.name);if(!o)throw new M(`Attachment ${t.name}: give its mimeType`,"bad-request");return this.call$(oe.uploadAttachment,{agent:e,name:t.name,mimeType:o,size:n.size},"createAgentAttachmentUpload").pipe(H(i=>Qo(i,n,t.name,this.options.fetch)))})}agents(){return this.call$(oe.sessionAgents,{},"sessionAgents")}conversations(e){return this.call$(oe.conversations,{agent:e},"agentConversations")}agent(e){return{conversation:t=>new jr(this,e,t??null),conversations:()=>this.conversations(e)}}events(e,t=0){return new _(n=>{let o=t,i=new Map,s=new X,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$(oe.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())}}))},d=this.webSocket();if(!d)return p(),s.add(Cr(this.options.pollIntervalMs??1500,this.options.pollIntervalMs??1500).subscribe(()=>p())),s;let f=0,v=!1,h=()=>{s.add(this.token$().pipe(H(m=>ii({url:ni(this.endpoint.url),WebSocket:d,connectionParams:{agentSession:m},query:oe.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 w=Math.min(Ya,1e3*2**f++);s.add(Cr(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)}},jr=class{constructor(e,t,n){this.client=e;this.agent=t;this.id=n}send(e,t={}){let n=t.credential!==void 0?R(t.credential):this.client.credential$();return(t.attachments?.length?B(t.attachments).pipe(qe(i=>this.client.uploadAttachment(this.agent,i)),P(i=>i.id),Cn()):R([])).pipe(H(i=>n.pipe(P(s=>({credential:s,attachments:[...t.attachmentIds??[],...i]})))),H(({credential:i,attachments:s})=>this.client.call$(oe.send,{agent:this.agent,conversationId:this.id,text:e,credential:i,...s.length?{attachments:s}:{}},"sendAgentMessage"))).pipe(_e(i=>this.id=i.conversationId),H(i=>this.client.events(i.conversationId,Math.max(0,i.seq-2)).pipe(It(s=>!((s.type==="done"||s.type==="error")&&s.runId===i.runId),!0))))}events(e){return this.id?e===void 0?this.history().pipe(H(t=>this.client.events(this.id,t.lastSeq??0))):this.client.events(this.id,e):Tt(()=>new M("No conversation yet - send a message first","bad-request"))}history(){return this.id?this.client.call$(oe.conversation,{id:this.id},"agentConversation"):Tt(()=>new M("No conversation yet - send a message first","bad-request"))}abort(){return this.id?this.client.call$(oe.abort,{conversationId:this.id},"abortAgentRun"):R(!1)}};function ai(){let r=globalThis.localStorage;try{let t=r?.getItem(si);if(t&&/^[A-Za-z0-9_-]{16,128}$/.test(t))return t}catch{}let e=globalThis.crypto.randomUUID().replace(/-/g,"");try{r?.setItem(si,e)}catch{}return e}var ua=mn(Ws()),g=mn(Yt());var se=mn(Yt()),fc=/^(https?:|mailto:)/i,ao=/^\s*[-*+]\s+/,Xr=/^\s*\d+[.)]\s+/,dc=/^```\s*([\w+-]*)\s*$/,Bs=/^(#{1,6})\s+(.*)$/;function Jt(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)||Vr.test(o)){let a=Vr.test(o),c=a?Vr:Zn,u=[];for(;n<t.length&&c.test(t[n]);)u.push(oe.html`<li>${Ge(t[n++].replace(c,""))}</li>`);e.push(a?oe.html`<ol>${u}</ol>`:oe.html`<ul>${u}</ul>`);continue}if(!o.trim()){n++;continue}let l=[];for(;n<t.length&&t[n].trim()&&!/^```/.test(t[n])&&!Ms.test(t[n])&&!Zn.test(t[n])&&!Vr.test(t[n]);)l.push(t[n++]);e.push(oe.html`<p>${l.map((a,c)=>c?oe.html`<br />${Ge(a)}`:Ge(a))}</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 Gt(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 Gt(r,function(){return{type:r}});case"fsa":return Gt(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 Gt(r,function(n){return{payload:n,type:r}});case"props":return Gt(r,function(n){return vt(vt({},n),{type:r})});default:throw new Error("Unexpected config.")}}function he(){return{_as:"payload",_p:void 0}}function Gt(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,l=i.length;s<l;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],l=0,a=s.types;l<a.length;l++){var c=a[l];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()),Jt=J("[chat] verifying",he()),Zt=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 Xt;(function(r){r.switchMap="switchMap",r.mergeMap="mergeMap",r.concatMap="concatMap",r.exhaustMap="exhaustMap"})(Xt||(Xt={}));var Us=r=>r!==null&&typeof r=="object";var Ds=r=>r.reduce((e,t)=>(...n)=>e(t(...n))),Xe=dn(G(r=>I(r))),Xr=r=>r.pipe(Xe),Qr=r=>Et(r)?r:r instanceof Promise?V(r):I(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:Ar};function Fs(r={},e={},t){var n;let o=r&&r.reducer$&&r.reducer$.pipe(Xe)||I((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)),l=(r&&r.initialState$&&r.initialState$.pipe(Xe)||I({})).pipe(kt()),a=r&&r.middleware$&&r.middleware$.pipe(Xe)||I([]),c=((n=r?.destroy$)===null||n===void 0?void 0:n.pipe(Xe))||yn,u=Ns[e&&e.actionFlatOp||Xt.concatMap],p=Ns[e&&e.stateFlatOp||Xt.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$:l,middleware$:a,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,l;s.add(r.state$.subscribe(c=>{l=c})),i.init(l),s.add(r.state$.pipe($n(r.actions$),ve(([,c])=>c.type!==Qn)).subscribe(([c,u])=>i.send(u,c)));let a=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(l)});return()=>{var c;s.unsubscribe(),typeof a=="function"&&a(),(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 l=Hs((n=this.config)===null||n===void 0?void 0:n.devTools);l&&(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:I(m=>m)).pipe(M(m=>Ws(m)))}));let{reducer$:a,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,a,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)}),l){let m=zs(this,l);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),I()))):o.pipe(G(i=>(console.error("[Effect] Error:",i),I())))}}function Vs(...r){return(e,t)=>Ee(...r.map(n=>n(e,t)))}var ec=r=>r?.code||"internal",to=r=>I(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(I(Yr()),n.agents().pipe(Ne(1),M(o=>Zt(tc(o,this.ctx))),G(to))):I(gt("unauthorized"))})));this.select$=xt()(e=>Ee(e.pipe(Re(Zt),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(Pt(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,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,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,notice:{kind:"error",code:e}})),ee(Jt,(r,{payload:e})=>({...r,notice:e?{kind:"busy",what:"verifying"}:r.notice?.kind==="busy"&&r.notice.what==="verifying"?null:r.notice})),ee(Zt,(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,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,notice:r.notice?.kind==="busy"?null:r.notice})),ee(Ze,r=>({...r,answering:!1,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,notice:{kind:"error",code:e.data?.code??"internal"}};if(e.type!=="message"||!e.data?.id)return{...r,conversationId:t};let n=ro(e.data);if(r.messages.some(s=>s.id===n.id))return{...r,conversationId:t};let o=[...r.messages],i=n.role==="user"?o.findIndex(s=>rc.test(s.id)&&s.text===n.text):-1;return i>=0?o[i]=n:o.push(n),{...r,conversationId:t,messages:o}}var nn=class{constructor(e,t={}){this.destroy$=new te;let n=new tn(e);this.store=eo({reducer$:I(Ks),initialState$:I({...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."}},oc={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:oc};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(dc);if(i){let l=[];for(n++;n<t.length&&!/^```\s*$/.test(t[n]);)l.push(t[n++]);n++,e.push(se.html`<pre><code data-lang=${i[1]||""}>${l.join(`
|
|
36
|
+
`)}</code></pre>`);continue}let s=o.match(Bs);if(s){e.push(se.html`<p><strong class="h">${Ze(s[2])}</strong></p>`),n++;continue}if(ao.test(o)||Xr.test(o)){let l=Xr.test(o),c=l?Xr:ao,u=[];for(;n<t.length&&c.test(t[n]);)u.push(se.html`<li>${Ze(t[n++].replace(c,""))}</li>`);e.push(l?se.html`<ol>${u}</ol>`:se.html`<ul>${u}</ul>`);continue}if(!o.trim()){n++;continue}let a=[];for(;n<t.length&&t[n].trim()&&!/^```/.test(t[n])&&!Bs.test(t[n])&&!ao.test(t[n])&&!Xr.test(t[n]);)a.push(t[n++]);e.push(se.html`<p>${a.map((l,c)=>c?se.html`<br />${Ze(l)}`:Ze(l))}</p>`)}return e}var hc=/(`[^`]+`)|(\*\*[^*]+\*\*)|(__[^_]+__)|(\*[^*\s][^*]*\*)|(\[[^\]]+\]\([^)\s]+\))|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?'"])/;function Ze(r){let e=[],t=r;for(;t;){let n=t.match(hc);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(se.html`<code>${o.slice(1,-1)}</code>`);else if(n[2]||n[3])e.push(se.html`<strong>${Ze(o.slice(2,-2))}</strong>`);else if(n[4])e.push(se.html`<em>${Ze(o.slice(1,-1))}</em>`);else if(n[5]){let[,i,s]=o.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/)??[];e.push(Vs(i,s))}else e.push(Vs(o,o));t=t.slice(n.index+o.length)}return e}function Vs(r,e){return fc.test(e)?se.html`<a href=${e} target="_blank" rel="noopener noreferrer nofollow">${r}</a>`:r}var bt=function(){return bt=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},bt.apply(this,arguments)};function K(r,e){if(typeof e=="function")return Zt(r,function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return bt(bt({},e.apply(void 0,n)),{type:r})});var t=e?e._as:"empty";switch(t){case"empty":return Zt(r,function(){return{type:r}});case"fsa":return Zt(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 Zt(r,function(n){return{payload:n,type:r}});case"props":return Zt(r,function(n){return bt(bt({},n),{type:r})});default:throw new Error("Unexpected config.")}}function te(){return{_as:"payload",_p:void 0}}function Zt(r,e){return Object.defineProperty(e,"type",{value:r,writable:!1})}var mc=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 Y(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=r.pop(),n=r.reduce(function(o,i){return mc(o,[i.type])},[]);return{reducer:t,types:n}}function Ks(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 Qr=K("[chat] shown",te()),en=K("[chat] connecting"),xt=K("[chat] failed",te()),Xt=K("[chat] verifying",te()),Qt=K("[chat] agents loaded",te()),Xe=K("[chat] pick agent",te()),tn=K("[chat] history loaded",te()),wt=K("[chat] new conversation"),_t=K("[chat] send",te()),rn=K("[chat] add files",te()),nn=K("[chat] remove file",te()),lo=K("[chat] resume",te()),on=K("[chat] event",te()),sn=K("[chat] run ended"),Qe=K("[chat] stop",te());var er;(function(r){r.switchMap="switchMap",r.mergeMap="mergeMap",r.concatMap="concatMap",r.exhaustMap="exhaustMap"})(er||(er={}));var Ys=r=>r!==null&&typeof r=="object";var Gs=r=>r.reduce((e,t)=>(...n)=>e(t(...n))),et=wn(Z(r=>R(r))),an=r=>r.pipe(et),ln=r=>Ot(r)?r:r instanceof Promise?B(r):R(r);function Js([r,e,t]){function n(o,i){return t.length>0?Gs(t)(e)(o,i):e(o,i)}return kn(n,r)}var Zs={switchMap:H,mergeMap:ne,concatMap:qe,exhaustMap:Or};function Xs(r={},e={},t){var n;let o=r&&r.reducer$&&r.reducer$.pipe(et)||R((m,w)=>m),i=new re,s=m=>Ce(r&&r.actionStream$&&r.actionStream$.pipe(et)||ue,t).pipe(ve(Ys),P(ln),u(an),_e(i),m,P(ln)),a=(r&&r.initialState$&&r.initialState$.pipe(et)||R({})).pipe(Pt()),l=r&&r.middleware$&&r.middleware$.pipe(et)||R([]),c=((n=r?.destroy$)===null||n===void 0?void 0:n.pipe(et))||En,u=Zs[e&&e.actionFlatOp||er.concatMap],p=Zs[e&&e.stateFlatOp||er.switchMap],d=m=>m.pipe(p(an),P(ln),p(an)),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 co="@@redux-devtools/JUMP_TO_STATE";function Qs(r){if(!r)return;let e=r===!0?{}:r;return e.enabled===!1?void 0:e}function ea(r){return(e,t)=>t?.type===co?t.state:r(e,t)}function ta(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 X,a;s.add(r.state$.subscribe(c=>{a=c})),i.init(a),s.add(r.state$.pipe(Rn(r.actions$),ve(([,c])=>c.type!==co)).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:co,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 cn=class{constructor(e,t){var n,o,i,s;this.config=e,this.options=t,this._dispatch$=new re,this.dispatch=m=>{this._dispatch$.next(m)};let a=Qs((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:R(m=>m)).pipe(P(m=>ea(m)))}));let{reducer$:l,actions$:c,actionStream$:u,middleware$:p,initialState$:d,destroy$:f,flattenState$:v,shareReplayConfig:h}=Xs(this.config,this.options,this._dispatch$);if(this.state$=Sn([d,l,p]).pipe(P(Js),qe(u),In(d),v,He(f),it(h)),this.state$.subscribe(),this.actions$=c.pipe(it(h)),!((s=this.config)===null||s===void 0)&&s.epic$&&this.config.epic$(this.actions$,this.state$).pipe(He(f)).subscribe({next:m=>this.dispatch(m),error:m=>console.error("[Epic] Error:",m)}),a){let m=ta(this,a);f.subscribe(()=>m())}}};function uo(r={},e={}){return new cn(r,e)}function Me(...r){let e=new Set(r.map(t=>t.type));return t=>t.pipe(ve(n=>e.has(n.type)))}function $t(r={dispatch:!0}){return e=>(t,n)=>{let o=e(t,n);return r.dispatch===!1?o.pipe(ot(),Z(i=>(console.error("[Effect] Error:",i),R()))):o.pipe(Z(i=>(console.error("[Effect] Error:",i),R())))}}function ra(...r){return(e,t)=>Ce(...r.map(n=>n(e,t)))}var vc=r=>r?.code||"internal",po=r=>R(xt(vc(r)));function gc(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 un=class{constructor(e){this.ctx=e;this.connect$=$t()((e,t)=>t.pipe(ve(n=>n.shown),ze(1),H(()=>{let n=this.ctx.client;return n?Se(R(en()),n.agents().pipe(ze(1),P(o=>Qt(gc(o,this.ctx))),Z(po))):R(xt("unauthorized"))})));this.select$=$t()(e=>Ce(e.pipe(Me(Qt),P(({payload:t})=>t.agentId)),e.pipe(Me(Xe),P(({payload:t})=>t))).pipe(ve(t=>!!t),H(t=>{let n=this.ctx.client;return n.conversations(t).pipe(ze(1),H(o=>{let i=o?.[0];return i?n.agent(t).conversation(i.id).history().pipe(ne(s=>B([tn({agentId:t,detail:s}),...s.answering?[lo({agentId:t,conversationId:s.id,afterSeq:s.lastSeq??0})]:[]]))):ue}),Z(po))})));this.run$=$t()(e=>Ce(e.pipe(Me(_t),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(Me(lo),P(({payload:t})=>{let{agentId:n,conversationId:o,afterSeq:i}=t,s=this.conversation(n,o);return{c:s,events:s.events(i)}}))).pipe(H(({c:t,events:n})=>this.follow$(t,n).pipe(He(e.pipe(Me(Qe,Xe,wt))),On(sn())))));this.abort$=$t()(e=>e.pipe(Me(Qe),ne(({payload:t})=>{let{agentId:n,conversationId:o}=t;return!o||!this.ctx.client?ue:this.conversation(n,o).abort().pipe(ot(),Z(()=>ue))})));this.failures$=$t()(e=>e.pipe(Me(xt),_e(({payload:t})=>this.ctx.emit("error",{code:t})),ot()))}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"})}),P(o=>on(o)),Z(po))}};var pn={shown:!1,agents:[],agentId:null,conversationId:null,messages:[],answering:!1,live:null,notice:null,files:[]};function fo(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)}}var yc=/^local:/,na={conversationId:null,messages:[],answering:!1,live:null,notice:null,files:[]},oa=Ks(pn,Y(Qr,(r,{payload:e})=>r.shown||!e?r:{...r,shown:!0}),Y(en,r=>({...r,notice:{kind:"busy",what:"connecting"}})),Y(xt,(r,{payload:e})=>({...r,answering:!1,live:null,notice:{kind:"error",code:e}})),Y(Xt,(r,{payload:e})=>({...r,notice:e?{kind:"busy",what:"verifying"}:r.notice?.kind==="busy"&&r.notice.what==="verifying"?null:r.notice})),Y(Qt,(r,{payload:e})=>({...r,agents:e.agents,agentId:e.agentId,notice:e.agentId?null:{kind:"error",code:"agent-unavailable"}})),Y(Xe,(r,{payload:e})=>({...r,...na,agentId:e})),Y(tn,(r,{payload:e})=>e.agentId!==r.agentId?r:{...r,conversationId:e.detail.id,messages:(e.detail.messages??[]).map(fo),answering:!!e.detail.answering,live:null,notice:e.detail.answering?{kind:"busy",what:"thinking"}:null}),Y(wt,r=>({...r,...na})),Y(_t,(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)}],files:[],answering:!0,notice:{kind:"busy",what:"thinking"}})),Y(rn,(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=Mn(n);return o?{...r,notice:{kind:"error",code:o}}:{...r,files:n,notice:r.notice?.kind==="error"?null:r.notice}}),Y(nn,(r,{payload:e})=>({...r,files:r.files.filter((t,n)=>n!==e),notice:r.notice?.kind==="error"?null:r.notice})),Y(on,(r,{payload:e})=>bc(r,e)),Y(sn,r=>({...r,answering:!1,live:null,notice:r.notice?.kind==="busy"?null:r.notice})),Y(Qe,r=>({...r,answering:!1,live:null,notice:{kind:"info",what:"stopped"}})));function bc(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 xc({...r,conversationId:t},e);if(e.type!=="message"||!e.data?.id)return{...r,conversationId:t};let n=fo(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=>yc.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 xc(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 fn=class{constructor(e,t={}){this.destroy$=new re;let n=new un(e);this.store=uo({reducer$:R(oa),initialState$:R({...pn,...t}),epic$:ra(n.select$,n.run$,n.abort$,n.failures$,n.connect$),destroy$:this.destroy$}),this.state$=this.store.state$.pipe(Tn())}dispatch(e){this.store.dispatch(e)}destroy(){this.destroy$.next(),this.destroy$.complete()}};var ia={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.",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."}},wc={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.",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."}},sa={en:ia,bg:wc};function ho(r,e={}){let t=String(r||"en").toLowerCase().split("-")[0],n=sa[t]??ia;return{...n,...e,errors:{...n.errors,...e.errors??{}}}}var aa=`
|
|
37
37
|
:host {
|
|
38
38
|
--_accent: var(--lf-chat-accent, #4f46e5);
|
|
39
39
|
--_accent-fg: var(--lf-chat-accent-fg, #ffffff);
|
|
@@ -159,6 +159,9 @@ header select {
|
|
|
159
159
|
.msg pre { margin: 6px 0; padding: 8px; overflow-x: auto; border-radius: 8px; background: rgba(0,0,0,0.06); font-size: 13px; }
|
|
160
160
|
.msg code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
|
|
161
161
|
.msg a { color: inherit; }
|
|
162
|
+
.msg.live > :last-child::after { content: '\\258D'; margin-left: 1px; opacity: 0.6; animation: lf-caret 1s steps(1) infinite; }
|
|
163
|
+
@keyframes lf-caret { 50% { opacity: 0; } }
|
|
164
|
+
@media (prefers-reduced-motion: reduce) { .msg.live > :last-child::after { animation: none; } }
|
|
162
165
|
.tools { font-size: 12px; color: var(--_muted); margin-top: 4px; }
|
|
163
166
|
|
|
164
167
|
.welcome { color: var(--_muted); }
|
|
@@ -203,8 +206,28 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
|
|
|
203
206
|
padding: 0 14px; height: 40px; font-weight: 600;
|
|
204
207
|
}
|
|
205
208
|
.send:disabled { opacity: 0.5; cursor: default; }
|
|
209
|
+
.attach { flex: none; height: 40px; }
|
|
210
|
+
.attach:disabled { opacity: 0.5; cursor: default; }
|
|
211
|
+
.files {
|
|
212
|
+
list-style: none; margin: 0; padding: 8px 12px 0; display: flex; flex-wrap: wrap; gap: 6px;
|
|
213
|
+
border-top: 1px solid var(--_border);
|
|
214
|
+
}
|
|
215
|
+
.file {
|
|
216
|
+
display: inline-flex; align-items: center; gap: 2px; max-width: 100%;
|
|
217
|
+
border: 1px solid var(--_border); border-radius: 999px; padding: 2px 2px 2px 10px; font-size: 13px;
|
|
218
|
+
}
|
|
219
|
+
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
|
|
220
|
+
.file-remove {
|
|
221
|
+
border: 0; background: transparent; color: var(--_muted); width: 22px; height: 22px;
|
|
222
|
+
border-radius: 999px; display: grid; place-items: center; padding: 0;
|
|
223
|
+
}
|
|
224
|
+
.file-remove:hover, .file-remove:focus-visible { background: var(--_bot-bg); color: var(--_fg); }
|
|
225
|
+
.file-remove svg { width: 14px; height: 14px; }
|
|
226
|
+
.files + form { border-top: 0; }
|
|
227
|
+
.msg-files { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
|
|
228
|
+
.msg-file { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,0.2); }
|
|
206
229
|
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
207
|
-
`;var
|
|
230
|
+
`;var la="https://lambforge.com/agent-turnstile.html",_c="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit";var dn=null;function $c(r){let e=r.defaultView;return e?.turnstile?Promise.resolve(e.turnstile):(dn||(dn=new Promise((t,n)=>{let o=r.createElement("script");o.src=_c,o.async=!0,o.onload=()=>e.turnstile?t(e.turnstile):n(new Error("turnstile did not load")),o.onerror=()=>{dn=null,n(new Error("turnstile did not load"))},r.head.append(o)})),dn)}function mo(r){let e=r.host.ownerDocument;if(r.sitekey)return $c(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||la),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 rr="lambforge-agent-chat",Ac=g.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"/>`,ca=g.svg`<path d="M18 6 6 18M6 6l12 12"/>`,Sc=g.svg`<path d="M12 5v14M5 12h14"/>`,Ec=g.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"/>`,Cc=[...Pr,".md",".csv",".yaml",".yml",".json",".txt"].join(","),tr=r=>g.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>`,D=class extends g.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 ho(this.locale||this.ownerDocument.documentElement.lang||"en",this.strings)}connect(){return Ee(()=>{let t=new fn({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(kt(()=>{t.destroy(),this.store===t&&(this.store=void 0)}))})}dispatch(t){this.store?.dispatch(t)}OnUpdate(){this.shown&&this.dispatch(Qr(!0))}resolveClient(){if(this.client)return this.client;let t=this.url||void 0;if(this.getToken){let n=this.getToken;this.client=new We({url:t,getToken:()=>n()})}else if(this.tokenUrl){let n=this.tokenUrl;this.client=new We({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 We({url:t,anonymous:{publishableKey:this.publishableKey,turnstileToken:()=>this.verifyHuman()}});else return console.error(`[${rr}] give it a session: token-url, publishable-key, .getToken or .client`),null;return this.client}verifyHuman(){return this.dispatch(Xt(!0)),this.turnstileBox().then(t=>mo({host:t,sitekey:this.turnstileSitekey||null,hostedUrl:this.turnstileUrl||null})).finally(()=>this.dispatch(Xt(!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(_t({agentId:n.agentId,conversationId:n.conversationId,text:i,...o.length?{files:o}:{}}))}}attach(t){let n=Array.from(t??[]);n.length&&this.dispatch(rn(n))}detach(t){this.dispatch(nn(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(Qe({agentId:t.agentId,conversationId:t.conversationId}))}}pick(t){this.dispatch(Xe(t))}startOver(){this.dispatch(wt()),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 g.html`
|
|
208
231
|
<button
|
|
209
232
|
class="launcher"
|
|
210
233
|
part="launcher"
|
|
@@ -215,7 +238,7 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
|
|
|
215
238
|
?hidden=${!o}
|
|
216
239
|
@click=${()=>this.setOpen(!this.open)}
|
|
217
240
|
>
|
|
218
|
-
<slot name="launcher">${
|
|
241
|
+
<slot name="launcher">${tr(Ac)}</slot>
|
|
219
242
|
</button>
|
|
220
243
|
<section
|
|
221
244
|
class="panel"
|
|
@@ -224,7 +247,7 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
|
|
|
224
247
|
aria-label=${s}
|
|
225
248
|
aria-modal=${String(o)}
|
|
226
249
|
?hidden=${!this.shown}
|
|
227
|
-
@keydown=${
|
|
250
|
+
@keydown=${p=>this.onPanelKey(p)}
|
|
228
251
|
>
|
|
229
252
|
<header part="header">
|
|
230
253
|
<span class="title">${s}</span>
|
|
@@ -233,48 +256,84 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
|
|
|
233
256
|
part="picker"
|
|
234
257
|
aria-label=${n.pickAgent}
|
|
235
258
|
?hidden=${t.agents.length<2}
|
|
236
|
-
@change=${
|
|
259
|
+
@change=${p=>this.pick(p.target.value)}
|
|
237
260
|
>
|
|
238
|
-
${t.agents.map(
|
|
261
|
+
${t.agents.map(p=>g.html`<option value=${p.id} ?selected=${p.id===t.agentId}>${p.name}</option>`)}
|
|
239
262
|
</select>
|
|
240
263
|
<button class="icon new" part="new" type="button" title=${n.newChat} aria-label=${n.newChat} @click=${()=>this.startOver()}>
|
|
241
|
-
${
|
|
264
|
+
${tr(Sc)}
|
|
242
265
|
</button>
|
|
243
266
|
<button class="icon close" part="close" type="button" title=${n.close} aria-label=${n.close} @click=${()=>this.setOpen(!1)}>
|
|
244
|
-
${
|
|
267
|
+
${tr(ca)}
|
|
245
268
|
</button>
|
|
246
269
|
</header>
|
|
247
|
-
<div
|
|
248
|
-
|
|
270
|
+
<div
|
|
271
|
+
class="messages"
|
|
272
|
+
part="messages"
|
|
273
|
+
role="log"
|
|
274
|
+
aria-live="polite"
|
|
275
|
+
aria-relevant="additions"
|
|
276
|
+
aria-busy=${String(!!l)}
|
|
277
|
+
>
|
|
278
|
+
${t.messages.length?t.messages.map(p=>this.bubble(p)):this.intro(t)}
|
|
279
|
+
${l?g.html`<div class="msg assistant live" part="message assistant live">${Jt(l.text)}</div>`:""}
|
|
249
280
|
</div>
|
|
250
|
-
<div class="turnstile" ?hidden=${
|
|
281
|
+
<div class="turnstile" ?hidden=${c?.kind!=="busy"||c.what!=="verifying"}></div>
|
|
251
282
|
<div
|
|
252
|
-
class="status ${
|
|
283
|
+
class="status ${c?.kind==="error"?"error":""} ${c?.kind==="busy"?"dots":""}"
|
|
253
284
|
part="status"
|
|
254
285
|
role="status"
|
|
255
|
-
>${this.noticeText(
|
|
256
|
-
|
|
286
|
+
>${this.noticeText(c)}</div>
|
|
287
|
+
${a&&t.files.length?g.html`<ul class="files" part="files" aria-label=${n.attached}>
|
|
288
|
+
${t.files.map((p,d)=>g.html`<li class="file" part="file">
|
|
289
|
+
<span class="file-name" title=${p.name}>${p.name}</span>
|
|
290
|
+
<button type="button" class="file-remove" aria-label=${`${n.removeFile}: ${p.name}`} @click=${()=>this.detach(d)}>
|
|
291
|
+
${tr(ca)}
|
|
292
|
+
</button>
|
|
293
|
+
</li>`)}
|
|
294
|
+
</ul>`:""}
|
|
295
|
+
<form part="composer" @submit=${p=>this.submit(p,t)}>
|
|
296
|
+
${a?g.html`<input
|
|
297
|
+
class="file-input"
|
|
298
|
+
type="file"
|
|
299
|
+
multiple
|
|
300
|
+
accept=${Cc}
|
|
301
|
+
hidden
|
|
302
|
+
@change=${p=>{let d=p.target;this.attach(d.files),d.value=""}}
|
|
303
|
+
/>
|
|
304
|
+
<button
|
|
305
|
+
class="icon attach"
|
|
306
|
+
part="attach"
|
|
307
|
+
type="button"
|
|
308
|
+
title=${n.attach}
|
|
309
|
+
aria-label=${n.attach}
|
|
310
|
+
?disabled=${t.answering}
|
|
311
|
+
@click=${()=>this.shadowRoot?.querySelector(".file-input")?.click()}
|
|
312
|
+
>
|
|
313
|
+
${tr(Ec)}
|
|
314
|
+
</button>`:""}
|
|
257
315
|
<label class="sr-only" for="lf-input">${n.placeholder}</label>
|
|
258
316
|
<textarea
|
|
259
317
|
id="lf-input"
|
|
260
318
|
part="input"
|
|
261
319
|
rows="1"
|
|
262
320
|
placeholder=${n.placeholder}
|
|
263
|
-
@keydown=${
|
|
264
|
-
@input=${
|
|
321
|
+
@keydown=${p=>this.onInputKey(p,t)}
|
|
322
|
+
@input=${p=>this.autosize(p.target)}
|
|
323
|
+
@paste=${p=>this.onPaste(p,a&&!t.answering)}
|
|
265
324
|
></textarea>
|
|
266
325
|
<button class="send" part="send" type="submit" aria-label=${t.answering?n.stop:n.send}>
|
|
267
326
|
${t.answering?n.stop:n.send}
|
|
268
327
|
</button>
|
|
269
328
|
</form>
|
|
270
329
|
</section>
|
|
271
|
-
`}bubble(t){return t.role==="user"?
|
|
272
|
-
${
|
|
273
|
-
${t.tools.length?
|
|
274
|
-
</div>`}intro(t){let n=t.agents.find(o=>o.id===t.agentId);return!n?.welcome&&!n?.suggestions?.length?"":
|
|
275
|
-
${n.welcome?
|
|
276
|
-
${n.suggestions?.length?
|
|
277
|
-
${n.suggestions.map(o=>
|
|
330
|
+
`}bubble(t){return t.role==="user"?g.html`<div class="msg user" part="message user">${t.text}${t.attachments?.length?g.html`<div class="msg-files">${t.attachments.map(n=>g.html`<span class="msg-file">${n}</span>`)}</div>`:""}</div>`:g.html`<div class="msg assistant" part="message assistant">
|
|
331
|
+
${Jt(t.text)}
|
|
332
|
+
${t.tools.length?g.html`<div class="tools">${this.t.usedTools}: ${t.tools.join(", ")}</div>`:""}
|
|
333
|
+
</div>`}intro(t){let n=t.agents.find(o=>o.id===t.agentId);return!n?.welcome&&!n?.suggestions?.length?"":g.html`
|
|
334
|
+
${n.welcome?g.html`<div class="msg assistant welcome">${Jt(n.welcome)}</div>`:""}
|
|
335
|
+
${n.suggestions?.length?g.html`<div class="suggestions">
|
|
336
|
+
${n.suggestions.map(o=>g.html`<button type="button" part="suggestion" @click=${()=>this.send(o)([t])}>${o}</button>`)}
|
|
278
337
|
</div>`:""}
|
|
279
|
-
`}scrollDown(){let t=this.shadowRoot?.querySelector(".messages");t&&(t.scrollTop=t.scrollHeight)}};
|
|
338
|
+
`}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)}};F([(0,g.property)({type:Boolean,reflect:!0})],D.prototype,"open",2),F([(0,g.property)({reflect:!0})],D.prototype,"mode",2),F([(0,g.property)({reflect:!0})],D.prototype,"position",2),F([(0,g.property)({reflect:!0})],D.prototype,"theme",2),F([(0,g.property)()],D.prototype,"agent",2),F([(0,g.property)()],D.prototype,"agents",2),F([(0,g.property)()],D.prototype,"locale",2),F([(0,g.property)({attribute:"title"})],D.prototype,"heading",2),F([(0,g.property)()],D.prototype,"url",2),F([(0,g.property)({attribute:"publishable-key"})],D.prototype,"publishableKey",2),F([(0,g.property)({attribute:"token-url"})],D.prototype,"tokenUrl",2),F([(0,g.property)({attribute:"turnstile-sitekey"})],D.prototype,"turnstileSitekey",2),F([(0,g.property)({attribute:"turnstile-url"})],D.prototype,"turnstileUrl",2),F([(0,g.property)({attribute:!1})],D.prototype,"client",2),F([(0,g.property)({attribute:!1})],D.prototype,"getToken",2),F([(0,g.property)({attribute:!1})],D.prototype,"strings",2),D=F([(0,ua.Component)({Settings:{selector:rr,styles:[(0,g.unsafeCSS)(aa)]},Loading:()=>g.html``,Error:()=>g.html``,State(){return this.connect()},Render:()=>function(r){return this.view(r)}})],D);var hn=document.currentScript,Tc={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(hn&&(hn.dataset.key||hn.dataset.tokenUrl)){let r=()=>{let e=document.createElement(rr);for(let[t,n]of Object.entries(Tc)){let o=hn.dataset[t];o!==void 0&&e.setAttribute(n,o)}document.body.append(e)};document.body?r():document.addEventListener("DOMContentLoaded",r,{once:!0})}})();
|
|
280
339
|
//# sourceMappingURL=agent-chat.js.map
|