UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

2 lines • 2.03 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_1____________________________.css","./_0____________________________________.css"])))=>i.map(i=>d[i]); import{n as e,r as t}from"./rolldown-runtime-CNOWq4Kh.js";import{$u as n,Qu as r,hi as i,li as a,oi as o}from"./_4____________________________.js";import{AN as s,EN as c,GN as l,fk as u,mk as d,qN as f}from"./_2_____________________________.js";import{N as p,P as m}from"./deferred-ui-support-DZEPWjAk.js";import{c as h,d as g,f as _,s as v,u as y}from"./template-draft-runtime-DZoxdWm2.js";var b=t({openTemplateCreator:()=>C});async function x(e,t){let n=await T.load().then(e=>({loaded:e}),e=>({error:e}));t.loading=!1;let r=t.pending;if(!r)return;let{agentId:i,client:o,revision:s}=r,l=()=>t.pending===r&&e.gateway.snapshot.client===o&&e.gateway.connectionRevision===s&&v(e);try{if(l()){if(`error`in n)throw n.error;let t=n.loaded.templateCreatorFlow(e);l()&&(r.review?t.open(i,r.review.draftId,r.review.sessionKey):await t.start(i))}}catch(t){l()&&d({severity:`error`,message:c(t),actionLabel:a(`common.retry`),onAction:()=>S(e,i,r.review)})}finally{t.pending===r&&(t.pending=null)}}function S(e,t,n){let r=e.gateway.snapshot.client,i=y(e);if(!r||i){n&&i!==`loading`&&d({severity:`warning`,message:a(i===`disabled`?`templatesDraft.reviewDisabled`:`templatesDraft.reviewUnavailable`),...i===`disabled`?{actionLabel:a(`templatesDraft.openLabs`),onAction:()=>e.navigate(`labs`)}:{}});return}let o=m(e),s=e.gateway.connectionRevision;(n||o.flow?.busy!==`starting`&&(o.pending?.client!==r||o.pending.revision!==s))&&(o.pending={agentId:t,client:r,revision:s,...n?{review:n}:{}},o.loading||(o.loading=!0,x(e,o)))}function C(e,t){S(e,t.agentId,{draftId:t.draftId,sessionKey:t.sessionKey})}function w(e,t){if(t&&v(e))return()=>S(e,t)}var T;function E(){return(E=e((()=>{o(),g(),s(),l(),u(),p(),h(),n(),f(_),T=i(()=>r(()=>import(`./template-creator-runtime-DqedCm1e.js`).then(e=>(e.n(),e.t)),__vite__mapDeps([0,1]),import.meta.url))})))()}export{E as n,w as r,b as t};