UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

23 lines 3.13 kB
import{n as e}from"./rolldown-runtime-DkW27tQK.js";import{R as t,wr as n,z as r}from"./control-ui-foundation-Cydpkyqa.js";import{Sc as i,bc as a}from"./control-ui-core-Rwzhj6nO.js";import{$ as o,K as s,X as c,st as l}from"./lit-runtime-CV_MH99K.js";import{_ as u,g as d}from"./control-ui-core-YphAl4aM.js";import{Yt as f,en as p}from"./control-ui-core-vvcQQV2m.js";import{ct as m,d as h,lt as g,m as _}from"./control-ui-boot-chat-_QSl8fbH.js";function v(e){let t=e?.props?.sessionKey;return typeof t==`string`&&t.trim()?t.trim():void 0}var y,b;function x(){return(x=e((()=>{r(),s(),o(),u(),h(),f(),i(),m(),y=class extends a{constructor(...e){super(...e),this.sessionKey=``,this.active=!0,this.targetSessionKey=``,this.retryLoad=()=>{!this.store||!this.targetSessionKey||this.store.load(this.targetSessionKey).catch(()=>void 0)}}connectedCallback(){super.connectedCallback(),this.syncStore()}willUpdate(){this.syncStore()}disconnectedCallback(){this.releaseStore(),super.disconnectedCallback()}render(){let e=this.store?.getError(this.targetSessionKey);if(e)return c`<div class="board-widget__plugin-loading" data-test-id="session-progress-error" role="alert" > <span >${p(e===`access-denied`?`sessionProgressCard.widgetAccessDenied`:`sessionProgressCard.widgetUnavailable`)}</span > ${e===`unavailable`?c`<button class="btn btn--sm" type="button" @click=${this.retryLoad}> ${p(`common.retry`)} </button>`:null} </div>`;let t=this.store?.get(this.targetSessionKey);if(t===void 0)return c`<p class="board-widget__plugin-loading"> ${p(`sessionProgressCard.widgetLoading`)} </p>`;if(t===null)return c`<p class="board-widget__plugin-loading"> ${p(`sessionProgressCard.widgetEmpty`)} </p>`;let n=this.context?.sessions?.state.result?.sessions.find(e=>e.key===this.targetSessionKey);return _(t,`board`,void 0,n?.status,n?.startedAt,n?.endedAt)}syncStore(){let e=v(this.widget)??this.sessionKey.trim(),t=this.active&&this.context?g(this.context.gateway):void 0;(t!==this.store||e!==this.targetSessionKey)&&(this.releaseStore(),this.store=t,this.targetSessionKey=e,t&&e&&(t.watch(this,[e]),this.unsubscribe=t.subscribe(()=>this.requestUpdate()),this.unsubscribeSessions=this.context?.sessions?.subscribe(()=>this.requestUpdate())))}releaseStore(){this.store?.unwatch(this),this.unsubscribe?.(),this.unsubscribeSessions?.(),this.store=void 0,this.unsubscribe=void 0,this.unsubscribeSessions=void 0}},n([t({context:d,subscribe:!0})],y.prototype,`context`,void 0),n([l({attribute:!1})],y.prototype,`widget`,void 0),n([l({attribute:!1})],y.prototype,`sessionKey`,void 0),n([l({attribute:!1})],y.prototype,`active`,void 0),customElements.get(`openclaw-session-progress-widget`)||customElements.define(`openclaw-session-progress-widget`,y),b=({widget:e,sessionKey:t,active:n})=>c` <openclaw-session-progress-widget .widget=${e} .sessionKey=${t} .active=${n} ></openclaw-session-progress-widget> `})))()}x();export{b as renderSessionProgressWidget}; //# sourceMappingURL=session-progress-BHGEJjf9.js.map