import{n as e}from"./rolldown-runtime-DkW27tQK.js";import{er as t}from"./control-ui-foundation-CeFMP1Ly.js";import{fl as n,ml as r}from"./control-ui-core-pH6nakZ-.js";import{J as i,W as a,Z as o,at as s}from"./lit-runtime-BEtFSUCp.js";import{m as c,p as l}from"./control-ui-core-DGVkFhVB.js";import{Ht as u,qt as d}from"./control-ui-core-Br5DB0Zj.js";import{In as f,Ln as p}from"./control-ui-boot-wpHCbPL9.js";import{Dr as m,Er as h,Or as g,Tr as _}from"./control-ui-boot-Cdpgu1Gm.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((()=>{p(),a(),o(),c(),_(),u(),r(),m(),y=class extends n{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 i``;let t=this.store?.get(this.targetSessionKey);if(t===void 0)return i`

${d(`sessionProgressCard.widgetLoading`)}

`;if(t===null)return i`

${d(`sessionProgressCard.widgetEmpty`)}

`;let n=this.context?.sessions?.state.result?.sessions.find(e=>e.key===this.targetSessionKey);return h(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}},t([f({context:l,subscribe:!0})],y.prototype,`context`,void 0),t([s({attribute:!1})],y.prototype,`widget`,void 0),t([s({attribute:!1})],y.prototype,`sessionKey`,void 0),t([s({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})=>i` `})))()}x();export{b as renderSessionProgressWidget}; //# sourceMappingURL=session-progress-BodToZtH.js.map