UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 3.38 kB
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{GN as t,Hv as n,JN as r,Vv as i}from"./_2_____________________________.js";import{Ar as a}from"./deferred-ui-support-DZEPWjAk.js";import{B as o,C as s,Dt as c,Rt as l,U as u,V as d,d as f,f as p,g as m,j as h,l as g,m as _,s as v,u as y,x as b}from"./_6____________________.js";import{n as x,t as S}from"./markdown-runtime-CtlJb8xA.js";function C(e){let t=c(()=>[...e.drafts]),n,[u,v]=d(t,{shallow:!0}),[y,b]=o(``),[x,S]=o(),C=t=>e.settled()?!1:!u.includes(t)||!t.isCurrent()?(b(r(`chat.detailPanel.draftRecovery.changed`)),!1):!0,k=async e=>{if(!C(e))return;let t=await i(e.content,()=>C(e));C(e)&&(S(t?e:void 0),b(t?``:r(`chat.detailPanel.draftRecovery.copyFailed`)))};var A=w(),j=A.firstChild,M=j.firstChild,N=M.firstChild.firstChild,P=N.nextSibling,F=M.nextSibling,I=F.nextSibling,L=I.firstChild;return A.addEventListener(`modal-cancel`,()=>e.finish()),A.initialFocus=()=>n,A._$owner=l(),f(N,()=>r(`chat.detailPanel.draftRecovery.review`)),f(P,()=>r(`chat.detailPanel.draftRecovery.description`)),f(j,h(s,{each:u,children:t=>{let i;var o=T(),s=o.firstChild,c=s.firstChild,l=c.nextSibling,d=s.nextSibling.firstChild,h=d.nextSibling,y=h.nextSibling;return _(()=>e=>{i=e},o),f(o,(()=>{var e=p(()=>!!t.context);return()=>e()?[(()=>{var e=E();return f(e,()=>t.context.sessionTitle),e})(),(()=>{var e=D();return f(e,()=>t.context.paneLabel),e})(),(()=>{var e=D();return f(e,()=>t.context.sessionKey),e})()]:void 0})(),s),f(c,()=>t.path),d._$$click=()=>void k(t),f(d,(()=>{var e=p(()=>x()===t);return()=>e()?r(`common.copied`):r(`chat.detailPanel.draftRecovery.copy`,{name:t.name})})()),h._$$click=()=>{C(t)&&a(t.name,t.content)},f(h,()=>r(`chat.detailPanel.draftRecovery.download`,{name:t.name})),y._$$click=()=>{if(!C(t)||!t.discard())return;let r=u.length===1;!r&&i.contains(document.activeElement)&&n.focus(),v(e=>{e.splice(e.indexOf(t),1)}),b(``),r&&e.finish()},f(y,()=>r(`chat.detailPanel.draftRecovery.discard`,{name:t.name})),g(()=>({e:[t.path,t.context?.sessionTitle,t.context?.paneLabel,t.context?.sessionKey].filter(Boolean).join(` — `),t:t.content}),({e,t},n)=>{e!==n?.e&&m(o,`aria-label`,e),l.value=t??``}),o}}),F),f(j,(()=>{var e=p(()=>!!y());return()=>e()?(()=>{var e=O();return f(e,y),e})():void 0})(),I),I._$owner=l(),L._$$click=()=>e.finish(),_(()=>e=>{n=e},L),f(L,()=>r(`chat.detailPanel.draftRecovery.keep`)),g(()=>({e:r(`chat.detailPanel.draftRecovery.review`),t:r(`chat.detailPanel.draftRecovery.description`)}),({e,t},n)=>{e!==n?.e&&m(A,`label`,e),t!==n?.t&&m(A,`description`,t)}),A}var w,T,E,D,O;function k(){return(k=e((()=>{y(),u(),S(),n(),t(),w=b(`<openclaw-modal-dialog><section class="exec-approval-card exec-approval-modal-stack"><div class=exec-approval-header><div><div class=exec-approval-title></div><div class=exec-approval-sub></div></div></div><!><openclaw-modal-actions class=exec-approval-actions><button type=button class=btn autofocus>`,1),T=b(`<section role=group style=overflow-wrap:anywhere><label class=field><span></span><textarea readonly rows=6></textarea></label><div class=exec-approval-actions><button type=button class=btn></button><button type=button class=btn></button><button type=button class="btn danger">`),E=b(`<div class=exec-approval-title>`),D=b(`<div class=exec-approval-sub>`),O=b(`<p role=alert>`),x(),v([`click`])})))()}k();export{C as FileDraftRecoveryDialog};