UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 28 kB
import{n as e,r as t}from"./rolldown-runtime-CNOWq4Kh.js";import{Cs as n,Ho as r,Oa as i,Ul as a,ka as o,lo as s,ol as c,rl as l,xr as u,yr as d,yt as f}from"./control-ui-connection-Bfj9beF_.js";import{BA as p,CO as m,Cy as h,JA as g,KA as _,QA as v,QC as y,SO as ee,Ty as b,XA as x,XC as S,YA as C,ZA as w,ZC as T,_O as E,aM as D,bO as te,dj as O,jA as k,mj as A,nO as ne,nw as re,pj as ie,qA as ae,rM as oe,tO as se,zA as j}from"./control-ui-boot-shared-DFTSUQQ0.js";import{B as M,C as ce,F as N,I as le,J as ue,O as P,Rt as F,S as de,U as fe,_ as pe,a as I,d as L,f as R,g as z,gt as me,j as B,l as V,o as H,p as U,s as he,u as ge,x as W,yt as _e}from"./solid-runtime-C416s-HC.js";import{X as ve,Y as ye}from"./deferred-ui-support-D-VedBtc.js";import{l as G,u as be}from"./route-controls-runtime-Bx6nx3QW.js";import"./connection-surfaces-0y6Akj0M.js";import{n as K,t as xe}from"./gateway-host-BgB-LCkp.js";var q,J;function Y(){return(Y=e((()=>{o(),q={connection:{help:{title:`How to connect`,step1:`Start the gateway on your host machine:`,step2:`Get a tokenized dashboard URL:`,step3:`Paste the Gateway URL and secret above, or open that URL directly.`,docsLink:`Read the docs →`}},login:{unsupportedBrowser:{title:`Update your browser to use OpenClaw`,description:`This browser is missing features the Control UI needs to display menus and dialogs.`,apple:`Use macOS 26.2 or iOS 26.2 or later, with Safari 26.2 or later.`,browsers:`You can also use Chrome or Firefox released within the last six months.`,native:`On an older Mac, open this dashboard in an up-to-date browser instead.`,open:`Open in browser`,opened:`Opened in your default browser.`,failed:`Could not open your browser. Copy this page’s address into an up-to-date browser.`},heading:`Connect to OpenClaw`,lede:`Enter the Gateway URL and secret, or open the one-time link that openclaw dashboard prints on the Gateway host.`,gatewayUrl:`Gateway URL`,gatewaySettings:`Gateway settings`,secret:`Gateway secret`,setupCodeHint:`This is a device setup code for the OpenClaw mobile app, not the Gateway secret. Paste it in the app's Gateway settings instead; the Gateway secret comes from openclaw gateway auth-token --show on the Gateway host.`,secretPlaceholder:`Paste the token or type the password`,runOnHost:`Run on the Gateway host`,connection:{target:`Connecting to {host}`,secretEntered:`secret entered`,noSecret:`no secret`,change:`Change`},showSecret:`Show Gateway secret`,hideSecret:`Hide Gateway secret`,toggleSecretVisibility:`Toggle Gateway secret visibility`,failure:{rawError:`Raw error`,busy:{title:`Gateway busy, retrying…`,summary:`The Gateway is reachable, but the connection could not be opened. This page will retry automatically.`,countdown:`Retrying in {seconds}s…`,retrying:`Retrying now…`},profileUnavailable:{title:`Couldn't verify your account`,summary:`OpenClaw couldn't check your account right now. Please try again shortly.`,stepRetry:`Retry shortly.`,stepAdmin:`If this continues, ask the person who manages OpenClaw to check account access.`},verifiedUserRequired:{title:`Verified identity required`,summary:`This Gateway has named roles enabled. Device and setup tokens cannot identify a person.`,stepIdentity:`Reconnect through the trusted proxy or Tailscale so the Gateway can verify your identity.`,stepSharedSecret:`For trusted local operator access, use the shared Gateway token or password.`},accessDenied:{title:`No access to this Gateway`,summary:`You're signed in, but this Gateway hasn't granted your account access, or that access has ended.`,stepAdmin:`Ask a Gateway administrator to assign your profile a role, or to grant or restore your access.`,stepFindProfile:`Administrators can find your profile with openclaw users list --json, then assign a role with users.setRole.`,stepReconnect:`This page reconnects on its own once access is granted.`},authRequired:{title:`This Gateway expects its token`,passwordTitle:`This Gateway expects its password`,summary:`The Gateway at {host} is reachable, but it needs a matching token or password before this browser can connect.`,stepPaste:`Paste the token from openclaw gateway auth-token --show into Gateway secret.`,stepPassword:`Type the configured Gateway password into Gateway secret.`,stepGenerate:`If no token is configured, run openclaw doctor --generate-gateway-token on the gateway host.`,stepConnect:`Click Connect again after updating the Gateway secret.`},authFailed:{title:`Gateway secret rejected`,summary:`{host} rejected the supplied Gateway secret. Check that it belongs to this Gateway and try again.`,stepDashboard:`Run openclaw dashboard --no-open for a fresh URL, or openclaw gateway auth-token --show to recover the token.`,stepReplace:`Replace the Gateway secret with the token for this Gateway URL.`},bootstrapInvalid:{title:`Pairing link is no longer valid`,summary:`This one-time dashboard link may have expired or already been used. Request a fresh link instead of changing the Gateway secret.`,stepOpen:`Open the fresh link that the command opens or copies in this browser. Pairing links can be used only once and expire after ten minutes.`,stepJson:`If the browser or clipboard is unavailable, run openclaw dashboard --json on the Gateway host and open its browserUrl in this browser.`},trustedProxy:{title:`Proxy authentication required`,summary:`The Gateway is reachable, but it rejected the proxy identity or forwarding information.`,stepSignIn:`Open the configured authenticated proxy or SSO dashboard URL and sign in there, rather than visiting the Gateway directly.`,stepHeaders:`Ask the Gateway administrator to check for missing identity headers and required-header forwarding on WebSocket upgrade requests, and confirm your account is permitted.`,stepNoToken:`A Gateway token cannot replace proxy authentication.`},rateLimited:{title:`Too many failed attempts`,summary:`The Gateway is temporarily limiting authentication attempts for this client.`,stepStop:`Stop retrying from this tab for a moment.`,stepWait:`Wait for the auth limiter to cool down, then reconnect with the corrected credential.`,stepCheckClients:`If this is a shared host, check other clients for repeated bad retries.`},pairing:{title:`Approve this browser`,scopeTitle:`Approve the new access level`,roleTitle:`Approve the new role`,metadataTitle:`Re-approve this browser`,summary:`This browser passed Gateway auth at {host}, but the Gateway has not seen it before. A one-time approval on the Gateway host finishes pairing.`,upgradeSummary:`This browser is already paired with {host}, but it asked for access it was not approved for. Approve the new request on the Gateway host.`,stepDashboard:`Prefer a link? Run openclaw dashboard on the Gateway host and open the one-time URL it prints in this browser.`,stepLatest:`That command prints the exact approve command for the newest pending request; run that one as well.`,stepReconnect:`Once approved, click Connect.`,waiting:`Waiting for approval… this page connects on its own once the request is approved.`,checkNow:`Check now`,declinedTitle:`Access request declined`,declinedSummary:`The operator declined this browser's access request. Automatic retries have stopped. You can request approval again when you are ready.`,expiredTitle:`Access request expired`,expiredSummary:`This browser's access request timed out without approval. Request approval again to continue.`,requestAgain:`Request again`},insecure:{title:`Secure browser context required`,summary:`This page is running over plain HTTP, so the browser cannot create the device identity the Gateway expects.`,stepHttps:`Use HTTPS/Tailscale Serve, or open http://127.0.0.1:18789 on the Gateway host.`,stepAvoidDisable:`Do not use a remote plain-HTTP URL; a token or password cannot replace browser device identity.`},origin:{title:`Browser origin not allowed`,summary:`The Gateway rejected this page origin before accepting the Control UI connection.`,stepAllowedOrigins:`Add this browser origin to gateway.controlUi.allowedOrigins.`,stepFullOrigin:`Use full origins such as http://localhost:5173, not wildcard patterns.`,stepRestart:`Restart or reload the Gateway after changing allowed origins.`},protocol:{title:`Protocol mismatch`,summary:`The served Control UI and the running Gateway do not agree on the supported connection protocol.`,refresh:`Refresh page`,stepDashboard:`Reopen the served dashboard with openclaw dashboard so the UI and Gateway come from the same install.`,stepDevUi:`If using pnpm ui:dev, rebuild or restart the dev UI against the current checkout.`,stepRestart:`Restart the Gateway after updating OpenClaw so it serves the current protocol.`},network:{title:`Gateway unreachable`,summary:`The browser could not reach {host}. Check the address and transport before retrying credentials.`,stepGateway:`Confirm the Gateway is running with openclaw status or openclaw gateway run.`,stepUrl:`Check the Gateway URL and use wss:// when the Gateway is behind HTTPS/Tailscale Serve.`,stepDashboard:`Reopen the dashboard with openclaw dashboard --no-open to recopy the current URL and auth details.`}}}},J=Object.assign(()=>{Object.assign(i.connection.help,q.connection.help),Object.assign(i.login,q.login)},{catalog:q})})))()}function X(e){let t=e.trim(),n=t.toLowerCase().startsWith(`oc-pair://`)?t.slice(10):t;if(!/^[A-Za-z0-9_-]+$/u.test(n))return`unknown`;try{let e=f(n.replace(/-/g,`+`).replace(/_/g,`/`)),t=JSON.parse(new TextDecoder().decode(e));return typeof t==`object`&&t&&`url`in t&&typeof t.url==`string`&&t.url.trim()!==``&&`bootstrapToken`in t&&typeof t.bootstrapToken==`string`&&t.bootstrapToken.trim()!==``?`setup-code`:`unknown`}catch{return`unknown`}}function Z(){return(Z=e((()=>{})))()}function Se(e){return e===l.AUTH_PASSWORD_MISSING||e===l.AUTH_PASSWORD_MISMATCH||e===l.AUTH_PASSWORD_NOT_CONFIGURED}function Q(e,t,n){let r=n.docsHref??`https://docs.openclaw.ai/web/dashboard`,i=ae(e),a=e=>A(`${t}.${e}`,n.stepParams);return{kind:n.kind,placement:n.placement??`status`,tone:n.tone??`danger`,field:n.field,title:a(n.titleKey??`title`),summary:a(n.summaryKey??`summary`),primaryCommand:n.primaryCommand,refreshAction:n.refreshAction,steps:n.stepKeys.map(e=>typeof e==`string`?{text:a(e),commands:[]}:{text:a(e.key),commands:e.commands}),docsHref:r,rawError:i}}function Ce(e){if(e.connected||!e.lastError)return null;let t=e.lastError,n=e.lastErrorCode??null,r=a(t),i=xe(e.gatewayUrl);if(n===`GATEWAY_BUSY`&&e.reconnectPending)return Q(t,`login.failure.busy`,{kind:`busy`,tone:`pending`,stepKeys:[]});if(n===l.AUTH_BOOTSTRAP_TOKEN_INVALID)return Q(t,`login.failure.bootstrapInvalid`,{kind:`bootstrap-invalid`,tone:`warn`,primaryCommand:`openclaw dashboard`,stepKeys:[`stepOpen`,{key:`stepJson`,commands:[`openclaw dashboard --json`]}],docsHref:`https://docs.openclaw.ai/cli/dashboard`});if(n===l.AUTHENTICATED_PROFILE_UNAVAILABLE)return Q(t,`login.failure.profileUnavailable`,{kind:`profile-unavailable`,tone:`pending`,stepKeys:[`stepRetry`,`stepAdmin`],docsHref:`https://docs.openclaw.ai/concepts/user-model#gateway-profile-and-github-credit`});if(n===l.AUTH_VERIFIED_USER_REQUIRED)return Q(t,`login.failure.verifiedUserRequired`,{kind:`verified-user-required`,stepKeys:[`stepIdentity`,`stepSharedSecret`],docsHref:`https://docs.openclaw.ai/gateway/operator-scopes`});if(n===l.OPERATOR_ACCESS_DENIED)return Q(t,`login.failure.accessDenied`,{kind:`access-denied`,tone:`warn`,stepKeys:[`stepAdmin`,{key:`stepFindProfile`,commands:[`openclaw users list --json`]},`stepReconnect`],docsHref:`https://docs.openclaw.ai/gateway/operator-scopes#named-operator-roles`});if(n===l.CONTROL_UI_BUILD_MISMATCH)return Q(t,`chat.sidebar`,{kind:`build-mismatch`,tone:`pending`,titleKey:`serverUpdatedTitle`,summaryKey:`serverUpdatedRefresh`,refreshAction:{label:A(`login.failure.protocol.refresh`)},stepKeys:[],docsHref:`https://docs.openclaw.ai/web/control-ui`});if(n===l.PAIRING_REJECTED||n===l.PAIRING_EXPIRED){let e=n===l.PAIRING_REJECTED;return Q(t,`login.failure.pairing`,{kind:e?`pairing-rejected`:`pairing-expired`,tone:`warn`,titleKey:e?`declinedTitle`:`expiredTitle`,summaryKey:e?`declinedSummary`:`expiredSummary`,stepKeys:[],docsHref:`https://docs.openclaw.ai/web/control-ui/connect-and-pair`})}let o=C(t,n);if(o)return Q(t,`login.failure.pairing`,{kind:`pairing-required`,tone:`pending`,docsHref:`https://docs.openclaw.ai/web/control-ui#device-pairing-first-connection`,titleKey:o.kind===`scope-upgrade-pending`?`scopeTitle`:o.kind===`role-upgrade-pending`?`roleTitle`:o.kind===`metadata-upgrade-pending`?`metadataTitle`:`title`,summaryKey:o.kind===`pairing-required`?`summary`:`upgradeSummary`,primaryCommand:o.requestId?`openclaw devices approve ${o.requestId}`:`openclaw devices approve --latest`,stepKeys:[...o.requestId?[]:[`stepLatest`],{key:`stepDashboard`,commands:[`openclaw dashboard`]},...e.reconnectPending?[]:[`stepReconnect`]],stepParams:{host:i}});if(n===l.AUTH_RATE_LIMITED||r.includes(`too many failed authentication attempts`)||r.includes(`rate limit`))return Q(t,`login.failure.rateLimited`,{kind:`auth-rate-limited`,tone:`warn`,stepKeys:[`stepStop`,`stepWait`,`stepCheckClients`]});if(x(t,n))return Q(t,`login.failure.insecure`,{kind:`insecure-context`,docsHref:`https://docs.openclaw.ai/web/control-ui#insecure-http`,stepKeys:[`stepHttps`,`stepAvoidDisable`]});if(n===l.CONTROL_UI_ORIGIN_NOT_ALLOWED||r.includes(`origin not allowed`))return Q(t,`login.failure.origin`,{kind:`origin-not-allowed`,docsHref:`https://docs.openclaw.ai/web/control-ui/development#debugging%2Ftesting%3A-dev-server-%2B-remote-gateway`,stepKeys:[`stepAllowedOrigins`,`stepFullOrigin`,`stepRestart`]});if(n===l.PROTOCOL_MISMATCH||r.includes(`protocol mismatch`))return Q(t,`login.failure.protocol`,{kind:`protocol-mismatch`,docsHref:`https://docs.openclaw.ai/web/control-ui/development#debugging%2Ftesting%3A-dev-server-%2B-remote-gateway`,refreshAction:{label:A(`login.failure.protocol.refresh`)},stepKeys:[{key:`stepDashboard`,commands:[`openclaw dashboard`]},{key:`stepDevUi`,commands:[`pnpm ui:dev`]},`stepRestart`]});let s=g(e),c=Se(n);if(s===`trusted-proxy`)return Q(t,`login.failure.trustedProxy`,{kind:`trusted-proxy`,stepKeys:[`stepSignIn`,`stepHeaders`,`stepNoToken`],docsHref:`https://docs.openclaw.ai/gateway/trusted-proxy-auth`});if(s===`required`||s===`failed`){let r=s===`required`;return Q(t,`login`,{kind:r?`auth-required`:`auth-failed`,placement:`form`,tone:r?`warn`:`danger`,field:`credential`,titleKey:c?`failure.authRequired.passwordTitle`:r||n===l.AUTH_TOKEN_MISMATCH?`failure.authRequired.title`:`failure.authFailed.title`,summaryKey:r?`failure.authRequired.summary`:(n===l.AUTH_TOKEN_MISMATCH||n===l.AUTH_PASSWORD_MISMATCH)&&X(e.secret??``)===`setup-code`?`setupCodeHint`:`failure.authFailed.summary`,stepKeys:c?[`failure.authRequired.stepPassword`,`failure.authRequired.stepConnect`]:r?[{key:`failure.authRequired.stepPaste`,commands:[`openclaw gateway auth-token --show`]},{key:`failure.authRequired.stepGenerate`,commands:[`openclaw doctor --generate-gateway-token`]},`failure.authRequired.stepConnect`]:[{key:`failure.authFailed.stepDashboard`,commands:[`openclaw dashboard --no-open`,`openclaw gateway auth-token --show`]},`failure.authFailed.stepReplace`],stepParams:{host:i}})}return Q(t,`login.failure.network`,{kind:`network`,placement:`form`,tone:`warn`,field:`url`,stepKeys:[{key:`stepGateway`,commands:[`openclaw status`,`openclaw gateway run`]},`stepUrl`,{key:`stepDashboard`,commands:[`openclaw dashboard --no-open`]}],stepParams:{host:i}})}function we(){return(we=e((()=>{c(),_(),K(),Z(),O()})))()}var Te=t({LoginGate:()=>Qe});function Ee(e){let t=N(()=>{let t=new Set(e.step.commands),n=[...t].map(t=>[t,e.step.text.indexOf(t)]).toSorted(([e,t],[n,r])=>t-r||n.length-e.length),r=[],i=0;for(let[a,o]of n)o<i||(r.push({text:e.step.text.slice(i,o)},{command:a}),t.delete(a),i=o+a.length);r.push({text:e.step.text.slice(i)});for(let e of t)r.push({text:` `},{command:e});return r});return B(ce,{get each(){return t()},keyed:!1,children:e=>B(P,{get when(){return e().command},get fallback(){return e().text},children:e=>B(G,{get command(){return e()}})})})}function De(e){return B(P,{get when(){return e.feedback.steps.length>0},get children(){var t=Pe();return L(t,B(ce,{get each(){return e.feedback.steps},keyed:!1,children:e=>(()=>{var t=Fe();return L(t,B(Ee,{get step(){return e()}})),t})()})),t}})}function Oe(e){var t=Ie(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=n.nextSibling,o=F();return L(r,()=>A(`login.failure.rawError`)),L(i,()=>e.feedback.rawError),z(a,`target`,S),L(a,()=>A(`common.learnMore`)),V(()=>({e:e.feedback.docsHref,t:T()}),({e,t},n)=>{e!==n?.e&&z(a,`href`,e),t!==n?.t&&z(a,`rel`,t),I(a,o)}),t}function ke(e){let t=()=>X(e.model.secret)===`setup-code`,n=()=>e.feedback?.placement===`form`?e.feedback.field:void 0,r=()=>{e.cancelRefresh(),e.model.onConnect()},i=e=>{e.key===`Enter`&&r()};var a=Le(),o=a.firstChild,s=o.firstChild,c=s.nextSibling,l=o.nextSibling,u=l.firstChild,d=u.nextSibling.firstChild,f=d.nextSibling,p=f.firstChild;return L(s,()=>A(`login.gatewayUrl`)),c._$$keydown=i,c._$$input=t=>{e.cancelRefresh(),e.model.onGatewayUrlChange(t.currentTarget.value)},L(u,()=>A(`login.secret`)),d._$$keydown=i,d._$$input=t=>{e.cancelRefresh(),e.model.onSecretChange(t.currentTarget.value)},f._$owner=F(),p._$$click=()=>e.model.onToggleGatewaySecret(),L(p,B(j,{get name(){return e.model.showGatewaySecret?`eye`:`eyeOff`}})),L(l,(()=>{var e=R(()=>!!t());return()=>e()?(()=>{var e=Re();return L(e,()=>A(`login.setupCodeHint`)),e})():t()})(),null),L(a,(()=>{var t=R(()=>!!e.withSubmit);return()=>t()?(()=>{var e=ze();return e._$$click=r,L(e,()=>A(`common.connect`)),e})():e.withSubmit})(),null),V(()=>({e:n()===`url`?`true`:void 0,t:e.model.gatewayUrl,a:e.model.showGatewaySecret?`text`:`password`,o:n()===`credential`?`true`:void 0,i:t()?`login-gate-secret-hint`:void 0,n:e.model.secret,s:A(`login.secretPlaceholder`),h:A(e.model.showGatewaySecret?`login.hideSecret`:`login.showSecret`),r:A(`login.toggleSecretVisibility`),d:e.model.showGatewaySecret?`true`:`false`}),({e,t,a:n,o:r,i,n:a,s:o,h:s,r:l,d:u},m)=>{e!==m?.e&&z(c,`aria-invalid`,e),c.value=t??``,n!==m?.a&&z(d,`type`,n),r!==m?.o&&z(d,`aria-invalid`,r),i!==m?.i&&z(d,`aria-describedby`,i),pe(d,`value`,a),o!==m?.s&&z(d,`placeholder`,o),s!==m?.h&&(f.content=s),l!==m?.r&&z(p,`aria-label`,l),u!==m?.d&&z(p,`aria-pressed`,u)}),a}function Ae(e){let t=()=>A(e.model.secret.trim()?`login.connection.secretEntered`:`login.connection.noSecret`);var n=Be(),r=n.firstChild,i=r.firstChild,a=r.nextSibling.nextSibling;a.firstChild;var o=a.nextSibling.nextSibling;return L(r,B(j,{name:`server`}),i),L(i,()=>A(`login.connection.target`,{host:xe(e.model.gatewayUrl)})),L(a,t,null),L(o,()=>A(`login.connection.change`)),n}function je(e){let t=()=>e.feedback.kind===`pairing-required`&&e.model.reconnectPending,n=()=>Math.max(0,Math.ceil(((e.model.reconnectAt??0)-e.now)/1e3)),r=()=>e.feedback.kind===`pairing-rejected`||e.feedback.kind===`pairing-expired`?A(`login.failure.pairing.requestAgain`):A(t()?`login.failure.pairing.checkNow`:`common.connect`);var i=Ve(),a=i.firstChild,o=a.firstChild,s=o.nextSibling.firstChild,c=s.nextSibling,l=a.nextSibling,u=l.nextSibling,d=u.nextSibling,f=d.nextSibling,p=f.firstChild,m=f.nextSibling,h=m.firstChild,g=h.nextSibling,_=m.nextSibling;return L(o,B(j,{get name(){return Ze[e.feedback.tone]}})),L(s,()=>e.feedback.title),L(c,()=>e.feedback.summary),L(i,B(P,{get when(){return e.feedback.primaryCommand},children:e=>(()=>{var t=He(),n=t.firstChild;return L(n,()=>A(`login.runOnHost`)),L(t,B(G,{get command(){return e()},variant:`hero`}),null),t})()}),l),L(i,B(De,{get feedback(){return e.feedback}}),u),L(i,(()=>{var t=R(()=>e.feedback.kind===`busy`);return()=>t()&&(()=>{var e=Ue();return L(e,(()=>{var e=R(()=>n()>0);return()=>e()?A(`login.failure.busy.countdown`,{seconds:String(n())}):A(`login.failure.busy.retrying`)})()),e})()})(),d),L(i,(()=>{var e=R(()=>!!t());return()=>e()?(()=>{var e=$();return e.firstChild,L(e,()=>A(`login.failure.pairing.waiting`),null),e})():t()})(),f),L(f,B(P,{get when(){return e.feedback.refreshAction},children:t=>(()=>{var n=We();return n._$$click=()=>e.onRefresh(),L(n,B(P,{get when(){return!e.refreshing},get fallback(){return A(`common.refreshing`)},get children(){return B(de,{get fallback(){return A(`common.retry`)},get children(){return e.readRefreshOutcome()??t().label}})}})),V(()=>e.refreshing,e=>{z(n,`disabled`,e)}),n})()}),p),p._$$click=()=>{e.cancelRefresh(),e.model.onConnect()},L(p,r),L(m,B(Ae,{get model(){return e.model}}),h),L(m,B(ke,ue(e,{withSubmit:!1})),g),L(i,B(Oe,{get feedback(){return e.feedback}}),_),V(()=>({e:e.feedback.kind,t:e.feedback.tone}),({e,t},n)=>{e!==n?.e&&z(i,`data-kind`,e),t!==n?.t&&z(i,`data-tone`,t)}),i}function Me(e){var t=Ge(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=n.nextSibling,o=a.nextSibling;return L(r,()=>e.feedback?.title??A(`login.heading`)),L(i,()=>e.feedback?.summary??A(`login.lede`)),L(t,B(ke,ue(e,{withSubmit:!0})),a),L(t,(()=>{var t=R(()=>!!e.feedback);return()=>t()?[B(De,{get feedback(){return e.feedback}}),B(Oe,{get feedback(){return e.feedback}})]:(()=>{var e=Ke(),t=e.firstChild,n=t.nextSibling,r=n.firstChild,i=r.firstChild,a=i.nextSibling,o=r.nextSibling,s=o.firstChild,c=s.nextSibling,l=o.nextSibling,u=n.nextSibling.firstChild,d=F();return L(t,()=>A(`connection.help.title`)),L(r,()=>A(`connection.help.step1`),i),L(r,B(G,{command:`openclaw gateway run`}),a),L(o,()=>A(`connection.help.step2`),s),L(o,B(G,{command:`openclaw dashboard`}),c),L(l,()=>A(`connection.help.step3`)),z(u,`target`,S),L(u,()=>A(`connection.help.docsLink`)),V(()=>T(),e=>{z(u,`rel`,e),I(u,d)}),e})()})(),o),V(()=>({e:U(e.feedback?`login-gate__body login-gate__failure`:`login-gate__body`),t:e.feedback?`status`:void 0,a:e.feedback?`polite`:void 0,o:e.feedback?.kind,i:e.feedback?.tone,n:U(e.feedback?`login-gate__failure-title`:`login-gate__heading`),s:U(e.feedback?`login-gate__failure-summary`:`login-gate__lede`)}),({e,t:n,a,o,i:s,n:c,s:l},u)=>{H(t,e,u?.e),n!==u?.t&&z(t,`role`,n),a!==u?.a&&z(t,`aria-live`,a),o!==u?.o&&z(t,`data-kind`,o),s!==u?.i&&z(t,`data-tone`,s),H(r,c,u?.n),H(i,l,u?.s)}),t}function Ne(e,t){t.style.display=`contents`;let r=N(()=>[e().lastError,e().lastErrorCode,e().lastErrorAuthReason,e().gatewayUrl,e().resourceBasePath,e().secret,e().connected,!!e().reconnectPending],{equals:(e,t)=>e.every((e,n)=>e===t[n])}),[i,a]=M(()=>{r()}),o=N(()=>i()?.result.then(()=>null),{loadingValue:void 0}),[c,l]=le(!1),[u,f]=M(Date.now());ve(1e3,()=>f(Date.now()),{enabled:()=>!!e().reconnectPending&&e().lastErrorCode===`GATEWAY_BUSY`&&(e().reconnectAt??0)>u(),immediate:!0});let p,m=()=>{p?.retired.resolve(),p=void 0},g=()=>{m(),a(void 0)},_=e=>{let n=t.props;return p===e&&t.isConnected&&n!==void 0&&!n.connected&&!n.reconnectPending&&[`lastError`,`lastErrorCode`,`lastErrorAuthReason`,`gatewayUrl`,`resourceBasePath`,`secret`].every(t=>n[t]===e.props[t])},v=N(()=>Ce(e()));me(()=>{let e=s(t,`login-gate-disconnect`,g),n=s(t,`login-gate-props-change`,()=>{p&&!_(p)&&m()});return()=>{m(),e(),n()}});let y=_e(function*(e,t){try{_(e)&&l(!0);let n=yield Promise.race([t,e.retired.promise]);if(_(e)&&!n)throw Error(`Control UI refresh did not reload the document`)}catch(t){if(_(e))throw t}finally{p===e&&m()}}),b=async()=>{p&&!_(p)&&m();let e=t.props;if(!e||p||!t.isConnected||e.connected||e.reconnectPending||!Ce(e)?.refreshAction||!ee(!0))return;let n={props:e,retired:Promise.withResolvers()};p=n;let r=te({canReload:()=>_(n)}),i=y(n,r);a({result:i}),await i.catch(()=>void 0)},x=()=>e().branding??se(),S=()=>e().branding?.brandIcon??(e().mascot===`none`?`mark`:`claw`);var C=qe(),w=C.firstChild,T=w.nextSibling,E=T.firstChild,D=E.firstChild,O=E.nextSibling,k=O.nextSibling;return C._$$mousedown=e=>{e.target===e.currentTarget&&oe(e)},w._$owner=F(),L(E,(()=>{var t=R(()=>S()===`claw`);return()=>t()?(()=>{var t=Je();return V(()=>d(`favicon.svg`,n(e().resourceBasePath)),e=>{z(t,`src`,e)}),t})():(()=>{var e=Ye();return L(e,(()=>{var e=R(()=>x().brandIcon!==`claw`&&x().brandIcon!==`mark`);return()=>e()?B(h,{get branding(){return x()},"aria-hidden":`true`}):B(j,{name:`mark`})})()),e})()})(),D),L(D,()=>x().brandName),L(T,B(P,{get when(){return R(()=>v()?.placement===`status`)()?v():null},get fallback(){return B(Me,{get model(){return e()},get feedback(){return v()},cancelRefresh:g})},children:t=>B(je,{get model(){return e()},get feedback(){return t()},cancelRefresh:g,get refreshing(){return c()},readRefreshOutcome:o,onRefresh:()=>void b(),get now(){return u()}})}),O),L(T,(()=>{var t=R(()=>!!e().onOpenGatewaySettings);return()=>t()?(()=>{var t=Xe(),n=t.firstChild;return n._$$click=()=>e().onOpenGatewaySettings?.(),L(n,()=>A(`login.gatewaySettings`)),t})():e().onOpenGatewaySettings})(),k),V(()=>v()?.placement??`form`,e=>{z(T,`data-mode`,e)}),C}var Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,$,We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe;function $e(){return($e=e((()=>{ge(),fe(),r(),m(),D(),u(),E(),ne(),Y(),y(),re(),K(),Z(),O(),ye(),v(),we(),be(),p(),b(),k(),Pe=W(`<ol class=login-gate__failure-steps>`),Fe=W(`<li>`),Ie=W(`<footer class=login-gate__foot><details class=login-gate__failure-detail><summary></summary><div class="login-gate__failure-raw mono"></div></details><a class="session-link login-gate__failure-docs">`),Le=W(`<div class=login-gate__form><div class=field><label for=login-gate-url></label><input id=login-gate-url inputmode=url autocapitalize=none autocorrect=off autocomplete=off spellcheck=false enterkeyhint=go placeholder=wss://gateway.example:443></div><div class=field><label for=login-gate-credential></label><span class=settings-secret><input id=login-gate-credential autocomplete=off spellcheck=false enterkeyhint=go><openclaw-tooltip><button type=button class=settings-secret__toggle>`,1),Re=W(`<p id=login-gate-secret-hint class=muted role=status>`),ze=W(`<button class="btn primary login-gate__connect">`),Be=W(`<summary><span class=login-gate__connection-target><span></span></span> <span class=login-gate__connection-cred>· </span> <span class=login-gate__connection-change>`),Ve=W(`<section class="login-gate__body login-gate__failure"role=status aria-live=polite><div class=login-gate__status-head><span class=login-gate__status-icon aria-hidden=true></span><div class=login-gate__status-text><h1 class=login-gate__failure-title></h1><p class=login-gate__failure-summary></p></div></div><!><!><!><div class=login-gate__actions><button class="btn login-gate__connect"></button></div><details class=login-gate__connection><!><!></details><!>`),He=W(`<div class=login-gate__hero><span class=login-gate__hero-label>`),Ue=W(`<p class=login-gate__retry aria-live=off>`),$=W(`<p class=login-gate__failure-summary><span class=session-run-spinner aria-hidden=true>`),We=W(`<button type=button class="btn primary login-gate__failure-refresh">`),Ge=W(`<section><div class=login-gate__status-text><h1></h1><p></p></div><!><!>`),Ke=W(`<details class=login-gate__help><summary class=login-gate__help-title></summary><ol class=login-gate__steps><li><!><!></li><li> <!></li><li></li></ol><div class=login-gate__docs><a class=session-link href=https://docs.openclaw.ai/web/dashboard>`),qe=W(`<div class=login-gate><openclaw-toast-host></openclaw-toast-host><div class=login-gate__card><header class=login-gate__brand><span class=login-gate__brand-name></span></header><!><!>`,1),Je=W(`<img class=login-gate__logo alt>`),Ye=W(`<span class="login-gate__logo login-gate__logo--neutral"aria-hidden=true>`),Xe=W(`<footer class=login-gate__recovery><button type=button class="btn btn--ghost">`),ie(J),Ze={pending:`shieldEllipsis`,warn:`clock`,danger:`shieldAlert`},Qe=w(`openclaw-login-gate`,(e,t)=>B(P,{get when(){return e.props},children:e=>Ne(e,t)}),{properties:{props:{default:void 0,attribute:!1}},disconnected:e=>e.dispatchEvent(new Event(`login-gate-disconnect`)),propertyChanged:e=>e.dispatchEvent(new Event(`login-gate-props-change`))}),he([`input`,`keydown`,`click`,`mousedown`])})))()}export{Y as a,Z as i,Te as n,J as o,X as r,$e as t};