openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
4 lines • 2.82 kB
JavaScript
import{n as e}from"./rolldown-runtime-8BhlS34s.js";import{qr as t}from"./control-ui-foundation-ZY_Flbbd.js";import{cc as n,hu as r,lu as i,sc as a,su as o,uu as s}from"./control-ui-core-3P365fbR.js";import{p as c}from"./control-ui-core-CFW9Qtjn.js";import{$ as l,Y as u,ct as d,nt as f,ut as p}from"./lit-runtime-P5vbNq6b.js";import{Al as m,jl as h}from"./control-ui-boot-shared-DoKu-5Ju.js";import{R as g,z as _}from"./control-ui-boot-shared-73R4ErOy.js";import{On as v,Tn as y}from"./control-ui-boot-shared-CcmBeh0v.js";import{Ai as b,ji as x}from"./control-ui-boot-shared-CApmg5ot.js";import{a as S,o as C}from"./control-ui-boot-new-BTHisEC4.js";var w;function T(){return(T=e((()=>{u(),f(),s(),m(),i(),n(),S(),_(),y(),x(),h(),w=class extends o{constructor(...e){super(...e),this.sessionKey=``,this.image=null,this.subscriptions=new a(this).watch(()=>this.context?.gateway,(e,t)=>e.subscribe(()=>{this.closeImage(),t()})).watch(()=>this.context?.chatSubmissions,(e,t)=>e.subscribeCreate(()=>{this.closeImage(),t()})).watch(()=>this.context?.placementStartup,(e,t)=>e.subscribe(t)),this.closeImage=()=>{this.image?.release?.(),this.image=null}}disconnectedCallback(){this.closeImage(),this.subscriptions.clear(),super.disconnectedCallback()}render(){let e=this.context.gateway.snapshot,t=e.selfUser?.identity,n=c(this.context,this.sessionKey),i=n?.phase===`failed`,a=n?.phase===`cancelled`,o=n?.action===`check-delivery`,s=!i&&!a,u=n?.initialTurn,d=i&&n?n.discardAndReload?{label:r(`newSession.discardUnsavedAndReload`),onClick:n.discardAndReload}:n.retryable?{label:r(o?`chat.queue.checkDelivery`:`common.retry`),onClick:()=>this.context.placementStartup.retry(n.sessionKey)}:void 0:void 0,f=u?b({text:u.text,mentions:u.mentions,attachments:u.attachments,createdAt:u.createdAt},`available`):this.context.chatSubmissions.readCreateMessage(this.sessionKey);return l`<section class="chat" aria-busy=${String(s)}>
${C({error:i?n.error??r(o?`chat.queue.checkDeliveryHelp`:`newSession.createFailed`):null,errorAction:d?{...d,disabled:e.phase!==`connected`||!e.client?.recoveryScopeReady}:void 0,pendingMessage:f,userId:t?.type===`profile`?t.id:null,submitting:s,statusLabel:e.phase===`connected`?g(null,n):r(`connection.reconnecting`),completion:a?{label:n.error??r(`newSession.placementCancelled`)}:i?{label:r(o?`chat.queue.deliveryUnconfirmed`:`chat.queue.notSent`)}:void 0,renderDraft:()=>l`<div role="status">${r(`connection.reconnecting`)}</div>`,onOpenImage:e=>{this.closeImage(),this.image=e}})}
</section>
${v(this.image,this.closeImage)}`}},t([p({attribute:!1})],w.prototype,`context`,void 0),t([p()],w.prototype,`sessionKey`,void 0),t([d()],w.prototype,`image`,void 0),customElements.get(`openclaw-pending-session-create`)||customElements.define(`openclaw-pending-session-create`,w)})))()}T();