UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

2 lines • 32 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_1____________________________.css","./_0____________________________________.css"])))=>i.map(i=>d[i]); import{n as e,r as t}from"./rolldown-runtime-CNOWq4Kh.js";import{$u as n,An as r,Bo as i,Ca as a,Mn as o,Mu as s,Pc as c,Qu as l,Ta as u,Wo as d,Xl as f,at as p,mi as m,pi as h,ql as g,qs as _,rt as v,ta as y,wa as ee,zo as te}from"./_4____________________________.js";import{$w as b,CN as x,CP as ne,GN as S,JN as C,MN as w,Qw as T,Qy as re,SN as E,TN as D,XM as O,Xk as ie,Zk as k,bP as ae,cl as A,dP as oe,dl as se,eT as ce,eb as le,fN as j,fr as ue,jN as de,lP as fe,ll as pe,pN as me,pT as he,pr as ge,qN as _e,rA as ve,tA as ye,ul as be,wN as xe,xN as Se}from"./_2_____________________________.js";import{B as M,C as N,F as P,I as Ce,J as we,O as F,Rt as I,S as Te,U as Ee,W as De,_ as Oe,a as ke,d as L,f as R,g as z,gt as Ae,j as B,l as V,o as H,p as U,r as W,s as je,u as Me,w as Ne,x as G,yt as Pe}from"./_6____________________.js";import{nt as Fe,tt as Ie}from"./control-ui-boot-chat-styles-DMRbEm40.js";import{n as Le,t as K}from"./connect-command-BZS_TVWX.js";import"./connection-surfaces-DPZ2HX3C.js";import{n as Re,t as ze}from"./gateway-host-CR7Bxa4O.js";var q,J;function Y(){return(Y=e((()=>{m(),q={connection:{help:{title:`How to connect`,step1:`On the computer where OpenClaw is installed, start the Gateway:`,step2:`Get a one-time sign-in link:`,step3:`Enter the Gateway URL and secret above, or open the link.`,docsLink:`Read the docs →`}},login:{unsupportedBrowser:{title:`Update your browser to use OpenClaw`,description:`This browser is missing features OpenClaw 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 page in an up-to-date browser instead.`,open:`Open in browser`,opened:`Opened in your default browser.`,failed:`Couldn’t 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 from openclaw dashboard on the computer running OpenClaw.`,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 computer running OpenClaw`,browserPair:{action:`Pair this browser`,open:`Pair with a code instead`,back:`Sign in with URL and secret`,intro:`Pair your own browser for administrator access. This is not a guest invitation. Get a code here, then approve it on the Gateway host.`,runOnGatewayHost:`Run on the Gateway host`,reconnecting:`Connection interrupted. Retrying with the same code…`,cancelling:`Withdrawing the request on the Gateway…`,cancelled:`Pairing request withdrawn.`,cancelFailed:`Could not confirm cancellation. The request may still be approved. Retry cancellation.`,retryCancel:`Retry cancellation`,alreadyApproved:`This browser was already approved. Cancel did not revoke its access. Choose Continue to connect.`,continue:`Continue`,getCode:`Get a code`,starting:`Requesting a pairing code…`,waiting:`Waiting for approval. Keep this page open.`,failure:{identityRequired:`This Gateway requires a verified identity. Use its normal identity-aware sign-in instead of browser code pairing.`,declined:`This request was declined on the Gateway host.`,expired:`This code expired. Pair this browser again for a new one.`,busy:`Too many pairing requests right now. Wait a few minutes and try again.`,unavailable:`This Gateway could not start pairing. Reload the page and try again.`,noIdentity:`This browser could not create its device key. Open this Gateway over HTTPS or localhost.`}},connection:{target:`Connecting to {host}`,secretEntered:`secret entered`,noSecret:`no secret`,change:`Change`},toggleSecretVisibility:`Toggle Gateway secret visibility`,failure:{rawError:`Show details`,busy:{title:`Gateway busy, retrying…`,summary:`Couldn’t connect because the Gateway is busy. This page will retry automatically.`,countdown:`Retrying in {seconds}s…`,retrying:`Retrying now…`},profileUnavailable:{title:`Couldn’t verify your account`,summary:`Couldn’t verify your account. Try again shortly.`,stepRetry:`Retry shortly.`,stepAdmin:`If this continues, ask an admin to check your account access.`},verifiedUserRequired:{title:`Verified identity required`,summary:`Couldn’t verify your identity. Device and setup tokens don’t identify a person.`,stepIdentity:`Sign in through the trusted proxy or Tailscale to verify your identity.`,stepSharedSecret:`For trusted local admin access, use the shared Gateway token or password.`},accessDenied:{title:`No access to this Gateway`,summary:`Couldn’t connect because your account doesn’t have access to this Gateway.`,stepAdmin:`Ask an admin to grant or restore your access.`,stepFindProfile:`Admins can find your profile with openclaw users list --json, then assign a role with users.setRole.`,stepReconnect:`Sign in with a different account, or choose Connect after an admin grants access.`},authRequired:{title:`This Gateway expects its token`,passwordTitle:`This Gateway expects its password`,summary:`Couldn’t connect to {host}. Enter its token or password to continue.`,stepPaste:`On the computer running OpenClaw, run openclaw gateway auth-token --show. Paste its token 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:`Couldn’t connect with this token or password. Check that it belongs to this Gateway and try again.`,stepDashboard:`On the computer running OpenClaw, run openclaw dashboard --no-open for a fresh link, 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:`Couldn’t use this one-time link. It may have expired or already been used. Get a new link instead of changing the Gateway secret.`,stepOpen:`Open the new link in this browser. Pairing links work once and expire after ten minutes.`,stepJson:`If the browser or clipboard is unavailable, run openclaw dashboard --json on the computer running OpenClaw and open its browserUrl in this browser.`},trustedProxy:{title:`Proxy authentication required`,summary:`Couldn’t verify your proxy sign-in. Sign in through the proxy to continue.`,stepSignIn:`Open OpenClaw through the sign-in proxy, not the Gateway directly.`,stepHeaders:`Ask an admin to check identity headers, required-header forwarding on WebSocket upgrade requests, and your account access.`,stepNoToken:`A Gateway token cannot replace proxy authentication.`},rateLimited:{title:`Too many failed attempts`,summary:`Couldn’t sign in because there were too many failed attempts. Wait before trying again.`,stepStop:`Stop retrying from this tab for a moment.`,stepWait:`Wait a few minutes, then reconnect with the correct token or password.`,stepCheckClients:`On a shared computer, check whether other clients are retrying with the wrong token or password.`},pairing:{title:`Approve this browser`,scopeTitle:`Approve the new access level`,roleTitle:`Approve the new role`,metadataTitle:`Re-approve this browser`,restoreTitle:`Approve this browser again`,restoreSummary:`Couldn’t connect to {host} because this browser’s {role} access is no longer active. The request asks for the same access it had before, nothing new. Approve it on the computer running OpenClaw.`,roleSummary:`Couldn’t connect to {host} because this browser is asking for the {role} role, which it doesn’t have yet. Approve the request on the computer running OpenClaw.`,scopeSummary:`Couldn’t connect to {host} because this browser is asking for more access: {scopes}. Approve the request on the computer running OpenClaw.`,summary:`Couldn’t connect to {host} until this browser is approved. Approve it on the computer running OpenClaw.`,upgradeSummary:`Couldn’t connect to {host} with the requested access. Approve the new request on the computer running OpenClaw.`,stepDashboard:`For a one-time link, run openclaw dashboard on the computer running OpenClaw and open the link in this browser.`,stepLatest:`Run the approve command it prints for the newest pending request.`,stepReconnect:`Once approved, choose Connect.`,waiting:`Waiting for approval… This page connects automatically once approved.`,checkNow:`Check now`,declinedTitle:`Access request declined`,declinedSummary:`Couldn’t connect because this browser’s access request was declined. Automatic retries have stopped. You can request approval again.`,expiredTitle:`Access request expired`,expiredSummary:`Couldn’t connect because this browser’s access request expired. Request approval again to continue.`,requestAgain:`Request again`},insecure:{title:`Secure browser context required`,summary:`Couldn’t connect over HTTP because this browser needs a secure page to identify itself.`,stepHttps:`Use HTTPS/Tailscale Serve, or open http://127.0.0.1:18789 on the computer running OpenClaw.`,stepAvoidDisable:`Don’t use a remote HTTP URL. A token or password can’t replace browser device identity.`},origin:{title:`Browser origin not allowed`,summary:`Couldn’t connect because this page’s address isn’t allowed. Ask an admin to allow it.`,stepAllowedOrigins:`Add this browser origin to gateway.controlUi.allowedOrigins.`,stepFullOrigin:`Use full origins such as http://localhost:5173, not wildcard patterns.`,stepRestart:`Once the allowed origins change takes effect, choose Connect.`},protocol:{title:`Protocol mismatch`,summary:`Couldn’t connect because this page and the Gateway use different versions. Reopen OpenClaw.`,refresh:`Refresh page`,stepDashboard:`Reopen OpenClaw with openclaw dashboard so the web app 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:`Couldn’t reach {host}. Check the URL and connection before trying another token or password.`,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:`Run openclaw dashboard --no-open on the computer running OpenClaw for the current URL and sign-in details.`}}}},J=Object.assign(()=>{Object.assign(h.connection.help,q.connection.help),Object.assign(h.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=y(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 Be(e){return e===g.AUTH_PASSWORD_MISSING||e===g.AUTH_PASSWORD_MISMATCH||e===g.AUTH_PASSWORD_NOT_CONFIGURED}function Ve(e,t){if(e===`pairing-required`)return{titleKey:`title`,summaryKey:`summary`};if(e===`metadata-upgrade-pending`)return{titleKey:`metadataTitle`,summaryKey:`upgradeSummary`};let n=t?.requestedRole,r=t?.approvedRoles??[];if(!n||!t?.requestedScopes)return{titleKey:e===`role-upgrade-pending`?`roleTitle`:`scopeTitle`,summaryKey:`upgradeSummary`};if(!r.includes(n))return{titleKey:`roleTitle`,summaryKey:`roleSummary`,params:{role:n}};let i=t.approvedScopes??[],a=t.requestedScopes.filter(e=>!p({role:n,requestedScopes:[e],allowedScopes:i}));return a.length>0?{titleKey:`scopeTitle`,summaryKey:`scopeSummary`,params:{scopes:a.join(`, `)}}:{titleKey:`restoreTitle`,summaryKey:`restoreSummary`,params:{role:n}}}function Q(e,t,n){let r=n.docsHref??`https://docs.openclaw.ai/web/dashboard`,i=E(e),a=e=>C(`${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}),details:n.detailKeys?.map(a),docsHref:r,rawError:i}}function He(e){if(e.connected||!e.lastError)return null;let t=e.lastError,n=e.lastErrorCode??null,r=s(t),i=ze(e.gatewayUrl);if(n===`GATEWAY_BUSY`&&e.reconnectPending)return Q(t,`login.failure.busy`,{kind:`busy`,tone:`pending`,stepKeys:[]});if(n===g.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===g.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===g.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===g.OPERATOR_ACCESS_DENIED)return Q(t,`login.failure.accessDenied`,{kind:`access-denied`,tone:`warn`,stepKeys:[`stepAdmin`,`stepReconnect`],detailKeys:[`stepFindProfile`],docsHref:`https://docs.openclaw.ai/gateway/operator-scopes#named-operator-roles`});if(n===g.CONTROL_UI_BUILD_MISMATCH)return Q(t,`chat.sidebar`,{kind:`build-mismatch`,tone:`pending`,titleKey:`serverUpdatedTitle`,summaryKey:`serverUpdatedRefresh`,refreshAction:{label:C(`login.failure.protocol.refresh`)},stepKeys:[],docsHref:`https://docs.openclaw.ai/web/control-ui`});if(n===g.PAIRING_REJECTED||n===g.PAIRING_EXPIRED){let e=n===g.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 a=xe(t,n);if(a){let n=Ve(a.kind,e.lastErrorPairing);return Q(t,`login.failure.pairing`,{kind:`pairing-required`,tone:`pending`,docsHref:`https://docs.openclaw.ai/web/control-ui#device-pairing-first-connection`,titleKey:n.titleKey,summaryKey:n.summaryKey,primaryCommand:a.requestId?`openclaw devices approve ${a.requestId}`:`openclaw devices approve --latest`,stepKeys:[...a.requestId?[]:[`stepLatest`],{key:`stepDashboard`,commands:[`openclaw dashboard`]},...e.reconnectPending?[]:[`stepReconnect`]],stepParams:{host:i,...n.params}})}if(n===g.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(D(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===g.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:[],detailKeys:[`stepAllowedOrigins`,`stepFullOrigin`,`stepRestart`]});if(n===g.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:C(`login.failure.protocol.refresh`)},stepKeys:[{key:`stepDashboard`,commands:[`openclaw dashboard`]},{key:`stepDevUi`,commands:[`pnpm ui:dev`]},`stepRestart`]});let o=x(e),c=Be(n);if(o===`trusted-proxy`)return Q(t,`login.failure.trustedProxy`,{kind:`trusted-proxy`,stepKeys:[`stepSignIn`,`stepNoToken`],detailKeys:[`stepHeaders`],docsHref:`https://docs.openclaw.ai/gateway/trusted-proxy-auth`});if(o===`required`||o===`failed`){let r=o===`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===g.AUTH_TOKEN_MISMATCH?`failure.authRequired.title`:`failure.authFailed.title`,summaryKey:r?`failure.authRequired.summary`:(n===g.AUTH_TOKEN_MISMATCH||n===g.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 Ue(){return(Ue=e((()=>{f(),v(),Se(),Re(),Z(),S()})))()}var We=t({LoginGate:()=>St,canPairBrowserWithGateway:()=>$});function $(e,t){if(u()||a())return!1;let n=URL.parse(e),r=window.location.protocol===`https:`?`wss:`:`ws:`;return n?.protocol===r&&n.host===window.location.host&&c(n.pathname)===c(t)}function Ge(e){let t=P(()=>{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(N,{get each(){return t()},keyed:!1,children:e=>B(F,{get when(){return e().command},get fallback(){return e().text},children:e=>B(K,{get command(){return e()}})})})}function Ke(e){return B(F,{get when(){return e.feedback.steps.length>0},get children(){var t=et();return L(t,B(N,{get each(){return e.feedback.steps},keyed:!1,children:e=>(()=>{var t=tt();return L(t,B(Ge,{get step(){return e()}})),t})()})),t}})}function qe(e){var t=nt(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=n.nextSibling,o=I();return L(r,()=>C(`login.failure.rawError`)),L(n,B(N,{get each(){return e.feedback.details??[]},children:e=>(()=>{var t=rt();return L(t,e),t})()}),i),L(i,()=>e.feedback.rawError),z(a,`target`,T),L(a,()=>C(`common.learnMore`)),L(t,B(Ie,{}),null),V(()=>({e:e.feedback.docsHref,t:b()}),({e,t},n)=>{e!==n?.e&&z(a,`href`,e),t!==n?.t&&z(a,`rel`,t),ke(a,o)}),t}function Je(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=>{be(e)||e.key===`Enter`&&r()};var a=it(),o=a.firstChild,s=o.firstChild,c=s.nextSibling,l=o.nextSibling,u=l.firstChild,d=u.nextSibling.firstChild,f=d.nextSibling;return L(s,()=>C(`login.gatewayUrl`)),c._$$keydown=i,W(c,`blur`,A),W(c,`keyup`,A,!0),W(c,`compositionend`,se),c._$$input=t=>{e.cancelRefresh(),e.model.onGatewayUrlChange(t.currentTarget.value)},L(u,()=>C(`login.secret`)),d._$$keydown=i,W(d,`blur`,A),W(d,`keyup`,A,!0),W(d,`compositionend`,se),d._$$input=t=>{e.cancelRefresh(),e.model.onSecretChange(t.currentTarget.value)},f._$$click=()=>e.model.onToggleGatewaySecret(),L(f,B(j,{get name(){return e.model.showGatewaySecret?`eye`:`eyeOff`}})),L(l,(()=>{var e=R(()=>!!t());return()=>e()?(()=>{var e=at();return L(e,()=>C(`login.setupCodeHint`)),e})():t()})(),null),L(a,(()=>{var t=R(()=>!!e.withSubmit);return()=>t()?(()=>{var e=ot();return e._$$click=r,L(e,()=>C(`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:C(`login.secretPlaceholder`),h:C(`login.toggleSecretVisibility`),r:e.model.showGatewaySecret?`true`:`false`}),({e,t,a:n,o:r,i,n:a,s:o,h:s,r:l},u)=>{e!==u?.e&&z(c,`aria-invalid`,e),c.value=t??``,n!==u?.a&&z(d,`type`,n),r!==u?.o&&z(d,`aria-invalid`,r),i!==u?.i&&z(d,`aria-describedby`,i),Oe(d,`value`,a),o!==u?.s&&z(d,`placeholder`,o),s!==u?.h&&z(f,`aria-label`,s),l!==u?.r&&z(f,`aria-pressed`,l)}),a}function Ye(e){return B(F,{get when(){return $(e.model.gatewayUrl,e.model.resourceBasePath)},get children(){var t=st(),n=t.firstChild,r=n.nextSibling;return t._$$click=()=>e.openPairCard(),L(t,()=>C(`login.browserPair.open`),n),L(t,B(j,{name:`chevronRight`}),r),t}})}function Xe(e){let t=()=>C(e.model.secret.trim()?`login.connection.secretEntered`:`login.connection.noSecret`);var n=ct(),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,()=>C(`login.connection.target`,{host:ze(e.model.gatewayUrl)})),L(a,t,null),L(o,()=>C(`login.connection.change`)),n}function Ze(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`?C(`login.failure.pairing.requestAgain`):C(t()?`login.failure.pairing.checkNow`:`common.connect`);var i=lt(),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 xt[e.feedback.tone]}})),L(s,()=>e.feedback.title),L(c,()=>e.feedback.summary),L(i,B(F,{get when(){return e.feedback.primaryCommand},children:e=>(()=>{var t=ut(),n=t.firstChild;return L(n,()=>C(`login.runOnHost`)),L(t,B(K,{get command(){return e()},variant:`hero`}),null),t})()}),l),L(i,B(Ke,{get feedback(){return e.feedback}}),u),L(i,(()=>{var t=R(()=>e.feedback.kind===`busy`);return()=>t()&&(()=>{var e=dt();return L(e,(()=>{var e=R(()=>n()>0);return()=>e()?C(`login.failure.busy.countdown`,{seconds:String(n())}):C(`login.failure.busy.retrying`)})()),e})()})(),d),L(i,(()=>{var e=R(()=>!!t());return()=>e()?(()=>{var e=ft();return e.firstChild,L(e,()=>C(`login.failure.pairing.waiting`),null),e})():t()})(),f),L(f,B(F,{get when(){return e.feedback.refreshAction},children:t=>(()=>{var n=pt();return n._$$click=()=>e.onRefresh(),L(n,B(F,{get when(){return!e.refreshing},get fallback(){return C(`common.refreshing`)},get children(){return B(Te,{get fallback(){return C(`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(i,B(Ye,e),m),L(m,B(Xe,{get model(){return e.model}}),h),L(m,B(Je,we(e,{withSubmit:!1})),g),L(i,B(qe,{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 Qe(e){var t=mt(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=n.nextSibling,o=a.nextSibling,s=o.nextSibling;return L(r,()=>e.feedback?.title??C(`login.heading`)),L(i,()=>e.feedback?.summary??C(`login.lede`)),L(t,B(Je,we(e,{withSubmit:!0})),a),L(t,B(Ye,e),o),L(t,(()=>{var t=R(()=>!!e.feedback);return()=>t()?[B(Ke,{get feedback(){return e.feedback}}),B(qe,{get feedback(){return e.feedback}})]:(()=>{var e=ht(),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=I();return L(t,()=>C(`connection.help.title`)),L(r,()=>C(`connection.help.step1`),i),L(r,B(K,{command:`openclaw gateway run`}),a),L(o,()=>C(`connection.help.step2`),s),L(o,B(K,{command:`openclaw dashboard`}),c),L(l,()=>C(`connection.help.step3`)),z(u,`target`,T),L(u,()=>C(`connection.help.docsLink`)),V(()=>b(),e=>{z(u,`rel`,e),ke(u,d)}),e})()})(),s),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 $e(e,t){t.style.display=`contents`;let n=P(()=>[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(()=>{n()}),o=P(()=>i()?.result.then(()=>null),{loadingValue:void 0}),[s,l]=Ce(!1),[u,f]=M(!1),[p,m]=M(Date.now());ge(1e3,()=>m(Date.now()),{enabled:()=>!!e().reconnectPending&&e().lastErrorCode===`GATEWAY_BUSY`&&(e().reconnectAt??0)>p(),immediate:!0});let h,g=()=>{h?.retired.resolve(),h=void 0},_=()=>{g(),a(void 0)},v=e=>{let n=t.props;return h===e&&t.isConnected&&n!==void 0&&!n.connected&&!n.reconnectPending&&[`lastError`,`lastErrorCode`,`lastErrorAuthReason`,`gatewayUrl`,`resourceBasePath`,`secret`].every(t=>n[t]===e.props[t])},y=P(()=>He(e()));Ae(()=>{let e=d(t,`login-gate-disconnect`,_),n=d(t,`login-gate-props-change`,()=>{h&&!v(h)&&g()});return()=>{g(),e(),n()}});let ee=Pe(function*(e,t){try{v(e)&&l(!0);let n=yield Promise.race([t,e.retired.promise]);if(v(e)&&!n)throw Error(`Control UI refresh did not reload the document`)}catch(t){if(v(e))throw t}finally{h===e&&g()}}),b=async()=>{h&&!v(h)&&g();let e=t.props;if(!e||h||!t.isConnected||e.connected||e.reconnectPending||!He(e)?.refreshAction||!te(!0))return;let n={props:e,retired:Promise.withResolvers()};h=n;let r=ne({canReload:()=>v(n)}),i=ee(n,r);a({result:i}),await i.catch(()=>void 0)},x=()=>e().branding??ie(),S=()=>e().branding?.brandIcon??(e().mascot===`none`?`mark`:`claw`);var w=gt(),T=w.firstChild,E=T.nextSibling,D=E.firstChild,O=D.firstChild,k=D.nextSibling,ae=k.nextSibling;return w._$$mousedown=e=>{e.target===e.currentTarget&&fe(e)},T._$owner=I(),L(D,(()=>{var t=R(()=>S()===`claw`);return()=>t()?(()=>{var t=_t();return V(()=>r(`favicon.svg`,c(e().resourceBasePath)),e=>{z(t,`src`,e)}),t})():(()=>{var e=vt();return L(e,(()=>{var e=R(()=>x().brandIcon!==`claw`&&x().brandIcon!==`mark`);return()=>e()?B(re,{get branding(){return x()},"aria-hidden":`true`}):B(j,{name:`mark`})})()),e})()})(),O),L(O,()=>x().brandName),L(E,B(F,{get when(){return R(()=>!!u())()?$(e().gatewayUrl,e().resourceBasePath):u()},get fallback(){return B(F,{get when(){return R(()=>y()?.placement===`status`)()?y():null},get fallback(){return B(Qe,{get model(){return e()},get feedback(){return y()},cancelRefresh:_,openPairCard:()=>f(!0)})},children:t=>B(Ze,{get model(){return e()},get feedback(){return t()},cancelRefresh:_,openPairCard:()=>f(!0),get refreshing(){return s()},readRefreshOutcome:o,onRefresh:()=>void b(),get now(){return p()}})})},get children(){return B(Te,{fallback:(e,t)=>B(ye,{get error(){return e()},onRetry:()=>t(),onClose:()=>f(!1)}),get children(){return B(Ne,{get children(){return B(bt,{host:t,get basePath(){return c(e().resourceBasePath)},get gatewayUrl(){return e().gatewayUrl},onPaired:t=>{f(!1),e().onBrowserPaired(t)},onBack:()=>f(!1)})}})}})}}),k),L(E,(()=>{var t=R(()=>!!e().onOpenGatewaySettings);return()=>t()?(()=>{var t=yt(),n=t.firstChild;return n._$$click=()=>e().onOpenGatewaySettings?.(),L(n,()=>C(`login.gatewaySettings`)),t})():e().onOpenGatewaySettings})(),ae),V(()=>y()?.placement??`form`,e=>{z(E,`data-mode`,e)}),w}var et,tt,nt,rt,it,at,ot,st,ct,lt,ut,dt,ft,pt,mt,ht,gt,_t,vt,yt,bt,xt,St;function Ct(){return(Ct=e((()=>{Me(),Ee(),_(),i(),oe(),o(),ee(),ae(),k(),Y(),ce(),Re(),he(),Z(),pe(),S(),ue(),w(),Ue(),Fe(),Le(),me(),ve(),le(),O(),n(),et=G(`<ol class=login-gate__failure-steps>`),tt=G(`<li>`),nt=G(`<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">`),rt=G(`<p>`),it=G(`<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><button type=button class=settings-secret__toggle>`),at=G(`<p id=login-gate-secret-hint class=muted role=status>`),ot=G(`<button class="btn primary login-gate__connect">`),st=G(`<button type=button class="btn btn--ghost login-gate__browser-pair-start"> <!>`),ct=G(`<summary><span class=login-gate__connection-target><span></span></span> <span class=login-gate__connection-cred>· </span> <span class=login-gate__connection-change>`),lt=G(`<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><!>`),ut=G(`<div class=login-gate__hero><span class=login-gate__hero-label>`),dt=G(`<p class=login-gate__retry aria-live=off>`),ft=G(`<p class=login-gate__failure-summary><span class=session-run-spinner aria-hidden=true>`),pt=G(`<button type=button class="btn primary login-gate__failure-refresh">`),mt=G(`<section><div class=login-gate__status-text><h1></h1><p></p></div><!><!><!>`),ht=G(`<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>`),gt=G(`<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),_t=G(`<img class=login-gate__logo alt>`),vt=G(`<span class="login-gate__logo login-gate__logo--neutral"aria-hidden=true>`),yt=G(`<footer class=login-gate__recovery><button type=button class="btn btn--ghost">`),_e(J),bt=De(()=>l(()=>import(`./login-gate-browser-pair-CiGx_UiE.js`),__vite__mapDeps([0,1]),import.meta.url),{export:`LoginGateBrowserPairCard`},`src/components/login-gate-browser-pair.tsx`),xt={pending:`shieldEllipsis`,warn:`clock`,danger:`shieldAlert`},St=de(`openclaw-login-gate`,(e,t)=>B(F,{get when(){return e.props},children:e=>$e(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`))}),je([`input`,`keyup`,`keydown`,`click`,`mousedown`])})))()}export{Y as a,Z as i,We as n,J as o,X as r,Ct as t};