UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 3.46 kB
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{Wo as t,li as n,oi as r}from"./_4____________________________.js";import{cl as i,dl as a,fN as o,iP as s,ll as c,nP as l,pN as u,rP as d,ul as f}from"./_2_____________________________.js";import{d as p,g as m,h,j as g,l as _,m as v,n as y,r as b,s as x,u as S,x as C}from"./_6____________________.js";import{Ft as w,It as T,Rt as E}from"./control-ui-boot-chat-styles-DMRbEm40.js";import{i as D,n as O,r as k}from"./chat-selection-popup-view-DkLqqanN.js";function A(e){if(e.readSignal?.aborted)return;E();let r,c,u,d,x,S,C=()=>{E(),e.onCancel?.()},w=()=>{(e.readSignal?.aborted||e.onSave(c.value)!==!1)&&E()},O=()=>{let t=c.scrollTop;c.style.height=`auto`,c.style.height=`${c.scrollHeight}px`,c.scrollTop=t,D(r,e.anchorElement?.getBoundingClientRect()??e.anchorRect)},A=e=>{if(e.target===c&&!f(e)&&(s(l.sendMessage,e)||s(l.modifiedEnter,e))&&(e.preventDefault(),w()),e.key===`Tab`){let t=[c,u,d,x,S].filter(e=>e.getClientRects().length>0),n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())}},M=h(()=>g(y,{get mount(){return document.body},get children(){var t=j(),s=t.firstChild,l=s.nextSibling,f=l.nextSibling.firstChild,h=f.nextSibling,y=h.nextSibling;return t._$$keydown=A,v(()=>e=>{r=e},t),b(s,`blur`,i),b(s,`keyup`,i,!0),b(s,`compositionend`,a),s._$$input=O,v(()=>e=>{c=e},s),l._$$click=w,v(()=>e=>{u=e},l),p(l,g(o,{name:`cornerDownLeft`})),f._$$click=()=>{E(),e.readSignal?.aborted||(e.onDelete??e.onCancel)?.()},v(()=>e=>{d=e},f),p(f,g(o,{name:`trash`})),h._$$click=C,v(()=>e=>{x=e},h),p(h,()=>n(`common.cancel`)),y._$$click=w,v(()=>e=>{S=e},y),p(y,()=>n(`common.save`)),_(()=>({e:!!e.expanded,t:n(`chat.messages.annotationEditor`),a:e.comment,o:n(`chat.messages.annotationComment`),i:n(`chat.messages.annotationComment`),n:n(`chat.messages.saveAnnotation`),s:n(`chat.messages.deleteAnnotation`),h:n(`chat.messages.deleteAnnotation`),r:n(`common.cancel`),d:n(`common.save`)}),({e,t:n,a:r,o:i,i:a,n:o,s:c,h:u,r:d,d:p},g)=>{e!==g?.e&&t.classList.toggle(`chat-annotation-editor--expanded`,e),n!==g?.t&&m(t,`aria-label`,n),s.value=r??``,i!==g?.o&&m(s,`placeholder`,i),a!==g?.i&&m(s,`aria-label`,a),o!==g?.n&&m(l,`aria-label`,o),c!==g?.s&&m(f,`aria-label`,c),u!==g?.h&&m(f,`title`,u),d!==g?.r&&m(h,`aria-label`,d),p!==g?.d&&m(y,`aria-label`,p)}),t}}),document.createElement(`div`)),N=e.comment,P=k(r,O,e.paneId,M,e.onCancel,()=>c.value===N);e.sourceRange&&typeof Highlight<`u`&&(CSS.highlights.set(`openclaw-comment`,new Highlight(e.sourceRange)),t(P,`abort`,()=>CSS.highlights.delete(`openclaw-comment`),{once:!0}));let F=()=>E();if(e.readSignal){let n=t(e.readSignal,`abort`,F,{once:!0});t(P,`abort`,n,{once:!0})}return c.focus({preventScroll:!0}),c.setSelectionRange(c.value.length,c.value.length),()=>{T(r)&&D(r,e.anchorElement?.getBoundingClientRect()??e.anchorRect)}}var j;function M(){return(M=e((()=>{S(),u(),r(),c(),d(),O(),w(),j=C(`<div class=chat-annotation-editor role=dialog><textarea rows=1></textarea><button type=button class="btn primary chat-annotation-editor__confirm"></button><div class=chat-annotation-editor__controls><button type=button class="oc-icon-button chat-annotation-editor__delete"></button><button type=button class=btn></button><button type=button class="btn primary">`),x([`keydown`,`input`,`keyup`,`click`])})))()}M();export{A as showChatAnnotationEditor};