openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 8.08 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{GN as t,JN as n,UN as r,_x as i,fN as a,mb as o,mx as s,pN as c,pb as l,qN as u}from"./_2_____________________________.js";import{B as d,C as f,F as p,H as m,O as h,Rt as g,U as _,d as v,f as y,g as b,gt as ee,j as x,l as S,m as C,s as w,u as T,x as E}from"./_6____________________.js";import"./owner-devices-dialog-DlHzLOTK.js";import{n as D,t as O}from"./en-openclaw-id-dialogs-BFGCHK4v.js";import{n as k,t as A}from"./en-openclaw-id-Don6YXzi.js";import{n as j,t as M}from"./feature-lifetime-BHVdXhSD.js";import{r as N,t as P}from"./ui-error-Bk6jJOft.js";import{n as F,t as te}from"./error-message-B7DmySYB.js";import{A as I,j as L,t as R}from"./src-UIxrOiBg.js";import{a as ne,c as re,i as ie,o as ae,s as oe}from"./owner-approval-lifetime-B8hNV4Yn.js";import{a as z,i as se,r as ce,t as B}from"./owner-approval-dialog-CdJ_2bpR.js";async function le(e){return(await e.request(`openclawId.people`,{})).link}async function ue(e){try{return e.rootPub?I(await L(e.rootPub)):null}catch{return null}}function de(e){let t;ee(()=>e.registerElement(t));let i=p(()=>{let t=e.approved.length>0?n(`openclawId.revokeCascade`,{device:e.device.label,devices:e.approved.map(e=>e.label).join(`, `)}):n(`openclawId.revokeOne`,{device:e.device.label}),i=[...new Intl.Segmenter(r(),{granularity:`sentence`}).segment(t)].at(-1)?.index??0,a=e.device.nodePeerKey?[n(`openclawId.revokeNode`,{device:e.device.label})]:[];return i?[t.slice(0,i),...a,t.slice(i)]:[t,...a]});var a=W(),o=a.firstChild,s=o.firstChild,c=s.firstChild,l=s.nextSibling,u=l.firstChild,d=u.nextSibling,m=o.nextSibling,_=m.nextSibling,w=_.nextSibling;return C(()=>n=>{t=n,e.morph(n)},a),v(c,()=>e.device.label),v(l,(()=>{var t=y(()=>e.device.peerKeys.length>0);return()=>t()?n(`openclawId.deviceRemote`):n(`openclawId.deviceLocal`)})(),u),v(l,(()=>{var t=y(()=>e.approver.kind===`kit`);return()=>t()?n(`openclawId.approvedByKit`):y(()=>e.approver.kind===`device`)()?n(`openclawId.approvedByDevice`,{device:e.approver.label}):n(`openclawId.approvedByRemoved`)})(),d),v(a,x(h,{get when(){return e.device.nodePeerKey},get children(){var e=H();return v(e,()=>n(`openclawId.runsTools`)),e}}),m),v(a,x(h,{get when(){return e.isThisBrowser},get children(){var e=H();return v(e,()=>n(`openclawId.thisBrowser`)),e}}),_),v(a,x(h,{get when(){return y(()=>!!e.canRevoke)()?!e.isThisBrowser:e.canRevoke},get children(){return x(h,{get when(){return e.confirming},get fallback(){var t=G();return t._$$click=()=>e.onConfirm(!0),v(t,()=>n(`openclawId.revoke`)),S(()=>e.busy,e=>{b(t,`disabled`,e)}),t},get children(){var t=U(),r=t.firstChild,a=r.nextSibling,o=a.firstChild,s=o.nextSibling;return v(r,x(f,{get each(){return i()},children:e=>(()=>{var t=K();return v(t,e),t})()})),a._$owner=g(),o._$$click=()=>e.onConfirm(!1),v(o,()=>n(`common.cancel`)),s._$$click=()=>e.onRevoke(),v(s,()=>n(`openclawId.revokeConfirm`,{device:e.device.label})),S(()=>({e:e.busy,t:e.busy}),({e,t},n)=>{e!==n?.e&&b(o,`disabled`,e),t!==n?.t&&b(s,`disabled`,t)}),t}})}}),w),S(()=>({e:!!e.confirming,t:e.device.label}),({e,t},n)=>{e!==n?.e&&a.classList.toggle(`openclaw-id-devices__row--confirming`,e),t!==n?.t&&b(c,`title`,t)}),a}function V(e){let t={signal:j(),value:void 0};return o(t,t=>{t.render(()=>{let[r,i]=d(null),[o,c]=d(null),[l,u]=d(null),[_,w]=d(!1),[T,E]=d(!1),[D,O]=d(null),[k,A]=d(!1),j=m(),[M,P]=d(null),F=se(),I=new Map,L=!1,R=async()=>{try{let[n,r]=await Promise.all([le(e.client),e.client.request(`openclawId.status`,{})]);if(w(r.channel===`local_operator`&&n.linked),c((await re(n).catch(()=>void 0))?.devicePub??null),u(await ue(n)),L&&!t.settled){let e=new Set(n.ownerDevices?.map(e=>e.devicePub));await F.collapse([...I].filter(([t])=>!e.has(t)).map(([,e])=>e))}i(n),n.ownerDevices?.some(e=>e.devicePub===D())||O(null)}catch(e){P(N(e,`devices`))}},ae=async t=>{let n=r();if(n&&!L){L=!0,E(!0),P(null);try{let r=await oe(n,t);await e.client.request(`openclawId.authority`,{action:`submit`,statement:r})}catch(e){P(N(e,`remove`))}finally{await R(),L=!1,E(!1)}}};ee(()=>{R()});let z=p(()=>{let e=o();return(r()?.ownerDevices??[]).toSorted((t,n)=>Number(n.devicePub===e)-Number(t.devicePub===e))});var B=Y(),H=B.firstChild,U=H.firstChild,W=U.nextSibling,G=W.nextSibling,X=G.nextSibling,Z=X.nextSibling,me=Z.firstChild,he=me.nextSibling;B.addEventListener(`modal-cancel`,()=>t.finish(void 0)),B._$owner=g();var Q=F.card;typeof Q==`function`||Array.isArray(Q)?C(()=>Q,H):F.card=H,v(U,()=>n(`openclawId.yourDevices`)),v(H,x(s,{class:`openclaw-id-devices__close`,icon:`x`,get label(){return n(`common.close`)},tooltip:!1,onClick:()=>t.finish(void 0)}),W),v(W,()=>n(`openclawId.yourDevicesBody`)),v(H,x(h,{get when(){return M()},children:e=>(()=>{var t=fe();return v(t,x(te,{get error(){return e()}})),t})()}),G),v(G,x(f,{get each(){return z()},keyed:e=>e.devicePub,children:e=>x(de,{get device(){return e()},get isThisBrowser(){return e().devicePub===o()},get approver(){return ie(z(),e())},get approved(){return y(()=>D()===e().devicePub)()?ne(z(),e()):[]},get canRevoke(){return!!o()},get busy(){return T()},get confirming(){return D()===e().devicePub},get morph(){return F.section},registerElement:t=>{let n=e().devicePub;return I.set(n,t),()=>{I.delete(n)}},onConfirm:t=>O(t?e().devicePub:null),onRevoke:()=>void ae(e())})})),b(X,`id`,j);var $=F.section;return typeof $==`function`||Array.isArray($)?C(()=>$,X):F.section=X,v(X,x(h,{get when(){return l()},children:e=>[(()=>{var t=pe(),r=t.firstChild,i=r.nextSibling;return v(r,()=>n(`openclawId.kitOwnerFingerprint`)),v(i,e),t})(),(()=>{var e=K();return v(e,()=>n(`openclawId.recoveryKitLine`)),e})()]})),v(Z,x(h,{get when(){return l()},get children(){var e=q(),t=e.firstChild,r=t.nextSibling;return e._$$click=()=>A(e=>!e),b(e,`aria-controls`,j),v(e,()=>n(`openclawId.securityDetails`),t),v(e,x(a,{name:`chevronDown`}),r),S(()=>k()?`true`:`false`,t=>{b(e,`aria-expanded`,t)}),e}}),me),v(Z,x(h,{get when(){return y(()=>!!_())()?o():_()},get children(){var r=J(),i=r.firstChild;return r._$owner=g(),i._$$click=()=>{t.finish(void 0),ce({client:e.client,onDevices:()=>void V(e)})},v(i,()=>n(`openclawId.approveNewDevice`)),r}}),he),S(()=>({e:n(`openclawId.yourDevices`),t:n(`openclawId.yourDevicesBody`),a:z().length>0,o:n(`openclawId.yourDevices`),i:!!k(),n:!k()}),({e,t,a:n,o:r,i,n:a},o)=>{e!==o?.e&&b(B,`label`,e),t!==o?.t&&b(B,`description`,t),n!==o?.a&&G.classList.toggle(`openclaw-id-owner-enter`,n),r!==o?.o&&b(G,`aria-label`,r),i!==o?.i&&X.classList.toggle(`openclaw-id-owner-enter`,i),a!==o?.n&&b(X,`hidden`,a)}),B})})}var H,U,W,G,K,q,J,Y,fe,pe;function X(){return(X=e((()=>{T(),_(),R(),O(),A(),M(),ae(),P(),t(),l(),i(),c(),F(),B(),z(),H=E(`<span class=chip>`),U=E(`<div class="openclaw-id-devices__confirmation openclaw-id-owner-enter"><div role=note></div><openclaw-modal-actions><button type=button class="btn btn--sm"></button><button type=button class="btn btn--sm danger openclaw-id-devices__confirm-revoke">`,1),W=E(`<div role=listitem class="row openclaw-id-devices__row"><div class="stack openclaw-id-devices__text"><strong class=openclaw-id-devices__label><span class=openclaw-id-devices__name></span></strong><div class="muted openclaw-id-devices__hint"> · <!></div></div><!><!><!>`),G=E(`<button type=button class=openclaw-id-devices__revoke>`),K=E(`<p>`),q=E(`<button type=button class=openclaw-id-devices__security><!><!>`),J=E(`<openclaw-modal-actions><button type=button class="btn primary">`,1),Y=E(`<openclaw-modal-dialog class="openclaw-id-owner-dialog openclaw-id-owner-dialog--devices"><div class="exec-approval-card openclaw-id-devices"><h2 class="exec-approval-title openclaw-id-devices__title"></h2><p class=openclaw-id-devices__description></p><div class="list openclaw-id-devices__list"role=list tabindex=0></div><div class=openclaw-id-devices__kit></div><div class="openclaw-id-devices__footer openclaw-id-owner-enter"><!><!>`,1),fe=E(`<div class="openclaw-id-devices__error openclaw-id-owner-enter"role=alert>`),pe=E(`<dl><dt></dt><dd>`),u(D),u(k),w([`click`])})))()}X();export{V as showOwnerDevicesDialog};