openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 3.57 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{dj as t,ej as n,mj as r,nj as i,pj as a}from"./control-ui-boot-shared-DFTSUQQ0.js";import{B as o,C as s,F as c,O as l,Rt as u,S as d,U as f,d as p,g as m,gt as h,j as g,l as _,m as v,s as y,u as b,x}from"./solid-runtime-C416s-HC.js";import{Qn as S,Zn as C}from"./deferred-ui-support-D-VedBtc.js";import{n as w,t as T}from"./en-settings-YsyvL-Mv.js";function E(e){let t=c(()=>{let t=[],n=(e,n,i)=>t.push({text:r(`configPage.deviceSettings.chromeExtension${e}`,i),status:n});if(e.failed===`inspection`)n(`Unknown`,!0),n(`StatusFailed`);else if(e.running||e.failed)n(e.running?`Preparing`:`Failed`,!0);else{let r=e.result,i=r?.installation??e.legacyResult;if(!i)return t;let a=(i.installedProfiles??i.discoveredProfiles)>0,o=i.installedProfiles!==void 0;n(a?`Detected`:o?`NotInstalled`:`Unknown`,!0),a&&i.discoveredProfiles===0&&n(`EnableHint`),r?(n(`Phases.${r.phase}`,!0),n(`Target`,!1,{hostname:r.target.hostname,profile:r.target.profile,port:String(r.target.relayPort)}),r.nextAction!==`none`&&n(`NextActions.${r.nextAction}`),r.connection.state===`connected`&&n(`TabsHint`)):(n(i.nativeHostRegistered?`Phases.waiting_for_connection`:`Failed`),i.nativeHostRegistered&&!a&&n(i.installRequested?`NextActions.open_chrome`:o?`NextActions.install_from_store`:`StatusUnsupported`))}return t});return g(s,{get each(){return t()},children:e=>(()=>{var t=O();return p(t,()=>e.text),_(()=>e.status?`status`:void 0,e=>{m(t,`role`,e)}),t})()})}function D(){let e,t=i()?.nativeDeviceSettings,n=t?S(t):void 0,a=()=>n?.read()?.browser,[f,y]=o(!1),[b,x]=o(),C=c(()=>b(),{loadingValue:void 0}),w=!1,T=!1;h(()=>()=>{w=!0});let D=c(()=>{let e=a();return!e||!t?[]:e.chromeSetupActions?e.chromeSetupActions:n?.read()?.device.platform===`macos`&&t.installChromeExtension?[`install`]:[]}),O=async(t,n)=>{let r=()=>!w&&e.isConnected;y(!0);try{if(a()?.chromeSetupActions===void 0){let e;if(t===`inspect`&&n.chromeExtensionStatus)e=await n.chromeExtensionStatus();else if(t===`install`&&n.installChromeExtension)e=await n.installChromeExtension();else return;if(r()&&D().includes(t))return{result:null,legacyResult:e}}else{let e=await n.setupChromeExtension(t);if(r()&&D().includes(t))return{result:e,legacyResult:null}}}catch(e){if(r())throw e}finally{r()&&(T=!1,y(!1))}},M=n=>{if(!e.isConnected||!t||T||!D().includes(n))return;T=!0;let r=O(n,t);r.catch(()=>{}),x(r)},N=()=>[[`install`,`chromeExtensionSetup`],[`inspect`,`chromeExtensionRefresh`],[`verify`,`chromeExtensionVerify`]].filter(([e])=>D().includes(e));var P=A();return v(()=>t=>e=t,P),P._$owner=u(),p(P,g(l,{get when(){return a()},get children(){var e=k(),t=e.firstChild,n=t.nextSibling;return p(t,()=>r(`configPage.deviceSettings.chromeExtensionHint`)),p(n,g(s,{get each(){return N()},children:([e,t])=>(()=>{var n=j();return n._$$click=()=>M(e),p(n,()=>r(`configPage.deviceSettings.${t}`)),_(()=>f(),e=>{m(n,`disabled`,e)}),n})()})),p(e,g(l,{get when(){return!f()},get fallback(){return g(E,{result:null,running:!0,failed:null})},get children(){return g(d,{get fallback(){return g(E,{result:null,running:!1,failed:`setup`})},get children(){return g(E,{get result(){return C()?.result??null},get legacyResult(){return C()?.legacyResult},running:!1,failed:null})}})}}),null),e}})),P}var O,k,A,j;function M(){return(M=e((()=>{b(),f(),T(),C(),n(),t(),O=x(`<p>`),k=x(`<div class=native-chrome-setup><p></p><div class=native-chrome-setup__actions>`),A=x(`<openclaw-native-chrome-setup>`,1),j=x(`<button type=button class=btn>`),a(w),y([`click`])})))()}export{M as n,D as t};