openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 3.19 kB
JavaScript
import{n as e,r as t}from"./rolldown-runtime-CNOWq4Kh.js";import{ut as n}from"./_4____________________________.js";import{AN as r,EN as i,GN as a,JN as o,dT as s,fT as c,iT as l,mb as u,pb as d,sT as f}from"./_2_____________________________.js";import{B as p,F as m,I as h,O as g,Rt as _,S as v,U as y,d as b,g as x,gt as S,j as C,l as w,m as T,s as E,u as D,x as O,yt as k}from"./_6____________________.js";import{Ht as A,Ut as j}from"./control-ui-boot-new-pHXPNTZp.js";var M=t({showInputDialog:()=>N});function N(e){return I?Promise.resolve(null):(I=!0,u({signal:e.signal,value:null},t=>t.render(()=>P(e,t.finish,()=>t.settled))).finally(()=>{I=!1}))}function P(e,t,r){let a=e.gateway?f(e.gateway):void 0,c,l=!1,[u,d]=h(!1),[y,E]=p(),D=m(()=>y()??null,{loadingValue:null}),O=m(()=>y()?.then(e=>!!e,()=>!0)??!1,{loadingValue:!1}),[j,M]=p(e.defaultValue??``),N=t=>e.requireValue?t.trim():t,P=t=>{let n=N(t),r=a?.read().snapshot.phase===`connected`,i=e.canSubmit?.();return i===!1||a!==void 0&&!r&&i!==!0||e.requireValue===!0&&!n.length||e.requireChange===!0&&n===(e.defaultValue??``)},I=k(function*(e,n){d(!0);try{(yield n)===null&&!r()&&t(e)}finally{l=!1,S(()=>{r()||c.focus()})}});async function L(a){if(a.preventDefault(),r()||l||P(c.value))return;let o=N(c.value),s=e.submit;if(!s){t(o);return}l=!0;let u;try{u=s(o)}catch(e){u=Promise.reject(e instanceof Error?e:new n(i(e)))}E(u),u.catch(()=>void 0),await Promise.resolve(),r()||await I(o,u)}var R=F(),z=R.firstChild,B=z.firstChild,V=B.firstChild.firstChild,H=V.nextSibling,U=B.nextSibling,W=U.firstChild,G=W.nextSibling;return R.addEventListener(`modal-cancel`,e=>{l?e.preventDefault():t(null)}),R.initialFocus=()=>c,R._$owner=_(),z.addEventListener(`submit`,e=>{L(e).catch(()=>void 0)}),b(z,C(A,{get title(){return e.title},get closeDisabled(){return u()},onClose:()=>t(null)}),B),b(V,()=>e.label??e.title),H._$$input=e=>M(e.currentTarget.value),T(()=>e=>{c=e},H),b(B,C(g,{get when(){return!u()},get children(){return C(v,{fallback:e=>C(s,{tone:`danger`,role:`alert`,get children(){return i(e())}}),get children(){return C(g,{get when(){return D()},get children(){return C(s,{tone:`danger`,role:`alert`,get children(){return D()}})}})}})}}),null),U._$owner=_(),W._$$click=()=>t(null),b(W,()=>e.cancelLabel??o(`common.cancel`)),b(G,()=>e.submitLabel??o(`common.save`)),w(()=>({e:e.title,t:e.label??e.title,a:!(e.label&&e.label!==e.title),o:j(),i:u(),n:!u()&&O()?`true`:void 0,s:u(),h:u()||P(j())}),({e,t,a:n,o:r,i,n:a,s:o,h:s},c)=>{e!==c?.e&&x(R,`label`,e),t!==c?.t&&x(R,`description`,t),n!==c?.a&&V.classList.toggle(`sr-only`,n),H.value=r??``,i!==c?.i&&x(H,`disabled`,i),a!==c?.n&&x(H,`aria-invalid`,a),o!==c?.s&&x(W,`disabled`,o),s!==c?.h&&x(G,`disabled`,s)}),R}var F,I;function L(){return(L=e((()=>{D(),y(),r(),l(),a(),d(),j(),c(),F=O(`<openclaw-modal-dialog><form class="oc-dialog input-dialog"><div class=oc-dialog__body><label class=field><span></span><input name=value type=text autocomplete=off spellcheck=false autofocus></label></div><openclaw-modal-actions class=oc-dialog__footer><button type=button class=btn></button><button type=submit class="btn primary">`,1),I=!1,E([`input`,`click`])})))()}export{M as n,N as r,L as t};