UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1,635 lines • 424 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./command-palette-CKRYVlRS.js","./session-snapshot-database-BBKeXATO.js","./control-ui-boot-shared-CkXlyZBY.js","./control-ui-boot-shared-gZIpWrfw.js","./control-ui-boot-shared-SQHdJTzb.js","./control-ui-boot-shared-VLPz5vN2.js","./config-runtime-BecGLziM.js","./control-ui-boot-shared-Q8KG_noF.js","./plugin-contracts-runtime-ByiEPbv_.js","./markdown-runtime-ORQpioyT.js","./control-ui-boot-chat-Ye5j4vAg.js","./control-ui-boot-shared-UG5ko-VG.js","./control-ui-boot-shared-XreXSF7h.js","./control-ui-boot-shared-dOnP4mAA.js","./control-ui-boot-shared-styles-BXPMRytW.js","./sidebar-update-runtime-DQZboSgD.js","./control-ui-boot-chat-k_u3nGjS.js","./control-ui-boot-chat-CGYcTLro.js","./control-ui-boot-chat-CmENwCKi.js","./control-ui-boot-chat-XPUNenUd.js","./chat-transcript-styles-BN-TorbW.js","./control-ui-boot-chat-styles-BcslGtWC.js","./control-ui-boot-new-CkyIHJ_L.js","./control-ui-boot-new-styles-cChqenO3.js","./transcript-search-BXRa7Hst.js","./en-apps-CQuXDReT.js","./settings-navigation-D9H_ojii.js","./settings-targets-Dyt-IAqP.js","./consent-dialog-DytMih5L.js","./reasoned-disabled-control-BE3CsN4F.js","./control-ui-core-DI-Q_yCI.css","./control-ui-boot-shared-styles-DUf4zEvn.css","./control-ui-boot-shared-DIWJGbGi.css","./sidebar-update-runtime-Bpn2ByHA.css","./chat-transcript-styles-B0IJwY9P.css","./control-ui-boot-chat-styles-SRk09zDG.css","./control-ui-boot-chat-C2DT0d4M.css","./control-ui-boot-new-styles-BS7lzENV.css","./control-ui-boot-new-D-SpiTTi.css","./command-palette-NBC8ATMP.css","./debug-overlay-CS__UmeQ.js","./keyboard-shortcuts-dialog-CJ9aQ5F-.js","./macos-titlebar-controls.runtime-Cs54QxDd.js","./terminal-panel-registration-DRAlY3On.js","./scrollbar-styles-z704pTjt.js","./panel-icon-button-BbsY5x_R.js","./panel-tab-strip-CniNZmas.js","./dock-destination-controls-BmjaupAr.js","./panel-empty-state-Cvj4wChf.js","./theme-color-DAo4KRoc.js","./catalog-terminal-start-DmNpGDDP.js","./browser-panel-s0odPIu7.js","./gateway-websocket-url-BW0hi5Wr.js","./browser-document-B_lgtp-W.js","./desktop-panel-CuBSlrvl.js","./control-ui-boot-chat-BD9CwLj7.js","./control-ui-boot-chat-B-b-JQel.js","./desktop-focus-window-DUCI-_oT.js","./control-ui-boot-chat-DhbON6pC.css","./link-reader-panel-DAzjGGyQ.js","./link-reader-response-2ZxZ1BKy.js","./board-document-TdjPzEp6.js","./board-view-DvSYdNVj.js","./control-ui-disabled-B8wp3jVt.js","./near-viewport-observer-WgGck829.js","./widget-sandbox-host-COBvR0Ux.js","./mcp-app-confirm-BOrRV_eo.js","./sandbox-host-Dm6XHU23.js","./board-view-CCkz6swN.css","./board-document-B0Y4zGJq.css","./approval-page-registration-HvX_GBXg.js","./approval-t2xr4qDL.js","./approval-hO9W1yf6.css","./question-page-registration-Bsw24wuT.js","./exec-approval-BFG7h9_d.js","./login-runtime-WXCKwuhW.js","./tooltip-CDOOCPai.js","./assistant-panel-content-CAyCK1pp.js","./custodian-surface-DjwsAcUK.js","./plugin-help-DJgR6Y-x.js","./custodian-alert-store-DMTYYmJp.js","./state-Bjk4TzHh.js","./wizard-step-controls-BftYzvp2.js","./wizard-step-controls-CYe5XwZR.css","./custodian-surface-D4ZqgxUa.css","./assistant-panel-content-DzJupYdl.css","./link-reader-hovercard-1pXZeQWw.js","./link-reader-hovercard-CzYUpnNa.css","./markdown-file-tooltip-DU-xNGQp.js","./markdown-file-tooltip-jvyPxCJD.css","./gateway-scope-upgrade.runtime-83WHMtpU.js","./theme-catalog-DYK4R1_4.js","./theme-palette-I53D9_19.js","./plugin-capabilities.runtime-cQeLLbWo.js","./mcp-app-routing-DFzELUUu.js","./native-link-menu.runtime-BzzSZCIb.js","./update-failure-report-Cb61r3uI.js","./en-update-actions-CGzQJvZs.js","./update-triage.runtime-CQQNKtdD.js","./en-settings-dSQ-fDvm.js","./browser-bootstrap.runtime-BC9ZQczo.js","./response-body-Cs9VotSw.js","./native-startup.runtime-DxNLJFaO.js","./native-embed-CiDYfKFT.css","./nav-drawer-swipe.runtime-BaBrg519.js","./server-prefs-profile-runtime-CL2b8ykJ.js","./user-prefs-request-Cs35VjAf.js","./update-confirmation.runtime-Bk-68DSg.js","./update-run-view-DsxSV0HV.js","./stream-auto-follow-controller-BZ0UzGsg.js","./update-run-view-CS3ezHvV.css","./onboarding-memory-import-BFv_cxJE.js","./onboarding-memory-import-DuWLEvoz.css","./settings-sidebar-DKAdrNKF.js","./config-form.tiers-DgDgyKyb.js","./config-form.search-cybY4IfR.js","./setup-schema-CSJcdeL-.js","./slots-DxtX6aTe.js","./view-pairing.runtime-D1dMw8JZ.js","./en-devices-z6NTBKSa.js","./composer-draft-retirement.runtime-CP_a6HdR.js"])))=>i.map(i=>d[i]);
import{n as e,r as t}from"./rolldown-runtime-8BhlS34s.js";import{$ as n,$a as r,$o as i,$t as a,$u as o,Aa as s,Ac as c,Ai as l,Ar as u,As as d,Au as f,Bn as p,Bs as m,Bt as h,C as g,Ca as _,Cc as v,Cs as y,Ct as b,Da as x,Dc as S,Dn as C,Ds as ee,Du as w,Ea as T,Es as E,Eu as D,Fc as O,Fi as k,Fl as A,Fn as te,Ft as ne,Ga as re,Gl as j,Gr as ie,Gs as ae,Hr as oe,Hs as se,Ht as ce,Ic as le,Ii as M,Is as ue,J as de,Ja as fe,Ka as pe,Kr as me,Ks as he,Ku as ge,Lc as _e,Ll as ve,Ls as ye,Lt as be,Lu as xe,Ma as Se,Mc as Ce,Ms as we,Mt as Te,Mu as Ee,Na as De,Ns as Oe,Nt as ke,Nu as Ae,O as je,Oa as Me,Oi as Ne,On as Pe,Or as Fe,Os as Ie,Ot as Le,Ou as Re,P as ze,Pa as Be,Pc as Ve,Pn as He,Ps as Ue,Pu as N,Q as We,Qa as Ge,Qo as Ke,Qt as qe,Qu as Je,Rn as Ye,Rs as Xe,S as Ze,Sa as Qe,Sc as $e,Si as et,Ss as tt,Ta as nt,Ts as rt,Tu as P,Ua as it,Uc as at,Ul as ot,Uo as st,Us as ct,Ut as lt,Uu as ut,Vl as dt,Vr as ft,Vt as pt,W as mt,Wa as ht,Wc as gt,Wl as _t,Ws as vt,X as yt,Xa as bt,Xc as xt,Xt as St,Xu as Ct,Y as wt,Ya as Tt,Yc as Et,Yl as Dt,Ys as Ot,Yu as kt,Z as At,Za as jt,Zs as Mt,Zt as Nt,_ as Pt,_a as Ft,_i as It,_n as Lt,_o as Rt,_r as zt,_s as Bt,_t as Vt,_u as Ht,aa as Ut,ac as Wt,ao as Gt,ar as Kt,as as qt,at as Jt,bi as Yt,bn as Xt,br as Zt,bs as Qt,bt as $t,bu as en,ca as tn,co as nn,cr as rn,da as an,dl as on,dn as sn,do as cn,dr as ln,dt as un,du as dn,ec as fn,en as pn,eo as mn,es as hn,et as gn,f as _n,fa as vn,fo as yn,fr as bn,ft as xn,g as Sn,ga as Cn,gc as wn,gi as Tn,gn as En,gr as Dn,gs as On,gt as kn,gu as An,h as jn,ha as Mn,hc as Nn,hi as Pn,ho as Fn,hu as In,i as Ln,ia as Rn,il as zn,in as Bn,io as Vn,is as Hn,it as Un,ja as Wn,jc as Gn,js as Kn,ju as qn,ka as Jn,kl as Yn,ks as Xn,ku as Zn,la as Qn,ll as $n,lo as er,lt as tr,m as nr,ma as rr,mc as ir,mi as ar,mo as or,mr as sr,mu as cr,n as lr,na as ur,nc as dr,nl as fr,nn as pr,no as mr,nr as hr,ns as gr,nt as _r,oa as vr,oo as yr,or as br,ot as xr,pa as Sr,pc as Cr,po as wr,pr as Tr,pt as Er,q as Dr,qa as Or,qc as kr,ql as Ar,qu as jr,ro as Mr,rs as Nr,sa as Pr,sn as Fr,so as Ir,sr as Lr,st as Rr,tn as zr,to as Br,tr as Vr,ts as Hr,tt as Ur,ua as Wr,uc as Gr,ul as Kr,un as qr,uo as Jr,ur as Yr,ut as Xr,uu as Zr,v as Qr,va as $r,vi as ei,vn as ti,vo as ni,vr as ri,vs as ii,vt as ai,vu as oi,wa as si,wl as ci,ws as li,xa as ui,xc as di,xi as fi,xn as pi,xs as mi,xu as hi,y as gi,yi as _i,yr as vi,ys as yi,yt as bi,yu as xi,zl as Si,zn as Ci,zs as wi,zu as F}from"./control-ui-core-CBJ5efDh.js";import{A as Ti,D as Ei,E as Di,G as I,J as L,K as Oi,M as ki,P as Ai,W as R,X as z,Z as ji,at as B,c as Mi,et as Ni,k as Pi,l as Fi,lt as Ii,rt as Li,s as Ri}from"./lit-runtime-IOnANfcZ.js";import{a as zi,c as Bi,d as Vi,l as Hi,n as Ui}from"./gateway-runtime-C77LeWZN.js";import{$i as Wi,$t as Gi,Aa as Ki,At as qi,Bi as Ji,Bo as Yi,Bt as Xi,C as Zi,Cn as Qi,Ct as $i,Da as ea,Di as ta,Dt as na,E as ra,Ea as ia,En as aa,Et as oa,Fa as sa,Fo as ca,Ga as la,Gi as ua,Gr as da,Gt as fa,Ha as pa,Ht as ma,Ja as ha,Jt as ga,Ki as _a,Kr as va,Kt as ya,La as ba,Lo as xa,Ma as Sa,Mt as Ca,Na as wa,Oa as Ta,Ot as Ea,Pa as Da,Po as V,Qa as Oa,Qt as ka,Ra as Aa,Ro as ja,S as Ma,Sn as Na,Sr as Pa,St as Fa,T as Ia,To as La,Ui as Ra,Ur as za,Ut as Ba,Vt as Va,Wa as Ha,Wr as Ua,Xa as Wa,Xr as Ga,Xt as Ka,Ya as qa,Yi as Ja,Zr as H,_ as Ya,bt as Xa,ca as Za,ci as Qa,cn as $a,co as eo,d as to,dn as no,dt as ro,ea as io,en as ao,f as oo,ft as so,gn as co,go as lo,h as uo,hn as fo,in as po,ja as mo,jn as ho,jt as go,k as _o,ka as vo,kt as yo,la as bo,ln as xo,m as So,ma as U,n as Co,na as wo,nn as To,nt as Eo,oa as Do,on as Oo,p as ko,pa as W,pn as Ao,qt as jo,r as Mo,rn as G,ro as No,rt as Po,sa as Fo,sn as Io,so as Lo,st as Ro,ta as zo,tn as Bo,tt as Vo,ua as Ho,un as Uo,uo as K,ut as Wo,vn as Go,vo as Ko,w as qo,wa as q,wt as Jo,x as Yo,xa as Xo,xn as Zo,xr as Qo,xt as $o,ya as es,yn as ts,za as ns}from"./ui-CmSP4d14.js";function rs(e){let t=e.slug;if(t){if($s.has(t)){nc.has(t)||(nc.add(t),console.warn(`[openclaw] /${t} is a native route; using /plugin.`));return}return t}}function is(e=[]){tc.clear();for(let t of e){let e=rs(t);e&&!tc.has(e)&&tc.set(e,t)}}function as(e,t=``){let n=ns(e),r=Aa(t);if(!n.startsWith(`${r}/`))return null;let i=n.slice(r.length+1);return i.length<=64&&/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(i)&&!$s.has(i)?i:null}function os(e,t=``){return tc.get(as(e,t)??``)??null}function ss(e,t=``){let n=rs(e);return{pathname:n?`${Aa(t)}/${n}`:J(`plugin`,t),search:n?``:`?${new URLSearchParams({plugin:e.pluginId,id:e.id})}`,hash:``}}function cs(e,t=``){if(ns(e.pathname)!==J(`plugin`,t))return e;let n=new URLSearchParams(e.search),r=[...tc.values()].find(e=>e.pluginId===n.get(`plugin`)&&e.id===n.get(`id`));if(!r)return e;let i=new URLSearchParams([...n].filter(([e])=>e.startsWith(`p.`)));return{...ss(r,t),search:i.size?`?${i}`:``,hash:e.hash}}function ls(e){return Object.hasOwn(Ys,e)}function us(e){return{id:e,...Ys[e]}}function J(e,t=``){return`${Aa(t)}${Ys[e].path}`}function ds(e,t,n){let r=ns(e),i=J(t,n);if(r===i)return``;let a=`${i}/`;return r.startsWith(a)&&r.slice(a.length)||null}function fs(e){return e.length===36&&pa.test(e)}function ps(e,t=``,n,r=12){let i=fs(e),a=Ct(Ko(n),48).replace(/-+$/u,``),o=i?`${a?`${a}-`:``}${e.replaceAll(`-`,``).slice(0,r).toLowerCase()}`:e,s=encodeURIComponent(fs(o)?`person-${o}`:o).replaceAll(`.`,`%2E`);i||(s=s.replace(/-(?=[0-9a-f]{8,32}$)/u,`%2D`));let c=`${J(`activity`,t)}/${s}`;return{pathname:c,search:``,href:c}}function ms(e,t=``){let n=ds(e,`activity`,t);if(!n||n.includes(`/`))return null;try{let e=decodeURIComponent(n);return!e.trim()||e===`.`||e===`..`?null:fs(e)?e:n.match(ic)?.[1]??e}catch{return null}}function hs(e,t=``){if(!Da(e))throw Error(`Invalid Workboard board id.`);let n=encodeURIComponent(e).replaceAll(`.`,`%2E`);return`${J(`workboard`,t)}/${n}`}function gs(e,t=null,n=``){if(!e||e.includes(`/`)||e===`.`||e===`..`)throw Error(`Invalid agent id for a route path.`);let r=encodeURIComponent(e).replaceAll(`.`,`%2E`),i=`${J(`agents`,n)}/${r}`;return t?`${i}/${t}`:i}function _s(e,t=``){let n=ds(e,`agents`,t);if(!n)return null;let r=n.split(`/`);if(r.length>2||!r[0])return null;let i;try{i=decodeURIComponent(r[0])}catch{return null}if(!i||i.includes(`/`)||i===`.`||i===`..`)return null;let a=r[1]??null,s=a&&o(a)?a:null;return{agentId:i,panel:s??`overview`,panelSegment:s,invalidPanel:a!==null&&s===null}}function vs(e,t=``){let n=J(`memory`,t);return e===`overview`?n:`${n}/${e}`}function ys(e,t=``){let n=ds(e,`memory`,t);return n===``?`overview`:n===`memories`||n===`dreams`||n===`settings`?n:null}function bs(e,t=``){return ns(e)===`${J(`plugin-settings`,t)}/discover`}function xs(e){return/^[A-Za-z0-9_-]+$/u.test(e)}function Ss(e,t=``){if(!xs(e))throw Error(`Invalid plugin catalog id for a route path.`);return`${J(`plugins`,t)}/${e}`}function Cs(e,t=``){let n=ds(e,`plugins`,t);return n&&xs(n)?n:null}function ws(e,t=``){if(!e||e===`.`||e===`..`)throw Error(`Invalid plugin id for a route path.`);let n=e===`discover`?`%64iscover`:encodeURIComponent(e).replaceAll(`.`,`%2E`);return`${J(`plugin-settings`,t)}/${n}`}function Ts(e,t=``){let n=ds(e,`plugin-settings`,t);if(!n||n.includes(`/`)||n===`discover`)return null;try{let e=decodeURIComponent(n);return e&&e!==`.`&&e!==`..`?e:null}catch{return null}}function Es(e){return e===`chat`||e===`dashboard`}function Ds(e,t=``){let n=ns(e),r=Aa(t);if(r&&n!==r&&!n.startsWith(`${r}/`))return null;let i=n.slice(r.length);return i.startsWith(`/chat/`)?`chat`:i.startsWith(`/dashboard/`)?`dashboard`:ha({pathname:n,basePath:r})?`chat`:null}function Os(e,t=``){return`${J(`terminal`,t)}/${encodeURIComponent(e)}`}function ks(e,t,n){let r=ds(e,t,n);if(!r||r.includes(`/`))return null;try{return decodeURIComponent(r)}catch{return null}}function As(e,t=``){return ks(e,`terminal`,t)?.trim()||null}function js(e,t=``){let n=ks(e,`workboard`,t);return Da(n)?n:null}function Ms(e,t=``){return As(e,t)?`terminal`:os(e,t)?`plugin`:_s(e,t)?`agents`:ms(e,t)?`activity`:js(e,t)?`workboard`:ys(e,t)?`memory`:bs(e,t)?`plugins`:Ts(e,t)?`plugin-settings`:Ds(e,t)}function Ns(e,t){let n=Cs(e,t)?`plugins`:Ms(e,t);return n&&(n!==`memory`||ys(e,t)!==`overview`)?[n,ac[n],e]:null}function Ps(e,t=``){let n=ns(e),r=Aa(t);if(r&&n!==r&&!n.startsWith(`${r}/`))return null;let i=r?n.slice(r.length)||`/`:n;return Cs(n,r)?`plugins`:Qs.get(i.toLowerCase())??Ms(n,r)}function Fs(e){if(Zs.includes(e))return!0;let t=e.split(`/`).find(Boolean);return Zs.some(e=>e.startsWith(`/${t}/`))}function Is(e){let t=Wa(e);if(t!==null)return t;let n=e.trim().endsWith(`/`),r=ns(e);if(r.toLowerCase().endsWith(`/index.html`))return Aa(r.slice(0,-11));if(r===`/`)return``;let i=r.split(`/`).filter(Boolean);for(let e=0;e<i.length;e+=1){let t=`/${i.slice(e).join(`/`)}`,n=Qs.has(t)?t:void 0,r=Object.values(Js).find(e=>t===e||t.startsWith(`${e}/`)),a=Ms(t);if(!n&&!r&&!a)continue;let o=i[e-1],s=r??(a?Ys[a].path:null),c=(n??s??``).split(`/`)[1];if(e===0||o===c)return``;let l=`/${i.slice(0,e).join(`/`)}`;return Fs(l)?``:l}if(!n||i.length===0)return``;let a=`/${i.join(`/`)}`;return Fs(a)?``:a}function Ls(e,t){return{pathname:J(e,t),search:``,hash:``}}function Rs(e,t){let n=new URLSearchParams(e.search),r=n.get(t)??e.pathname;n.delete(t);let i=n.toString();return{pathname:r,search:i?`?${i}`:``,hash:e.hash}}function zs(e,t){return e?.pathname===t?.pathname&&e?.search===t?.search&&e?.hash===t?.hash}var Bs,Vs,Hs,Us,Ws,Gs,Ks,qs,Js,Ys,Xs,Zs,Qs,$s,ec,tc,nc,rc,ic,ac;function Y(){return(Y=e((()=>{lo(),la(),ba(),wa(),Je(),kt(),Bs=`__openclawAgentPath`,Vs=`__openclawActivityPath`,Hs=`__openclawTerminalPath`,Us=`__openclawSessionPath`,Ws=`__openclawMemoryPath`,Gs=`__openclawPluginsPath`,Ks=`__openclawPluginSettingsPath`,qs=`__openclawWorkboardPath`,Js={approval:`/approve`,question:`/ask`},Ys={settings:{path:`/settings`},chat:{path:`/chat`},terminal:{path:`/terminal`},dashboard:{path:`/dashboard`},dashboards:{path:`/dashboards`},custodian:{path:`/custodian`},"new-session":{path:`/new`},activity:{path:`/activity`},meetings:{path:`/meetings`},apps:{path:`/apps`},portals:{path:`/portals`},"agents-home":{path:`/agents`},agents:{path:`/settings/agents`},channels:{path:`/settings/channels`,aliases:[`/channels`]},connection:{path:`/settings/connection`},config:{path:`/settings/general`,aliases:[`/config`]},profile:{path:`/settings/profile`,aliases:[`/profile`]},communications:{path:`/settings/communications`,aliases:[`/communications`]},appearance:{path:`/settings/appearance`,aliases:[`/appearance`]},lobsterdex:{path:`/settings/lobsterdex`,aliases:[`/lobsterdex`]},device:{path:`/settings/device`},"device-permissions":{path:`/settings/device/permissions`},notifications:{path:`/settings/notifications`},security:{path:`/settings/security`},secrets:{path:`/settings/secrets`},advanced:{path:`/settings/advanced`},approvals:{path:`/settings/approvals`},automation:{path:`/settings/automation`,aliases:[`/automation`]},mcp:{path:`/settings/mcp`,aliases:[`/mcp`]},memory:{path:`/settings/memory`},search:{path:`/settings/search`},talk:{path:`/settings/talk`},infrastructure:{path:`/settings/infrastructure`,aliases:[`/infrastructure`]},labs:{path:`/settings/labs`},updates:{path:`/settings/updates`},about:{path:`/settings/about`},"ai-agents":{path:`/settings/ai-agents`,aliases:[`/ai-agents`]},"model-setup":{path:`/settings/model-setup`,aliases:[`/model-setup`]},"model-providers":{path:`/settings/model-providers`,aliases:[`/model-providers`]},"memory-import":{path:`/memory-import`,aliases:[`/settings/memory-import`]},workboard:{path:`/workboard`},worktrees:{path:`/worktrees`,aliases:[`/settings/worktrees`]},sessions:{path:`/sessions`,aliases:[`/settings/sessions`]},systems:{path:`/systems`},usage:{path:`/usage`},debug:{path:`/debug`},logs:{path:`/logs`},"skill-workshop":{path:`/skills/workshop`},skills:{path:`/skills`},"skill-settings":{path:`/settings/skills`},plugins:{path:`/plugins`},"plugin-settings":{path:`/settings/plugins`},cron:{path:`/automations`,aliases:[`/cron`]},devices:{path:`/settings/devices`,aliases:[`/nodes`]},"cloud-workers":{path:`/settings/cloud-workers`},plugin:{path:`/plugin`}},Xs=Object.keys(Ys),Zs=[],Qs=new Map;for(let e of Xs){let t=Ys[e],n=`aliases`in t?[t.path,...t.aliases]:[t.path];for(let t of n){let n=ns(t);Zs.push(n),Qs.has(n)||Qs.set(n,e)}}$s=new Set(Zs.map(e=>e.split(`/`)[1])),ec=`__openclawPluginPath`,tc=new Map,nc=new Set,rc=`person`,ic=/(?:^|-)([0-9a-f]{8,32})$/u,ac={terminal:Hs,plugin:ec,agents:Bs,activity:Vs,workboard:qs,memory:Ws,plugins:Gs,"plugin-settings":Ks,chat:Us,dashboard:Us}})))()}function oc(){}function sc(e){return!1}function cc(e){return e}function lc(e){try{let t=new URL(cc(e),location.href);return t.protocol=t.protocol.replace(/^ws/u,`http`),t.origin===location.origin}catch{return!1}}function uc(e){return e}function dc(){return(dc=e((()=>{})))()}function fc(){return window.__OPENCLAW_NATIVE_WEB_CHROME__===!0}function pc(){let e=window.__OPENCLAW_NATIVE_EMBED__;if(!q(e))return null;let{platform:t,formFactor:n,surface:r}=e;return(t===`ios`||t===`macos`||t===`android`)&&(n===`phone`||n===`pad`||n===`desktop`)&&(r===void 0||r===`conversation`)?{platform:t,formFactor:n,...r?{surface:r}:{}}:null}function mc(){return pc()!==null}function hc(){let e=window.__OPENCLAW_NATIVE_HISTORY__;return e&&typeof e.canGoBack==`boolean`&&typeof e.canGoForward==`boolean`?e:{canGoBack:!1,canGoForward:!1}}var gc;function _c(){return(_c=e((()=>{gc=`openclaw:native-history-state`,typeof window<`u`&&window.dispatchEvent(new Event(`openclaw:native-window-chrome-available`))})))()}function vc(){let e=typeof window>`u`?void 0:window.__OPENCLAW_CONTROL_UI_BASE_PATH__,t=typeof e==`string`?e:typeof document>`u`?null:document.documentElement.getAttribute(ia);return t===null?null:Aa(t)}function yc(e){let t=vc(),n=t===``&&as(e)?``:t||Is(e);return[n,t??n]}function bc(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash}}function xc(e){return`${e.pathname}${e.search}${e.hash}`}function Sc(){let e=window.history.state;if(e&&typeof e==`object`&&`openclawNativeEmbedDepth`in e){let t=e.openclawNativeEmbedDepth;if(typeof t==`number`&&Number.isSafeInteger(t)&&t>=0)return t}return 0}function Cc(){return Sc()>0}function wc(){let e=mc(),t=new Set,n;return{location:bc,push:t=>window.history.pushState(e?{openclawNativeEmbedDepth:Sc()+1}:{},``,xc(t)),replace:t=>window.history.replaceState(e?{openclawNativeEmbedDepth:Sc()}:{},``,xc(t)),listen:e=>{if(t.add(e),!n){let e=()=>{let e=bc();for(let n of t)n(e)};window.addEventListener(`popstate`,e),n=()=>window.removeEventListener(`popstate`,e)}return()=>{t.delete(e),t.size===0&&(n?.(),n=void 0)}}}}function Tc(){return(Tc=e((()=>{Sa(),Y(),_c()})))()}function Ec(e,t){let n=e!==`sw.js`&&typeof document<`u`?document.documentElement.getAttribute(ja):null,r=n?`?v=${encodeURIComponent(n)}`:``;return`${Aa(t??``)}/${e}${r}`}function Dc(e){let t=yc(typeof window>`u`?`/`:window.location.pathname)[1];return Ec(e,t)}function Oc(){return(Oc=e((()=>{Yi(),Y(),Tc()})))()}function kc(e){return e===`plugins`||e===`skills`||e===`skill-workshop`}function Ac(e){return e===`sessions`||e===`worktrees`}function jc(e){return Gc.includes(e)}function Mc(e){if(typeof e!=`string`)return null;if(e.startsWith(`route:`)){let t=e.slice(6);return t===`workboard`?{type:`plugin`,key:`workboard/workboard`}:jc(t)?{type:`route`,route:t}:null}if(e.startsWith(`session:`)){let t=e.slice(8).trim();return t?{type:`session`,key:t}:null}if(e.startsWith(`workboard:`)){let t=e.slice(10).trim();return Da(t)?{type:`plugin`,key:`workboard/board-${t}`}:null}if(e.startsWith(`plugin:`)){let t=e.slice(7),n=t.indexOf(`/`);return n>0&&n<t.length-1?{type:`plugin`,key:t}:null}return null}function Nc(e){return e.type===`route`?`route:${e.route}`:e.type===`plugin`?`plugin:${e.key}`:`session:${e.key}`}function Pc(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){let e=Mc(n);if(!e)continue;let r=Nc(e);t.includes(r)||t.push(r)}return t}function Fc(e){let t=new Set(e.flatMap(e=>{let t=Mc(e);return t?.type===`route`?[t.route]:[]}));return Gc.filter(e=>!t.has(e))}function Ic(e,t,n=null){if(e===`device`)return n!==null;if(e===`device-permissions`){let e=n?.snapshot;return!!(e&&(e.permissions.entries.length>0||e.permissions.location||e.capabilities?.activeComputerPresenceEnabled!==void 0))}return e===`updates`?t||n!==null:t||Jc.has(e)}function Lc(e){let t=e?.device;if(t?.platform===`macos`)return`nav.settingsGroupDevice`;if(t?.platform===`linux`||t?.platform===`windows`)return`nav.settingsGroupThisComputer`;if(t?.platform===`ios`){if(t.formFactor===`phone`)return`nav.settingsGroupThisIPhone`;if(t.formFactor===`pad`)return`nav.settingsGroupThisIPad`}return`nav.settingsGroupThisDevice`}function Rc(e,t=null){return qc.map(n=>({labelKey:n.labelKey===`nav.settingsGroupDevice`?Lc(t?.snapshot):n.labelKey,routes:n.routes.filter(n=>Ic(n,e,t))})).filter(e=>e.routes.length>0)}function X(e,t){return[e,`tabs.${t}`,`subtitles.${t}`]}function zc(e){return Zc.has(e)}function Bc(e){return e!==void 0&&zc(e)}function Vc(e){return Qc[e]?.[0]??`folder`}function Hc(e){let[,t]=Qc[e];return F(t)}function Uc(e){let t=e.brandName??`OpenClaw`,n=e.context.endsWith(t)?e.context:`${e.context} — ${t}`;return e.gatewayDisconnected?`(${F(`connection.disconnectedTitle`)}) ${n}`:e.attentionCount&&e.attentionCount>0?`(${e.attentionCount}) ${n}`:n}function Wc(e){let t=Qc[e][2];return F(t)}var Gc,Kc,qc,Jc,Yc,Xc,Zc,Qc;function $c(){return($c=e((()=>{wa(),N(),Gc=[`agents-home`,`dashboards`,`usage`,`cron`,`sessions`,`systems`,`activity`,`meetings`,`plugins`,`apps`,`portals`],Kc=[`agents-home`,`dashboards`,`systems`,`cron`,`plugins`].map(e=>Nc({type:`route`,route:e})),qc=[{labelKey:null,routes:[`custodian`,`profile`,`appearance`,`notifications`]},{labelKey:`nav.settingsGroupDevice`,routes:[`device`,`device-permissions`]},{labelKey:`nav.settingsGroupConnections`,routes:[`connection`,`channels`,`communications`,`talk`,`devices`,`cloud-workers`]},{labelKey:`nav.settingsGroupAgents`,routes:[`agents`,`model-providers`,`search`,`plugin-settings`,`skill-settings`,`mcp`,`memory`,`automation`]},{labelKey:`nav.settingsGroupSecurity`,routes:[`security`,`secrets`,`approvals`]},{labelKey:`nav.settingsGroupSystem`,routes:[`infrastructure`,`labs`,`advanced`,`debug`,`logs`,`updates`,`about`]}],Jc=new Set([`profile`,`appearance`,`notifications`,`connection`,`channels`,`talk`,`devices`,`agents`,`model-providers`,`search`,`plugin-settings`,`skill-settings`,`memory`,`approvals`,`advanced`,`debug`,`logs`,`about`]),Yc=[`config`,`ai-agents`,`model-setup`,`lobsterdex`],Xc=[`ai-agents`],Zc=new Set([...qc.flatMap(e=>e.routes),...Yc]),Qc={settings:[`settings`,`nav.settings`,`common.settingsSections`],"agents-home":X(`bot`,`agentsHome`),agents:X(`bot`,`agents`),activity:X(`activity`,`activity`),meetings:X(`book`,`meetings`),apps:X(`layoutGrid`,`apps`),portals:X(`monitor`,`portals`),approvals:X(`badgeCheck`,`approvals`),workboard:X(`kanban`,`workboard`),worktrees:X(`folder`,`worktrees`),channels:X(`link`,`channels`),connection:X(`radio`,`connection`),sessions:X(`fileText`,`sessions`),systems:X(`monitor`,`systems`),usage:X(`coins`,`usage`),cron:X(`calendarClock`,`cron`),skills:X(`bookOpenText`,`skills`),"skill-settings":X(`bookOpenText`,`skills`),plugins:X(`plug`,`plugins`),"plugin-settings":X(`plug`,`plugins`),"skill-workshop":X(`wrench`,`skillWorkshop`),device:X(`monitor`,`device`),"device-permissions":X(`shieldCheck`,`devicePermissions`),devices:X(`monitorSmartphone`,`devices`),"cloud-workers":X(`server`,`cloudWorkers`),chat:X(`messageSquare`,`chat`),terminal:[`terminal`,`terminal.title`,`terminal.open`],dashboard:X(`layoutDashboard`,`chat`),dashboards:X(`layoutDashboard`,`dashboards`),custodian:X(`lobster`,`custodian`),config:[`settings`,`nav.settings`,`subtitles.config`],profile:X(`circleUser`,`profile`),communications:X(`send`,`communications`),appearance:X(`palette`,`appearance`),lobsterdex:X(`bug`,`lobsterdex`),automation:X(`terminal`,`automation`),mcp:X(`wrench`,`mcp`),memory:X(`book`,`memory`),search:X(`search`,`search`),talk:X(`mic`,`talk`),infrastructure:X(`globe`,`infrastructure`),labs:X(`flaskConical`,`labs`),updates:X(`download`,`updates`),about:X(`fileText`,`about`),"ai-agents":X(`brain`,`aiAgents`),"model-setup":X(`spark`,`modelSetup`),"model-providers":[`box`,`routeTitles.modelProviders`,`subtitles.modelProviders`],"memory-import":X(`download`,`memoryImport`),notifications:[`bell`,`routeTitles.notifications`,`subtitles.notifications`],security:X(`shieldCheck`,`security`),secrets:[`key`,`tabs.secrets`,`secretsStore.hint`],advanced:[`fileCode`,`routeTitles.advanced`,`subtitles.advanced`],debug:X(`bug`,`debug`),logs:X(`scrollText`,`logs`),plugin:X(`plug`,`plugin`),"new-session":[`plus`,`newSession.title`,`newSession.hint`]}})))()}function el(){return typeof window>`u`?void 0:window}function tl(){return(tl=e((()=>{})))()}function nl(e){if(e.button!==0||e.defaultPrevented)return;for(let t of e.composedPath())if(t instanceof Element&&t.matches(il))return;let t=el()?.webkit?.messageHandlers?.openclawWindowDrag,n=t?.postMessage.bind(t);if(n){try{n({type:`window-drag`})}catch{return}e.preventDefault()}}function rl(e){if(e.target!==e.currentTarget||!(e.currentTarget instanceof HTMLElement))return;let t=Number.parseFloat(getComputedStyle(e.currentTarget).paddingTop);!Number.isFinite(t)||e.offsetY>t||nl(e)}var il;function al(){return(al=e((()=>{il=`a, button, input, select, textarea, [role='button'], [role='tab'], [role='menu'], [role^='menuitem'], [contenteditable]`})))()}var ol;function sl(){return(sl=e((()=>{R(),ol=z`
    <svg viewBox="0 0 24 24" class="icon--filled" width="16" height="16" fill="currentColor" stroke="none" aria-hidden="true">
      <path
        d="M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.56 0-.27-.01-1.17-.02-2.12-3.2.7-3.87-1.36-3.87-1.36-.52-1.33-1.28-1.68-1.28-1.68-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.19 1.76 1.19 1.03 1.76 2.7 1.25 3.36.96.1-.75.4-1.25.72-1.54-2.55-.29-5.24-1.28-5.24-5.69 0-1.26.45-2.28 1.19-3.09-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.18a11.1 11.1 0 0 1 5.78 0c2.21-1.49 3.18-1.18 3.18-1.18.63 1.59.23 2.76.11 3.05.74.81 1.19 1.83 1.19 3.09 0 4.42-2.7 5.39-5.26 5.68.41.35.78 1.05.78 2.12 0 1.53-.01 2.76-.01 3.14 0 .3.21.67.8.55A11.5 11.5 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z"
      />
    </svg>
  `})))()}var cl;function ll(){return(ll=e((()=>{cl={viewBox:`0 0 120 120`,inset:8,size:104,radius:28,glyph:`M40 42L62 60L40 78M68 80H88`,strokeWidth:11}})))()}function ul(e){pl=e;for(let e of ml)e()}function dl(){return pl}function fl(e){return io(ml,e)}var pl,ml;function hl(){return(hl=e((()=>{wo(),pl=Do(void 0),ml=new Set})))()}var gl;function _l(){return(_l=e((()=>{R(),ll(),hl(),gl=z`<svg viewBox=${cl.viewBox} width="100%" height="100%" fill="none" aria-hidden="true">
  <rect
    x=${cl.inset}
    y=${cl.inset}
    width=${cl.size}
    height=${cl.size}
    rx=${cl.radius}
    style="fill: var(--primary); stroke: none"
  />
  <path
    d=${cl.glyph}
    style="fill: none; stroke: var(--primary-foreground)"
    stroke-width=${cl.strokeWidth}
    stroke-linecap="round"
    stroke-linejoin="round"
  />
</svg>`})))()}function Z(e,t){return L`
    <svg
      viewBox="0 0 24 24"
      style=${t??I}
      fill="none"
      stroke="currentColor"
      stroke-width="2"
      stroke-linecap="round"
      stroke-linejoin="round"
    >
      ${e}
    </svg>
  `}var vl,yl;function bl(){return(bl=e((()=>{R(),_l(),vl={"⌘":z`<path d="M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3" />`,"⌥":z`<path d="M3 3h6l6 18h6M14 3h7" />`,"⇧":z`<path d="M9 19a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1v-6a1 1 0 0 1 1-1h3.293a.707.707 0 0 0 .5-1.207l-7.086-7.086a1 1 0 0 0-1.414 0l-7.086 7.086a.707.707 0 0 0 .5 1.207H8a1 1 0 0 1 1 1z" />`,"⌃":z`<path d="m18 15-6-6-6 6" />`,"⏎":z`<polyline points="9 10 4 15 9 20" /><path d="M20 4v7a4 4 0 0 1-4 4H4" />`,"↑":z`<path d="M12 19V5m-7 7 7-7 7 7" />`,"↓":z`<path d="M12 5v14m7-7-7 7-7-7" />`,"←":z`<path d="m12 19-7-7 7-7M19 12H5" />`,"→":z`<path d="M5 12h14m-7-7 7 7-7 7" />`},yl={bookOpenText:Z(z`<path d="M12 5v16M16 13h2M16 9h2" />
    <path d="M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z" />
    <path d="M6 13h2M6 9h2" />`),mark:gl,shieldCheck:Z(z`<path d="M20 13c0 5-3.5 7.5-8 9-4.5-1.5-8-4-8-9V5l8-3 8 3zM9 12l2 2 4-4" />`),shieldX:Z(z`<path d="M20 13c0 5-3.5 7.5-8 9-4.5-1.5-8-4-8-9V5l8-3 8 3zM9.5 9.5l5 5m0-5-5 5" />`),cpu:Z(z` <rect width="16" height="16" x="4" y="4" rx="2" />
    <rect width="6" height="6" x="9" y="9" rx="1" />
    <path d="M15 2v2M15 20v2M2 15h2M2 9h2M20 15h2M20 9h2M9 2v2M9 20v2" />`),foldVertical:Z(z`<path d="M12 22v-6M12 8V2M4 12H2M10 12H8M16 12h-2M22 12h-2M19 9l-3 3 3 3M5 15l3-3-3-3" />`),wrench:Z(z` <path
    d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"
  />`),fileCode:Z(z` <path
      d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"
    />
    <polyline points="14 2 14 8 20 8" />
    <path d="M10 13l-2 2 2 2M14 17l2-2-2-2" />`),edit:Z(z`<path
      d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"
    />`),home:Z(z` <path d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
    <polyline points="9 22 9 12 15 12 15 22" />`),cloud:Z(z`<path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z" />`),penLine:Z(z`<path d="M12 20h9M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" />`),paperclip:Z(z` <path
    d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"
  />`),globe:Z(z` <circle cx="12" cy="12" r="10" />
    <path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" />
    <path d="M2 12h20" />`),image:Z(z` <rect width="18" height="18" x="3" y="3" rx="2" ry="2" />
    <circle cx="9" cy="9" r="2" />
    <path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />`),copyImage:Z(z` <rect width="14" height="14" x="8" y="8" rx="2" />
    <path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
    <circle cx="13" cy="13" r="1" />
    <path d="m21 18-3-3-5 5" />`),camera:Z(z` <path
      d="M14.5 4 16 7h3a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h3l1.5-3z"
    />
    <circle cx="12" cy="13" r="3" />`),cameraOff:Z(z`<path
      d="M14.564 14.558a3 3 0 1 1-4.122-4.121M2 2l20 20M20 20H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 .819-.175M9.695 4.024A2 2 0 0 1 10.004 4h3.993a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v7.344"
    />`),smartphone:Z(z` <rect width="14" height="20" x="5" y="2" rx="2" ry="2" />
    <path d="M12 18h.01" />`),circleQuestionMark:Z(z` <circle cx="12" cy="12" r="10" />
    <path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3M12 17h.01" />`),plug:Z(z`<path d="M12 22v-5M9 8V2M15 8V2M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z" />`),circle:Z(z`<circle cx="12" cy="12" r="10" />`),puzzle:Z(z` <path
    d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"
  />`),panelLeft:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
    <path d="M9 3v18" />`),panelLeftClose:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
    <path d="M9 3v18M16 10l-3 2 3 2" />`),panelLeftOpen:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
    <path d="M9 3v18M14 10l3 2-3 2" />`),chevronDown:Z(z`<path d="M6 9l6 6 6-6" />`),chevronRight:Z(z`<path d="M9 18l6-6-6-6" />`),chevronLeft:Z(z`<path d="M15 18l-6-6 6-6" />`),externalLink:Z(z`<path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6M15 3h6v6M10 14L21 3" />`),send:Z(z`<path d="m22 2-7 20-4-9-9-4ZM22 2 11 13" />`),forward:Z(z`<path d="m15 17 5-5-5-5M4 18v-2a4 4 0 0 1 4-4h12" />`),stop:Z(z`<rect width="14" height="14" x="5" y="5" rx="1" />`),pin:Z(z` <line x1="12" x2="12" y1="17" y2="22" />
    <path
      d="M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"
    />`),pinOff:Z(z` <line x1="2" x2="22" y1="2" y2="22" />
    <line x1="12" x2="12" y1="17" y2="22" />
    <path
      d="M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0-.39.04"
    />`),download:Z(z` <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
    <polyline points="7 10 12 15 17 10" />
    <line x1="12" x2="12" y1="15" y2="3" />`),mic:Z(z`<path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3ZM19 10v2a7 7 0 0 1-14 0v-2M12 19v3" />`),volume2:Z(z` <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5" />
    <path d="M15.54 8.46a5 5 0 0 1 0 7.07M19.07 4.93a10 10 0 0 1 0 14.14" />`),volumeX:Z(z` <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5" />
    <path d="m22 9-6 6" />
    <path d="m16 9 6 6" />`),bookmark:Z(z`<path d="m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z" />`),plus:Z(z`<path d="M5 12h14M12 5v14" />`),gitBranch:Z(z` <circle cx="6" cy="5" r="2" />
    <circle cx="18" cy="6" r="2" />
    <circle cx="6" cy="19" r="2" />
    <path d="M6 7v10M8 9h5a5 5 0 0 0 5-5" />`),gitFork:Z(z` <circle cx="6" cy="6" r="3" />
    <circle cx="18" cy="6" r="3" />
    <circle cx="12" cy="18" r="3" />
    <path d="M6 9a6 6 0 0 0 6 6M18 9a6 6 0 0 1-6 6" />`),gitPullRequest:Z(z` <circle cx="6" cy="6" r="3" />
    <circle cx="18" cy="18" r="3" />
    <path d="M13 6h3a2 2 0 0 1 2 2v7M6 9v12" />`),gitPullRequestDraft:Z(z` <circle cx="6" cy="6" r="3" />
    <circle cx="18" cy="18" r="3" />
    <path d="M6 9v12" />
    <path d="M18 6v.01" />
    <path d="M18 11v.01" />`),gitPullRequestClosed:Z(z` <circle cx="6" cy="6" r="3" />
    <path d="M6 9v12" />
    <path d="m15 9 6 6" />
    <path d="m21 9-6 6" />`),gitMerge:Z(z` <circle cx="6" cy="6" r="3" />
    <circle cx="18" cy="18" r="3" />
    <path d="M6 21V9a9 9 0 0 0 9 9" />`),terminal:Z(z` <polyline points="4 17 10 11 4 5" />
    <line x1="12" x2="20" y1="19" y2="19" />`),squareTerminal:Z(z` <path d="m7 11 2-2-2-2M11 13h4" />
    <rect width="18" height="18" x="3" y="3" rx="2" ry="2" />`),listTree:Z(z`<path d="M21 12h-8M21 6H8M21 18h-8M3 6v4c0 1.1.9 2 2 2h3M3 10v6c0 1.1.9 2 2 2h3" />`),claw:Z(z` <path
      d="M8.2 10 A5.2 5.2 0 1 0 8.2 20.4 A5.2 5.2 0 0 0 8.2 10 Z M10.2 20 C14.5 20.8 19 18.6 22.3 13.2 C21 12.9 19.7 12.7 18.4 12.8 L17.5 14.6 L16 12.9 L14.3 14.5 L13.5 13 L11.5 14.2 Z"
    />
    <path
      class="claw-icon__jaw"
      d="M5.6 12.2 C5.2 5.6 10.4 1.4 15.6 2 C19.4 2.6 21.8 5.2 22.6 8.2 C20.9 7.7 19.2 7.6 17.6 7.9 L16.9 6.3 L15.2 8.5 C13.6 9.4 12.2 10.9 11.6 12.4 L6.8 13 Z"
    />`),spark:Z(z` <path
    d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"
  />`),lobster:L`
    <svg viewBox="0 0 120 120" fill="none">
      <defs>
        <linearGradient id="lob-g" x1="0%" y1="0%" x2="100%" y2="100%">
          <stop offset="0%" style="stop-color: var(--lobster-icon-body, #ff4d4d)" />
          <stop offset="100%" style="stop-color: var(--lobster-icon-shade, #991b1b)" />
        </linearGradient>
      </defs>
      <path
        d="M60 10C30 10 15 35 15 55C15 75 30 95 45 100L45 110L55 110L55 100C55 100 60 102 65 100L65 110L75 110L75 100C90 95 105 75 105 55C105 35 90 10 60 10Z"
        fill="url(#lob-g)"
      />
      <path d="M20 45C5 40 0 50 5 60C10 70 20 65 25 55C28 48 25 45 20 45Z" fill="url(#lob-g)" />
      <path
        d="M100 45C115 40 120 50 115 60C110 70 100 65 95 55C92 48 95 45 100 45Z"
        fill="url(#lob-g)"
      />
      <path
        d="M45 15Q35 5 30 8"
        style="stroke: var(--lobster-icon-body, #ff4d4d)"
        stroke-width="3"
        stroke-linecap="round"
      />
      <path
        d="M75 15Q85 5 90 8"
        style="stroke: var(--lobster-icon-body, #ff4d4d)"
        stroke-width="3"
        stroke-linecap="round"
      />
      <circle cx="45" cy="35" r="6" style="fill: var(--lobster-icon-eye, #050810)" />
      <circle cx="75" cy="35" r="6" style="fill: var(--lobster-icon-eye, #050810)" />
      <circle cx="46" cy="34" r="2.5" fill="#00e5cc" />
      <circle cx="76" cy="34" r="2.5" fill="#00e5cc" />
    </svg>
  `,circleUser:Z(z` <path d="M18 20a6 6 0 0 0-12 0" />
    <circle cx="12" cy="10" r="4" />
    <circle cx="12" cy="12" r="10" />`),bell:Z(z`<path
      d="M10.268 21a2 2 0 0 0 3.464 0M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"
    />`),palette:Z(z` <path
      d="M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z"
    />
    <circle cx="13.5" cy="6.5" r=".5" fill="currentColor" />
    <circle cx="17.5" cy="10.5" r=".5" fill="currentColor" />
    <circle cx="6.5" cy="12.5" r=".5" fill="currentColor" />
    <circle cx="8.5" cy="7.5" r=".5" fill="currentColor" />`),flaskConical:Z(z`<path
      d="M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2M6.453 15h11.094M8.5 2h7"
    />`),badgeCheck:Z(z` <path
      d="M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"
    />
    <path d="m9 12 2 2 4-4" />`),refresh:Z(z`<path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8M21 3v5h-5" />`),rotateCcw:Z(z`<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8M3 3v5h5" />`),trash:Z(z`<path
      d="M3 6h18M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2M10 11v6M14 11v6"
    />`),eye:Z(z` <path
      d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"
    />
    <circle cx="12" cy="12" r="3" />`),eyeOff:Z(z`<path
      d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49M14.084 14.158a3 3 0 0 1-4.242-4.242M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143M2 2l20 20"
    />`),arrowUpDown:Z(z`<path d="M21 16l-4 4-4-4M17 20V4M3 8l4-4 4 4M7 4v16" />`),panelRightOpen:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
    <path d="M15 3v18M10 10l-3 2 3 2" />`),panelRightClose:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
    <path d="M15 3v18M8 10l3 2-3 2" />`),columns2:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
    <path d="M12 3v18" />`),panelBottomOpen:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
    <path d="M3 15h18M10 8l2 3 2-3" />`),panelBottomClose:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
    <path d="M3 15h18M10 11l2-3 2 3" />`),maximize:Z(z` <polyline points="15 3 21 3 21 9" />
    <polyline points="9 21 3 21 3 15" />
    <line x1="21" x2="14" y1="3" y2="10" />
    <line x1="3" x2="10" y1="21" y2="14" />`),minimize:Z(z` <polyline points="4 14 10 14 10 20" />
    <polyline points="20 10 14 10 14 4" />
    <line x1="14" x2="21" y1="10" y2="3" />
    <line x1="3" x2="10" y1="21" y2="14" />`)}})))()}function xl(e){return Sl[e]}var Sl;function Cl(){return(Cl=e((()=>{R(),sl(),bl(),Sl={github:ol,repeat:Z(z`<path d="m17 2 4 4-4 4"/><path d="M3 11V9a3 3 0 0 1 3-3h15M7 22l-4-4 4-4"/><path d="M21 13v2a3 3 0 0 1-3 3H3"/>`),layers:Z(z`<path d="m12 3 10 5-10 5L2 8Z"/><path d="m2 12 10 5 10-5M2 16l10 5 10-5"/>`),messageCircle:Z(z`<path
    d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"
  />`),messageSquare:Z(z` <path
    d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"
  />`),messageSquarePlus:Z(z` <path
      d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"
    />
    <path d="M12 7v6" />
    <path d="M9 10h6" />`),messageCircleOff:Z(z` <path d="m2 2 20 20" />
    <path
      d="M4.93 4.929a10 10 0 0 0-1.938 11.412 2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 0 0 11.302-1.989"
    />
    <path d="M8.35 2.69A10 10 0 0 1 21.3 15.65" />`),layoutGrid:Z(z` <rect width="7" height="7" x="3" y="3" rx="1" />
    <rect width="7" height="7" x="14" y="3" rx="1" />
    <rect width="7" height="7" x="14" y="14" rx="1" />
    <rect width="7" height="7" x="3" y="14" rx="1" />`),barChart:Z(z` <line x1="12" x2="12" y1="20" y2="10" />
    <line x1="18" x2="18" y1="20" y2="4" />
    <line x1="6" x2="6" y1="20" y2="16" />`),layoutDashboard:Z(z` <rect width="7" height="9" x="3" y="3" rx="1" />
    <rect width="7" height="5" x="14" y="3" rx="1" />
    <rect width="7" height="9" x="14" y="12" rx="1" />
    <rect width="7" height="5" x="3" y="16" rx="1" />`),coins:Z(z` <circle cx="8" cy="8" r="6" />
    <path d="M18.09 10.37A6 6 0 1 1 10.34 18" />
    <path d="M7 6h1v4" />
    <path d="m16.71 13.88.7.71-2.82 2.82" />`),activity:Z(z` <path d="M22 12h-4l-3 9L9 3l-3 9H2" />`),clock:Z(z` <circle cx="12" cy="12" r="10" />
    <polyline points="12 6 12 12 16 14" />`),circleX:Z(z` <circle cx="12" cy="12" r="10" />
    <path d="m15 9-6 6" />
    <path d="m9 9 6 6" />`),arrowLeftRight:Z(z`<path d="m8 3-4 4 4 4" />
    <path d="M4 7h16" />
    <path d="m16 21 4-4-4-4" />
    <path d="M20 17H4" />`),arrowUpRight:Z(z` <path d="M7 17 17 7" />
    <path d="M7 7h10v10" />`),link:Z(z` <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
    <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />`),radio:Z(z` <circle cx="12" cy="12" r="2" />
    <path
      d="M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"
    />`),fileText:Z(z` <path
      d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"
    />
    <polyline points="14 2 14 8 20 8" />
    <line x1="16" x2="8" y1="13" y2="13" />
    <line x1="16" x2="8" y1="17" y2="17" />
    <line x1="10" x2="8" y1="9" y2="9" />`),file:Z(z` <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
    <polyline points="14 2 14 8 20 8" />`),fileDiff:Z(z` <path
      d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.7.71l3.59 3.58A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"
    />
    <path d="M9 10h6" />
    <path d="M12 13V7" />
    <path d="M9 17h6" />`),diff:Z(z` <path d="M12 3v14" />
    <path d="M5 10h14" />
    <path d="M5 21h14" />`),braces:Z(z` <path
      d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"
    />
    <path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1" />`),mail:Z(z` <path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z" />
    <polyline points="22,6 12,13 2,6" />`),outbox:Z(z` <polyline points="22 12 16 12 14 15 10 15 8 12 2 12" />
    <path d="M2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6" />
    <path d="M12 10V3" />
    <path d="m8 6 4-4 4 4" />`),inbox:Z(z` <polyline points="22 12 16 12 14 15 10 15 8 12 2 12" />
    <path d="m5.45 5.11-3.45 6.89v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89a2 2 0 0 0-1.79-1.11h-9.52a2 2 0 0 0-1.79 1.11z" />`),star:Z(z`<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />`),wandSparkles:Z(z` <path d="M15 4V2" />
    <path d="M15 16v-2" />
    <path d="M8 9h2" />
    <path d="M20 9h2" />
    <path d="M17.8 11.8 19 13" />
    <path d="M15 9h0" />
    <path d="M17.8 6.2 19 5" />
    <path d="m3 21 9-9" />
    <path d="M12.2 6.2 11 5" />`),chrome:Z(z` <circle cx="12" cy="12" r="10" />
    <circle cx="12" cy="12" r="4" />
    <line x1="21.17" y1="8" x2="12" y2="8" />
    <line x1="3.95" y1="6.06" x2="8.54" y2="14" />
    <line x1="10.88" y1="21.94" x2="15.46" y2="14" />`),panelsTopLeft:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
    <line x1="3" y1="9" x2="21" y2="9" />
    <line x1="9" y1="21" x2="9" y2="9" />`),box:Z(z` <path
      d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"
    />
    <polyline points="3.27 6.96 12 12.01 20.73 6.96" />
    <line x1="12" y1="22.08" x2="12" y2="12" />`),music:Z(z` <path d="M9 18V5l12-2v13" />
    <circle cx="6" cy="18" r="3" />
    <circle cx="18" cy="16" r="3" />`),asterisk:Z(z` <path d="M12 2v6" />
    <path d="m4.93 10.93 4.24 4.24" />
    <path d="M2 12h6" />
    <path d="m4.93 13.07 4.24-4.24" />
    <path d="M12 22v-6" />
    <path d="m19.07 13.07-4.24-4.24" />
    <path d="M22 12h-6" />
    <path d="m19.07 10.93-4.24 4.24" />`),zap:Z(z`<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2" />`),monitor:Z(z` <rect width="20" height="14" x="2" y="3" rx="2" />
    <line x1="8" x2="16" y1="21" y2="21" />
    <line x1="12" x2="12" y1="17" y2="21" />`),monitorSmartphone:Z(z` <path
      d="M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8"
    />
    <path d="M10 19v-3.96 3.15" />
    <path d="M7 19h5" />
    <rect width="6" height="10" x="16" y="12" rx="2" />`),server:Z(z` <rect width="20" height="8" x="2" y="2" rx="2" ry="2" />
    <rect width="20" height="8" x="2" y="14" rx="2" ry="2" />
    <line x1="6" x2="6.01" y1="6" y2="6" />
    <line x1="6" x2="6.01" y1="18" y2="18" />`),sun:Z(z` <circle cx="12" cy="12" r="4" />
    <path d="M12 2v2" />
    <path d="M12 20v2" />
    <path d="m4.93 4.93 1.41 1.41" />
    <path d="m17.66 17.66 1.41 1.41" />
    <path d="M2 12h2" />
    <path d="M20 12h2" />
    <path d="m6.34 17.66-1.41 1.41" />
    <path d="m19.07 4.93-1.41 1.41" />`),moon:Z(z` <path d="M12 3a6.5 6.5 0 0 0 9 9 9 9 0 1 1-9-9Z" />`),settings:Z(z` <path
      d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"
    />
    <circle cx="12" cy="12" r="3" />`),bug:Z(z` <path d="m8 2 1.88 1.88" />
    <path d="M14.12 3.88 16 2" />
    <path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1" />
    <path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6" />
    <path d="M12 20v-9" />
    <path d="M6.53 9C4.6 8.8 3 7.1 3 5" />
    <path d="M6 13H2" />
    <path d="M3 21c0-2.1 1.7-3.9 3.8-4" />
    <path d="M20.97 5c0 2.1-1.6 3.8-3.5 4" />
    <path d="M22 13h-4" />
    <path d="M17.2 17c2.1.1 3.8 1.9 3.8 4" />`),scrollText:Z(z` <path
      d="M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4"
    />
    <path d="M19 17V5a2 2 0 0 0-2-2H4" />
    <path d="M15 8h-5" />
    <path d="M15 12h-5" />`),folder:Z(z` <path
    d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"
  />`),kanban:Z(z` <rect width="18" height="18" x="3" y="3" rx="2" />
    <path d="M8 7v7" />
    <path d="M12 7v4" />
    <path d="M16 7v9" />`),bot:Z(z` <path d="M12 8V4H8" />
    <rect width="16" height="12" x="4" y="8" rx="2" />
    <path d="M2 14h2" />
    <path d="M20 14h2" />
    <path d="M15 13v2" />
    <path d="M9 13v2" />`),userPlus:Z(z`<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" />
    <circle cx="9" cy="7" r="4" />
    <path d="M20 8v6" />
    <path d="M23 11h-6" />`),users:Z(z` <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" />
    <circle cx="9" cy="7" r="4" />
    <path d="M22 21v-2a4 4 0 0 0-3-3.87" />
    <path d="M16 3.13a4 4 0 0 1 0 7.75" />`),shieldQuestion:Z(z` <path
      d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"
    />
    <path d="M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3" />
    <path d="M12 17h.01" />`),shield:Z(z` <path
      d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"
    />`),shieldEllipsis:Z(z` <path
      d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"
    />
    <path d="M8 12h.01" /><path d="M12 12h.01" /><path d="M16 12h.01" />`),shieldLock:Z(z` <path
      d="M20 9.807V6a1 1 0 0 0-1-1c-2 0-4.49-1.19-6.24-2.72a1.17 1.17 0 0 0-1.52 0C9.5 3.8 7 5 5 5a1 1 0 0 0-1 1v7c0 3.88 2.107 6.254 5 7.796"
    />
    <path d="M19 17v-2a2 2 0 0 0-4 0v2" />
    <rect x="13" y="17" width="8" height="5" rx="1" />`),shieldCog:Z(z` <path d="m10.929 14.467-.383.924" />
    <path d="M10.929 8.923 10.546 8" />
    <path d="M13.225 8.923 13.608 8" />
    <path d="m13.607 15.391-.382-.924" />
    <path d="m14.849 10.547.923-.383" />
    <path d="m14.849 12.843.923.383" />
    <path
      d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"
    />
    <path d="m9.305 10.547-.923-.383" />
    <path d="m9.305 12.843-.923.383" />
    <circle cx="12.077" cy="11.695" r="3" />`),shieldAlert:Z(z` <path
      d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"
    />
    <path d="M12 8v4" />
    <path d="M12 16h.01" />`),menu:Z(z` <line x1="4" x2="20" y1="12" y2="12" />
    <line x1="4" x2="20" y1="6" y2="6" />
    <line x1="4" x2="20" y1="18" y2="18" />`),x:Z(z` <path d="M18 6 6 18" />
    <path d="m6 6 12 12" />`),check:Z(z`<path d="M20 6 9 17l-5-5" />`),info:Z(z`<circle cx="12" cy="12" r="10" /><path d="M12 16v-4" /><path d="M12 8h.01" />`),square:Z(z`<rect width="18" height="18" x="3" y="3" rx="2" />`),play:Z(z`<polygon points="6 3 20 12 6 21 6 3" />`),pause:Z(z` <rect x="14" y="4" width="4" height="16" rx="1" />
    <rect x="6" y="4" width="4" height="16" rx="1" />`),target:Z(z` <circle cx="12" cy="12" r="10" />
    <circle cx="12" cy="12" r="6" />
    <circle cx="12" cy="12" r="2" />`),switchCamera:Z(z` <path d="M11 19H6.5a4.5 4.5 0 0 1 0-9H8" />
    <path d="m8 16 3 3-3 3" />
    <path d="M13 5h4.5a4.5 4.5 0 0 1 0 9H16" />
    <path d="m16 8-3-3 3-3" />`),archive:Z(z` <rect width="20" height="5" x="2" y="3" rx="1" />
    <path d="M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8" />
    <path d="M10 12h4" />`),archiveRestore:Z(z` <rect width="20" height="5" x="2" y="3" rx="1" />
    <path d="M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8" />
    <path d="m9 15 3-3 3 3" />
    <path d="M12 12v6" />`),alertTriangle:Z(z` <path
      d="m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"
    />
    <path d="M12 9v4" />
    <path d="M12 17h.01" />`),globeOff:Z(z` <path
      d="M10.114 4.462A14.5 14.5 0 0 1 12 2a10 10 0 0 1 9.313 13.643"
    />
    <path d="M15.557 15.556A14.5 14.5 0 0 1 12 22 10 10 0 0 1 4.929 4.929" />
    <path d="M15.892 10.234A14.5 14.5 0 0 0 12 2a10 10 0 0 0-3.643.687" />
    <path d="M17.656 12H22" />
    <path d="M19.071 19.071A10 10 0 0 1 12 22 14.5 14.5 0 0 1 8.44 8.45" />
    <path d="M2 12h10" />
    <path d="m2 2 20 20" />`),hand:Z(z` <path d="M18 11V6a2 2 0 0 0-4 0v5" />
    <path d="M14 10V4a2 2 0 0 0-4 0v6" />
    <path d="M10 10.5V6a2 2 0 0 0-4 0v8" />
    <path d="M6 14v-2a2 2 0 0 0-4 0v4c0 4.4 3.6 8 8 8h2c4.4 0 8-3.6 8-8v-5a2 2 0 0 0-4 0v2" />`),key:Z(z` <circle cx="7.5" cy="15.5" r="5.5" />
    <path d="m21 2-9.6 9.6" />
    <path d="m15.5 7.5 3 3L22 7l-3-3" />`),flag:Z(z` <path d="M5 22V4" />
    <path d="M5 4c5-4 9 4 14 0v11c-5 4-9-4-14 0" />`),lock:Z(z` <rect width="18" height="11" x="3" y="11" rx="2" />
    <path d="M7 11V7a5 5 0 0 1 10 0v4" />`),pencil:Z(z` <path
      d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
    />
    <path d="m15 5 4 4" />`),pipette:Z(z` <path
      d="m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12"
    />
    <path
      d="m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z"
    />
    <path d="m2 22 .414-.414" />`),pencilSparkles:Z(z` <path d="M10 3H8" />
    <path d="m15.007 5.008 3.987 3.986" />
    <path d="M20 15v4" />
    <path
      d="M21.174 6.813a2.82 2.82 0 0 0-3.986-3.987L3.842 16.175a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
    />
    <path d="M22 17h-4" />
    <path d="M4 5v4" />
    <path d="M6 7H2" />
    <path d="M9 2v2" />`),layoutComfortable:Z(z` <rect width="16" height="5" x="4" y="4" rx="1.5" />
    <rect width="16" height="5" x="4" y="15" rx="1.5" />
    <line x1="7" x2="16" y1="7" y2="7" />
    <line x1="7" x2="16" y1="18" y2="18" />`),layoutCompact:Z(z` <rect width="16" height="3" x="4" y="4" rx="1" />
    <rect width="16" height="3" x="4" y="9" rx="1" />
    <rect width="16" height="3" x="4" y="14" rx="1" />
    <rect width="16" height="3" x="4" y="19" rx="1" />`),list:Z(z`<path d="M8 6h13" /><path d="M8 12h13" /><path d="M8 18h13" />
    <path d="M3 6h.01" /><path d="M3 12h.01" /><path d="M3 18h.01" />`),listFilter:Z(z` <path d="M3 6h18" />
    <path d="M7 12h10" />
    <path d="M10 18h4" />`),gripVertical:Z(z` <circle cx="9" cy="6" r="1.1" fill="currentColor" stroke="none" />
    <circle cx="9" cy="12" r="1.1" fill="currentColor" stroke="none" />
    <circle cx="9" cy="18" r="1.1" fill="currentColor" stroke="none" />
    <circle cx="15" cy="6" r="1.1" fill="currentColor" stroke="none" />
    <circle cx="15" cy="12" r="1.1" fill="currentColor" stroke="none" />
    <circle cx="15" cy="18" r="1.1" fill="currentColor" stroke="none" />`),arrowDown:Z(vl[`↓`]),arrowUp:Z(vl[`↑`]),audioLines:Z(z`<path d="M2 10v3" />
    <path d="M6 6v11" />
    <path d="M10 3v18" />
    <path d="M14 8v7" />
    <path d="M18 5v13" />
    <path d="M22 10v3" />`),chevronUp:Z(vl[`⌃`]),chevronsUpDown:Z(z`<path d="m7 15 5 5 5-5" />
    <path d="m7 9 5-5 5 5" />`),arrowRight:Z(vl[`→`]),arrowLeft:Z(vl[`←`]),cornerDownLeft:Z(vl[`⏎`]),cornerUpLeft:Z(z` <polyline points="9 14 4 9 9 4" />
    <path d="M20 20v-7a4 4 0 0 0-4-4H4" />`),cornerDownRight:Z(z` <polyline points="15 10 20 15 15 20" />
    <path d="M4 4v7a4 4 0 0 0 4 4h12" />`),copy:Z(z` <rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
    <path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />`),search:Z(z` <circle cx="11" cy="11" r="8" />
    <path d="m21 21-4.3-4.3" />`),wrapText:Z(z` <path d="M3 6h18" />
    <path d="M3 12h15a3 3 0 1 1 0 6h-4" />
    <path d="m16 16-2 2 2 2" />
    <path d="M3 18h7" />`),brain:Z(z` <path
      d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"
    />
    <path
      d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"
    />
    <path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4" />
    <path d="M17.599 6.5a3 3 0 0 0 .399-1.375" />
    <path d="M6.003 5.125A3 3 0 0 0 6.401 6.5" />
    <path d="M3.477 10.896a4 4 0 0 1 .585-.396" />
    <path d="M19.938 10.5a4 4 0 0 1 .585.396" />
    <path d="M6 18a4 4 0 0 1-1.967-.516" />
    <path d="M19.967 17.484A4 4 0 0 1 18 18" />`),book:Z(z` <path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20" />`),loader:Z(z` <path d="M12 2v4" />
    <path d="m16.2 7.8 2.9-2.9" />
    <path d="M18 12h4" />
    <path d="m16.2 16.2 2.9 2.9" />
    <path d="M12 18v4" />
    <path d="m4.9 19.1 2.9-2.9" />
    <path d="M2 12h4" />
    <path d="m4.9 4.9 2.9 2.9" />`),calendarClock:Z(z` <path
      d="M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5"
    />
    <path d="M16 2v4" />
    <path d="M8 2v4" />
    <path d="M3 10h5" />
    <path d="M17.5 17.5 16 16.3V14" />
    <circle cx="16" cy="16" r="6" />`),listChecks:Z(z` <path d="m3 17 2 2 4-4" />
    <path d="m3 7 2 2 4-4" />
    <path d="M13 6h8" />
    <path d="M13 12h8" />
    <path d="M13 18h8" />`),moreHorizontal:Z(z` <circle cx="5" cy="12" r="1" />
    <circle cx="12" cy="12" r="1" />
    <circle cx="19" cy="12" r="1" />`),...yl}})))()}function wl(e){return Object.hasOwn(vl,e)}function Tl(e){let t=e===`↵`?`⏎`:e;return wl(t)?L`<span
        class="kbd__symbol"
        style="position:relative;display:inline-block;width:1em;height:1em"
        ><span
          style="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap"
          >${e}</span
        ><span aria-hidden="true" style="position:absolute;inset:0;display:flex;align-items:center"
          >${Z(vl[t],`width:1em;height:1em;stroke-width:2.3`)}</span
        ></span
      >`:L`<span class="kbd__text">${e}</span>`}function El(e,t={}){let n=typeof e==`string`||typeof e==`number`?[String(e)]:e;return L`<kbd
    class=${`shortcut-kbd${t.className?` ${t.className}`:``}`}
    style=${t.inline?`font:inherit`:I}
    slot=${t.slot??I}
    aria-hidden=${t.ariaHidden?`true`:I}
    ?hidden=${t.hidden}
    ${t.ref?Pi(t.ref):I}
    >${n.map(Tl)}</kbd
  >`}function Dl(e,t={}){let n=t.applePlatform??Ja(),r=w(e,n);return t.separateKeys?L`${r.map(e=>El(e,t))}`:El(n?r:r.flatMap((e,t)=>t===0?[e]:[`+`,e]),t)}function Ol(e,t){return L`${e}${` (`}${Dl(t,{inline:!0})})`}function kl(e,t){return L`${e.split(`{shortcut}`).map((e,n)=>n===0?e:L`${t}${e}`)}`}function Al(){return(Al=e((()=>{R(),Di(),Re(),bl()})))()}function jl(e){return q(e)&&e.type===`sw-updated`&&typeof e.version==`string`&&e.version!==Nl.buildId}function Ml(e){if(e.controlUiBuildSource===`configured`)return!1;let t=Nl.buildId?.trim(),n=e.buildId?.trim();if(t&&t!==`dev`&&n)return t!==n;let r=Nl.version?.trim(),i=e.version?.trim();return!!(r&&i&&r!==i)}var Nl;function Pl(){return(Pl=e((()=>{Nl={version:`2026.10.9`,commit:`8b18b5578f66eab1501cba4cef2310d88bfb9a41`,builtAt:`2026-10-29T11:14:29.241Z`,release:!0,commitAt:`2026-10-29T11:01:13.000Z`,branch:`release-ci/8b18b5578f66-1793271700018`,dirty:!0,buildId:`2026.10.9-release-8b18b5578f66-2026-10-29T11-14-29.241Z`}})))()}function Fl(e,t){let n={canReload:e,onBlocked:t};return Ll.add(n),()=>void Ll.delete(n)}function Il(e=!1){let t=[...Ll].find(e=>!e.canReload());return t&&e&&t.onBlocked(),!t}var Ll;function Rl(){return(Rl=e((()=>{Ll=new Set})))()}function zl(e){return e instanceof Error&&Ql.test(e.message)}function Bl(e=new URL(window.location.href)){e.searchParams.set(`openclaw_mount_recovery`,String(Date.now())),window.location.replace(e.href)}function Vl(){if(tu)return tu;let e=(async()=>{let e=new AbortController,t=setTimeout(()=>e.abort(),Xl);try{let t=new URL(window.location.href),[n,r]=yc(t.pathname);return t.pathname=`${r}/index.html`,t.search=``,t.hash=``,(await fetch(t.href,{method:`HEAD`,cache:`no-store`,signal:e.signal})).ok}catch{return!1}finally{clearTimeout(t)}})().finally(()=>{tu===e&&(tu=null)});return tu=e,e}function Hl(e,t){if(!e)return!1;try{return e.setItem(Jl,t),!0}catch{return!1}}async function Ul(e={}){if(e.canReload?.()===!1||!Il())return!1;let t=e.storage===void 0?jr():e.storage,n=e.buildId??Nl.buildId;try{if(t?.getItem(Jl)===n)return!1}catch{}let r=Date.now(),i=t??eu,a=$l.get(i)??[new Map,n],o=a[0],s=a[1];if(e.buildId===void 0&&s!==null&&s!==n&&(o.get(s)?.active??0)>0)return!1;for(let[e,t]of o)t.active===0&&r-t.attemptedAt>=Yl&&o.delete(e);let c=o.get(n);if(c&&(c.active===0||a[1]!==n))return!1;let l=c??{attemptedAt:r,active:0};if(!c&&e.buildId!==void 0){let e=Math.floor(Math.random()*Zl);e>0&&(l.ready=_a(e))}l.active+=1,o.set(n,l),a[1]=n,$l.set(i,a);try{if(l.ready&&await l.ready,!await Wl({timeoutMs:e.buildId===void 0?0:void 0},()=>e.canReload?.()!==!1&&Il()&&a[1]===n))return!1}finally{--l.active,l.attemptedAt=Date.now()}let u=e.reload??Bl;return!Il()||e.canReload?.()===!1||a[1]!==n||!Hl(t,n)?!1:(a[1]=null,u(),!0)}async function Wl(e,t){let n=Date.now()+(e.timeoutMs??nu);for(let e=0;;e+=1){if(!t())return!1;let r=n-Date.now();if(e>0&&r<=0)return!1;let i=await ua(Vl,r>0?r:Xl,()=>!1);if(!t())return!1;if(i)return!0;let a=n-Date.now();if(a<=0)return!1;await _a(Math.min(ru,a))}}async function Gl(e={}){if(!await Wl(e,()=>e.canReload?.()!==!1&&Il(!0))||e.canReload?.()===!1||!Il(!0))return!1;let t=e.storage===void 0?jr():e.storage,n=t??eu,r=e.reload??Bl,i=$l.get(n)??[new Map,Nl.buildId];$l.set(n,i);let a=i[1];return a!==null&&(i[1]=null,Hl(t,a),r(),!0)}function Kl(){let e=e=>{let t=e.payload;zl(t)&&Ul()};return window.addEventListener(`vite:preloadError`,e),()=>window.removeEventListener(`vite:preloadError`,e)}function ql(){let e=!1,t=!1,n=null,r=()=>{window.removeEventListener(`load`,o),window.removeEventListener(`error`,s,!0)},i=()=>{if(t||n)return;n=document.createElement(`div`),n.role=`alert`,n.style.cssText=`position:fixed;inset:0 0 auto;z-index:2147483647;padding:12px;text-align:center;background:#1f2937;color:#fff;font:14px system-ui`;let e=document.createElement(`button`);e.textContent=F(`common.reload`),e.addEventListener(`click`,()=>void Gl({timeoutMs:0})),n.append(F(`lazyView.stylesFailed`),` `,e),document.body.append(n)},a=async()=>{e||t||(e=!0,r(),await Ul()||i())};function o(){if(getComputedStyle(document.documentElement).getPropertyValue(`--openclaw-css-ok`).trim()===`1`){r();return}a()}function s(e){let t=e.target;t instanceof HTMLLinkElement&&t.relList.contains(`stylesheet`)&&a()}return window.addEventListener(`error`,s,!0),document.readyState===`complete`?o():window.addEventListener(`load`,o,{once:!0}),()=>{t=!0,r(),n?.remove(),n=null}}var Jl,Yl,Xl,Zl,Ql,$l,eu,tu,nu,ru;function iu(){return(iu=e((()=>{Ra(),Pl(),N(),Tc(),Rl(),Jl=`openclaw.controlUi.staleChunkReloadBuildId`,Yl=5e3,Xl=3e3,Zl=2e3,Ql=/importing a module script failed|failed to fetch dynamically imported module|error loading dynamically imported module|unable to preload css/i,$l=new WeakMap,eu={},tu=null,nu=3e4,ru=1e3})))()}function au(e,t){if(customElements.get(e))return Promise.resolve();let n=su.get(e);if(n)return n;let r=Promise.resolve().then(t).then(()=>{if(!customElements.get(e))throw Error(`Custom element module did not define ${e}`)}).finally(()=>{su.delete(e)});return su.set(e,r),r}function ou(e){return customElements.get(e.tagName)!==void 0}var su,cu,lu,uu,du,fu,pu,mu,hu,gu,_u,vu,yu,bu,xu,Su,Cu,wu,Tu,Eu,Du;function Ou(){return(Ou=e((()=>{N(),iu(),U(),su=new Map,cu=class{constructor(e,t,n=e=>Gl({canReload:e})){this.host=e,this.onClose=t,this.retryStale=n,this.preloads=new Set,this.activeDismissed=!1}get visibleState(){return this.current}preload(e,t){ou(e)||this.preloads.has(e.tagName)||(this.preloads.add(e.tagName),au(e.tagName,e.loadModule).then(()=>this.host.requestUpdate(),n=>{t?.reportError&&!this.current&&(this.current={element:e,error:n,stale:zl(n),status:`error`},this.host.requestUpdate())}).finally(()=>this.preloads.delete(e.tagName)))}request(e,t){let n={action:t,element:e,status:`loading`};this.current=n,this.host.requestUpdate(),this.load(n)}requestWhileActive(e,t){t?this.active!==e&&(this.active=e,this.activeDismissed=!1):this.active===e&&(this.active=void 0,this.activeDismissed=!1),!t&&this.current?.element===e?this.abandon():this.pumpActive()}retry(){let e=this.current;if(e?.status!==`error`)return;let t={action:e.action,element:e.element,status:`loading`};this.current=t,this.host.requestUpdate(),(e.stale?this.retryStale(()=>this.current===t):Promise.resolve(!1)).then(e=>{!e&&this.current===t&&this.load(t)})}close(){this.current&&(this.current.element===this.active&&(this.activeDismissed=!0),this.onClose?.(),this.abandon())}abandon(){this.current&&(this.current=void 0,this.host.requestUpdate(),this.pumpActive())}pumpActive(){this.active&&!this.activeDismissed&&!this.current&&!ou(this.active)&&this.request(this.active)}load(e){au(e.element.tagName,e.element.loadModule).then(async()=>{this.host.requestUpdate(),this.current===e&&(await this.host.updateComplete,this.current===e&&((!this.host.queryRenderedElement||this.host.queryRenderedElement(e.element.tagName)!==null)&&e.action?.(),this.current===e&&this.abandon()))},t=>{this.current===e&&(this.current={action:e.action,element:e.element,error:t,stale:zl(t),status:`error`},this.host.requestUpdate())})}},lu={tagName:`openclaw-command-palette`,label:`command palette`,loadModule:()=>W(()=>import(`./command-palette-CKRYVlRS.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39]),import.meta.url)},uu={tagName:`openclaw-debug-overlay`,get label(){return F(`debug.overlay.title`)},loadModule:()=>W(()=>import(`./debug-overlay-CS__UmeQ.js`),__vite__mapDeps([40,1,30]),import.meta.url)},du={tagName:`openclaw-keyboard-shortcuts-dialog`,get label(){return F(`shortcutsOverlay.title`)},loadModule:()=>W(()=>import(`./keyboard-shortcuts-dialog-CJ9aQ5F-.js`),__vite__mapDeps([41,1,11,3,2,4,5,8,7,6,9,12,13,14,15,30,31,32,33]),import.meta.url)},fu=`openclaw-app-sidebar`,pu={tagName:fu,label:fu,loadModule:()=>W(()=>import(`./control-ui-boot-shared-XreXSF7h.js`).then(e=>(e.Tn(),e.wn)),__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,30,31,32,33]),import.meta.url)},mu=`openclaw-macos-titlebar-controls`,hu={tagName:mu,label:mu,loadModule:()=>W(()=>import(`./macos-titlebar-controls.runtime-Cs54QxDd.js`),__vite__mapDeps([42,1,30]),import.meta.url)},gu={tagName:`openclaw-sidebar-attention`,label:F(`attention.issues`),loadModule:()=>W(()=>import(`./control-ui-boot-shared-XreXSF7h.js`).then(e=>(e.Cr(),e.wr)),__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,30,31,32,33]),import.meta.url)},_u={tagName:`openclaw-terminal-panel`,label:`terminal panel`,loadModule:()=>W(()=>import(`./terminal-panel-registration-DRAlY3On.js`).then(e=>(e.t(),e.n)),__vite__mapDeps([43,1,5,4,18,2,3,6,7,8,9,10,11,12,13,14,15,19,17,16,20,21,44,45,46,47,48,49,50,30,31,32,33,34,35,36]),import.meta.url)},vu={tagName:`openclaw-browser-panel`,label:`browser panel`,loadModule:()=>W(()=>import(`./browser-panel-s0odPIu7.js`).then(e=>(e.n(),e.t)),__vite__mapDeps([51,1,2,3,4,5,6,7,8,9,11,12,13,14,15,17,10,18,19,16,20,21,44,45,46,52,47,48,30,31,32,33,34,35,36]),import.meta.url)},yu={tagName:`openclaw-browser-document`,label:vu.label,loadModule:()=>W(()=>import(`./browser-document-B_lgtp-W.js`),__vite__mapDeps([53,1,12,3,2,4,5,8,7,6,9,11,13,14,15,51,17,10,18,19,16,20,21,44,45,46,52,47,48,30,31,32,33,34,35,36]),import.meta.url)},bu={tagName:`openclaw-desktop-panel`,label:`desktop panel`,loadModule:()=>W(()=>import(`./desktop-panel-CuBSlrvl.js`).then(e=>(e.n(),e.t)),__vite__mapDeps([54,1,13,3,2,4,5,8,7,6,9,11,12,14,15,55,10,19,17,18,16,20,21,56,22,23,44,45,52,29,57,30,31,33,32,34,35,36,37,38,58]),import.meta.url)},xu={tagName:`openclaw-link-reader-panel`,get label(){return F(`linkReader.title`)},loadModule:()=>W(()=>import(`./link-reader-panel-DAzjGGyQ.js`),__vite__mapDeps([59,1,2,3,4,5,6,7,8,9,12,11,13,14,15,45,46,60,30,31,32,33]),import.meta.url)},Su={tagName:`openclaw-board-document`,label:`dashboard document`,loadModule:()=>W(()=>import(`./board-document-TdjPzEp6.js`),__vite__mapDeps([61,1,2,3,4,5,6,7,8,9,17,10,11,12,13,14,15,18,19,16,20,21,62,63,64,65,66,67,30,31,32,33,34,35,36,68,69]),import.meta.url)},Cu={tagName:`openclaw-approval-page`,label:`approval page`,loadModule:()=>W(()=>import(`./approval-page-registration-HvX_GBXg.js`),__vite__mapDeps([70,1,2,3,4,5,6,7,8,9,12,11,13,14,15,71,30,31,32,33,72]),import.meta.url)},wu=`openclaw-question-page`,Tu={tagName:wu,label:wu,loadModule:()=>W(()=>import(`./question-page-registration-Bsw24wuT.js`),__vite__mapDeps([73,1,12,3,2,4,5,8,7,6,9,11,13,14,15,56,10,19,17,18,16,20,21,55,22,23,71,30,31,32,33,34,35,36,37,38,58,72]),import.meta.url)},Eu={tagName:`openclaw-exec-approval`,get label(){return F(`tabs.approvals`)},loadModule:()=>W(()=>import(`./exec-approval-BFG7h9_d.js`),__vite__mapDeps([74,1,12,3,2,4,5,8,7,6,9,11,13,14,15,30,31,32,33]),import.meta.url)},Du={tagName:`openclaw-login-gate`,label:`login screen`,loadModule:()=>W(()=>import(`./login-runtime-WXCKwuhW.js`).then(e=>(e.t(),e.n)),__vite__mapDeps([75,1,11,3,2,4,5,8,7,6,9,12,13,14,15,30,31,32,33]),import.meta.url)}})))()}var ku;function Au(){return(Au=e((()=>{R(),ku=Ii`
  .shortcut-kbd:where(:not([hidden])) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
  }

  .shortcut-kbd > span + span {
    margin-inline-start: 0.15em;
  }
  .kbd__text {
    text-box: trim-both cap alphabetic;
  }
  .shortcut-kbd::before {
    content: "";
    height: 1lh;
  }
`})))()}function ju(e){return e.replace(/\s+/g,` `).trim()}function Mu(e){return typeof e==`object`&&!!e&&`namespaceURI`in e&&(e.namespaceURI===`http://www.w3.org/1999/xhtml`||e.namespaceURI===`http://www.w3.org/2000/svg`)}function Nu(e){return e.nodeType===Node.ELEMENT_NODE}function Pu(e,t){let n=e.ownerDocument.defaultView?.getComputedStyle(e);if(e.hasAttribute(`hidden`)||!t&&e.getAttribute(`aria-hidden`)===`true`||n?.display===`none`||n?.contentVisibility===`hidden`)return``;let r=n?.visibility!==`hidden`&&n?.visibility!==`collapse`&&(n?.display===`contents`||typeof e.checkVisibility!=`function`||e.checkVisibility({checkOpacity:t,checkVisibilityCSS:!0}));return[...e.childNodes].map(e=>Nu(e)?Pu(e,t):e.nodeType===Node.TEXT_NODE&&r?e.textContent??``:``).join(` `)}function Fu(e){return Pu(e,!1)}function Iu(e){return e.matches(`[data-tooltip-overflow]`)||e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight}function Lu(e,t){let n=ju(e),r=ju(Pu(t,!0));if(!n||!r.includes(n)||Iu(t))return!1;for(let e of t.querySelectorAll(`*`))if(Mu(e)&&Iu(e))return!1;return!0}function Ru(e){let t=e?.closest(`openclaw-tooltip`);t&&e?t.focusTriggerWithoutOpening(e):e?.focus()}var zu,Bu,Vu,Hu,Uu,Wu,Gu,Ku,qu;function Ju(){return(Ju=e((()=>{R(),ji(),Ou(),hi(),Ht(),Ae(),Au(),U(),zu=`a[href], button, input, select, textarea, [tabindex]:not([tabindex="-1"])`,Bu=150,Vu=300,Hu=100,Uu=0,Wu=()=>`openclaw-tooltip-${++Uu}`,Gu=class extends Ee{constructor(...e){super(...e),this.delayed=!0,this.#e=`keyboard`,this.#t=null,this.#r=e=>{[`Alt`,`Control`,`Meta`,`Shift`].includes(e.key)||(this.#e=`keyboard`)},this.#i=()=>{this.#e=`pointer`}}#e;#t;connectedCallback(){super.connectedCallback(),this.style.display=`contents`,this.#e=`keyboard`,this.ownerDocument.addEventListener(`keydown`,this.#r,!0),this.ownerDocument.addEventListener(`pointerdown`,this.#i,!0)}disconnectedCallback(){this.ownerDocument.removeEventListener(`keydown`,this.#r,!0),this.ownerDocument.removeEventListener(`pointerdown`,this.#i,!0),Ku.closeForProvider(this),this.#n(),this.delayed=!0,super.disconnectedCallback()}focusOpensTooltip(){return this.#e===`keyboard`}openTooltip(){this.delayed=!1,this.#n()}closeTooltip(){this.#n(),this.#t=window.setTimeout(()=>{this.#t=null,this.delayed=!0},Vu)}#n(){this.#t!==null&&(window.clearTimeout(this.#t),this.#t=null)}#r;#i;render(){return L`<slot></slot>`}},Ku=class e extends Ee{constructor(...t){super(...t),this.content=``,this.placement=`top`,this.closeDelay=Hu,this.describe=!0,this.autoSize=!1,this.disabled=!1,this.openOnClick=!1,this.anchor=null,this.materialized=!1,this.#t=null,this.#n=!1,this.#r=null,this.#i=null,this.#a=null,this.#o=!1,this.#s=!1,this.#c=!1,this.#l=null,this.#u=!1,this.#d=!1,this.#f=null,this.#p=null,this.#m=null,this.#h=Wu(),this.#g=`${this.#h}-description`,this.#b=e=>{(!(`pointerType`in e)||e.pointerType!==`touch`)&&(this.#o=!0,this.#c=!1,this.#B(),this.#k())},this.#x=e=>{(!(`pointerType`in e)||e.pointerType!==`touch`)&&(this.#o=!1,this.#c=!0,this.#U(!1),this.#H())},this.#S=e=>{e.pointerType!==`touch`&&(this.#s=!0,this.#c=!1,this.#B(),this.#A())},this.#C=e=>{e.pointerType!==`touch`&&(this.#s=!1,this.#c=!0,this.#H())},this.#w=()=>{this.openOnClick||this.#F()},this.#T=()=>{this.#F()},this.#E=()=>{if(this.#d){this.#d=!1,this.#F();return}this.#m?.focusOpensTooltip()!==!1&&this.#A()},this.#D=e=>{e instanceof FocusEvent&&e.relatedTarget instanceof Node&&this.#P(e.relatedTarget)||this.#n||this.#o||this.#s||this.#F()},this.#O=()=>{if(this.openOnClick&&!this.#n){this.#A(),this.#n=this.hasAttribute(`open`);return}this.#F()},this.#j=t=>{e.consumeEscape(t,this.ownerDocument)},this.#M=e=>{e.composedPath().some(e=>e===this||e===this.#t)||this.#F()},this.#N=e=>{e.pointerType!==`touch`&&this.#c&&this.#a===null&&!e.composedPath().includes(this)&&this.#H(!0)},this.#q=()=>{this.#K(),this.#R(),this.#G||this.#F()}}static#e=new WeakMap;static{this.consumeEscape=(t,n)=>{if(t.key!==`Escape`||t.defaultPrevented||t.isComposing||t.keyCode===229)return!1;let r=e.#e.get(n);if(!r)return!1;t.preventDefault(),t.stopImmediatePropagation();let i=n.activeElement,a=i&&r.contains(i)&&!r.#t?.contains(i)?r.#L():null;return r.#F(),a instanceof HTMLElement&&r.focusTriggerWithoutOpening(a),!0}}static closeForProvider(t){let n=e.#e.get(t.ownerDocument);n&&n.#m===t&&n.#F()}#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;static{this.styles=[ku,Ii`
      :host {
        display: contents;
      }

      wa-tooltip:not(:defined) {
        display: none;
      }

      wa-tooltip {
        --max-width: var(--openclaw-tooltip-max-width, min(260px, calc(100vw - 16px)));
        --wa-tooltip-arrow-size: var(--openclaw-tooltip-arrow-size, 0px);
        --wa-tooltip-background-color: var(
          --openclaw-tooltip-background-color,
          color-mix(in srgb, var(--bg-elevated) 97%, var(--text) 3%)
        );
        --wa-tooltip-border-color: var(
          --openclaw-tooltip-border-color,
          var(--overlay-border, var(--border-strong))
        );
        --wa-tooltip-border-width: 1px;
        --wa-tooltip-border-style: solid;
        --wa-tooltip-content-color: var(--text);
        --wa-tooltip-border-radius: var(--openclaw-tooltip-border-radius, var(--radius-md));
        --show-duration: var(--openclaw-tooltip-popup-show-duration, var(--wa-transition-fast));
        --hide-duration: var(--openclaw-tooltip-popup-hide-duration, var(--wa-transition-fast));
        font-family: var(--font-body);
      }

      wa-tooltip::part(body) {
        padding: var(--openclaw-tooltip-padding, 5px 7px);
        box-shadow: var(--openclaw-tooltip-shadow, var(--overlay-shadow, var(--shadow-md)));
        font-size: 11px;
        font-weight: 500;
        line-height: 1.25;
        overflow-wrap: anywhere;
      }

      :host(.sidebar-hover-tooltip) wa-tooltip[open]::part(base__popup) {
        animation: var(--openclaw-tooltip-open-animation);
      }

      @media (prefers-reduced-motion: reduce) {
        wa-tooltip {
          --show-duration: 0ms;
          --hide-duration: 0ms;
        }

        :host(.sidebar-hover-tooltip) wa-tooltip[open]::part(base__popup) {
          animation: none;
        }
      }

      @keyframes openclaw-tooltip-hover-card-in {
        from {
          opacity: 0;
          transform: scale(0.95);
        }
        to {
          opacity: 1;
          transform: scale(1);
        }
      }

      .tooltip-content {
        display: block;
        text-align: center;
        white-space: pre-line;
      }

      .tooltip-rich-content {
        display: block;
        pointer-events: auto;
        text-align: left;
      }
    `]}connectedCallback(){super.connectedCallback(),this.style.display=`contents`}updated(){this.#_(),this.#R(),this.#y(),(this.disabled||!this.#G||this.hasAttribute(`open`)&&this.#I())&&this.#F()}disconnectedCallback(){this.#F(),this.#p?.disconnect(),this.#p=null,this.#m=null,this.#v(),super.disconnectedCallback()}#_(){let e=this.renderRoot.querySelector(`slot:not([name])`),t=this.anchor??e?.assignedElements({flatten:!0}).find(Mu);if(t===this.#t||(this.#F(),this.#v(),!t))return;this.#t=t,this.#m=null;let n=t;for(;n;){let e=n.closest(`openclaw-tooltip-provider`);if(e){this.#m=e;break}let t=n.getRootNode();n=t instanceof ShadowRoot?t.host:null}t.addEventListener(`pointerenter`,this.#b),t.addEventListener(`pointerleave`,this.#x),t.addEventListener(`pointerdown`,this.#w),t.addEventListener(`pointercancel`,this.#T),t.addEventListener(`focusin`,this.#E),t.addEventListener(`focusout`,this.#D),t.addEventListener(`click`,this.#O,!0),this.#K(),this.#R(),this.#y()}#v(){let e=this.#t;e&&(e.removeEventListener(`pointerenter`,this.#b),e.removeEventListener(`pointerleave`,this.#x),e.removeEventListener(`pointerdown`,this.#w),e.removeEventListener(`pointercancel`,this.#T),e.removeEventListener(`focusin`,this.#E),e.removeEventListener(`focusout`,this.#D),e.removeEventListener(`click`,this.#O,!0),this.#z(),this.#t=null)}previewForAnchor(e,t,n){this.anchor=e,this.content=t,this.updateComplete.then(()=>{this.anchor===e&&e.isConnected&&this.isConnected&&(n===`focus`?this.#E():(this.#o=!0,this.#k()))})}async#y(){let e=this.webAwesomeTooltip;if(!e)return;e.showDelay=0,e.hideDelay=0;let t=this.#t;if(!customElements.get(`wa-tooltip`)){e.anchor=t;return}if(await e.updateComplete,this.webAwesomeTooltip===e&&this.#t===t){e.anchor=t;let n=e.popup;if(!n)return;this.autoSize?n.setAttribute(`auto-size`,`vertical`):n.removeAttribute(`auto-size`),n.autoSizePadding=this.autoSize?8:0,n.shiftPadding=this.autoSize?8:0}}#b;#x;#S;#C;#w;#T;#E;#D;#O;#k(){if(this.disabled||this.hasAttribute(`open`)||this.#i!==null)return;let e=this.#m,t=this.delay===void 0&&e?.delayed===!1?0:Math.max(0,this.delay??Bu);this.#i=window.setTimeout(()=>{this.#i=null,this.#A()},t)}#A(){if(this.disabled||!this.#t||!this.#G||this.#I())return;this.materialized=!0,au(`wa-tooltip`,()=>W(()=>import(`./tooltip-CDOOCPai.js`),__vite__mapDeps([76,1,5,4,30]),import.meta.url)).then(async()=>{await this.updateComplete,await this.#y();let t=this.webAwesomeTooltip;t&&this.isConnected&&e.#e.get(this.ownerDocument)===this&&(t.placement=this.#J(),t.open=!0)}).catch(t=>{e.#e.get(this.ownerDocument)===this&&(this.#F(),oi({message:xi(t)}))}),this.#U(!1);let t=e.#e.get(this.ownerDocument);t&&t!==this&&t.#F(),e.#e.set(this.ownerDocument,this),this.#m?.openTooltip(),this.#R(),this.setAttribute(`open`,``),this.renderRoot.querySelector(`.tooltip-rich-content`)?.removeAttribute(`inert`),this.ownerDocument.addEventListener(`pointerdown`,this.#M,!0),this.ownerDocument.addEventListener(`focusin`,this.#M,!0),this.hoverDismissDelay!==void 0&&this.ownerDocument.addEventListener(`pointermove`,this.#N,!0),this.ownerDocument.defaultView?.addEventListener(`keydown`,this.#j,!0)}#j;#M;#N;#P(e){return this.contains(e)||this.#t?.contains(e)===!0}#F(){this.#n=!1,this.removeAttribute(`open`),this.renderRoot.querySelector(`.tooltip-rich-content`)?.setAttribute(`inert`,``),this.ownerDocument.removeEventListener(`pointerdown`,this.#M,!0),this.ownerDocument.removeEventListener(`focusin`,this.#M,!0),this.ownerDocument.removeEventListener(`pointermove`,this.#N,!0),this.ownerDocument.defaultView?.removeEventListener(`keydown`,this.#j,!0),this.#U(),this.webAwesomeTooltip?.open&&(this.webAwesomeTooltip.open=!1),e.#e.get(this.ownerDocument)===this&&(e.#e.delete(this.ownerDocument),this.#m?.closeTooltip())}#I(){return!this.#W&&this.#t!==null&&Lu(this.content,this.#t)}#L(){let e=this.#t;return e?e.matches(zu)?e:e.querySelector(zu)??e:null}#R(){let e=this.#W;if(this.webAwesomeTooltip?.style.setProperty(`pointer-events`,e?`auto`:`none`),!this.describe){this.#z();return}let t=this.#L();if(!t)return;this.#r=t;let n=t.getAttribute(`aria-describedby`);if(this.#u||=(this.#l=n,!0),!this.#f){let e=this.ownerDocument.createElement(`span`);e.id=this.#g,e.hidden=!0;let n=t.getRootNode();(n instanceof ShadowRoot?n:this).append(e),this.#f=e}let r=e||this.content;this.#f.textContent!==r&&(this.#f.textContent=r);let i=new Set((n??``).split(/\s+/u).filter(Boolean));i.add(this.#g);let a=[...i].join(` `);n!==a&&t.setAttribute(`aria-describedby`,a)}#z(){let e=this.#r??this.#t;e&&(this.#l?e.setAttribute(`aria-describedby`,this.#l):e.removeAttribute(`aria-describedby`),this.#r=null,this.#f?.remove(),this.#f=null,this.#l=null,this.#u=!1)}#B(){this.#a!==null&&(window.clearTimeout(this.#a),this.#a=null)}#V(e=!1){if(e)return this.#o||this.#s;let t=this.#t?.getRootNode(),n=t instanceof ShadowRoot?t.activeElement:this.ownerDocument.activeElement;return this.#n||this.#o||this.#s||n instanceof Node&&this.#P(n)}#H(e=!1){if(this.#B(),!this.#V(e)){if(!this.#W){this.#F();return}this.#a=window.setTimeout(()=>{this.#a=null,this.#V(e)||this.#F()},this.hoverDismissDelay??this.closeDelay)}}#U(e=!0){this.#i!==null&&(window.clearTimeout(this.#i),this.#i=null),this.#B(),e&&(this.#o=!1,this.#s=!1,this.#c=!1)}get#W(){return ju(this.renderRoot.querySelector(`slot[name="content"]`)?.assignedNodes({flatten:!0}).map(e=>e.textContent??``).join(` `)??``)}get#G(){return this.#W||this.content}#K(){this.#p?.disconnect(),this.#p??=new MutationObserver(()=>this.#R());let e=this.renderRoot.querySelector(`slot[name="content"]`);for(let t of e?.assignedNodes({flatten:!0})??[])this.#p.observe(t,{characterData:!0,childList:!0,subtree:!0})}#q;#J(){return(this.placement===`right-start`||this.placement===`right`)&&this.ownerDocument.defaultView?.matchMedia?.(`(max-width: 640px)`).matches?`bottom-start`:this.placement}render(){return L`
      <slot @slotchange=${()=>this.#_()}></slot>
      ${this.materialized?L`<wa-tooltip
              id=${this.#h}
              placement=${this.#J()}
              trigger="manual"
              @wa-hide=${()=>this.#F()}
            >
              <span class="tooltip-content">${this.contentTemplate??this.content}</span>
              <span
                class="tooltip-rich-content"
                ?inert=${!this.hasAttribute(`open`)}
                @pointerenter=${this.#S}
                @pointerleave=${this.#C}
                @focusin=${this.#E}
                @focusout=${this.#D}
              >
                <slot name="content" @slotchange=${this.#q}></slot>
              </span>
            </wa-tooltip>`:L` <slot name="content" hidden @slotchange=${this.#q}></slot> `}
    `}focusTriggerWithoutOpening(e){this.#t?.contains(e)&&!e.matches(`:focus`)&&(this.#d=!0),e.focus()}},H([B()],Ku.prototype,`content`,void 0),H([B({attribute:!1})],Ku.prototype,`contentTemplate`,void 0),H([B()],Ku.prototype,`placement`,void 0),H([B({type:Number})],Ku.prototype,`closeDelay`,void 0),H([B({type:Number})],Ku.prototype,`hoverDismissDelay`,void 0),H([B({type:Number})],Ku.prototype,`delay`,void 0),H([B({type:Boolean})],Ku.prototype,`describe`,void 0),H([B({type:Boolean,attribute:`auto-size`})],Ku.prototype,`autoSize`,void 0),H([B({type:Boolean})],Ku.prototype,`disabled`,void 0),H([B({type:Boolean,attribute:`open-on-click`})],Ku.prototype,`openOnClick`,void 0),H([B({attribute:!1})],Ku.prototype,`anchor`,void 0),H([Ni(`wa-tooltip`)],Ku.prototype,`webAwesomeTooltip`,void 0),H([Li()],Ku.prototype,`materialized`,void 0),qu=Ku.consumeEscape,customElements.get(`openclaw-tooltip-provider`)||customElements.define(`openclaw-tooltip-provider`,Gu),customElements.get(`openclaw-tooltip`)||customElements.define(`openclaw-tooltip`,Ku)})))()}var Yu;function Xu(){return(Xu=e((()=>{R(),ji(),al(),Oc(),N(),Ae(),Cl(),Al(),Ju(),Yu=class extends f{constructor(...e){super(...e),this.navDrawerOpen=!1,this.resourceBasePath=``,this.environment=null}render(){let e=this.navDrawerOpen?F(`nav.collapse`):F(`nav.expand`);return L`
      <header class="topbar">
        <div class="topnav-shell">
          <openclaw-tooltip .content=${e}>
            <button
              type="button"
              class="topbar-icon-btn topbar-nav-toggle"
              @click=${e=>this.onToggleDrawer(e.currentTarget)}
              aria-label=${e}
              aria-expanded=${String(this.navDrawerOpen)}
            >
              <span class="nav-collapse-toggle__icon" aria-hidden="true">${Sl.menu}</span>
            </button>
          </openclaw-tooltip>
          <div class="topnav-shell__content" @mousedown=${nl}>
            <div class="topbar-brand" aria-label="OpenClaw">
              <img
                class="topbar-brand__logo"
                src=${Ec(`apple-touch-icon.png`,this.resourceBasePath)}
                loading="lazy"
                alt=""
                aria-hidden="true"
              />
              <span class="topbar-brand__title">OpenClaw</span>
              ${this.environment&&L`<span class="control-ui-environment-pill">${this.environment.label}</span>`}
            </div>
          </div>
          <div class="topnav-shell__actions">
            <openclaw-tooltip
              .content=${F(`chat.commandPaletteTitle`)}
              .contentTemplate=${kl(F(`chat.commandPaletteTitle`).replace(`⌘K`,`{shortcut}`),El([`⌘`,`K`],{inline:!0}))}
            >
              <button
                class="topbar-search"
                @click=${this.onOpenPalette}
                aria-label=${F(`chat.openCommandPalette`)}
              >
                ${Sl.search}
              </button>
            </openclaw-tooltip>
          </div>
        </div>
      </header>
    `}},H([B({attribute:!1})],Yu.prototype,`navDrawerOpen`,void 0),H([B({attribute:!1})],Yu.prototype,`resourceBasePath`,void 0),H([B({attribute:!1})],Yu.prototype,`environment`,void 0),H([B({attribute:!1})],Yu.prototype,`onToggleDrawer`,void 0),H([B({attribute:!1})],Yu.prototype,`onOpenPalette`,void 0),customElements.get(`openclaw-app-topbar`)||customElements.define(`openclaw-app-topbar`,Yu)})))()}function Zu(e){let t=$u.get(e);return t||(t=new Qu,$u.set(e,t)),t}var Qu,$u;function ed(){return(ed=e((()=>{Qu=class{constructor(){this.region=`page`,this.listeners=new Set}get current(){return this.region}claim(e){if(this.region!==e){this.region=e;for(let e of this.listeners)e()}}subscribe(e){return io(this.listeners,e)}},$u=new WeakMap})))()}var td;function nd(){return(nd=e((()=>{td=Ga(`openclaw.application`)})))()}function rd(e,t,n,r=``,i={}){return Ha({namespace:e,sessionKey:n,fallbackAgentId:t,basePath:r,displayName:i.displayName??void 0,exactKey:i.exactKey,mainKey:i.mainKey??void 0,shortIdLength:i.shortIdLength??32})}function id(){return(id=e((()=>{la()})))()}function ad(e){let t=e.agentId?.trim()||Si(e.sessionKey)?.agentId;t&&(e.background?e.selection.set(K(t),{background:!0}):e.selection.set(K(t))),e.gateway.setSessionKey(e.sessionKey)}function od(e,t,n,r,i={}){let a=e=>{let n=e?.trim()?K(e):null,r=t.state.agentsList;if(!r&&!i.requireConfiguredAgent)return n;let a=r?.agents.filter(e=>!i.requireConfiguredAgent||e.kind!==`system`)??[],o=e=>a.some(t=>K(t.id)===e),s=r?K(r.defaultId):null;return o(n)?n:o(s)?s:a[0]?K(a[0].id):null},o=e=>{let n=e?.trim()?K(e):null;return t.state.agentsList?.agents.some(e=>e.kind===`system`&&K(e.id)===n)?null:n},s=e.connection.gatewayUrl,c=n?.load(s)?.trim(),l=a(c?K(c):e.snapshot.assistantAgentId?K(e.snapshot.assistantAgentId):null),u=i.requireConfiguredAgent&&!t.state.agentsList&&c?K(c):null,d=r?.settings.sidebarAgentsMode===`roster`,f=e=>o(r?.settings.sidebarPreTeamScope===void 0?e:r.settings.sidebarPreTeamScope),p=f(l),m=r?.settings.sidebarPreTeamScope===void 0&&!t.state.agentsList,h=!d&&m,g=new Set(t.state.agentsList?.agents.map(e=>K(e.id))),_={selectedId:l,scopeId:i.requireConfiguredAgent?l:d?null:p},v=e.snapshot.assistantAgentId?K(e.snapshot.assistantAgentId):null,y=!c||!u&&l!==K(c);c&&y&&n?.save(s,null);let b=new Set,x=0,S=x,C=e=>{let t=a(e.selectedId),n=i.requireConfiguredAgent?t:d||t===e.selectedId?e.scopeId:t,r={selectedId:t,scopeId:o(n)};if(_.selectedId!==r.selectedId||_.scopeId!==r.scopeId||S!==x){S=x,_=r;for(let e of b)e(_)}},ee=r?.subscribe(()=>{if(e.connection.gatewayUrl!==s)return;let t=r.settings.sidebarAgentsMode===`roster`;t!==d&&(x+=1,d=t,d?(p=_.scopeId,m=h):p=f(p),h=!d&&m,r.patch({sidebarPreTeamScope:d?p:void 0}),C({..._,scopeId:d?null:p}))}),w=e.subscribe(i=>{let a=i.assistantAgentId?K(i.assistantAgentId):null,o=a!==v;v=a;let c=e.connection.gatewayUrl;if(c!==s){s=c,x+=1,u=null;let e=n?.load(s)?.trim();y=!e;let i=e?K(e):a;d=r?.settings.sidebarAgentsMode===`roster`,p=f(i),m=r?.settings.sidebarPreTeamScope===void 0&&!t.state.agentsList,h=!d&&m,g.clear(),C({selectedId:i,scopeId:d?null:p});return}o&&y&&a&&(d||(h=!t.state.agentsList),C({selectedId:a,scopeId:d?_.scopeId:a}))}),T=t.subscribe(()=>{if(i.requireConfiguredAgent){let e=u??(y?v:_.selectedId),r=a(e);t.state.agentsList?(u=null,!y&&r!==e&&(y=!0,n?.save(s,null))):y||(u=e),C({selectedId:r,scopeId:r});return}let e=new Set(t.state.agentsList?.agents.map(e=>K(e.id))),c=_.scopeId;t.state.agentsList&&(p&&(m||g.has(p))&&!e.has(p)&&(p=o(a(p)),d&&r?.patch({sidebarPreTeamScope:p})),m=!1,h=!1,d&&_.scopeId&&g.has(_.scopeId)&&!e.has(_.scopeId)&&(c=null),g=e),!y&&a(_.selectedId)!==_.selectedId&&(y=!0,n?.save(s,null)),C(y&&v?{selectedId:v,scopeId:d||_.selectedId===v?c:v}:{..._,scopeId:c})}),E=(e,r)=>{r?.background||(x+=1);let o=e?.trim()?K(e):null;u=i.requireConfiguredAgent&&!t.state.agentsList?o:null,y=!o||!u&&a(o)!==o,d||(h=!t.state.agentsList),n?.save(s,y?null:o),C({selectedId:o,scopeId:d?_.scopeId:o})};return{get state(){return _},get intentRevision(){return x},set:E,setScope(e){if(i.requireConfiguredAgent){E(e);return}x+=1,h=!1;let t=e?.trim()?K(e):null;C({..._,scopeId:t})},subscribe:e=>io(b,e),dispose(){ee?.(),w(),T(),b.clear()}}}function sd(){return(sd=e((()=>{Yn()})))()}function cd(){return L`<div
    class="assistant-panel-loading"
    role="status"
    aria-live="polite"
    aria-label=${F(`common.loading`)}
    aria-busy="true"
  >
    <div class="assistant-panel-loading__content" aria-hidden="true">
      <div class="assistant-panel-loading__messages">
        <div>
          <div class="assistant-panel-loading__lines"><span></span><span></span><span></span></div>
        </div>
        <div class="assistant-panel-loading__message--reply">
          <div class="assistant-panel-loading__lines"><span></span><span></span></div>
        </div>
        <div>
          <div class="assistant-panel-loading__lines"><span></span><span></span></div>
        </div>
      </div>
      <div class="assistant-panel-loading__composer"></div>
    </div>
  </div>`}function ld(){return(ld=e((()=>{R(),N()})))()}var ud,dd;function fd(){return(fd=e((()=>{R(),ji(),N(),Ae(),ud=[`pointerup`,`pointercancel`,`blur`],dd=class extends Ee{constructor(...e){super(...e),this.splitRatio=.6,this.minRatio=.4,this.maxRatio=.7,this.label=``,this.orientation=`vertical`,this.startPosition=0,this.startRatio=0,this.dragRatio=0,this.dragSize=0,this.dragFrame=0,this.pendingPosition=null,this.activePointerId=null,this.handlePointerDown=e=>{if(e.button===0&&this.activePointerId===null&&(this.startPosition=this.orientation===`horizontal`?e.clientY:e.clientX,this.startRatio=this.currentRatio(),this.dragRatio=this.startRatio,this.dragSize=this.measureDragSize(),!(this.dragSize<=0))){this.classList.add(`dragging`),this.activePointerId=e.pointerId,typeof this.setPointerCapture==`function`&&this.setPointerCapture(e.pointerId),window.addEventListener(`pointermove`,this.handlePointerMove);for(let e of ud)window.addEventListener(e,this.finishDragging);this.addEventListener(`lostpointercapture`,this.finishDragging),e.preventDefault(),this.dispatchEvent(new CustomEvent(`resize-start`,{bubbles:!0,composed:!0}))}},this.handlePointerMove=e=>{e.pointerId===this.activePointerId&&(this.pendingPosition=this.orientation===`horizontal`?e.clientY:e.clientX,this.dragFrame||=requestAnimationFrame(this.flushPointerMove))},this.flushPointerMove=()=>{this.dragFrame=0;let e=this.pendingPosition;this.pendingPosition=null,e!==null&&(this.dragRatio=this.emitResize(this.startRatio+(e-this.startPosition)/this.dragSize))},this.handleKeyDown=e=>{let t=e.shiftKey?.05:.02,n=this.currentRatio(),r=null,i=this.orientation===`horizontal`?`ArrowUp`:`ArrowLeft`,a=this.orientation===`horizontal`?`ArrowDown`:`ArrowRight`;e.key===i?r=n-t:e.key===a?r=n+t:e.key===`Home`?r=this.minRatio:e.key===`End`&&(r=this.maxRatio),r!=null&&(e.preventDefault(),this.emitResize(r),this.emitResize(r,`resize-end`))},this.finishDragging=e=>{if(`pointerId`in e&&e.pointerId!==this.activePointerId)return;this.activePointerId!==null&&(this.dragFrame&&=(cancelAnimationFrame(this.dragFrame),0),this.flushPointerMove(),this.emitResize(this.dragRatio,`resize-end`));let t=this.activePointerId;if(t!==null){this.classList.remove(`dragging`),this.removeEventListener(`lostpointercapture`,this.finishDragging),this.activePointerId=null,typeof this.releasePointerCapture==`function`&&(typeof this.hasPointerCapture!=`function`||this.hasPointerCapture(t))&&this.releasePointerCapture(t),this.dragFrame&&=(cancelAnimationFrame(this.dragFrame),0),this.pendingPosition=null,window.removeEventListener(`pointermove`,this.handlePointerMove);for(let e of ud)window.removeEventListener(e,this.finishDragging)}}}static{this.styles=Ii`
    :host {
      width: var(--resize-handle-size, 6px);
      cursor: col-resize;
      flex-shrink: 0;
      position: relative;
      touch-action: none;
      user-select: none;
    }
    :host::before {
      content: "";
      position: absolute;
      top: 0;
      left: -4px;
      right: -4px;
      bottom: 0;
    }
    /* The visible divider is a centered hairline, not the whole gutter:
       filling the host paints a fat bar that stacks with neighboring pane
       borders into a multi-line smear while dragging. */
    :host::after {
      content: "";
      position: absolute;
      top: 0;
      bottom: 0;
      inset-inline-start: var(--resize-handle-line-inline, 50%);
      width: var(--resize-handle-line-size, 1px);
      transform: translateX(-50%);
      background: var(--resize-handle-rest-color, var(--border, #1e2028));
      transition:
        background 150ms ease-out,
        width 150ms ease-out;
    }
    :host(:hover)::after,
    :host(.dragging)::after,
    :host(:focus-visible)::after {
      width: var(--resize-handle-active-line-size, 2px);
      background: var(--resize-handle-active-color, currentColor);
    }
    :host(:focus-visible) {
      outline: 2px solid var(--accent, #ff5c5c);
      outline-offset: 2px;
    }
    :host([orientation="horizontal"]) {
      width: auto;
      height: var(--resize-handle-size, 6px);
      cursor: row-resize;
    }
    :host([orientation="horizontal"])::before {
      top: -4px;
      left: 0;
      right: 0;
      bottom: -4px;
    }
    :host([orientation="horizontal"])::after {
      top: var(--resize-handle-line-block, 50%);
      bottom: auto;
      inset-inline-start: 0;
      left: 0;
      right: 0;
      width: auto;
      height: var(--resize-handle-line-size, 1px);
      transform: translateY(-50%);
      transition:
        background 150ms ease-out,
        height 150ms ease-out;
    }
    :host([orientation="horizontal"]:hover)::after,
    :host([orientation="horizontal"].dragging)::after,
    :host([orientation="horizontal"]:focus-visible)::after {
      width: auto;
      height: var(--resize-handle-active-line-size, 2px);
    }
  `}render(){return I}connectedCallback(){super.connectedCallback(),this.setAttribute(`role`,`separator`),this.setAttribute(`tabindex`,`0`),this.setAttribute(`aria-orientation`,this.orientation),this.addEventListener(`pointerdown`,this.handlePointerDown),this.addEventListener(`keydown`,this.handleKeyDown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`pointerdown`,this.handlePointerDown),this.removeEventListener(`keydown`,this.handleKeyDown),this.finishDragging(new Event(`disconnect`))}updated(){this.setAttribute(`aria-valuemin`,String(this.toAriaValue(this.minRatio))),this.setAttribute(`aria-valuemax`,String(this.toAriaValue(this.maxRatio))),this.setCurrentAriaValue(this.currentRatio()),this.setAttribute(`aria-label`,this.label||F(`common.resizeSplitView`)),this.setAttribute(`aria-orientation`,this.orientation)}emitResize(e,t=`resize`){let n=this.clampRatio(e);return t===`resize`&&this.setCurrentAriaValue(n),this.dispatchEvent(new CustomEvent(t,{detail:{splitRatio:n},bubbles:!0,composed:!0})),n}clampRatio(e){return Math.max(this.minRatio,Math.min(this.maxRatio,e))}measureDragSize(){let e=this.measureSize?.()??0;if(e>0)return e;let t=this.previousElementSibling?.getBoundingClientRect(),n=this.nextElementSibling?.getBoundingClientRect(),r=this.orientation===`horizontal`?`height`:`width`,i=(t?.[r]??0)+(n?.[r]??0);return i>0?i:this.parentElement?.getBoundingClientRect()?.[r]??0}currentRatio(){let e=this.measureRatio?.();return e!==void 0&&Number.isFinite(e)?this.clampRatio(e):this.splitRatio}toAriaValue(e){return Math.round(e*100)}setCurrentAriaValue(e){this.setAttribute(`aria-valuenow`,String(this.toAriaValue(e)))}},H([B({type:Number})],dd.prototype,`splitRatio`,void 0),H([B({type:Number})],dd.prototype,`minRatio`,void 0),H([B({type:Number})],dd.prototype,`maxRatio`,void 0),H([B({type:String})],dd.prototype,`label`,void 0),H([B({type:String,reflect:!0})],dd.prototype,`orientation`,void 0),H([B({attribute:!1})],dd.prototype,`measureRatio`,void 0),H([B({attribute:!1})],dd.prototype,`measureSize`,void 0),customElements.get(`resizable-divider`)||customElements.define(`resizable-divider`,dd)})))()}var pd;function md(){return(md=e((()=>{R(),fd(),pd=class{constructor(e,t){this.host=e,this.options=t,this.open=!1,this.suppressed=!1,this.persistedOpen=!1,this.onViewportResize=()=>{let e=Math.min(this.height,this.options.layout.maxHeight()),t=Math.min(this.width,this.maxWidth());(e!==this.height||t!==this.width)&&(this.height=e,this.width=t,this.syncReservation(),this.options.onResize?.(),this.host.requestUpdate())},this.dock=t.layout.defaults.dock,this.height=t.layout.defaults.height,this.width=t.layout.defaults.width,e.addController(this)}hostConnected(){if(this.isFullscreen()){this.open=this.options.isAvailable();return}let e=this.options.layout.load();this.persistedOpen=e.open,this.open=e.open&&this.options.isAvailable(),this.dock=e.dock,this.height=e.height,this.width=Math.min(e.width,this.maxWidth()),window.addEventListener(`resize`,this.onViewportResize)}hostDisconnected(){window.removeEventListener(`resize`,this.onViewportResize),this.clearReservation()}setOpen(e,t=!0){this.open=e,this.syncReservation(),t&&this.persist(),this.host.requestUpdate()}hideWithoutPersisting(){this.setOpen(!1,!1)}setSuppressed(e){return this.suppressed!==e&&(this.suppressed=e,e?(this.hideWithoutPersisting(),!1):this.restoreOpenState())}restoreOpenState(){return this.suppressed||!this.options.isAvailable()||this.open||!this.isFullscreen()&&!this.persistedOpen?!1:(this.setOpen(!0,!1),!0)}setDock(e,t=!0){this.dock=e,this.syncReservation(),t&&this.persist(),this.host.requestUpdate()}persist(){this.persistedOpen=this.open,this.options.layout.save({open:this.open,dock:this.dock,height:this.height,width:this.width})}syncReservation(){if(!this.reservesViewport())return;let e=this.options.isAvailable()&&this.open,t=document.documentElement.style;t.setProperty(`--oc-${this.options.reservationPrefix}-reserve-bottom`,e&&this.dock===`bottom`?`${this.height}px`:`0px`),t.setProperty(`--oc-${this.options.reservationPrefix}-reserve-right`,e&&this.dock===`right`?`${this.width}px`:`0px`)}resize(e){let t=this.dock===`bottom`,n=t?this.options.layout.minHeight:this.options.layout.minWidth,r=t?this.options.layout.maxHeight():this.maxWidth(),i=Math.min(r,Math.max(n,(1-e.detail.splitRatio)*this.size()));t?this.height=i:this.width=i,this.syncReservation(),this.options.onResize?.(),this.host.requestUpdate()}size(){return this.dock===`bottom`?window.innerHeight:window.innerWidth}renderResizer(e,t){if(this.isFullscreen()||this.dock===`main`)return I;let n=this.dock===`bottom`,r=this.size(),i=n?this.options.layout.minHeight:this.options.layout.minWidth,a=n?this.options.layout.maxHeight():this.maxWidth(),o=n?this.height:this.width;return L`<resizable-divider
      class="${e}-resizer ${e}-resizer--${this.dock}"
      .orientation=${n?`horizontal`:`vertical`}
      .label=${t}
      .splitRatio=${1-o/r}
      .minRatio=${1-a/r}
      .maxRatio=${1-i/r}
      .measureRatio=${()=>1-(n?this.height:this.width)/this.size()}
      .measureSize=${()=>this.size()}
      @resize=${e=>this.resize(e)}
      @resize-end=${()=>this.persist()}
    ></resizable-divider>`}clearReservation(){if(!this.reservesViewport())return;let e=document.documentElement.style;e.setProperty(`--oc-${this.options.reservationPrefix}-reserve-bottom`,`0px`),e.setProperty(`--oc-${this.options.reservationPrefix}-reserve-right`,`0px`)}reservesViewport(){return!this.isFullscreen()&&!(this.host instanceof HTMLElement&&this.host.hasAttribute(`embedded`))}isFullscreen(){return this.options.isFullscreen?.()===!0}maxWidth(){return Math.max(this.options.layout.minWidth,Math.min(this.options.layout.maxWidth(),this.options.maxWidth?.()??1/0))}}})))()}function hd(e){let t={open:!1,dock:e.defaultDock,height:e.defaultHeight,width:e.defaultWidth},n=()=>Math.max(e.minHeight,Math.floor((globalThis.innerHeight||800)*.8)),r=()=>Math.max(e.minWidth,Math.floor((globalThis.innerWidth||1280)*.8)),i=(e,t,n,r)=>Math.min(typeof e==`number`&&Number.isFinite(e)&&e>=t?e:r,n);return{defaults:t,minHeight:e.minHeight,minWidth:e.minWidth,maxHeight:n,maxWidth:r,load(){try{let a=globalThis.localStorage?.getItem(e.storageKey);if(!a)return{...t};let o=JSON.parse(a);return{open:!!o.open,dock:e.supportedDocks.includes(o.dock)?o.dock:t.dock,height:i(o.height,e.minHeight,n(),t.height),width:i(o.width,e.minWidth,r(),t.width)}}catch{return{...t}}},save(t){try{globalThis.localStorage?.setItem(e.storageKey,JSON.stringify(t))}catch{}}}}var gd,_d,vd;function yd(){return(yd=e((()=>{gd=hd({storageKey:`openclaw.terminal.panel.v1`,minHeight:140,minWidth:320,defaultDock:`bottom`,supportedDocks:[`bottom`,`right`,`main`],defaultHeight:320,defaultWidth:520}),_d=hd({storageKey:`openclaw.browser.panel.v1`,minHeight:240,minWidth:380,defaultDock:`right`,supportedDocks:[`bottom`,`right`],defaultHeight:420,defaultWidth:560}),vd=hd({storageKey:`openclaw.custodian.panel.v1`,minHeight:240,minWidth:320,defaultDock:`right`,supportedDocks:[`bottom`,`right`],defaultHeight:420,defaultWidth:440})})))()}function bd(){return L`<div class="loading-skeleton" aria-hidden="true">
    <div class="loading-skeleton__header">
      <div class="skeleton loading-skeleton__avatar"></div>
      <div class="skeleton skeleton-line loading-skeleton__title"></div>
    </div>
    <div class="loading-skeleton__messages">
      <div class="loading-skeleton__message loading-skeleton__message--user">
        <div class="skeleton skeleton-line"></div>
        <div class="skeleton skeleton-line skeleton-line--medium"></div>
      </div>
      <div class="loading-skeleton__message">
        <div class="skeleton loading-skeleton__avatar"></div>
        <div class="skeleton skeleton-line"></div>
        <div class="skeleton skeleton-line skeleton-line--long"></div>
        <div class="skeleton skeleton-line skeleton-line--medium"></div>
      </div>
    </div>
    <div class="skeleton loading-skeleton__composer"></div>
  </div>`}function xd(e){return L`<main
    class="connect-splash connect-splash--skeleton"
    role="status"
    aria-live="polite"
    aria-label=${e??F(`common.loading`)}
  >
    <div class="connect-splash__layout" aria-hidden="true" @mousedown=${nl}>
      <aside class="connect-splash__sidebar">
        <div class="skeleton loading-skeleton__avatar"></div>
        <div class="skeleton connect-splash__new-session"></div>
        ${[85,65,75,55,80,60].map(e=>L`<div class="skeleton skeleton-line" style=${`width: ${e}%`}></div>`)}
      </aside>
      ${bd()}
    </div>
    ${e?L`<span class="connect-splash__status">${e}</span>`:I}
  </main>`}function Sd(){return(Sd=e((()=>{R(),al(),N()})))()}function Cd(){return L`
    <section
      class="lazy-view-state lazy-view-state--loading"
      role="status"
      aria-live="polite"
      aria-label=${F(`common.loading`)}
    >
      ${bd()}
    </section>
  `}function wd(){return(wd=e((()=>{R(),N(),Sd()})))()}function Td(){return L`<section class="agent-startup-state" role="status" aria-live="polite">
    <span class="btn__spinner" aria-hidden="true"></span>
    <div>${F(`agentStartup.title`)}</div>
    <div>${F(`agentStartup.description`)}</div>
  </section>`}function Ed(e,t,n){return e.status===`loading`?Cd():Od({actionLabel:F(`common.retry`),error:e.error,stale:e.stale,subtitle:e.element.label,onRetry:t,onClose:n})}function Dd(e){let t=e.visibleState;if(!t)return I;let n=()=>e.close(),r=t.status===`loading`;return L`<openclaw-modal-dialog
    class=${r?`lazy-element-loading-modal`:I}
    label=${t.element.label}
    @modal-cancel=${n}
  >
    ${r?L`<section class="lazy-element-loading">
            <header class="lazy-element-loading__header">
              <h2>${t.element.label}</h2>
              <button
                class="btn btn--ghost btn--icon"
                type="button"
                aria-label=${F(`common.close`)}
                @click=${n}
              >
                ${xl(`x`)}
              </button>
            </header>
            <div
              class="lazy-element-loading__status"
              role="status"
              aria-live="polite"
              aria-label=${F(`common.loading`)}
            >
              <span class="btn__spinner" aria-hidden="true"></span>
              <span>${F(`common.loading`)}</span>
            </div>
          </section>`:Ed(t,()=>e.retry(),n)}
  </openclaw-modal-dialog>`}function Od({actionLabel:e,error:t,onClose:n,onRetry:r,render:i,stale:a=!1,subtitle:o}){let s=xi(t);return L`
    ${i?.()??I}
    ${kd({title:F(a?`lazyView.staleTitle`:`lazyView.errorTitle`),subtitle:o??F(a?`lazyView.staleSubtitle`:`lazyView.genericSubtitle`),actions:L`
        <button class="btn lazy-view-error__action" @click=${r}>
          ${e??F(a?`common.reload`:`lazyView.retry`)}
        </button>
        ${n?L`<button class="btn" type="button" @click=${n}>
                ${F(`common.close`)}
              </button>`:I}
      `,detail:s,inline:!!i,stale:a})}
  `}function kd({actions:e,className:t,detail:n,inline:r=!1,role:i=`alert`,stale:a=!1,subtitle:o,title:s}){let c=`lazy-view-error${r?` lazy-view-error--inline`:``}${a?` lazy-view-error--stale`:``}${t?` ${t}`:``}`;return L`
    <div class=${c} role=${i}>
      <div class="lazy-view-error__icon" aria-hidden="true">
        ${xl(a?`refresh`:`alertTriangle`)}
      </div>
      <div class="lazy-view-error__title">${s}</div>
      <div class="lazy-view-error__subtitle">${o}</div>
      ${e?L`<div class="lazy-view-error__actions">${e}</div>`:I}
      ${n?L`<details class="lazy-view-error__details">
              <summary>${F(`chat.details`)}</summary>
              <code class="lazy-view-error__detail">${n}</code>
            </details>`:I}
    </div>
  `}function Ad(){return(Ad=e((()=>{R(),N(),hi(),Cl(),wd()})))()}function jd(e){return Zn(P.terminalPanel,e)}function Md(e){return Zn(P.homePanel,e)}var Nd,Pd,Fd,Id,Ld,Rd,zd,Bd,Vd,Hd,Ud,Wd;function Gd(){return(Gd=e((()=>{Re(),Nd=`openclaw:terminal-toggle`,Pd=`openclaw:terminal-dock-bottom`,Fd=`openclaw:browser-toggle`,Id=`openclaw:desktop-toggle`,Ld=`openclaw:portal-toggle`,Rd=`openclaw:home-toggle`,zd=`openclaw:custodian-toggle`,Bd=`openclaw:debug-overlay-request`,Vd=`openclaw:keyboard-shortcuts-request`,Hd=`openclaw:link-reader-panel-toggle`,Ud=`openclaw:plugin-panel-toggle`,Wd=`openclaw:ui-command`})))()}function Kd(){let e=dl().brandName;return e===`OpenClaw`?F(`nav.askOpenClaw`):F(`nav.askBrand`,{brand:e})}function qd(){return(qd=e((()=>{hl(),N()})))()}var Jd,Yd;function Xd(){return(Xd=e((()=>{Ua(),R(),ji(),$c(),Y(),ed(),nd(),Ou(),al(),N(),$n(),gt(),Yn(),Ae(),_e(),O(),v(),ld(),md(),yd(),Cl(),Ad(),Gd(),qd(),U(),Jd={tagName:`openclaw-assistant-panel-content`,get label(){return F(`assistantPanel.title`)},loadModule:()=>W(()=>import(`./assistant-panel-content-CAyCK1pp.js`),__vite__mapDeps([77,1,3,2,4,5,8,7,6,9,78,11,12,13,14,15,79,17,10,18,19,16,20,21,80,81,82,56,55,22,23,30,31,32,33,34,35,36,83,37,38,58,84,85]),import.meta.url)},Yd=class extends qn{constructor(){super(),this.custodianAvailable=!1,this.homeAvailable=!1,this.custodianSuppressed=!1,this.pageSessionKey=``,this.pageAgentId=``,this.pageRouteId=`chat`,this.pageRouteFailed=!1,this.homeStarted=!1,this.pendingPrimaryPane=null,this.destination=`custodian`,this.builtInDestination=`custodian`,this.publishedSessionKey=null,this.contentLoader=new cu(this),this.minimizeRequestId=0,this.dockLayout=new pd(this,{layout:vd,reservationPrefix:`assistant`,isAvailable:()=>this.available}),this.onToggleRequest=e=>this.handleToggleRequest(e),this.handledMinimizeRequestId=0,this.targetScope=``,this.homeDefaults={},this.startHomeAfterPrimaryChat=()=>{if(this.homeStarted||!this.dockLayout.open||this.destination!==`home`)return;if(this.pageRouteId!==`chat`||this.pageRouteFailed){this.homeStarted=!0;return}let e=this.primaryChatPane();if(!e?.transcriptReady||this.pendingPrimaryPane===e)return;this.pendingPrimaryPane=e;let t=this.context;Promise.resolve().then(()=>e.updateComplete).then(()=>{this.pendingPrimaryPane===e&&(this.pendingPrimaryPane=null,this.isConnected&&this.context===t&&this.primaryChatPane()===e&&e.transcriptReady&&(this.homeStarted=!0))})},new le(this).effect(()=>this.context?.assistantDock,e=>e.attach(this)).watch(()=>this.context,(e,t)=>S(e,t)).watchStore(()=>this.store).watchStore(()=>this.context?.agentSelection).watchStore(()=>this.context?.agents).watchStore(()=>this.context?.theme).watchStore(()=>this.context?.gateway)}connectedCallback(){super.connectedCallback(),document.addEventListener(Ce,this.startHomeAfterPrimaryChat),document.addEventListener(Ve,this.startHomeAfterPrimaryChat),window.addEventListener(zd,this.onToggleRequest),window.addEventListener(Rd,this.onToggleRequest),this.dockLayout.setSuppressed(this.restoreSuppressed)}disconnectedCallback(){document.removeEventListener(Ce,this.startHomeAfterPrimaryChat),document.removeEventListener(Ve,this.startHomeAfterPrimaryChat),this.pendingPrimaryPane=null,window.removeEventListener(zd,this.onToggleRequest),window.removeEventListener(Rd,this.onToggleRequest),typeof this.destination!=`string`&&this.closeSession(),this.claimInput(`page`),super.disconnectedCallback()}willUpdate(){let e=this.dockLayout.open,t=this.context?.gateway.connection.gatewayUrl??``;if(t!==this.targetScope){this.targetScope=t,this.homeStarted=!1,this.pendingPrimaryPane=null,this.homeDefaults={};let e=null;try{e=es(JSON.parse(ge()?.getItem(this.targetStorageKey)??`null`))}catch{}this.destination=e?.destination===`home`?`home`:`custodian`,this.builtInDestination=this.destination}this.context?.gateway.snapshot.phase===`connected`&&(this.homeDefaults={agentsList:this.context.agents.state.agentsList??this.homeDefaults.agentsList,hello:this.context.gateway.snapshot.hello}),this.dockLayout.setSuppressed(this.restoreSuppressed),this.minimizeRequestId>0&&this.minimizeRequestId!==this.handledMinimizeRequestId&&this.custodianAvailable&&this.store&&(this.handledMinimizeRequestId=this.minimizeRequestId,typeof this.destination==`string`&&this.store.hasRealUserTurn()&&this.openDestination(`custodian`)),this.available?this.dockLayout.restoreOpenState():this.dockLayout.hideWithoutPersisting(),e&&!this.dockLayout.open&&this.claimInput(`page`),typeof this.destination==`string`&&this.context&&this.custodianAvailable&&!this.custodianSuppressed&&window.innerWidth>1100&&di(this.context)&&this.openDestination(`custodian`),this.startHomeAfterPrimaryChat(),this.contentLoader.requestWhileActive(Jd,this.dockLayout.open&&(this.destination!==`home`||this.homeStarted)||this.custodianAvailable&&this.minimizeRequestId>this.handledMinimizeRequestId),this.dockLayout.syncReservation(),this.publishSessionKey()}primaryChatPane(){return[...(this.closest(`openclaw-app-shell`)??this.parentElement)?.querySelectorAll(`openclaw-chat-pane.chat-pane-cache__pane--active`)??[]].find(e=>e.presented!==!1&&e.sessionKey&&ci(e.sessionKey,this.pageSessionKey))}get targetStorageKey(){return`openclaw.assistant.panel.target.v1:${this.targetScope}`}persistTarget(){if(typeof this.destination==`string`)try{ge()?.setItem(this.targetStorageKey,JSON.stringify({destination:this.destination}))}catch{}}get homeTarget(){let e=this.homeDefaults,t=Kr(e.agentsList?.agents??[]),n=j(e),r=this.context?.agentSelection.state.selectedId,i=r?K(r):``,a=t.find(e=>e.id===i)?.id??t.find(e=>e.id===n)?.id??t[0]?.id??n;return{..._t(e,No({agentId:a,mainKey:ot(e)}),a),agentId:a}}availableFor(e){return typeof e!=`string`||(e===`home`?this.homeAvailable:this.custodianAvailable)}get available(){return this.availableFor(this.destination)}get suppressed(){if(this.destination===`custodian`)return this.custodianSuppressed;let e=this.context,t=this.destination===`home`?this.pageRouteId===`chat`:Es(this.pageRouteId);if(!e||!t)return!1;let n=_t(this.homeDefaults,this.pageSessionKey,this.pageAgentId),r=typeof this.destination==`string`?this.homeTarget:_t(this.homeDefaults,this.destination.params.sessionKey,this.destination.params.agentId);return n.sessionKey===r.sessionKey&&K(n.agentId)===K(r.agentId)}claimInput(e){this.context&&Zu(this.context).claim(e)}get restoreSuppressed(){return this.suppressed||this.destination===`custodian`&&Bc(this.pageRouteId)}openSession(e,t){typeof this.destination==`string`&&(this.builtInDestination=this.destination),this.openDestination({params:structuredClone(e),activation:t})}closeSession(e){(!e||typeof this.destination!=`string`&&this.destination.activation===e)&&this.setOpen(!1)}get openSessionKey(){return this.dockLayout.open&&!this.suppressed&&typeof this.destination!=`string`?this.destination.params.sessionKey:null}publishSessionKey(){let e=this.openSessionKey;e!==this.publishedSessionKey&&(this.publishedSessionKey=e,this.context?.assistantDock?.notify())}openDestination(e){this.destination=e,this.dockLayout.setSuppressed(this.restoreSuppressed),this.available&&(this.setOpen(!0),this.suppressed&&(this.dockLayout.hideWithoutPersisting(),this.claimInput(`page`),e===`home`&&this.openHomePage())),this.publishSessionKey()}openHomePage(){if(this.context){let{sessionKey:e,agentId:t}=this.homeTarget,n=xt({context:this.context,face:`chat`,sessionKey:e,agentId:t,focusComposer:!0});this.context.navigate(`chat`,n.options)}}setOpen(e){!e&&this.destination!==`home`&&this.context&&$e(this.context),e&&this.destination===`home`&&(this.homeStarted=!0),this.persistTarget(),this.dockLayout.setOpen(e),this.claimInput(e?`dock`:`page`),!e&&typeof this.destination!=`string`&&(this.destination=this.builtInDestination),this.publishSessionKey()}toggle(){if(this.available){if(this.suppressed){this.destination===`home`&&this.openHomePage();return}this.setOpen(!this.dockLayout.open)}}handleToggleRequest(e){let t=e.type===`openclaw:home-toggle`?`home`:`custodian`;if(!this.availableFor(t))return;let n=es(e instanceof CustomEvent?e.detail:null),r=n?.dock;(r===`right`||r===`bottom`)&&this.dockLayout.setDock(r,!1),n?.open===!1?this.destination===t&&this.setOpen(!1):this.destination!==t||n?.open===!0?this.openDestination(t):this.toggle()}get assistantPanelOpen(){return this.dockLayout.open}render(){let e=this.available&&this.dockLayout.open,t=this.dockLayout.dock,n=typeof this.destination==`string`?void 0:this.destination.params,r=n??this.homeTarget,i=typeof this.destination==`string`?this.destination:`session`,a=this.contentLoader.visibleState,o=t===`bottom`?`height:${this.dockLayout.height}px`:`width:${this.dockLayout.width}px`;return L`
      <section
        class="assistant-panel assistant-panel--${t}"
        style=${o}
        ?hidden=${!e}
        aria-label=${F(`assistantPanel.title`)}
        @pointerdown=${()=>this.claimInput(`dock`)}
        @focusin=${()=>this.claimInput(`dock`)}
      >
        ${this.dockLayout.renderResizer(`assistant-panel`,F(`assistantPanel.resize`))}
        <header class="rail-header assistant-panel-header" @mousedown=${nl}>
          <div class="assistant-panel-title">
            <openclaw-mascot
              .mood=${this.destination===`custodian`&&this.store?.sending?`thinking`:`idle`}
              .size=${16}
            ></openclaw-mascot>
            ${n?L`<button type="button" class="assistant-panel-tab rail-header__title" aria-pressed="true" title=${n.label}>${n.label}</button>`:I}
            ${[`home`,`custodian`].map(e=>this.availableFor(e)?L`<button
                    type="button"
                    class="assistant-panel-tab"
                    aria-pressed=${this.destination===e}
                    @click=${()=>this.openDestination(e)}
                  >
                    ${e===`home`?F(`assistantPanel.home`):Kd()}
                  </button>`:I)}
          </div>
          <div class="rail-header__actions assistant-panel-actions">
            ${this.destination===`home`?L`<button
                    class="rail-header__action assistant-panel-icon"
                    type="button"
                    aria-label=${F(`assistantPanel.openHome`)}
                    @click=${()=>this.openHomePage()}
                  >
                    ${Sl.maximize}
                  </button>`:I}
            <button
              class="rail-header__action assistant-panel-icon"
              type="button"
              aria-label=${F(t===`bottom`?`assistantPanel.dockRight`:`assistantPanel.dockBottom`)}
              @click=${()=>this.dockLayout.setDock(t===`bottom`?`right`:`bottom`)}
            >
              ${t===`bottom`?Sl.panelRightOpen:Sl.panelBottomOpen}
            </button>
            <button
              class="rail-header__action assistant-panel-icon"
              type="button"
              aria-label=${F(`assistantPanel.close`)}
              @click=${()=>this.setOpen(!1)}
            >
              ${Sl.x}
            </button>
          </div>
        </header>
        ${ou(Jd)?L`<openclaw-assistant-panel-content
                ?hidden=${!e||this.destination===`home`&&!this.homeStarted}
                .active=${e&&(this.destination!==`home`||this.homeStarted)}
                .destination=${i}
                .sessionKey=${r.sessionKey}
                .agentId=${r.agentId}
                .sessionContext=${n?.context}
                .context=${this.context}
                .pageRouteId=${this.pageRouteId}
                .pageSessionKey=${this.pageSessionKey}
                .pageAgentId=${this.pageAgentId}
                .store=${this.store}
                @assistant-custodian-store=${e=>{this.store=e.detail}}
              ></openclaw-assistant-panel-content>`:I}
        ${e&&(!ou(Jd)||this.destination===`home`&&!this.homeStarted)?a?.status===`error`?Ed(a,()=>this.contentLoader.retry(),()=>this.setOpen(!1)):cd():I}
      </section>
    `}},H([za({context:td,subscribe:!0}),B({attribute:!1})],Yd.prototype,`context`,void 0),H([B({type:Boolean})],Yd.prototype,`custodianAvailable`,void 0),H([B({type:Boolean})],Yd.prototype,`homeAvailable`,void 0),H([B({type:Boolean})],Yd.prototype,`custodianSuppressed`,void 0),H([B()],Yd.prototype,`pageSessionKey`,void 0),H([B()],Yd.prototype,`pageAgentId`,void 0),H([B()],Yd.prototype,`pageRouteId`,void 0),H([B({type:Boolean})],Yd.prototype,`pageRouteFailed`,void 0),H([Li()],Yd.prototype,`homeStarted`,void 0),H([Li()],Yd.prototype,`destination`,void 0),H([B({type:Number})],Yd.prototype,`minimizeRequestId`,void 0),H([B({attribute:!1})],Yd.prototype,`store`,void 0),customElements.get(`openclaw-assistant-panel`)||customElements.define(`openclaw-assistant-panel`,Yd)})))()}function Zd(){return typeof(typeof window>`u`?void 0:window)?.webkit?.messageHandlers?.openclawBrowser?.postMessage==`function`}function Qd(){return(Qd=e((()=>{})))()}var $d=t({OpenClawModalDialog:()=>rf});function ef(e){e.focus({preventScroll:!0}),e.dispatchEvent(new Event(`openclaw:restore-focus`))}function tf(e,t){let n=nf.size>0;nf.delete(e),t&&nf.add(e);let r=nf.size>0;n!==r&&window.dispatchEvent(new CustomEvent(`openclaw:native-modal-state`,{detail:{open:r}}))}var nf,rf;function af(){return(af=e((()=>{ho(),R(),ji(),wn(),Ae(),nf=document.openClawModalLayers??=new Set,rf=class extends Ee{constructor(...e){super(...e),this.open=!0,this.manual=!1,this.label=``,this.description=``,this.#t=null,this.#r=0,this.#i=!1,this.#a=!1,this.#o=!1,this.#u=()=>{this.#a&&(this.#o=!0)},this.#d=e=>{e.target===e.currentTarget&&this.#f(e instanceof FocusEvent?e.relatedTarget:null)},this.#p=e=>{if(e.target!==e.currentTarget)return;this.#l();let t=this.#n,n=this.#t;this.#n=void 0,this.open=!1,this.#t=null,t!==void 0&&setTimeout(()=>{t===null?n&&document.activeElement===n&&n.blur():t.isConnected&&ef(t)},0)},this.#m=e=>{if(e.target!==e.currentTarget)return;if(this.#i){this.#i=!1;return}let t=new CustomEvent(`modal-cancel`,{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(t),t.defaultPrevented&&e.preventDefault()}}get#e(){return this.renderRoot?.querySelector(`wa-dialog`)}#t;#n;#r;#i;#a;#o;#s;static{this.styles=Ii`
    :host {
      /* Slotted document panels share the standard/fullscreen shell height limit. */
      --openclaw-modal-height-limit: var(--openclaw-modal-max-height, calc(100dvh - 48px));
      display: contents;
    }

    wa-dialog {
      --width: min(var(--openclaw-modal-width, 540px), calc(100vw - 48px));
      --spacing: 0;
      --backdrop-filter: var(--openclaw-modal-backdrop-filter, blur(4px));
    }

    wa-dialog::part(dialog) {
      max-width: var(--openclaw-modal-max-width, calc(100vw - 48px));
      max-height: var(--openclaw-modal-height-limit);
      padding: 0;
      border: 0;
      background: transparent;
      color: var(--text);
      overflow: visible;
    }

    wa-dialog::part(body) {
      padding: 0;
      overflow: visible;
    }

    :host(.fullscreen) {
      --openclaw-modal-height-limit: calc(100dvh - 20px);
    }

    :host(.fullscreen) wa-dialog {
      --width: calc(100vw - 20px);
    }

    :host(.fullscreen) wa-dialog::part(dialog) {
      max-width: calc(100vw - 20px);
    }

    :host(.viewport-edge-to-edge) wa-dialog {
      --width: 100vw;
    }

    :host(.viewport-edge-to-edge) wa-dialog::part(dialog) {
      width: 100vw;
      height: 100dvh;
      max-width: none;
      max-height: none;
      margin: 0;
      border-radius: 0;
    }

    /* Slotted scroll containers need the body's definite viewport height. */
    :host(.viewport-edge-to-edge) wa-dialog::part(body),
    :host(.drawer) wa-dialog::part(body) {
      height: 100%;
    }

    :host(.palette) wa-dialog::part(dialog) {
      margin-block-start: min(20dvh, 160px);
      margin-block-end: auto;
    }

    :host(.palette) wa-dialog {
      --openclaw-modal-backdrop-filter: none;
      --wa-color-overlay-modal: color-mix(in oklab, black 12%, transparent);
      --show-duration: 0ms;
      --hide-duration: 0ms;
    }

    :host(.drawer) wa-dialog {
      --width: min(var(--openclaw-modal-width, 100vw), 100vw);
      --show-duration: 200ms;
      --hide-duration: 0ms;
    }

    :host(.drawer) wa-dialog::part(dialog) {
      height: 100dvh;
      max-width: 100vw;
      max-height: 100dvh;
      margin: 0 0 0 auto;
      border-radius: 0;
    }

    :host(.drawer) wa-dialog[open]::part(dialog) {
      animation: openclaw-drawer-in 200ms cubic-bezier(0.32, 0.72, 0, 1);
    }

    :host(.drawer--floating) {
      --openclaw-drawer-inset: 20px;
      --openclaw-modal-height-limit: calc(100dvh - var(--openclaw-drawer-inset) * 2);
    }

    :host(.drawer--floating) wa-dialog {
      --width: min(
        var(--openclaw-modal-width, 620px),
        calc(100vw - var(--openclaw-drawer-inset) * 2)
      );
    }

    :host(.drawer--floating) wa-dialog::part(body) {
      height: 100%;
    }

    :host(.drawer--floating) wa-dialog::part(dialog) {
      height: calc(100dvh - var(--openclaw-drawer-inset) * 2);
      max-width: calc(100vw - var(--openclaw-drawer-inset) * 2);
      max-height: calc(100dvh - var(--openclaw-drawer-inset) * 2);
      margin: var(--openclaw-drawer-inset) var(--openclaw-drawer-inset) auto auto;
      border-radius: var(--radius-xl);
    }

    @keyframes openclaw-drawer-in {
      from {
        transform: translateX(calc(100% + var(--openclaw-drawer-inset, 0px)));
      }
      to {
        transform: translateX(0);
      }
    }

    @media (prefers-reduced-motion: reduce) {
      wa-dialog,
      :host(.drawer) wa-dialog {
        --show-duration: 0ms;
        --hide-duration: 0ms;
      }

      :host(.drawer) wa-dialog[open]::part(dialog) {
        animation: none;
      }
    }
    @media (max-width: 640px) {
      :host(.drawer--floating) {
        --openclaw-drawer-inset: 12px;
      }

      :host {
        --openclaw-modal-height-limit: 90dvh;
      }

      wa-dialog {
        --width: min(var(--openclaw-modal-width, 540px), calc(100vw - 24px));
      }

      wa-dialog::part(dialog) {
        max-width: var(--openclaw-modal-max-width, calc(100vw - 24px));
      }
    }

    @media (max-width: 768px),
      (max-width: 932px) and (max-height: 500px) and (orientation: landscape) {
      :host(.mobile-edge-to-edge) wa-dialog {
        --width: 100vw;
      }

      :host(.mobile-edge-to-edge) wa-dialog::part(dialog) {
        width: 100vw;
        height: 100dvh;
        max-width: none;
        max-height: none;
        margin: 0;
        border-radius: 0;
      }

      :host(.mobile-edge-to-edge) wa-dialog::part(body) {
        height: 100%;
      }
    }
  `}connectedCallback(){this.manual&&(this.open=!1),super.connectedCallback(),this.open&&(tf(this,!0),this.#s??=Nn()),this.updateComplete.then(()=>this.#c())}disconnectedCallback(){tf(this,!1),this.#l(),this.#r+=1,this.#a=!1;let e=this.#e,t=e?.shadowRoot?.querySelector(`dialog`);t?.open&&t.close(),e&&(e.open=!1);let n=this.#n===void 0?this.#t:this.#n;this.#t=null,this.#n=void 0,n?.isConnected&&ef(n),super.disconnectedCallback()}render(){return L`
      <wa-dialog
        without-header
        light-dismiss
        .label=${this.label}
        @pointerdown=${{handleEvent:this.#u,capture:!0}}
        @keydown=${{handleEvent:this.#u,capture:!0}}
        @focusin=${this.#d}
        @wa-after-show=${this.#d}
        @wa-after-hide=${this.#p}
        @wa-hide=${this.#m}
      >
        <slot></slot>
      </wa-dialog>
    `}updated(e){e.has(`open`)&&(tf(this,this.open&&this.isConnected),this.open&&this.isConnected&&(this.#s??=Nn())),this.#c()}async#c(){let e=++this.#r,t=this.#e;if(!t||(await t.updateComplete,e!==this.#r||!this.isConnected))return;let n=t.shadowRoot?.querySelector(`dialog`);if(n){n.setAttribute(`role`,`dialog`),n.setAttribute(`aria-modal`,`true`);for(let[e,t]of Object.entries({"aria-label":this.label,"aria-description":this.description}))t?n.setAttribute(e,t):n.removeAttribute(e);if(this.open){n.open||(this.#t=document.activeElement instanceof HTMLElement?document.activeElement:null,this.#a=!0,this.#o=!1,t.open=!0,await t.updateComplete),e===this.#r&&this.isConnected&&this.open&&n.open&&this.#a&&(this.#a=!1,this.#f(null,n,!this.#o));return}this.#a=!1,t.open||n.open?(this.#i=!0,t.open=!1):this.#l()}}#l(){this.#s?.(),this.#s=void 0}#u;#d;#f(e=null,t,n=!1){if(!this.isConnected)return;let r=this.getRootNode(),i=r instanceof ShadowRoot?r.activeElement:this.ownerDocument.activeElement,a=this.querySelector(`[autofocus]`);i instanceof HTMLElement&&i!==this&&this.contains(i)&&(!n||!a||i===a)||(e instanceof HTMLElement&&this.contains(e)?e:a??t)?.focus({preventScroll:!0})}#p;#m;show(){this.open=!0}setReturnFocusTarget(e){this.#n=e}hide(){this.open=!1}},H([B({type:Boolean})],rf.prototype,`open`,void 0),H([B({type:Boolean,reflect:!0})],rf.prototype,`manual`,void 0),H([B()],rf.prototype,`label`,void 0),H([B()],rf.prototype,`description`,void 0),customElements.get(`openclaw-modal-dialog`)||customElements.define(`openclaw-modal-dialog`,rf)})))()}function of(e,t){return t?.status===`pending`&&t.module===void 0&&t.error===void 0&&e?e:t??e}function sf(e){return{status:e.status,active:e.matches[0],pending:e.pendingMatches[0]}}function cf(){return{status:`idle`,active:void 0,pending:void 0,settled:void 0,showPending:!1}}var lf,uf;function df(){return(df=e((()=>{ae(),lf=1e3,uf=class{constructor(e){this.invalidate=e,this.connected=!1,this.selection=cf(),this.snapshotValue=cf(),this.showPending=!1,this.notFoundActive=!1,this.notFoundDeclined=!1,this.notFoundQueued=!1,this.notFoundGeneration=0,this.notFoundRecoveryReady=!0,this.retryEnabled=!0,this.startupAttempt=0}get snapshot(){return this.snapshotValue}setInputs(e){(this.retryContext!==e.retryContext||this.retryEnabled!==(e.retryEnabled??!0))&&this.clearStartupRetry(),this.retryContext=e.retryContext,this.retryEnabled=e.retryEnabled??!0,this.onNotFound=e.onNotFound;let t=e.notFoundRecoveryReady??!0,n=!this.notFoundRecoveryReady&&t&&this.notFoundDeclined;if(this.notFoundRecoveryReady=t,this.router===e.router){this.updateStartupRetry(),n&&this.selection.status===`notFound`&&(this.cancelNotFoundEffect(),this.updateNotFoundEffect(this.selection.status));return}if(this.detachSource(),this.router=e.router,this.settled=void 0,this.connected){this.attachSource();return}let r=e.router?sf(e.router.getState()):cf();this.applySelection(r)}connect(){this.connected||(this.connected=!0,this.attachSource(!1),this.invalidate())}disconnect(){this.connected&&(this.connected=!1,this.detachSource())}attachSource(e=!0){let t=this.router;if(!this.unsubscribe){if(!t){this.applySelection(cf(),e);return}this.applySelection(sf(t.getState()),e),this.unsubscribe=t.subscribe(()=>this.applySelection(sf(t.getState())))}}detachSource(){this.unsubscribe?.(),this.unsubscribe=void 0,this.clearPendingTimer(),this.pendingMatchId=void 0,this.showPending=!1,this.cancelNotFoundEffect(),this.clearStartupRetry()}applySelection(e,t=!0){if(this.selection=e,e.status===`idle`||e.status===`notFound`)this.settled=void 0;else{let t=of(e.active,e.pending);t?.status===`success`?this.settled=t:(t?.status===`error`||t?.status===`notFound`||t?.status===`redirected`)&&(this.settled=void 0)}let n=e.pending;n?.status!==`pending`||n.module!==void 0||n.error!==void 0||e.active?(this.clearPendingTimer(),this.pendingMatchId=void 0,this.showPending=!1):this.pendingMatchId===n.id?this.connected&&!this.showPending&&this.pendingTimer===void 0&&this.schedulePendingFallback(n.id):(this.clearPendingTimer(),this.pendingMatchId=n.id,this.showPending=!1,this.schedulePendingFallback(n.id)),this.updateStartupRetry(),this.publish({...e,settled:this.settled,showPending:this.showPending,startupPending:this.startupMatchId!==void 0},t),this.updateNotFoundEffect(e.status)}schedulePendingFallback(e){this.connected&&(this.pendingTimer=globalThis.setTimeout(()=>{this.pendingTimer=void 0;let t=this.selection.pending,n=t?.id===e&&t.status===`pending`&&t.module===void 0&&t.error===void 0&&!this.selection.active;this.connected&&this.pendingMatchId===e&&n&&(this.showPending=!0,this.publish({...this.selection,settled:this.settled,showPending:!0}))},lf))}updateStartupRetry(){let e=this.selection.pending??this.selection.active;if(e?.id!==this.startupMatchId&&this.clearStartupRetry(),!this.connected||!this.retryEnabled||this.retryContext===void 0||!e){this.clearStartupRetry();return}if(e.status===`pending`||e.isFetching){globalThis.clearTimeout(this.startupTimer),this.startupTimer=void 0;return}if(!he(e.error)){this.clearStartupRetry();return}this.startupMatchId=e.id,this.startupTimer===void 0&&(this.startupTimer=globalThis.setTimeout(()=>{this.startupTimer=void 0;let t=this.selection.pending??this.selection.active;this.connected&&this.retryEnabled&&t?.id===e.id&&he(t.error)&&this.retryContext!==void 0&&this.router?.revalidate(this.retryContext,e.routeId).catch(()=>void 0)},Ot(e.error,this.startupAttempt++)))}clearStartupRetry(){globalThis.clearTimeout(this.startupTimer),this.startupTimer=void 0,this.startupMatchId=void 0,this.startupAttempt=0}updateNotFoundEffect(e){if(e!==`notFound`){(this.notFoundActive||this.notFoundQueued)&&this.cancelNotFoundEffect();return}if(!this.connected||this.notFoundActive)return;this.notFoundActive=!0,this.notFoundQueued=!0;let t=++this.notFoundGeneration;queueMicrotask(()=>{this.connected&&t===this.notFoundGeneration&&this.selection.status===`notFound`&&(this.notFoundQueued=!1,this.onNotFound?.()===!1&&(this.notFoundDeclined=!0))})}cancelNotFoundEffect(){this.notFoundGeneration+=1,this.notFoundActive=!1,this.notFoundDeclined=!1,this.notFoundQueued=!1}publish(e,t=!0){let n=this.snapshotValue;(n.status!==e.status||n.active!==e.active||n.pending!==e.pending||n.settled!==e.settled||n.showPending!==e.showPending||n.startupPending!==e.startupPending)&&(this.snapshotValue=e,t&&this.connected&&this.invalidate())}clearPendingTimer(){this.pendingTimer!==void 0&&(globalThis.clearTimeout(this.pendingTimer),this.pendingTimer=void 0)}}})))()}function ff(e,t){if(!Es(e)||!t||typeof t!=`object`)return;let n=t;return n.kind===`session`&&typeof n.sessionKey==`string`&&n.sessionKey.trim()||void 0}function pf(e){let t=of(e.matches[0],e.pendingMatches[0]),n=e.matches[0],r=n?ff(n.routeId,n.data):void 0;return{routeId:t?.routeId,location:t?.location,routeFailed:t?t.status===`error`||t.status===`notFound`:e.status===`notFound`||void 0,committedRouteId:n?.routeId,committedLocation:n?.location,committedSessionKey:r}}function mf(e,t){return e.routeId===t.routeId&&e.routeFailed===t.routeFailed&&zs(e.location,t.location)&&e.committedRouteId===t.committedRouteId&&zs(e.committedLocation,t.committedLocation)&&e.committedSessionKey===t.committedSessionKey}function hf(){return(hf=e((()=>{Y(),df()})))()}var gf;function _f(){return(_f=e((()=>{R(),ji(),N(),vt(),Ae(),Cl(),af(),gf=class extends f{render(){let e=this.props;if(!e?.pendingGatewayUrl)return I;let t=F(`connection.switchGateway.title`),n=F(`connection.switchGateway.summary`),r=ct(e.currentGatewayUrl),i=ct(e.pendingGatewayUrl),a=!!e.currentGatewayUrl.trim()&&po(e.currentGatewayUrl)!==po(e.pendingGatewayUrl),o=[F(`connection.switchGateway.note`),e.linkCarriesToken?F(`connection.switchGateway.noteToken`):null,a?F(`connection.switchGateway.noteScoped`,{host:r}):null].filter(Boolean);return L`
      <openclaw-modal-dialog label=${t} description=${n} @modal-cancel=${e.onCancel}>
        <div class="gateway-switch">
          <div class="gateway-switch__head">
            <span class="gateway-switch__icon" aria-hidden="true">${Sl.shieldAlert}</span>
            <div class="gateway-switch__text">
              <h2 class="gateway-switch__title">${t}</h2>
              <p class="gateway-switch__summary">${n}</p>
            </div>
          </div>
          <div class="gateway-switch__hosts">
            <div class="gateway-switch__host">
              <span class="gateway-switch__label">${F(`connection.switchGateway.current`)}</span>
              <code translate="no">${e.currentGatewayUrl.trim()||F(`common.na`)}</code>
            </div>
            <span class="gateway-switch__arrow" aria-hidden="true">${Sl.arrowRight}</span>
            <div class="gateway-switch__host gateway-switch__host--next">
              <span class="gateway-switch__label">${F(`connection.switchGateway.next`)}</span>
              <code translate="no">${e.pendingGatewayUrl}</code>
            </div>
          </div>
          <p class="gateway-switch__note">${o.join(` `)}</p>
          <div class="gateway-switch__actions">
            <button type="button" class="btn primary" @click=${e.onConfirm}>
              ${F(`connection.switchGateway.confirm`,{host:i})}
            </button>
            <button type="button" class="btn" @click=${e.onCancel}>
              ${F(`connection.switchGateway.cancel`)}
            </button>
          </div>
        </div>
      </openclaw-modal-dialog>
    `}},H([B({attribute:!1})],gf.prototype,`props`,void 0),customElements.get(`openclaw-gateway-url-confirmation`)||customElements.define(`openclaw-gateway-url-confirmation`,gf)})))()}function vf(e){let t={focus:t=>void e(t,`focus`),pointer:t=>void e(t,`pointer`)};return document.addEventListener(`pointerover`,t.pointer,!0),document.addEventListener(`focusin`,t.focus,!0),()=>{document.removeEventListener(`pointerover`,t.pointer,!0),document.removeEventListener(`focusin`,t.focus,!0)}}function yf(e,t,n=!1){return t===`pointer`?e.matches(`:hover`):n?document.activeElement instanceof Node&&e.contains(document.activeElement):e.matches(`:focus`)}function bf(e,t){return Math.max(0,t-(performance.now()-e))}var xf;function Sf(){return(Sf=e((()=>{Ou(),xf=class{constructor(e){this.params=e,this.stopListeners=null}install(e){customElements.get(this.params.tag)||(this.stopListeners=vf(e))}providerFor(e){let t=e;for(;t;){let e=t.closest(this.params.tag);if(e)return e;t=wi(t)}return null}async define(){await au(this.params.tag,async()=>{let e=await this.params.load();customElements.get(this.params.tag)||customElements.define(this.params.tag,e)}),this.stopListeners?.(),this.stopListeners=null,this.params.onDefined?.()}}})))()}function Cf(e){return/^(?:www\.)?github\.com\.?$/i.test(e)}function wf(e,t){try{let n=decodeURIComponent(e),r=decodeURIComponent(t);return/^[a-z\d](?:[a-z\d-]{0,37}[a-z\d])?$/i.test(n)&&/^[a-z\d._-]{1,100}$/i.test(r)&&!/^\.{1,2}$|\.(?:git|atom)$/i.test(r)?[n,r]:null}catch{return null}}function Tf(e){if(!e.href.startsWith(`https://github.com/`))return!1;let t=/^\/([^/]+)\/([^/]+)\/?$/u.exec(e.pathname),n=t?wf(t[1],t[2]):null;return!(!n||/^(?:account|accounts|apps|auth|codespaces|copilot|dashboard|discussions|email|emails|enterprises|github-copilot|issues|join|login|logout|marketplace|new|notifications|oauth|orgs|organizations|projects|pulls|repositories|session|sessions|settings|signup|sponsors|stars|two-factor|user|users|verify|watching)$/i.test(n[0]))}function Ef(e){let t=/^\/([^/]+)\/([^/]+)\/(?:issues\/([1-9]\d{0,9})|pull\/([1-9]\d{0,9})(?:\/(?:files|checks|commits(?:\/[a-fA-F\d]{7,40})?))?)\/?$/u.exec(e.pathname);if(!t)return null;let n=wf(t[1],t[2]);return n?[...n,t[3],t[4]]:null}function Df(e){return e.href.startsWith(`https://github.com/`)?Ef(e):null}function Of(){return(Of=e((()=>{})))()}function kf(e,t){if(!e||e.length>8192)return null;let n=URL.parse(e);if(!n||n.protocol!==`https:`||n.username||n.password||n.port)return null;for(let e of t){if(!e.linkReader.hosts.includes(n.hostname))continue;let t=If.get(e);if(t===void 0){try{t=new RegExp(e.linkReader.pathPattern,`u`)}catch{t=null}If.set(e,t)}if(t?.test(n.pathname))return{href:n.href,reader:e}}return null}function Af(e){return e.reader.pluginId+`:`+e.reader.id+`:`+e.href.split(`#`,1)[0]}function jf(e){let t=URL.parse(e.href);if(t&&Cf(t.hostname)&&!Df(t)&&!Tf(t)||e.matches(`[download], [data-file-path], [data-session-href], .markdown-session-link, [data-link-reader-external]`))return!1;for(let t=e;t;t=wi(t))if(t.matches(`openclaw-tooltip, openclaw-browser-tab-card, wa-popover, .link-reader-hovercard, .link-hovercard, .session-progress-hovercard, .chat-source-card`))return!1;return!0}function Mf(e){let t=e.pagePreviewContext;return!!(t?.config.current.automaticallyFetchFavicons&&t.gateway.snapshot.client===e.client&&Bi(t.gateway.snapshot,`controlUi.linkPreview`,`operator.read`,{requireAdvertisement:!1}))}function Nf(e,t){if(!t.client||!jf(e))return null;let n=kf(e.href,t.claimedReaders?.length?t.claimedReaders:t.readers);if(n)return n.reader.linkReader.previewMethod&&t.readers.includes(n.reader)?n:null;if(!Mf(t))return null;let r=URL.parse(e.href);return r&&[`http:`,`https:`].includes(r.protocol)&&r.origin!==location.origin&&!r.username&&!r.password&&r.href.length<=2048?{kind:`page`,href:r.href}:null}var Pf,Ff,If;function Lf(){return(Lf=e((()=>{Hi(),Pf=`openclaw-link-reader-hovercard-provider`,Ff=[],If=new WeakMap})))()}function Rf(e){let t=Vf.providerFor(e);return t?Nf(e,t):null}function zf(e){let t=Rf(e);return!!(t&&(t.reader||customElements.get(`openclaw-link-reader-hovercard-provider`)))}async function Bf(e,t){if(t===`pointer`&&e instanceof PointerEvent&&e.pointerType===`touch`)return;let n=Xe(e),r=n?Rf(n):null;if(r&&!r.reader&&t===`focus`&&!n?.matches(`:focus-visible`)||!n||!r)return;let i=performance.now();try{await Vf.define()}catch{return}let a=Vf.providerFor(n);await a?.updateComplete;let o=Rf(n);a&&o&&n.isConnected&&o?.reader===r.reader&&o.href===r.href&&yf(n,t)&&a.activateFromBootstrap(n,r,t,t===`pointer`?bf(i,250):0)}var Vf;function Hf(){return(Hf=e((()=>{Sf(),Lf(),U(),Vf=new xf({tag:Pf,load:async()=>(await W(async()=>{let{LinkReaderHovercardProvider:e}=await import(`./link-reader-hovercard-1pXZeQWw.js`);return{LinkReaderHovercardProvider:e}},__vite__mapDeps([86,1,2,3,4,5,6,7,8,9,11,12,13,14,15,19,10,17,18,16,20,21,60,30,31,32,33,34,35,36,87]),import.meta.url)).LinkReaderHovercardProvider}),Vf.install(Bf)})))()}function Uf(e){return e.hasAttribute(`aria-label`)||e.hasAttribute(`aria-labelledby`)||e.matches(`img[alt], input[alt]`)||Fu(e).trim()?!1:e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?!e.labels?.length&&!e.matches(`input[type="button"], input[type="submit"], input[type="reset"]`):!0}function Wf(e){let t=null,n=null,r=()=>{if(!n)return;let{anchor:e,title:r,label:i,disposeFileContent:a}=n;n=null,a?.(),o.disconnect(),e.removeEventListener(`pointerleave`,s),e.removeEventListener(`focusout`,c),r!==null&&e.getAttribute(`title`)===``&&e.setAttribute(`title`,r),i!==null&&e.getAttribute(`aria-label`)===i&&e.removeAttribute(`aria-label`),t&&(t.anchor=null,t.remove(),t.replaceChildren())},i=e=>!!(e&&zf(e)),a=()=>i(n?.link)||n?.anchor.matches(`[aria-haspopup="dialog"][aria-expanded="true"]`)?``:n?.anchor.getAttribute(`data-tooltip`)??n?.title??``,o=new MutationObserver(e=>{if(n){if(!n.anchor.isConnected||n.anchor.getAttribute(`data-file-path`)!==n.filePath){r();return}i(n.link)&&(n.previewOwned=!0,t&&(t.content=``)),e.some(e=>n?.anchor.contains(e.target)||e.target===n?.link)&&(e.some(e=>e.target===n?.anchor&&e.attributeName===`title`)&&(n.title=n.anchor.getAttribute(`title`),n.title!==null&&(n.anchor.setAttribute(`title`,``),o.takeRecords())),n.label!==null&&n.anchor.getAttribute(`aria-label`)===n.label&&(n.anchor.removeAttribute(`aria-label`),n.label=null),n.title&&Uf(n.anchor)&&(n.label=n.title,n.anchor.setAttribute(`aria-label`,n.label)),t&&!n.filePath&&(t.content=a()))}}),s=e=>{n&&e.target===n.anchor&&(n.pointer=!1,!n.focus&&!n.filePath&&r())},c=e=>{!n||e instanceof FocusEvent&&e.relatedTarget instanceof Node&&n.anchor.contains(e.relatedTarget)||(n.focus=!1,!n.pointer&&!n.filePath&&r())},l=l=>{if(`pointerType`in l&&l.pointerType===`touch`||n?.filePath&&l.composedPath().includes(t))return;let u=l.composedPath().filter(Mu),d=Xe(l),f=u.some(e=>e.localName===`openclaw-tooltip`),p;for(let e of u){if(e.localName===`iframe`)break;let t=e===n?.anchor?n.title:e.getAttribute(`title`),r=e.getAttribute(`data-file-path`)??e.getAttribute(`data-tooltip`)??t;if(r!==null){p=r?e:void 0;break}}let m=l.type===`focusin`?`focus`:`pointer`,h=i(d);if(p===n?.anchor&&h===n?.previewOwned){n&&(n.link=d,n[m]=!0,d&&!n.anchor.contains(d)&&o.observe(d,{attributes:!0,attributeFilter:[`href`]}));return}if(!p&&(n?.filePath||n?.focus&&m===`pointer`)||(r(),!p))return;let g=p.getAttribute(`title`),_=g&&Uf(p)?g:null;n={anchor:p,link:d,previewOwned:h,filePath:p.getAttribute(`data-file-path`),title:g,label:_,pointer:m===`pointer`,focus:m===`focus`},g!==null&&p.setAttribute(`title`,``),_!==null&&p.setAttribute(`aria-label`,_),p.addEventListener(`pointerleave`,s),p.addEventListener(`focusout`,c),o.observe(p,{attributes:!0,attributeFilter:[`title`,`data-tooltip`,`data-file-path`,`aria-hidden`,`aria-haspopup`,`aria-expanded`,`href`],characterData:!0,subtree:!0}),d&&!p.contains(d)&&o.observe(d,{attributes:!0,attributeFilter:[`href`]}),o.observe(e,{childList:!0,subtree:!0});let v=p.getRootNode();v instanceof ShadowRoot&&o.observe(v,{childList:!0,subtree:!0});let y=n.filePath??a();if(!f&&y){if(t??=e.createElement(`openclaw-tooltip`),n.filePath){let i=n,a=n.filePath,o=e.createElement(`span`);o.slot=`content`,o.className=`markdown-file-tooltip`,o.textContent=a,t.append(o),p.after(t),t.previewForAnchor(p,``,m),W(async()=>{let{renderMarkdownFileTooltip:e}=await import(`./markdown-file-tooltip-DU-xNGQp.js`);return{renderMarkdownFileTooltip:e}},__vite__mapDeps([88,1,12,3,2,4,5,8,7,6,9,11,13,14,15,30,31,32,33,89]),import.meta.url).then(({renderMarkdownFileTooltip:e})=>{n===i&&o.isConnected&&(i.disposeFileContent=e(o,a))}).catch(e=>{n===i&&(r(),oi({message:xi(e)}))});return}(u.find(e=>e.localName===`openclaw-modal-dialog`)??e.body).append(t),t.previewForAnchor(p,y,m)}};return e.addEventListener(`pointerover`,l,!0),e.addEventListener(`focusin`,l,!0),()=>{e.removeEventListener(`pointerover`,l,!0),e.removeEventListener(`focusin`,l,!0),r()}}function Gf(){return(Gf=e((()=>{Ju(),hi(),Ht(),Hf(),U()})))()}function Kf(e,t,n){return e?!e.scopes||$o({role:e.role??`operator`,requestedScopes:[t],allowedScopes:e.scopes}):n}function qf(e){let t=e?.hello?.auth??null;return{canWrite:Jf(t),canAdmin:Xf(t),canPair:Zf(t),canReviewApprovals:!t||Qf(t),canGrantApprovals:Qf(t)}}function Jf(e){return Kf(e,`operator.write`,!0)}function Yf(e){return Kf(e,`operator.read`,!0)}function Xf(e){return Kf(e,`operator.admin`,!0)}function Zf(e){return Kf(e,`operator.pairing`,!1)}function Qf(e){return Kf(e,`operator.approvals`,!1)}function $f(e){return Yf(e)||Kf(e,`operator.sessions.read`,!0)}function ep(e,t,n){let r=e.hello?.auth?.sessionCap,i=t?.sharingRole;if(!t||!i||n.archived||n.catalog||r===`none`||!Bi(e,`session.reactions.set`,`operator.write`))return!1;let a=t.visibility??`shared`;return a===`draft`?i===`owner`||i===`admin`:i===`viewer`?a===`shared`?r!==`view`&&r!==`suggest`:a===`suggest`&&r!==`view`:!0}function tp(){return(tp=e((()=>{Xa(),Hi()})))()}function np(e){return io(xp,e)}function rp(e){Wi(xp,e,e=>console.error(`[boot-record] observer failed`,e))}function ip(e){return e.recoveryScope?{recoveryScope:e.recoveryScope}:{authMethod:e.authMethod,credential:e.credential}}function ap(e,t){return!e||!t?!1:e.recoveryScope===void 0?t.recoveryScope===void 0&&e.authMethod===t.authMethod&&e.credential===t.credential:e.recoveryScope===t.recoveryScope}function op(e){let t=e?.trim();return t?Ue(t).toString(16):null}function sp(e,t){let n=e?.method===`bootstrap-token`?`device-token`:e?.method;if(e?.recoveryScope?.trim()&&n&&[`trusted-proxy`,`tailscale`,`password`].includes(n))return{authMethod:n,credential:``};if(n!==`token`&&n!==`device-token`)return null;let r=op(n===`token`?t:e?.deviceToken);return r?{authMethod:n,credential:r}:null}function cp(e){if(!q(e)||!q(e.agents))return!1;let t=e.agents;return e.version===2&&([`token`,`device-token`].includes(String(e.authMethod))||[`trusted-proxy`,`tailscale`,`password`].includes(String(e.authMethod))&&typeof e.recoveryScope==`string`&&e.recoveryScope.length>0)&&(e.recoveryScope===void 0||typeof e.recoveryScope==`string`&&e.recoveryScope.length>0)&&typeof e.credential==`string`&&typeof e.savedAt==`number`&&Number.isFinite(e.savedAt)&&e.savedAt>=0&&typeof e.scope==`string`&&(e.profileId===null||typeof e.profileId==`string`)&&typeof t.defaultId==`string`&&t.defaultId.trim().length>0&&typeof t.mainKey==`string`&&t.mainKey.trim().length>0&&(t.scope===`per-sender`||t.scope===`global`)&&Array.isArray(t.agents)&&t.agents.every(e=>q(e)&&typeof e.id==`string`)&&Array.isArray(e.groups)&&e.groups.every(e=>q(e)&&typeof e.name==`string`&&typeof e.position==`number`)&&Array.isArray(e.sectionOrder)&&e.sectionOrder.every(e=>typeof e==`string`)}function lp(e,t){if(!e||new TextEncoder().encode(e).length>vp)return null;try{let n=JSON.parse(e);return cp(n)&&n.scope===t?n:null}catch{return null}}function up(e,t){let n=ge(),r=_p+e;try{let i=n?.getItem(r);if(i==null)return null;let a=lp(i,e);if(a&&Date.now()-a.savedAt<=yp)try{let e=t(a.authMethod);return([`trusted-proxy`,`tailscale`,`password`].includes(a.authMethod)?e===``:a.credential===op(e))?a:null}catch{return null}}catch{}try{n?.removeItem(r)}catch{}return null}function dp(e,t){wp&&wp.record.scope===e&&ap(ip(wp.record),t)&&(wp=void 0,clearTimeout(Cp),Cp=void 0)}function fp(e,t){try{let n=ge(),r=_p+e,i=n?.getItem(r),a=i?JSON.parse(i):null;cp(a)&&a.scope===e&&ap(ip(a),t)&&n?.removeItem(r)}catch{}}function pp(e,t){if(t){dp(e,t),fp(e,t),rp({scope:e,retiredOwner:t});return}bp+=1,rp({scope:e});try{let t=ge();if(!t)return;if(e!==void 0){t.removeItem(_p+e);return}for(let e=t.length-1;e>=0;--e){let n=t.key(e);n?.startsWith(_p)&&t.removeItem(n)}}catch{}}function mp(e){let t=e.client;if(!t||t.offlineRecoveryRetired||e.connected&&!t.recoveryScopeReady)return;t.recoveryScopeReady&&t.recoveryScope&&Sp.set(t,t.recoveryScope);let n=Sp.get(t);return(t.recoveryScopeReady?t.recoveryScope:t.offlineRecoveryScope??(n===t.recoveryScope?n:void 0))?.trim()||void 0}function hp(){clearTimeout(Cp),Cp=void 0;let e=wp;if(wp=void 0,!e||e.generation!==bp)return;let{record:t}=e,n=ge(),r=_p+t.scope;try{let e={...t.agents,agents:t.agents.agents.map(e=>{let t=e.identity?{...e.identity}:void 0;return t&&(delete t.avatar,delete t.avatarUrl),{...e,identity:t}})},i=JSON.stringify({...t,agents:e});new TextEncoder().encode(i).length>vp?fp(t.scope,ip(t)):(n?.setItem(r,i),n?.getItem(r)===i&&rp({scope:t.scope,replacement:ip(t)}))}catch{fp(t.scope,ip(t))}}function gp(e){clearTimeout(Cp),wp={record:e,generation:bp},Cp=setTimeout(hp,500)}var _p,vp,yp,bp,xp,Sp,Cp,wp;function Tp(){return(Tp=e((()=>{_p=`openclaw.control.bootRecord.v1:`,vp=65536,yp=2592e6,bp=0,xp=new Set,Sp=new WeakMap,typeof window<`u`&&typeof window.addEventListener==`function`&&typeof document<`u`&&typeof document.addEventListener==`function`&&(window.addEventListener(`storage`,e=>{if(e.key!==null&&!e.key.startsWith(_p))return;let t=e.key?.slice(31),n=lp(e.newValue,t),r=n&&Date.now()-n.savedAt<=yp?ip(n):void 0,i=e.newValue===null?lp(e.oldValue,t):null,a=i?ip(i):void 0;(!t||wp?.record.scope===t)&&(!a||wp&&ap(a,ip(wp.record)))&&!ap(r,wp?ip(wp.record):void 0)&&(bp+=1),rp({scope:t,external:!0,replacement:r,retiredOwner:a})}),window.addEventListener(`pagehide`,hp),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&hp()}))})))()}function Ep(e){let t=e.connectionRevision,n=e.snapshot,r=n.phase===`connected`&&n.client?.recoveryScopeReady!==!1,i=n.phase===`connected`?n.selfUser??null:void 0,a=i?.id,o=n.client?.offlineRecoveryRetired?void 0:n.hello?.auth?.recoveryScope??mp({client:n.client}),s=Dp.get(e);if(!s||s.revision!==t||s.recoveryScope!==void 0&&o!==void 0&&s.recoveryScope!==o||n.client?.offlineRecoveryRetired===!0&&s.recoveryScope!==void 0||a!==void 0&&s.userId!==void 0&&s.userId!==a){let n={scope:{key:++Op,displayUser:i??null,readyOnce:r},revision:t,userId:a,recoveryScope:o};return Dp.set(e,n),n.scope}return s.userId??=a,s.recoveryScope??=o,s.scope.readyOnce||=r,i===void 0?n.phase!==`reconnecting`&&n.phase!==`reload-required`&&(s.scope.displayUser=null):s.scope.displayUser=i,s.scope}var Dp,Op;function kp(){return(kp=e((()=>{Tp(),Dp=new WeakMap,Op=0})))()}function Ap(e){let t=new URLSearchParams(e).get(`onboarding`);return t!==null&&/^(?:1|true|yes|on)$/iu.test(t.trim())}function jp(){return(jp=e((()=>{})))()}var Mp,Np,Pp,Fp,Ip;function Lp(){return(Lp=e((()=>{R(),Ri(),Ai(),Mp=[[`pluginEmbed`,`content--plugin-embed`],[`hubHeader`,`content--hub-header`],[`toolbarHeader`,`content--toolbar-header`],[`workbench`,`content--workbench`],[`settingsPage`,`content--settings-page`],[`settingsWide`,`content--settings-wide`],[`settingsWorkspace`,`content--settings-workspace`],[`memoryPage`,`content--memory-page`],[`logsPage`,`content--logs-page`],[`activityPage`,`content--activity-page`],[`terminalPage`,`content--terminal-page`]],Np=new WeakMap,Pp=class extends Ti{constructor(...e){super(...e),this.traits={}}render(e){return I}update(e,[t]){return this.host=e.options?.host instanceof Element?e.options.host:void 0,this.traits=t,this.publish(),I}publish(){let e=this.isConnected&&this.host?.isConnected?this.host.closest(`main.content`):null,t=e?Np.get(e):void 0;t!==this.controller&&(this.controller?.clear(this),this.controller=t),this.host&&this.controller?.record(this,this.host,this.traits)}disconnected(){this.controller?.clear(this),this.controller=void 0}reconnected(){this.publish()}},Fp=ki(Pp),Ip=class{constructor(e){this.host=e,this.reporters=new Map,this.contentRef=e=>{e!==this.content&&(this.content&&Np.delete(this.content),this.content=e,e&&(Np.set(e,this),this.apply()))},e.addController(this)}record(e,t,n){if(!t.isConnected||!this.content?.contains(t)||!Mp.some(([e])=>n[e])){this.clear(e);return}let r=this.reporters.get(e);r?.host===t&&Mp.every(([e])=>!!r.traits[e]==!!n[e])||(this.reporters.set(e,{host:t,traits:{...n}}),this.apply(),this.host.requestUpdate())}clear(e){this.reporters.delete(e)&&(this.apply(),this.host.requestUpdate())}get current(){let e={};for(let[t,n]of this.reporters){if(!n.host.isConnected||!this.content?.contains(n.host)){this.reporters.delete(t);continue}for(let[t]of Mp)n.traits[t]&&(e[t]=!0)}return e}get className(){let e=this.current;return Mp.filter(([t])=>e[t]).map(([,e])=>e).join(` `)}apply(){let e=this.current;for(let[t,n]of Mp)this.content?.classList.toggle(n,!!e[t])}hostDisconnected(){this.reporters.clear(),this.apply()}}})))()}function Rp(e,t,n){let r=Ps(t.pathname,n),i=r?e.getRoute(r):null;i&&Promise.resolve(i.component()).catch(()=>void 0)}function zp(e,t,n){return e===`workboard`?Wr(t,n).canonicalLocation??t:e===`plugin`?cs(t,n):t}function Bp(){let e=sa({routes:Gp});return{...e,navigate:(t,n,r,i)=>n.nativeConversation?.interceptNavigation(i??Ls(t,n.basePath))?Promise.resolve():e.navigate(t,n,r,i?zp(t,i,n.basePath):void 0),routeIdFromPath:Ps}}function Vp(e,t){let n=Ns(e.pathname,t);if(!n)return e;let[r,i,a]=n,o=new URLSearchParams(e.search);return o.set(i,a),{...e,pathname:J(r,t),search:`?${o.toString()}`}}function Hp(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`notFound`}async function Up(e){try{await e}catch(e){if(!Hp(e))throw e}}async function Wp(e,t,n,r){is(r.gateway.snapshot.hello?.controlUiTabs);let i=t.location(),a=zp(Ps(i.pathname,n),i,n);zs(i,a)||(t.replace(a),i=t.location());let o=_s(i.pathname,n);o?.invalidPanel&&(t.replace({...i,pathname:gs(o.agentId,null,n)}),i=t.location()),Ps(i.pathname,n)===null&&!as(i.pathname,n)&&(t.replace({...i,pathname:e.pathForRoute(`chat`,n)}),i=t.location());let s=Ns(i.pathname,n);await Up(e.start({location:()=>Vp(t.location(),n),push:e=>t.push(e),replace:e=>t.replace(e),listen:i=>{let a=!0,o=!1,s=r.gateway.snapshot.hello,c,l=()=>{let t=e.getState();return t.pendingMatches[0]??t.matches[0]},u=async(t,n)=>{let i=t.data;if(i?.kind!==`session`||!n&&!i.sessionResolutionFromCache)return;let{client:o,hello:s}=r.gateway.snapshot,c=Ep(r.gateway),u=()=>a&&r.gateway.snapshot.phase===`connected`&&r.gateway.snapshot.client===o&&r.gateway.snapshot.hello===s&&Ep(r.gateway)===c&&l()?.abortController===t.abortController&&e.getState().pendingMatches.length===0;try{let{sessionRouteTargetFromLocation:n}=await W(async()=>{let{sessionRouteTargetFromLocation:e}=await import(`./control-ui-boot-chat-B-b-JQel.js`).then(e=>(e.t(),e.n));return{sessionRouteTargetFromLocation:e}},__vite__mapDeps([56,1,3,2,4,5,8,7,6,9,10,11,12,13,14,15,19,17,18,16,20,21,55,22,23,30,31,32,33,34,35,36,37,38,58]),import.meta.url);if(!u())return;let a=n(r,t.location)?.target;if(!a||!(a.kind===`short`||a.kind===`literal`&&a.slugCandidate))return;let{querySessionReference:o}=await W(async()=>{let{querySessionReference:e}=await import(`./control-ui-boot-chat-B-b-JQel.js`).then(e=>(e.r(),e.i));return{querySessionReference:e}},__vite__mapDeps([56,1,3,2,4,5,8,7,6,9,10,11,12,13,14,15,19,17,18,16,20,21,55,22,23,30,31,32,33,34,35,36,37,38,58]),import.meta.url);if(!u())return;(await o(r,{key:i.sessionKey,agentId:a.agentId},t.abortController.signal))?.kind===`not-found`&&u()&&await e.revalidate(r,t.routeId)}catch{}},d=()=>{let t=l();if(!t||!Es(t.routeId)){c=void 0;return}let n=Ep(r.gateway);if(c?.controller!==t.abortController&&(c=void 0),!(c&&c.scope!==n)){if(r.gateway.snapshot.phase!==`connected`){(t.status===`pending`||t.status===`success`||t.isFetching===`loader`)&&(c={controller:t.abortController,scope:n,verifySession:c?.verifySession===!0||s!==null||t.data!==void 0});return}if(t.status===`success`&&!t.isFetching){let e=c;c=void 0,e&&u(t,e.verifySession)}c&&!o&&t.status===`error`&&(o=!0,queueMicrotask(()=>{o=!1;let t=l();a&&c&&t?.abortController===c.controller&&Ep(r.gateway)===c.scope&&r.gateway.snapshot.phase===`connected`&&t.status===`error`&&(c=void 0,t.abortController.abort(),l()?.abortController===t.abortController&&e.navigate(t.routeId,r,{history:`none`,revalidate:!0},t.location).catch(()=>void 0))}))}},f=e.subscribe(d),p=r.gateway.subscribe(o=>{d(),s!==o.hello&&(s=o.hello,is(o.hello?.controlUiTabs),queueMicrotask(()=>{if(!a||r.gateway.snapshot.phase!==`connected`)return;let o=t.location(),s=cs(o,n),c=e.getState();if(c.pendingMatches.some(e=>!zs(e.location,o)))return;let l=o.pathname!==J(`plugin`,n)&&[...c.matches,...c.pendingMatches].some(e=>e.routeId===`plugin`);!zs(o,s)||l&&os(o.pathname,n)?e.navigate(`plugin`,r,{history:`replace`},s).catch(e=>{console.error(`[openclaw] Plugin tab navigation failed`,e)}):l&&i(o)}))}),m=t.listen(a=>{if(r.nativeConversation?.interceptNavigation(a)){let n=e.getState().location;n&&t.replace(n);return}let o=zp(Ps(a.pathname,n),a,n);zs(a,o)||t.replace(o);let s=Ns(o.pathname,n);if(s){e.navigate(s[0],r,{history:`none`},o).catch(e=>{console.error(`[openclaw] Dynamic route navigation failed`,e)});return}i(o)});return()=>{a=!1,c=void 0,f(),p(),m()}}},n,r)),s&&zs(t.location(),i)&&await Up(e.navigate(s[0],r,{history:`none`},i))}var Gp;function Kp(){return(Kp=e((()=>{ba(),Y(),kp(),we(),d(),Ie(),E(),li(),tt(),Qt(),ii(),On(),Hn(),gr(),hn(),Ke(),Rt(),or(),cn(),er(),Ir(),Gt(),Mr(),Br(),r(),jt(),Tt(),Or(),it(),De(),Wn(),Jn(),x(),nt(),_(),ui(),Ft(),Mn(),Sr(),an(),Qn(),Pr(),Ut(),U(),Gp=[...yi,i,fe,rr,Kn,mr,ni,y,Se,Xn,ee,rt,mi,Bt,Nr,nn,Oe,yr,...qt,bt,Ge,mn,s,tn,vr,si,Cn,T,Me,vn,Fn,Vn,Qe,...$r,...Be,Hr,yn,wr,Jr,ht]})))()}function qp(){return(qp=e((()=>{ro()})))()}function Jp(e){if(Object.keys(e).length===1){if(typeof e.deviceToken==`string`&&e.deviceToken)return{deviceToken:e.deviceToken};if(typeof e.token==`string`&&e.token)return{token:e.token};if(typeof e.password==`string`&&e.password)return{password:e.password}}throw Error(`The app returned an invalid Gateway credential. Reconnect in the app.`)}function Yp(e,t){let n=q(e)?e:{},r=q(n.client)?n.client:{},i=q(n.device)?n.device:{},a=q(n.auth)?n.auth:{},o=yo(typeof r.id==`string`?r.id:void 0),s=qi(typeof r.mode==`string`?r.mode:void 0);if(!o||!s||typeof r.version!=`string`||typeof r.platform!=`string`||!Array.isArray(n.scopes)||!n.scopes.every(e=>typeof e==`string`)||typeof i.id!=`string`||typeof i.publicKey!=`string`||typeof i.signature!=`string`||i.nonce!==t.nonce||i.signedAt!==t.signedAt)throw Error(`The app returned an invalid Gateway authorization. Reconnect in the app.`);return{client:{id:o,mode:s,version:r.version,platform:r.platform,...typeof r.deviceFamily==`string`?{deviceFamily:r.deviceFamily}:{},...typeof r.instanceId==`string`?{instanceId:r.instanceId}:{}},scopes:n.scopes,auth:Jp(a),device:{id:i.id,publicKey:i.publicKey,signature:i.signature,nonce:t.nonce,signedAt:t.signedAt}}}function Xp(e,t={}){let n=window,r=n.OpenClawNativeGatewayAuth,i=n.webkit?.messageHandlers?.OpenClawNativeGatewayAuth,a=new Map,o=new Map,s,c=!1,l=e=>{let t=e;if(typeof e==`string`)try{t=JSON.parse(e)}catch{return}q(t)&&typeof t.id==`string`&&a.get(t.id)?.(t)};if(r&&(r.onmessage=e=>l(e.data)),t.messagePort&&n.top===n){let t=r=>{let i=r.ports[0];if(c||s||r.source!==null||r.origin!==``||r.ports.length!==1||!i)return;let a;try{a=typeof r.data==`string`?JSON.parse(r.data):void 0}catch{return}if(q(a)&&a.type===`openclaw.native-control-auth`&&typeof a.gatewayUrl==`string`&&G(a.gatewayUrl)===G(e)){s=i,s.addEventListener(`message`,e=>l(e.data)),s.start(),n.removeEventListener(`message`,t);for(let[e,t]of o)try{s.postMessage(t)}catch(t){l({id:e,error:xi(t)})}o.clear()}};n.addEventListener(`message`,t),n.addEventListener(`pagehide`,()=>{c=!0,n.removeEventListener(`message`,t),s?.close();for(let e of a.keys())l({id:e,error:`Native dashboard document closed`});o.clear()},{once:!0})}return async({gatewayUrl:u,nonce:d,signedAt:f,signal:p})=>{if(G(u)!==G(e))throw Error(`This dashboard belongs to a different Gateway. Select the Gateway in the app.`);if(c||n.top!==n||!r&&!i&&!t.messagePort)throw Error(`Native Gateway authorization is unavailable. Reopen this dashboard in the app.`);if(!/[^\p{White_Space}\p{Control}\ufeff]/u.test(d)||new TextEncoder().encode(d).length>512||d.includes(`|`)||!Number.isSafeInteger(f)||f<=0)throw Error(`The Gateway did not provide a valid native authentication challenge.`);p.throwIfAborted();let m={id:go(),nonce:d,signedAt:f};return await new Promise((e,t)=>{let n=(n,r)=>{a.delete(m.id)&&(o.delete(m.id),clearTimeout(u),p.removeEventListener(`abort`,c),n===void 0?r&&e(r):t(n))},c=()=>n(Error(xi(p.reason??`Native Gateway authorization cancelled.`))),u=setTimeout(()=>n(new Zp(`The app did not authorize this dashboard in time. Reconnect in the app.`)),fa/2);a.set(m.id,e=>{try{if(typeof e.error==`string`)throw new Zp(e.error);n(void 0,Yp(e.result,m))}catch(e){n(e instanceof Error?e:Error(xi(e)))}}),p.addEventListener(`abort`,c,{once:!0});try{let e;r?e=r.postMessage(JSON.stringify(m)):i?e=i.postMessage(m):s?s.postMessage(JSON.stringify(m)):o.set(m.id,JSON.stringify(m)),e&&e.then(l,e=>n(new Zp(xi(e))))}catch(e){n(new Zp(xi(e)))}})}}var Zp;function Qp(){return(Qp=e((()=>{ya(),Ea(),hi(),Ca(),Zp=class extends Error{}})))()}function $p(e,t){let n=e&&typeof e==`object`&&`name`in e?e.name:void 0,r=typeof n==`string`&&n.trim()?n:void 0,i=xi(e),a=i.toLowerCase(),o=r?.toLowerCase()===`securityerror`||a.includes(`security error`)||a.includes(`mixed content`)||a.includes(`insecure websocket`),s=t.trim().toLowerCase().startsWith(`ws://`),c=o?rm:nm;return{code:c,message:o?`Browser refused the Gateway WebSocket for security reasons.`+(s?` Use wss:// when the Control UI is served over HTTPS/Tailscale Serve, or open the loopback dashboard at http://127.0.0.1:18789.`:` Check the Gateway WebSocket URL and browser security policy.`):`Could not create the Gateway WebSocket: ${i}`,details:{code:c,browserErrorName:r,browserMessage:i}}}async function em(e,t){try{let n=new URL(e,window.location.href);n.protocol=n.protocol.replace(/^ws/u,`http`);let r=new URL(uc(new URL(`/healthz`,n).href),window.location.href);if(r.origin!==new URL(window.location.href).origin)return!1;let i=await fetch(r,{cache:`no-store`,credentials:`same-origin`,redirect:`error`,signal:t});if(!i.ok)return!1;let a=await i.json();return typeof a==`object`&&!!a&&`ok`in a&&a.ok===!0&&`status`in a&&a.status===`live`}catch{return!1}}function tm(e,t,n){let r=new WebSocket(cc(e)),i=!0,a=!1,o,s=()=>{i=!1,o!==void 0&&(clearTimeout(o),o=void 0)},c=(e,n)=>{a||(s(),a=!0,t.close(e,n))};return r.addEventListener(`open`,()=>{a||(s(),t.open())}),r.addEventListener(`message`,e=>{a||t.message(String(e.data??``))}),r.addEventListener(`close`,e=>c(e.code,e.reason)),r.addEventListener(`error`,()=>{a||(s(),t.error(Error(`websocket error`)))}),o=setTimeout(()=>{if(o=void 0,!i)return;i=!1;let e=`gateway websocket opening timed out after ${fa}ms`;try{t.error(Error(e))}finally{r.close(),c(1006,e)}},fa),{isOpen:()=>!a&&r.readyState===WebSocket.OPEN,send:e=>{let t=n?.();if(t!==void 0&&new TextEncoder().encode(e).byteLength>t)throw new im;r.send(e)},close:(e,t)=>{a||(s(),r.close(e===1008?4008:e,t),c(e??1e3,t??``))}}}var nm,rm,im;function am(){return(am=e((()=>{ya(),hi(),nm=`BROWSER_WEBSOCKET_CONSTRUCTOR_ERROR`,rm=`BROWSER_WEBSOCKET_SECURITY_ERROR`,im=class extends Error{constructor(){super(`Request exceeds the Gateway payload limit. Shorten the message or remove one or more attachments and retry.`),this.name=`GatewayPayloadLimitError`}}})))()}var om;function sm(){return(sm=e((()=>{Qi(),la(),om=class{constructor(e){this.reconnect=e,this.stream=new Na,this.projectedEvents=new WeakMap,this.generation=0}clear(){this.generation+=1,this.stream.clear()}async request(e,t,n,r){let i=this.generation,a=await e.request(t,n,r);if(t===`sessions.messages.unsubscribe`&&i===this.generation){let e=es(a)?.key,t=es(n),r=(typeof e==`string`?Lo(e)?.agentId:void 0)??t?.agentId??(e===`global`&&typeof t?.key==`string`?Lo(t.key)?.agentId:void 0);this.stream.retire(t=>{let n=t.agentId??Lo(t.sessionKey)?.agentId;return t.sessionKey===e&&n===r})}return a}dispatch(e,t){let n=this.project(e);n&&t?.(n)}project(e){if(e.event!==`chat`)return e;if(this.projectedEvents.has(e))return this.projectedEvents.get(e)??null;let t=this.stream.project(e),n=t.missingBaseline?null:t.event;return t.missingBaseline&&this.reconnect(`chat stream baseline missing`),this.projectedEvents.set(e,n),n}}})))()}function cm(e){let{gatewayCode:t,message:n,details:r,retryable:i,retryAfterMs:a}=e;return{code:t,message:n,details:r,retryable:i,retryAfterMs:a}}function lm(e){try{let t=new URL(e,window.location.href);return ar(t.hostname)||t.host===new URL(window.location.href).host}catch{return!1}}function um(e,t,n,r){if(t)return{retry:t.retryable,notify:!0,pendingError:t};let i=n??e.connectFailure?.error,a=e.connectFailure?.reconnectDelayMs;if(a!==void 0)return{retry:!0,notify:!0,reconnectDelayMs:a,pendingError:i};let o=i instanceof mm?cm(i):void 0;return{retry:pm(o)===no.AUTH_TOKEN_MISMATCH?r:!Va({details:o?.details,protocolMismatchIsTerminal:!0}),notify:!0,pendingError:i}}function dm(e,t){let n=$p(e,t.url);try{t.onClose?.({code:1006,reason:n.code===`BROWSER_WEBSOCKET_SECURITY_ERROR`?`security error`:`websocket error`,error:n,willRetry:!1})}catch(e){console.error(`[gateway] close handler error:`,e)}}function fm(e,t){return co(t)===no.PROTOCOL_MISMATCH||!e?.toLowerCase().includes(`protocol mismatch`)?t:{code:no.PROTOCOL_MISMATCH,clientMinProtocol:4,clientMaxProtocol:4,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}}}function pm(e){return co(e?.details)}var mm;function hm(){return(hm=e((()=>{fo(),Ka(),Xi(),am(),mm=class extends ga{constructor(e){let t=fm(e.message,e.details);super({...e,details:t,message:Ao({message:e.message,details:t})}),this.name=`GatewayRequestError`}}})))()}function gm(){if(navigator.platform===`MacIntel`)return navigator.maxTouchPoints>1||/iPad/u.test(navigator.userAgent)?`iPad`:`Mac`}async function _m({opts:e,connectNonce:t,connectChallengeTs:n,generation:r,serverCapabilities:i,nativeSignal:a,selectAuth:o}){let s=vm,c=Intl.DateTimeFormat().resolvedOptions().timeZone||void 0,l={id:e.clientName??na.CONTROL_UI,version:e.clientVersion??`control-ui`,buildId:e.clientBuildId,platform:e.platform??navigator.platform??`web`,deviceFamily:e.deviceFamily??(e.platform===void 0?gm():void 0),mode:e.mode??oa.WEBCHAT,instanceId:e.instanceId,...c?{timeZone:c}:{}},u=e.token?.trim()||void 0,d={authToken:u,authPassword:e.password?.trim()||void 0},f;if(e.nativeConnectAuth){if(!t||typeof n!=`number`||!Number.isSafeInteger(n))throw Error(`The Gateway did not provide a valid native authentication challenge.`);f=await e.nativeConnectAuth({gatewayUrl:e.url,nonce:t,signedAt:n,signal:a}),a.throwIfAborted(),l={...f.client,buildId:e.clientBuildId,...c?{timeZone:c}:{}},d={authToken:f.auth.token,authPassword:f.auth.password,resolvedDeviceToken:f.auth.deviceToken}}let p=f?null:await _i().catch(()=>null);p&&(d=o({role:s,deviceId:p.deviceId})),f||(d.authPassword??=d.authToken);let m=f?.scopes??$a({requestedScopes:d.authBootstrapToken?e.bootstrapProfile===`owner`?[...Eo]:[...Vo]:e.scopes,usingStoredDeviceToken:d.usingStoredDeviceToken,storedScopes:d.storedScopes,defaultScopes:ym}),h=f?.device;if(p){if(n===null)throw Error(`gateway connect challenge timestamp invalid`);let e=n??Date.now(),r=t??``,i=aa({deviceId:p.deviceId,clientId:l.id,clientMode:l.mode,role:s,scopes:m,signedAtMs:e,token:d.signatureToken??null,nonce:r}),a=await fi(p.privateKey,i);h={id:p.deviceId,publicKey:p.publicKey,signature:a,signedAt:e,nonce:r}}return{generation:r,params:{minProtocol:4,maxProtocol:4,client:l,role:s,scopes:m,device:h,...To({modelCatalog:e.modelCatalog,serverCapabilities:i,caps:[`agent-kind`,`approvals`,`task-suggestions`,`terminal-offset-seq`,`terminal-session-metadata`,`terminal-upload-path-style`,`tool-events`,`chat-only-assistant-text`,`session-scoped-events`,`inline-widgets`,`model-selection-policy`,`ui-agent-github-settings`,`ui-commands`,`ultrafast`,`usage-refreshing`]}),auth:f?.auth??Oo(d),userAgent:navigator.userAgent,locale:xe.getRequestedLocale()},explicitGatewayToken:f?void 0:u,selectedAuth:d,deviceIdentity:p}}var vm,ym;function bm(){return(bm=e((()=>{Io(),Ea(),Bo(),Sa(),Po(),N(),Tn(),vm=`operator`,ym=[`operator.admin`,`operator.read`,`operator.write`,`operator.approvals`,`operator.questions`,`operator.pairing`]})))()}function xm(e){return jo(typeof e==`number`&&Number.isFinite(e)&&e>0?e:Sm,{minMs:Cm})*2}var Sm,Cm;function wm(){return(wm=e((()=>{ya(),Sm=3e4,Cm=1e3})))()}async function Tm(e){if(!e||typeof crypto>`u`||!crypto.subtle)return``;try{let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return Ui.bytesToHex(new Uint8Array(t))}catch{return``}}var Em,Dm,Om,km,Am,jm,Mm;function Nm(){return(Nm=e((()=>{zi(),fo(),Ba(),Io(),Fa(),Xa(),Qp(),hi(),Tn(),Ca(),am(),sm(),hm(),bm(),wm(),U(),Em=4008,Dm=4013,Om=1006,km=5e3,Am=15e3,jm=1e4,Mm=class{constructor(e){this.opts=e,this.chatEvents=new om(e=>this.forceReconnect(e)),this.scopeUpgradeRuntime=null,this.inboundActivitySeq=0,this.lastInboundActivityAtMs=null,this.firstUnansweredRequestAtMs=null,this.maxInboundSilenceMs=null,this.inboundSilenceTimer=null,this.inboundSilenceProbe=null,this.pendingDeviceTokenRetry=!1,this.deviceTokenRetryBudgetUsed=!1,this.nativeAuthAbort=null,this.nativeAuthError=null,this.recovery={value:``,resolved:!1,generation:0},this.scopeUpgradeBinding=null,this.reachabilityProbe=null,this.pendingPairing=null,this.pairingFailure=null,this.offlineStorageRetired=!1,this.client=new ma({createSocket:e=>(this.pendingPairing=null,this.pairingFailure=null,this.reachabilityProbe?.abort(),this.reachabilityProbe=null,this.chatEvents.clear(),this.maxPayloadBytes=void 0,tm(this.opts.url,e,()=>this.maxPayloadBytes)),createRequestId:go,createRequestError:e=>new mm({code:e.code??`UNAVAILABLE`,message:e.message??`request failed`,details:e.details,retryable:e.retryable,retryAfterMs:e.retryAfterMs}),buildConnectPlan:({nonce:e,challengeTs:t,generation:n,serverCapabilities:r})=>this.buildConnectPlan(e,t,n,r),buildConnectParams:e=>e.params,onConnectPlanError:e=>this.opts.nativeConnectAuth?(this.nativeAuthError=e instanceof mm?e:new mm({code:`UNAVAILABLE`,message:xi(e),retryable:e instanceof Zp}),{closeCode:Em,closeReason:`native authorization unavailable`,stop:!this.nativeAuthError.retryable}):{closeCode:Em,closeReason:`connect failed`},onConnectHello:(e,t)=>this.handleConnectHello(e,t.plan),onHello:e=>this.opts.onHello?.(e),onConnectFailure:(e,t)=>this.handleConnectFailure(e,t.plan),resolveClose:e=>um(e,this.nativeAuthError,this.pairingFailure,this.pendingDeviceTokenRetry),onClose:(e,t)=>{this.nativeAuthAbort?.abort(),this.chatEvents.clear(),this.recovery={...this.recovery,generation:e.generation+1,resolved:!1},this.clearInboundActivity(),this.scopeUpgradeBinding=null;let n=this.pairingFailure??e.connectFailure?.error??this.nativeAuthError;if(this.pendingPairing=null,t.notify){let r={code:e.code,reason:e.reason,error:n instanceof mm?cm(n):void 0,willRetry:t.retry};if(t.retry&&!e.socketOpened&&e.code===Om&&!e.reason&&!r.error){let e=new AbortController;this.reachabilityProbe=e;let t=setTimeout(()=>e.abort(),1e3);em(this.opts.url,e.signal).then(n=>{clearTimeout(t),this.reachabilityProbe===e&&(this.reachabilityProbe=null,this.opts.onClose?.({...r,...n&&!e.signal.aborted?{busy:!0}:{}}))}).catch(e=>console.error(`[gateway] close handler error:`,e))}else this.opts.onClose?.(r)}},onReconnectScheduled:e=>this.opts.onReconnectScheduled?.(e),onSocketFactoryError:e=>{this.pendingDeviceTokenRetry=!1,dm(e,this.opts)},onEvent:e=>{if(this.pendingPairing){this.handlePairingResolution(e);return}this.chatEvents.dispatch(e,this.opts.onEvent)},onGap:e=>this.opts.onGap?.(e),onActivity:()=>{this.inboundActivitySeq+=1,this.lastInboundActivityAtMs=Date.now(),this.firstUnansweredRequestAtMs=null},onRequestTiming:e=>this.opts.onRequestTiming?.(e),onCallbackError:(e,t)=>console.error(`[gateway] ${e} handler error:`,t),handshake:{mode:`fallback`,timeoutMs:750},reconnect:{initialMs:800,multiplier:1.7,maxMs:15e3},nowMs:()=>typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()})}get instanceId(){return this.opts.instanceId}get gatewayUrl(){return this.opts.url}start(){this.client.start()}stop(){this.nativeAuthAbort?.abort(),this.reachabilityProbe?.abort(),this.reachabilityProbe=null,this.chatEvents.clear(),this.clearInboundActivity(),this.recovery={...this.recovery,generation:this.recovery.generation+1,resolved:!1},this.client.stop(),this.cancelScopeUpgrade(),this.scopeUpgradeBinding=null,this.pendingDeviceTokenRetry=!1,this.deviceTokenRetryBudgetUsed=!1}get connected(){return this.client.connected}get needsWakeReconnect(){return this.pendingPairing||this.pairingFailure||this.client.opening?!1:!this.client.connected||this.lastInboundActivityAtMs!==null&&this.maxInboundSilenceMs!==null&&Date.now()-this.lastInboundActivityAtMs>=this.maxInboundSilenceMs}get connectionGeneration(){return this.recovery.generation}get recoveryScope(){return this.recovery.value}get offlineRecoveryRetired(){return this.offlineStorageRetired}get offlineRecoveryScope(){return this.opts.offlineRecoveryScope}retireOfflineRecoveryScope(){this.opts.offlineRecoveryScope=void 0,this.offlineStorageRetired=!0}get recoveryScopeReady(){return this.recovery.resolved}get scopeUpgradeReady(){return this.connected&&this.scopeUpgradeBinding!==null}async buildConnectPlan(e,t,n,r){this.nativeAuthError=null,this.recovery={...this.recovery,generation:n,resolved:!1},this.nativeAuthAbort?.abort(),this.nativeAuthAbort=new AbortController;let i=await _m({opts:this.opts,connectNonce:e,connectChallengeTs:t,generation:n,serverCapabilities:r,nativeSignal:this.nativeAuthAbort.signal,selectAuth:e=>this.selectConnectAuth(e)});return this.pendingDeviceTokenRetry&&i.selectedAuth.authDeviceToken&&(this.pendingDeviceTokenRetry=!1),i}handleConnectHello(e,t){if(this.recovery.value=e.auth?.recoveryScope??``,this.opts.offlineRecoveryScope=e.auth?.recoveryScope,this.offlineStorageRetired=!1,this.maxPayloadBytes=e.policy?.maxPayload,this.initializeInboundActivity(e),this.pendingDeviceTokenRetry=!1,this.deviceTokenRetryBudgetUsed=!1,this.opts.bootstrapToken=void 0,this.opts.bootstrapProfile=void 0,this.scopeUpgradeBinding=t.deviceIdentity&&{clientId:t.params.client.id,deviceId:t.deviceIdentity.deviceId,role:t.params.role??`operator`},e?.auth?.deviceToken&&t.deviceIdentity){let n=e.auth.role??t.params.role??`operator`,r=n===t.params.role&&e.auth.deviceToken===t.selectedAuth.storedToken?t.selectedAuth.storedScopes??e.auth.scopes??[]:e.auth.scopes??[];et({deviceId:t.deviceIdentity.deviceId,gatewayUrl:this.opts.url,role:n,token:e.auth.deviceToken,scopes:r})}this.resolveRecoveryScope(e,t)}async resolveRecoveryScope(e,t){let n=e.auth?.recoveryScope,r=await Tm(e.auth?.deviceToken??t.selectedAuth.authDeviceToken??t.selectedAuth.resolvedDeviceToken??t.selectedAuth.authToken),i=n&&e.auth?.recoveryMigrationAllowed===!0&&r?(await W(async()=>{let{default:e}=await import(`./control-ui-boot-shared-dOnP4mAA.js`).then(e=>(e.m(),e.h));return{default:e}},__vite__mapDeps([13,1,3,2,4,5,8,7,6,9,11,12,14,15,30,31,33,32]),import.meta.url)).default:void 0;t.generation===this.recovery.generation&&this.client.connected&&(i?.(this.opts.url,r,n),this.recovery.value=n??r,this.recovery.resolved=!0,this.opts.offlineRecoveryScope=this.recovery.value||void 0,this.opts.onRecoveryScopeChange?.())}initializeInboundActivity(e){this.maxInboundSilenceMs=xm(e.policy?.tickIntervalMs),this.lastInboundActivityAtMs=Date.now(),this.firstUnansweredRequestAtMs=null,this.inboundSilenceTimer=setInterval(()=>this.checkInboundSilence(),km)}checkInboundSilence(){let e=this.lastInboundActivityAtMs;if(!this.connected||e===null||this.maxInboundSilenceMs===null)return;if(typeof document<`u`&&document.visibilityState!==`visible`){this.clearInboundSilenceProbe();return}let t=Date.now(),n=this.inboundSilenceProbe;if(n&&e===n.activityAtMs){t>=n.deadlineMs&&(this.clearInboundActivity(),this.forceReconnect(`inbound silence probe timeout`));return}if(this.clearInboundSilenceProbe(),t-e<this.maxInboundSilenceMs&&(this.firstUnansweredRequestAtMs===null||t-this.firstUnansweredRequestAtMs<Am))return;let r=new AbortController;this.inboundSilenceProbe={activityAtMs:e,deadlineMs:t+jm,abort:r},this.client.request(`health`,{probe:!1},{timeoutMs:jm,signal:r.signal}).catch(()=>void 0)}clearInboundSilenceProbe(){let e=this.inboundSilenceProbe;this.inboundSilenceProbe=null,e?.abort.abort()}clearInboundActivity(){this.inboundSilenceTimer!==null&&(clearInterval(this.inboundSilenceTimer),this.inboundSilenceTimer=null),this.clearInboundSilenceProbe(),this.lastInboundActivityAtMs=null,this.firstUnansweredRequestAtMs=null,this.maxInboundSilenceMs=null}handleConnectFailure(e,t){let n=ts(e.details);if(e instanceof mm&&n?.waitForResolution&&n.requestId&&n.deviceId&&n.deviceId===t.deviceIdentity?.deviceId)return this.pendingPairing={requestId:n.requestId,deviceId:n.deviceId},this.opts.onClose?.({code:Em,reason:`pairing approval pending`,error:cm(e),willRetry:!0}),{closeCode:Em,closeReason:`pairing approval pending`,keepOpen:!0};let r=e instanceof mm?pm(e):null;Uo({retryBudgetUsed:this.deviceTokenRetryBudgetUsed,currentDeviceToken:t.selectedAuth.authDeviceToken,explicitToken:t.explicitGatewayToken,storedToken:t.selectedAuth.storedToken,trustedEndpoint:!!t.deviceIdentity&&lm(this.opts.url),errorDetails:e instanceof mm?e.details:void 0})&&(this.pendingDeviceTokenRetry=!0,this.deviceTokenRetryBudgetUsed=!0),t.selectedAuth.storedToken&&(t.selectedAuth.resolvedDeviceToken===t.selectedAuth.storedToken||t.selectedAuth.authDeviceToken===t.selectedAuth.storedToken)&&t.deviceIdentity&&r===no.AUTH_DEVICE_TOKEN_MISMATCH&&Pn({deviceId:t.deviceIdentity.deviceId,gatewayUrl:this.opts.url,role:t.params.role??`operator`});let i=Jo(e);return i===null?{closeCode:Em,closeReason:`connect failed`}:{closeCode:Dm,closeReason:`gateway starting`,reconnectDelayMs:Math.ceil(i*(1+Math.random()*.2))}}handlePairingResolution(e){if(e.event!==`device.pair.resolved`||!this.pendingPairing)return;let t=e.payload;if(!q(t)||t.requestId!==this.pendingPairing.requestId||t.deviceId!==this.pendingPairing.deviceId)return;let n=t.decision;(n===`approved`||n===`rejected`||n===`expired`)&&((n===`rejected`||n===`expired`)&&(this.pairingFailure=new mm({code:`NOT_PAIRED`,message:n===`rejected`?`This browser's access request was declined.`:`This browser's access request expired.`,details:{code:n===`rejected`?no.PAIRING_REJECTED:no.PAIRING_EXPIRED,...this.pendingPairing,pauseReconnect:!0}})),this.client.closeSocket(Em,`pairing ${n}`))}selectConnectAuth(e){let t=ei({deviceId:e.deviceId,gatewayUrl:this.opts.url,role:e.role}),n=t?.scopes??[],r=e.role!==`operator`||$o({role:e.role,requestedScopes:[`operator.sessions.read`],allowedScopes:n});return xo({token:this.opts.token,bootstrapToken:this.opts.bootstrapToken,password:this.opts.password,storedToken:r?t?.token:void 0,storedScopes:t?.scopes,pendingDeviceTokenRetry:this.pendingDeviceTokenRetry,trustedDeviceTokenRetry:lm(this.opts.url),preferBootstrapToken:!0})}request(e,t,n){let r={...n,onSent:e=>{this.firstUnansweredRequestAtMs??=Date.now(),n?.onSent?.(e)}};return this.chatEvents.request(this.client,e,t,r)}async requestScopeUpgrade(e={}){let t=this.scopeUpgradeBinding;if(!this.connected||!t)throw Error(`scope upgrade requires a connected browser device`);return(await this.loadScopeUpgradeRuntime()).requestScopeUpgrade({binding:t,scopes:ym,onPending:e.onPending})}cancelScopeUpgrade(){this.scopeUpgradeRuntime?.then(e=>e.cancelScopeUpgrade()).catch(()=>void 0)}loadScopeUpgradeRuntime(){return this.scopeUpgradeRuntime??=W(async()=>{let{createGatewayScopeUpgradeRuntime:e}=await import(`./gateway-scope-upgrade.runtime-83WHMtpU.js`);return{createGatewayScopeUpgradeRuntime:e}},__vite__mapDeps([90,1,30]),import.meta.url).then(({createGatewayScopeUpgradeRuntime:e})=>e({gatewayUrl:this.opts.url,request:(e,t,n)=>this.request(e,t,n),reconnect:()=>this.forceReconnect(`scope upgrade approved`)})).catch(e=>{throw this.scopeUpgradeRuntime=null,e})}addEventListener(e){return this.client.addEventListener(t=>this.chatEvents.dispatch(t,e))}forceReconnect(e){this.client.closeSocket(4e3,e)}}})))()}function Pm(e){if(!Vm.test(e))return;let[t=``,n]=e.toLowerCase().split(`e`),r=t.startsWith(`-`),[i=``,a=``]=(r?t.slice(1):t).split(`.`),o=`${i||`0`}${a}`;if(/^0+$/u.test(o))return{numerator:0n,denominator:1n};let s=Number(n??0);if(!Number.isSafeInteger(s))return;let c=a.length-s;if(o.length>Hm||Math.abs(c)>Hm)return;let l=BigInt(o),u=c<0?l*10n**BigInt(-c):l;return{numerator:r?-u:u,denominator:c>0?10n**BigInt(c):1n}}function Fm(e,t){return e.numerator*t.denominator===t.numerator*e.denominator}function Im(e){return Vm.test(e.trim())}function Lm(e){let t=e.trim();return/^-?\d+$/u.test(t)&&!Number.isSafeInteger(Number(t))}function Rm(e,t){let n=e.trim();if(n===``)return;let r=Pm(n),i=Number(n);if(!r||!Number.isFinite(i)||t&&!Number.isInteger(i))return e;let a=Number.isInteger(i)?void 0:Bm(i);return(Number.isInteger(i)?r.numerator===BigInt(i)*r.denominator:a&&Fm(r,a))?i:e}function zm(e){return Number.isInteger(e)?BigInt(e).toString():String(e)}function Bm(e){if(Number.isFinite(e))return Pm(String(e))}var Vm,Hm;function Um(){return(Um=e((()=>{Vm=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u,Hm=1024})))()}function Wm(e,t,n){let r=`${Aa(t)}${n}`;if(e===r||e===`${r}/`)return null;let i=`${r}/`;if(!e.startsWith(i))return;let a=e.slice(i.length);if(!a||a.includes(`/`))return null;try{let e=decodeURIComponent(a);return e&&e!==`.`&&e!==`..`?e:null}catch{return null}}function Gm(e,t){let n=Wm(e,t,Js.approval);if(n!==void 0)return{kind:`approval`,approvalId:n};let r=Wm(e,t,Js.question);return r===void 0?null:{kind:`question`,questionId:r}}function Km(){return(Km=e((()=>{Y()})))()}var qm;function Jm(){return(Jm=e((()=>{qm=class{constructor(){this.listeners=new Set}attach(e){return this.owner=e,this.notify(),()=>{this.owner===e&&(this.owner=void 0,this.notify())}}openSession(e,t){if(!this.owner)throw Error(`The conversation dock is unavailable. Reopen the Control UI and try again.`);this.owner.openSession(e,t)}close(e){this.owner?.closeSession(e)}get openSessionKey(){return this.owner?.openSessionKey??null}subscribe(e){return io(this.listeners,e)}notify(){for(let e of this.listeners)e()}}})))()}function Ym(e){let t=Xo(e)?.phase;return t===`accepting`||t===`preparing`||t===`draining`||t===`prepared`?t:void 0}function Xm(e){return e.reason instanceof Error?e.reason:new DOMException(`Gateway wait aborted`,`AbortError`)}function Zm(e,t){let n=e.snapshot.client;return t.aborted?Promise.reject(Xm(t)):n&&e.snapshot.phase===`connected`?Promise.resolve(n):new Promise((n,r)=>{let i=()=>void 0,a=!1,o=()=>{i(),t.removeEventListener(`abort`,s)},s=()=>{o(),r(Xm(t))};t.addEventListener(`abort`,s,{once:!0}),i=e.subscribe(e=>{e.phase===`connected`&&e.client&&(a=!0,o(),n(e.client))}),(a||t.aborted)&&i()})}function Qm(){return(Qm=e((()=>{})))()}function $m(e,t){let n=e?.trim();if(!n||!t)return null;let r=K(n);return t.agents.some(e=>K(e.id)===r)?r:null}function eh(e,t){let n=new URLSearchParams(e.search);if(!n.has(`session`))return null;let r=J(`chat`,t),i=J(`dashboard`,t),a=e.pathname===r||e.pathname===`${r}/`?`chat`:e.pathname===i||e.pathname===`${i}/`?`dashboard`:null;return a?{face:n.get(`face`)===`dashboard`?`dashboard`:a,sessionKey:n.get(`session`)?.trim()??``}:null}function th(){return(th=e((()=>{Y(),Yn()})))()}function nh(e){if(!uh.test(e))throw Error(`Unsupported tweakcn link. Expected a theme share URL.`)}function rh(e,t){let n=V(e);if(!n||n.length>fh)throw Error(`Unsupported tweakcn token: ${t}`);let r=n.toLowerCase();if(ph.some(e=>r.includes(e)))throw Error(`Unsupported tweakcn token: ${t}`);for(let e of n){let n=e.charCodeAt(0);if(n<32||n===127||"{};<>`".includes(e))throw Error(`Unsupported tweakcn token: ${t}`)}return n}function ih(e,t){let n=rh(e,t);if(/[^A-Za-z0-9 ,'"._-]/.test(n))throw Error(`Unsupported tweakcn token: ${t}`);return n}function ah(e){if(!e)return null;let t=[];for(let n of mh){let r=n===`font-body`||n===`font-display`||n===`mono`?ih(e[n],n):rh(e[n],n);t.push([n,r])}return Object.fromEntries(t)}function oh(e){let t=V(e);return t?Ji(t,80):`Custom`}function sh(e){let t=es(e);if(!t)return null;let{sourceUrl:n,themeId:r,label:i,importedAt:a}=t;if(typeof n!=`string`||typeof r!=`string`||typeof i!=`string`||typeof a!=`string`)return null;try{nh(r);let e=ah(es(t.light)??void 0),o=ah(es(t.dark)??void 0);return!e||!o?null:{sourceUrl:n,themeId:r,label:oh(i),importedAt:a,light:e,dark:o}}catch{return null}}function ch(e){let t=ah(e.light),n=ah(e.dark);if(!t||!n)throw Error(`Stored custom theme is missing required tokens.`);let r=e=>mh.map(t=>`  --${t}: ${e[t]};`).join(`
`);return[`:root[data-theme="custom"] {`,r(n),`}`,`:root[data-theme="custom-light"] {`,r(t),`}`].join(`
`)}function lh(e){if(typeof document>`u`)return;let t=document.getElementById(dh);if(!e){t?.remove();return}let n;try{n=ch(e)}catch{t?.remove();return}t||(t=document.createElement(`style`),t.id=dh,document.head.appendChild(t)),t.textContent=n}var uh,dh,fh,ph,mh;function hh(){return(hh=e((()=>{uh=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,dh=`openclaw-custom-theme`,fh=240,ph=[`url(`,`image(`,`image-set(`,`-webkit-image-set(`,`cross-fade(`,`element(`,`-moz-element(`,`paint(`,`@import`,`expression(`,`/*`,`*/`,`\\`],mh=`bg.bg-accent.bg-elevated.bg-hover.bg-muted.bg-content.card.card-foreground.card-highlight.popover.popover-foreground.panel.panel-strong.panel-hover.chrome.chrome-strong.text.text-strong.chat-text.muted.muted-strong.muted-foreground.border.border-strong.border-hover.input.ring.accent.accent-hover.accent-muted.accent-subtle.accent-foreground.accent-glow.primary.primary-foreground.secondary.secondary-foreground.accent-2.accent-2-muted.accent-2-subtle.destructive.destructive-foreground.danger.danger-muted.danger-subtle.focus.focus-ring.focus-glow.font-body.font-display.mono.grid-line`.split(`.`)})))()}function gh(e){if(typeof e!=`string`)return;let t=e.trim().replace(/\s+/g,` `);return t&&t.length<=100&&!/["\\;,{}<>\p{Cc}]/u.test(t)?t:void 0}function _h(e){let t=gh(e);return t?`"${t}", ${vh}`:vh}var vh;function yh(){return(yh=e((()=>{vh=`"JetBrains Mono", "OpenClaw Nerd Symbols", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`})))()}function bh(e,t){return{theme:e===`custom`||bo(e)?e:`claw`,mode:Ho(t)??`system`}}function xh(e,t){let n=t;if(n===`system`&&(n=typeof globalThis.matchMedia==`function`&&globalThis.matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`),e===`claw`)return n;let r=Za(e)?e===`knot`?`openknot`:e:`custom`;return n===`light`?`${r}-light`:r}function Sh(e,t){if(typeof document>`u`||e===`claw`||!Za(e)){t();return}let n=`openclaw-theme-palette-${e}`,r=document.getElementById(n);if(r instanceof HTMLLinkElement&&r.sheet){t();return}let i=r instanceof HTMLLinkElement?r:document.createElement(`link`),a=e=>{i.removeEventListener(`load`,a),i.removeEventListener(`error`,a),e.type===`error`&&(console.error(`Theme palette failed to load; reload to retry: ${i.href}`),i.remove()),t()};i.addEventListener(`load`,a),i.addEventListener(`error`,a),r||(i.id=n,i.rel=`stylesheet`,i.href=Dc(`themes/${e}.css`),document.head.append(i))}function Ch(){return(Ch=e((()=>{Fo(),Oc()})))()}function wh(e){return Ia.find(t=>t===e)}function Th(e,t,n){let r=Ph[Za(e)?e:`custom`];return{ui:t??r.ui,chat:n??r.chat}}function Eh(e){let t=`openclaw-typeface-${e}`,n=Nh[e].asset;if(!n)return;let r=document.getElementById(t);if(r instanceof HTMLLinkElement)return r;let i=document.createElement(`link`);return i.id=t,i.rel=`stylesheet`,i.href=Dc(n),document.head.append(i),i}function Dh(e){typeof document<`u`&&(Eh(e.ui),Eh(e.chat),Eh(`jetbrains-mono`))}function Oh(){Ia.forEach(Eh)}function kh(e,t){for(let[n,r]of[[`--font-body`,e],[`--font-chat`,t]])r?document.documentElement.style.setProperty(n,Nh[r].stack):document.documentElement.style.removeProperty(n)}function Ah(e){Mh[e].kind===`serif`?document.documentElement.style.setProperty(`--chat-font-smoothing`,`auto`):document.documentElement.style.removeProperty(`--chat-font-smoothing`)}var jh,Mh,Nh,Ph;function Fh(){return(Fh=e((()=>{ra(),Fo(),Oc(),jh={sans:`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`,serif:`Georgia, "Times New Roman", serif`,mono:`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace`},Mh={"instrument-sans":{label:`Instrument Sans`,kind:`sans`},geist:{label:`Geist`,kind:`sans`},"dm-sans":{label:`DM Sans`,kind:`sans`},"ibm-plex-sans":{label:`IBM Plex Sans`,kind:`sans`},"space-grotesk":{label:`Space Grotesk`,kind:`sans`},"atkinson-hyperlegible":{label:`Atkinson Hyperlegible`,family:`Atkinson Hyperlegible Next`,kind:`sans`},fraunces:{label:`Fraunces`,kind:`serif`},lora:{label:`Lora`,kind:`serif`},"jetbrains-mono":{label:`JetBrains Mono`,kind:`mono`},system:{label:`System`,kind:`sans`}},Nh=Object.fromEntries(Ia.map(e=>{let{label:t,family:n=t,kind:r}=Mh[e];return[e,{label:t,stack:e===`system`?jh.sans:`"${n}", ${jh[r]}`,asset:e===`system`?void 0:`fonts/${e}.css`}]})),Ph={claw:{ui:`instrument-sans`,chat:`instrument-sans`},knot:{ui:`geist`,chat:`geist`},dash:{ui:`dm-sans`,chat:`fraunces`},absolutely:{ui:`space-grotesk`,chat:`lora`},tide:{ui:`ibm-plex-sans`,chat:`ibm-plex-sans`},beacon:{ui:`atkinson-hyperlegible`,chat:`atkinson-hyperlegible`},phosphor:{ui:`jetbrains-mono`,chat:`jetbrains-mono`},crt:{ui:`jetbrains-mono`,chat:`jetbrains-mono`},manuscript:{ui:`lora`,chat:`lora`},rose:{ui:`dm-sans`,chat:`dm-sans`},miami:{ui:`space-grotesk`,chat:`space-grotesk`},custom:{ui:`system`,chat:`system`}}})))()}function Ih(e){let t=V(e);return t?dn(t)?t.length<=Uh?t:null:/[\r\n]/.test(t)?null:t.length<=Hh?t:null:null}function Lh(e){let t=V(e?.name);return{name:t?Ji(t,Vh):null,avatar:Ih(e?.avatar)}}function Rh(e){return Lh(e).name??`You`}function zh(e){let t=Lh(e);return cr(t.avatar,{identity:{avatar:t.avatar??void 0}})}function Bh(e){let t=Lh(e),n=t.avatar;return n?zh(t)?null:n:null}var Vh,Hh,Uh;function Wh(){return(Wh=e((()=>{Zr(),Vh=50,Hh=16,Uh=2e6})))()}function Gh(e){return`${_g}${po(e)}`}function Kh(e){return`${bg}${po(e)}`}function qh(e){for(let t of e.matchAll(Og)){let e=t[0].toLowerCase();if(!Tg.has(e)&&!wg.has(e)&&!Eg.has(e))return!1}return!0}function Jh(e){if(typeof e!=`string`)return;let t=e.trim().replace(/\s+/g,` `);if(!(t.length===0||t.length>Ag)){if(wg.has(t.toLowerCase())||kg.test(t))return t;if(Dg.test(t)&&CSS.supports(`max-width`,t)&&qh(t))return/^(?:calc|clamp|fit-content|max|min)\(.+\)$/i.test(t)?t:void 0}}function Yh(e,t){return n=>e.find(e=>e===n)??t}function Xh(e){return Ng.find(t=>t===e)}function Zh(e){return qo(`ui.accent`,e)}function Qh(e){return typeof e!=`number`||!Number.isFinite(e)?100:Cg.reduce((t,n)=>Math.abs(e-n)<Math.abs(e-t)?n:t)}function $h(e){let t=V(e);return e===null?null:t?K(t):void 0}function eg(){return typeof document>`u`?!1:!!document.querySelector(`script[src*="/@vite/client"]`)}function tg(){let e=location.protocol===`https:`?`wss`:`ws`,t=yc(location.pathname)[0],n=`${e}://${location.host}${t}`;if(!eg())return{pageUrl:n,effectiveUrl:n};let r=location.hostname;return{pageUrl:n,effectiveUrl:`${e}://${r.includes(`:`)&&!r.startsWith(`[`)?`[${r}]`:r}:18789`}}function ng(e){let{effectiveUrl:t}=tg();if(po(e.gatewayUrl)===po(t))return e;let n=og(t);return{...e,gatewayUrl:t,token:cg(e.gatewayUrl,t,{token:e.token,password:``}).token,sessionKey:n.sessionKey,lastActiveSessionKey:n.lastActiveSessionKey}}function rg(e,t){let n=ta(e?.getItem(Gh(t))??``),r=V(n?.gatewayUrl);return n&&(!r||po(r)===po(t))?{gatewayUrl:r??t,parsed:n}:null}function ig(e){return`${Ro}${po(e)}`}function ag(e,t,n){let r=t.sessionsByGateway?.[po(e)],i=V(r?.sessionKey),a=V(r?.lastActiveSessionKey),o=V(r?.selectedAgentId);return i&&a?{sessionKey:i,lastActiveSessionKey:a,...o?{selectedAgentId:K(o)}:{}}:n}function og(e){let t={sessionKey:`main`,lastActiveSessionKey:`main`};try{let n=rg(ge(),e);return n?ag(e,n.parsed,t):t}catch{return t}}function sg(e){try{let t=jr();if(!t)return``;t.removeItem(Sg);let n=t.getItem(ig(e));return V(n)??``}catch{return``}}function cg(e,t,n){let r=po(e)===po(t),i=G(e)===G(t);return{token:r?n.token:sg(t),password:i?n.password:``}}function lg(e,t){try{let n=jr();if(!n)return;n.removeItem(Sg);let r=ig(e),i=V(t)??``;if(i){n.setItem(r,i);return}n.removeItem(r)}catch{}}function ug(e){return Bg=e,()=>{Bg===e&&(Bg=null)}}function dg(e=Bg?.gatewayUrl()){let t=fg(e);return{...t,token:sg(t.gatewayUrl)}}function fg(e=void 0){let t=zg;if(t&&(!e||po(t.gatewayUrl)===po(e)))return e?{...t,gatewayUrl:e}:t;let{pageUrl:n,effectiveUrl:r}=tg(),i=ge(),a={gatewayUrl:e??r,sessionKey:`main`,lastActiveSessionKey:`main`,theme:Rg.theme,themeMode:Rg.themeMode,chatShowThinking:!0,chatShowToolCalls:!0,chatPersistCommentary:!0,chatShowTaskProgress:Rg.chatShowTaskProgress,chatCollapseTaskProgress:Rg.chatCollapseTaskProgress,chatSendShortcut:Rg.chatSendShortcut,catalogOpenTarget:Rg.catalogOpenTarget,navCollapsed:!1,navWidth:yg,sidebarAgentsMode:`chip`,sidebarEntries:[...Kc],sidebarLiveActivity:Rg.sidebarLiveActivity,showAdvancedSettings:!1,pinnedAgentIds:[],composerHoldToRecord:Rg.composerHoldToRecord};try{let t=e??V(i?.getItem(Kh(n))),o=(t?rg(i,t):null)??(e?null:rg(i,r));if(!o)return a;let s=o.parsed,c=o.gatewayUrl,l=e??(c===n?r:c),u=ag(l,s,a),d=sh(s.customTheme),{theme:f,mode:m}=bh(s.theme,s.themeMode),h=Qh(s.textScale),g=Xo(s)??{},_=Object.hasOwn(g,`sidebarEntries`)?null:Array.isArray(g.sidebarPinnedRoutes)?Pc(g.sidebarPinnedRoutes.map(e=>typeof e==`string`?`route:${e}`:e)):null,v=e=>{let t=s[e];return typeof t==`boolean`?t:a[e]},y={gatewayUrl:l,sessionKey:u.sessionKey,lastActiveSessionKey:u.lastActiveSessionKey,selectedAgentId:u.selectedAgentId,theme:f===`custom`&&!d?`claw`:f,themeMode:m,accent:Zh(s.accent),fontUi:wh(s.fontUi),fontChat:wh(s.fontChat),tabIcon:_o(s.tabIcon),terminalFontFamily:gh(s.terminalFontFamily),chatShowThinking:v(`chatShowThinking`),chatShowToolCalls:v(`chatShowToolCalls`),chatPersistCommentary:v(`chatPersistCommentary`),chatShowTaskProgress:v(`chatShowTaskProgress`),chatCollapseTaskProgress:v(`chatCollapseTaskProgress`),chatSendShortcut:Mg(s.chatSendShortcut),chatFollowUpMode:Xh(s.chatFollowUpMode),catalogOpenTarget:Ig(s.catalogOpenTarget),realtimeTalkInputDeviceId:V(s.realtimeTalkInputDeviceId),realtimeTalkVideoDeviceId:V(s.realtimeTalkVideoDeviceId),composerHoldToRecord:v(`composerHoldToRecord`),talkCameraAutoEnable:typeof s.talkCameraAutoEnable==`boolean`?s.talkCameraAutoEnable:void 0,chatSplitLayout:te(s.chatSplitLayout),chatWorkspaceDock:Lg(s.chatWorkspaceDock),boardSessionViews:hr(s.boardSessionViews),sidebarSessionLayouts:p(s.sidebarSessionLayouts),sidebarSessionActivePanels:Ci(s.sidebarSessionActivePanels),navCollapsed:a.navCollapsed,navWidth:typeof s.navWidth==`number`&&s.navWidth>=240&&s.navWidth<=400?s.navWidth:a.navWidth,sidebarAgentsMode:s.sidebarAgentsMode===`roster`?`roster`:`chip`,sidebarPreTeamScope:$h(s.sidebarPreTeamScope),sidebarCollapsedAgentIds:La(s.sidebarCollapsedAgentIds),sidebarEntries:Pc(g.sidebarEntries)??_??a.sidebarEntries,sidebarLiveActivity:v(`sidebarLiveActivity`),chatMessageMaxWidth:Jh(s.chatMessageMaxWidth),showAdvancedSettings:v(`showAdvancedSettings`),pinnedAgentIds:La(s.pinnedAgentIds),textScale:h===Rg.textScale?void 0:h,customTheme:d??void 0,locale:ut(s.locale)?s.locale:void 0,...s.lobsterPetVisits===!1?{lobsterPetVisits:!1}:{},...s.lobsterPetSounds===!0?{lobsterPetSounds:!0}:{},...s.sessionDeleteConfirm===!1?{sessionDeleteConfirm:!1}:{},...s.openLinksInControlUiBrowser===!0?{openLinksInControlUiBrowser:!0}:{},...s.openLinksExternally===!0?{openLinksExternally:!0}:{}};return _!==null&&gg({...y,token:sg(l)},{selectGateway:!e}),y}catch{return a}}function pg(e){Vg=e}function mg(e,t={}){let n=dg(e.gatewayUrl),r={...n,...e};return gg(r,{selectGateway:t.selectGateway??e.gatewayUrl!==void 0}),Vg?.(n,r),r}function hg(){let e=ge();try{let t=e?.getItem(xg);return t?Lh(JSON.parse(t)):Lh()}catch{return Lh()}}function gg(e,t={}){let n=ge(),r=po(e.gatewayUrl),i=Gh(e.gatewayUrl),a={};try{let t=rg(n,e.gatewayUrl);if(t){let e=t.parsed;e.sessionsByGateway&&typeof e.sessionsByGateway==`object`&&(a=e.sessionsByGateway)}}catch{}let o=Object.fromEntries([...Object.entries(a).filter(([e])=>e!==r),[r,{sessionKey:e.sessionKey,lastActiveSessionKey:e.lastActiveSessionKey,...V(e.selectedAgentId)?{selectedAgentId:K(e.selectedAgentId)}:{}}]].slice(-10)),s={gatewayUrl:e.gatewayUrl,theme:e.theme,themeMode:e.themeMode,accent:Zh(e.accent),fontUi:wh(e.fontUi),fontChat:wh(e.fontChat),tabIcon:_o(e.tabIcon),terminalFontFamily:gh(e.terminalFontFamily),chatShowThinking:e.chatShowThinking,chatShowToolCalls:e.chatShowToolCalls,chatPersistCommentary:e.chatPersistCommentary??!0,chatShowTaskProgress:e.chatShowTaskProgress!==!1&&void 0,chatCollapseTaskProgress:e.chatCollapseTaskProgress===!0||void 0,chatSendShortcut:e.chatSendShortcut===`modifier-enter`?`modifier-enter`:void 0,chatFollowUpMode:Xh(e.chatFollowUpMode),catalogOpenTarget:e.catalogOpenTarget===`terminal`?`terminal`:void 0,realtimeTalkInputDeviceId:V(e.realtimeTalkInputDeviceId),realtimeTalkVideoDeviceId:V(e.realtimeTalkVideoDeviceId),composerHoldToRecord:e.composerHoldToRecord!==!1&&void 0,talkCameraAutoEnable:typeof e.talkCameraAutoEnable==`boolean`?e.talkCameraAutoEnable:void 0,chatSplitLayout:e.chatSplitLayout||void 0,chatWorkspaceDock:e.chatWorkspaceDock===`bottom`?`bottom`:void 0,boardSessionViews:e.boardSessionViews&&Object.keys(e.boardSessionViews).length>0?hr(e.boardSessionViews):void 0,sidebarSessionLayouts:e.sidebarSessionLayouts&&Object.keys(e.sidebarSessionLayouts).length>0?p(e.sidebarSessionLayouts):void 0,sidebarSessionActivePanels:e.sidebarSessionActivePanels&&Object.keys(e.sidebarSessionActivePanels).length>0?Ci(e.sidebarSessionActivePanels):void 0,navWidth:e.navWidth,sidebarAgentsMode:e.sidebarAgentsMode===`roster`?`roster`:`chip`,sidebarPreTeamScope:$h(e.sidebarPreTeamScope),sidebarCollapsedAgentIds:e.sidebarCollapsedAgentIds?.length?La(e.sidebarCollapsedAgentIds):void 0,sidebarEntries:e.sidebarEntries,sidebarLiveActivity:e.sidebarLiveActivity!==!1&&void 0,chatMessageMaxWidth:Jh(e.chatMessageMaxWidth),showAdvancedSettings:e.showAdvancedSettings===!0||void 0,pinnedAgentIds:e.pinnedAgentIds?.length?e.pinnedAgentIds:void 0,textScale:e.textScale===void 0?void 0:Qh(e.textScale),customTheme:e.customTheme||void 0,sessionsByGateway:o,locale:e.locale||void 0,lobsterPetVisits:e.lobsterPetVisits!==!1&&void 0,lobsterPetSounds:e.lobsterPetSounds===!0||void 0,sessionDeleteConfirm:e.sessionDeleteConfirm!==!1&&void 0,openLinksInControlUiBrowser:e.openLinksInControlUiBrowser===!0||void 0,openLinksExternally:e.openLinksExternally===!0||void 0},c=JSON.stringify(s),{token:l,...u}=e;zg=u;try{let{pageUrl:r}=tg(),a=Kh(r);n?.setItem(i,c),(t.selectGateway||n?.getItem(a)==null)&&n?.setItem(a,e.gatewayUrl),n?.removeItem(vg),n&&(zg=null)}catch{}let d=Bg;d&&po(d.gatewayUrl())===r&&d.refresh()}var _g,vg,yg,bg,xg,Sg,Cg,wg,Tg,Eg,Dg,Og,kg,Ag,jg,Mg,Ng,Pg,Fg,Ig,Lg,Rg,zg,Bg,Vg;function Hg(){return(Hg=e((()=>{Qa(),eo(),lo(),Zi(),Wo(),$c(),N(),Vr(),Ye(),He(),Tc(),hh(),yh(),Ch(),Fh(),Wh(),_g=`openclaw.control.settings.v1:`,vg=`openclaw.control.settings.v1`,yg=258,bg=`openclaw.control.currentGateway.v1:`,xg=`openclaw.control.user.v1`,Sg=`openclaw.control.token.v1`,Cg=[90,100,110,125,140],wg=new Set([`none`,`min-content`,`max-content`]),Tg=new Set([`calc`,`clamp`,`fit-content`,`max`,`min`]),Eg=new Set([`ch`,`em`,`rem`,`vh`,`vmax`,`vmin`,`vw`,`px`]),Dg=/^[0-9A-Za-z.%+\-*/(),\s]+$/,Og=/[A-Za-z][A-Za-z0-9-]*/g,kg=/^(?:\d+(?:\.\d+)?|\.\d+)(?:px|rem|em|ch|vw|vh|vmin|vmax|%)$/i,Ag=96,jg=[`enter`,`modifier-enter`],Mg=Yh(jg,`enter`),Ng=[`queue`,`steer`],Pg=Yh(Ng,`steer`),Fg=[`viewer`,`terminal`],Ig=Yh(Fg,`viewer`),Lg=Yh([`right`,`bottom`],`right`),Rg={theme:`claw`,themeMode:`system`,textScale:100,sidebarLiveActivity:!0,chatMessageMaxWidth:`48rem`,chatShowTaskProgress:!0,chatCollapseTaskProgress:!1,chatSendShortcut:`enter`,catalogOpenTarget:`viewer`,composerHoldToRecord:!0,lobsterPetVisits:!0,lobsterPetSounds:!1,sessionDeleteConfirm:!0},zg=null,Bg=null,Vg=null})))()}function Ug(e,t){return!new URLSearchParams(e.search+`&`+e.hash.slice(1)).has(`session`)&&!as(e.pathname,t)&&(Ps(e.pathname,t)===null||/^\/chat\/?$/u.test(e.pathname.slice(t.length)))}async function Wg(e){let t=eh(e.location,e.basePath);if(!t)return null;let n=!!(e.agentsList()?.mainKey?.trim()||e.gateway.snapshot.phase===`connected`&&e.gateway.snapshot.hello),r=Si(t.sessionKey);t.sessionKey&&!n&&await Zm(e.gateway,e.signal);let i={agentsList:e.agentsList(),hello:e.gateway.snapshot.hello},a=r?.agentId??($m(e.selectedAgentId,i.agentsList)||j(i)),o=ot(i),s=t.sessionKey?rd(t.face,a,t.sessionKey,e.basePath,{mainKey:o}):null,c=new URLSearchParams(e.location.search);c.delete(`session`),c.delete(`face`);let l=c.toString();return{...e.location,pathname:s??J(t.face,e.basePath),search:l?`?${l}`:``}}function Gg(e,t,n,r,i){if(!Ug(e,t)||!n.trim())return e;let a=Si(n)?.agentId??r.trim();if(!a)return e;let{options:o}=xt({face:`chat`,sessionKey:n,fallbackAgentId:a,basePath:t,mainKey:i,exactKey:!0});if(o.pathname===J(`chat`,t))return e;let s=new URLSearchParams(e.search);return new URLSearchParams(o.search).forEach((e,t)=>s.set(t,e)),{...e,pathname:o.pathname,search:s.size?`?${s}`:``}}function Kg(e,t,n){if(Ps(e.pathname,t)===`new-session`){let t=Kt(e.search).agentId;return t?{agentId:t}:{}}let r=og(n);if(Ps(e.pathname,t)===`model-providers`)return r.selectedAgentId?{agentId:r.selectedAgentId}:{};let i=Gg(e,t,r.sessionKey,r.selectedAgentId??``),a=so(i.pathname,t);if(a?.kind===`literal`)return{agentId:a.agentId,sessionKey:a.sessionKey};if(a?.kind===`main`)return{agentId:a.agentId,sessionKey:No({agentId:a.agentId})};if(a?.kind===`short`)return{agentId:a.agentId,shortId:a.shortId,...a.slugHint?{slugHint:a.slugHint}:{}};if(Tr(e,t,Ps)){let e=Si(r.sessionKey)?.agentId??r.selectedAgentId;return{sessionKey:r.sessionKey,...e?{agentId:e}:{}}}}function qg(e){let t=null;return()=>t??=e.resolve().catch(t=>{if(e.signal.aborted)return e.fallback;throw t})}async function Jg(e){let t=await Wg(e);if(t)return t;if(!Ug(e.location,e.basePath))return e.location;let n=await Zm(e.gateway,e.signal),r=e.gateway.snapshot.hello,i=e.agentsList(),a={agentsList:i,hello:e.gateway.snapshot.hello},o=e.sessionKey.trim()||e.gateway.snapshot.sessionKey,s=j(a),c=Si(o)?.agentId??$m(e.selectedAgentId,i)??s;if(i=await e.ensureAgentsList?.()??i,e.signal.throwIfAborted(),e.gateway.snapshot.client!==n||e.gateway.snapshot.hello!==r)return Jg(e);s=j({agentsList:i,hello:r}),i&&!$m(c,i)&&(c=$m(e.selectedAgentId,i)??s,o=No({agentId:c,mainKey:ot({agentsList:i,hello:e.gateway.snapshot.hello})}));let l={agentsList:i,hello:e.gateway.snapshot.hello},u=ot(l),d=_t(l,o,c);o=d.sessionKey,c=d.agentId??c;let f=Si(o),p=A(o)||(f?.rest??o).toLowerCase()===u.toLowerCase(),m=null;if(!p&&!zn(o)){try{m=await n.request(`sessions.resolve`,{key:o,agentId:c,allowMissing:!0},{signal:e.signal})}catch{e.signal.throwIfAborted()}if(e.signal.throwIfAborted(),e.gateway.snapshot.client!==n||e.gateway.snapshot.hello!==r)return Jg(e);m&&!m.ok&&(o=No({agentId:c,mainKey:u}))}let h=m?.ok?m:void 0;return Gg(e.location,e.basePath,h?.key??o,h?.agentId??c,u)}function Yg({router:e,gateway:t,agents:n,agentSelection:r,connectionBootstrap:i,initialChatRoute:a,chatSubmissions:o}){i.setForegroundRoute(a?void 0:null);let s=t.subscribe(e=>{i.synchronize({client:e.client,connected:e.phase===`connected`})}),c=e=>{let a=e.pendingMatches[0]??e.matches[0];if(!a&&e.status===`idle`)return;let s=Xo(a?.data),c=s?.kind===`session`&&typeof s.sessionKey==`string`?s.sessionKey:null;i.setForegroundRoute(a?.routeId!==`chat`||o.creation?null:a.status===`pending`?void 0:a.status===`success`&&c&&!zn(c)?rn({settings:t.connection,client:t.snapshot.client,agentsList:n.state.agentsList,hello:t.snapshot.hello,assistantAgentId:r.state.selectedId},{sessionKey:c,agentId:typeof s?.agentId==`string`?s.agentId:void 0}):null)},l=()=>c(e.getState()),u=[s,e.subscribe(c),r.subscribe(l),o.subscribeCreate(l)];return()=>u.forEach(e=>e())}function Xg(){return(Xg=e((()=>{Y(),Kp(),id(),qp(),fr(),gt(),Yn(),Lr(),bn(),Qm(),th(),Hg()})))()}function Zg(e){let t=!1,n=()=>({navCollapsed:t,navWidth:e.settings.navWidth,sidebarEntries:e.settings.sidebarEntries,pinnedAgentIds:e.settings.pinnedAgentIds??[]}),r=new Set;return{get snapshot(){return n()},update(e){let i=e.navCollapsed!==void 0&&e.navCollapsed!==t;e.navCollapsed!==void 0&&(t=e.navCollapsed);let a={};if(e.navWidth!==void 0&&(a.navWidth=e.navWidth),e.sidebarEntries!==void 0&&(a.sidebarEntries=[...e.sidebarEntries]),e.pinnedAgentIds!==void 0&&(a.pinnedAgentIds=[...e.pinnedAgentIds]),Object.keys(a).length>0&&mg(a),i)for(let e of r)e(n())},subscribe(t){r.add(t);let i=e.subscribe(()=>t(n()));return()=>{r.delete(t),i()}}}}function Qg(e,t){let n=e.snapshot.pinnedAgentIds,r=n.includes(t)?n.filter(e=>e!==t):[...n,t];e.update({pinnedAgentIds:r})}function $g(){return($g=e((()=>{Hg()})))()}function e_(e){let t=e.trim().replace(/^#/,``);if(!/^[0-9a-fA-F]{6}$/.test(t))return`#ffffff`;let n=e=>{let n=Number.parseInt(t.slice(e,e+2),16)/255;return n<=.04045?n/12.92:((n+.055)/1.055)**2.4};return .2126*n(0)+.7152*n(2)+.0722*n(4)>.179?`#000000`:`#ffffff`}function t_(){return(t_=e((()=>{})))()}function n_(){if(typeof document>`u`)return;let e=document.documentElement,t=document.querySelector(`.shell--chat`)!==null;e.classList.toggle(`control-ui-chat-shell`,t);let n=getComputedStyle(e),r=n.getPropertyValue(`--bg`).trim(),i=globalThis.matchMedia?.(`(max-width: 768px), (max-width: 932px) and (max-height: 500px) and (orientation: landscape)`).matches&&t&&n.getPropertyValue(`--bg-content`).trim()||r;if(i){e.style.setProperty(`--control-ui-system-chrome-background`,i);for(let e of document.querySelectorAll(`meta[name="theme-color"]`))e.content=i,e.removeAttribute(`media`)}}function r_(e){s_=e;let t=document.documentElement,n=(s_===`theme`?void 0:s_??o_)?.trim().replace(/^#/,``),r=n&&/^[0-9a-fA-F]{6}$/.test(n)?`#${n}`:null;if(!r){for(let e of a_)t.style.removeProperty(e);return}let i=e_(r),a=(e,t)=>`color-mix(in srgb, var(${e}) ${t}%, transparent)`;for(let e of[`--ring`,`--accent`,`--accent-muted`,`--primary`])t.style.setProperty(e,r);for(let e of[`--accent-foreground`,`--primary-foreground`])t.style.setProperty(e,i);t.style.setProperty(`--accent-hover`,`color-mix(in srgb, var(--accent) 82%, white 18%)`),t.style.setProperty(`--primary-hover`,`color-mix(in srgb, var(--primary) 82%, white 18%)`),t.style.setProperty(`--accent-subtle`,a(`--accent`,16)),t.style.setProperty(`--accent-glow`,a(`--accent`,30)),t.style.setProperty(`--focus`,a(`--ring`,22)),t.style.setProperty(`--focus-ring`,`0 0 0 2px var(--bg), 0 0 0 3px ${a(`--ring`,80)}`),t.style.setProperty(`--focus-glow`,`0 0 0 2px var(--bg), 0 0 0 3px var(--ring), 0 0 16px var(--accent-glow)`)}function i_(e){o_=e,r_(s_)}var a_,o_,s_;function c_(){return(c_=e((()=>{a_=[`--ring`,`--accent`,`--accent-foreground`,`--accent-hover`,`--accent-muted`,`--accent-subtle`,`--accent-glow`,`--primary`,`--primary-hover`,`--primary-foreground`,`--focus`,`--focus-ring`,`--focus-glow`]})))()}function l_(e,t){return t?.branding??Do(zo.find(t=>t.id===e.theme))}function u_(e,t){if(typeof globalThis.matchMedia!=`function`)return;let n=globalThis.matchMedia(e);if(typeof n.addEventListener==`function`)return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t);if(typeof n.addListener==`function`)return n.addListener(t),()=>n.removeListener(t)}function d_(e,t){if(typeof document>`u`)return;let n=document.documentElement,r=e.theme.includes(`/`)&&!t?`claw`:e.theme,i=xh(r,t?.mode??e.themeMode);n.dataset.themeId=r,n.dataset.theme=i,n.dataset.themeMode=i.endsWith(`light`)?`light`:`dark`;let a=l_(e,t);n.dataset.themeMascot=a.mascot,a.avatarHat?n.dataset.themeAvatarHat=a.avatarHat:delete n.dataset.themeAvatarHat,n.dataset.themeResolved=n.dataset.themeMode,n.classList.toggle(`wa-light`,n.dataset.themeMode===`light`),n.classList.toggle(`wa-dark`,n.dataset.themeMode===`dark`),n.style.colorScheme=n.dataset.themeMode,n.style.setProperty(`--control-ui-text-scale`,`${(e.textScale??100)/100}`);let o=Th(r,e.fontUi,e.fontChat);Dh(o),kh(e.fontUi,e.fontChat),Ah(o.chat),lh(t?.palette??e.customTheme),r_(e.accent),n_()}function f_(e){let{sessionKey:t,lastActiveSessionKey:n,selectedAgentId:r,...i}=e;return JSON.stringify(i)}function p_(e,t){let{token:n,...r}=e,i=r,a=null,o,s=new Set,c=0,l,u=!1,d=!1,f,p=!1,m=()=>{let e=++c,t=!1,n=dl(),r=l_(i,l?.theme(i.theme));ul(r),Sh(i.theme,()=>{if(e===c){if(d_(i,l?.theme(i.theme)),t)for(let e of s)e();typeof document<`u`&&(n.brandIcon!==`claw`||r.brandIcon!==`claw`)&&W(async()=>{let{invalidateControlUiFaviconPalette:e,syncControlUiFavicon:t}=await import(`./control-ui-boot-shared-XreXSF7h.js`).then(e=>(e.Fa(),e.Pa));return{invalidateControlUiFaviconPalette:e,syncControlUiFavicon:t}},__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,30,31,32,33]),import.meta.url).then(({invalidateControlUiFaviconPalette:e,syncControlUiFavicon:t})=>{p||(e(),t())})}}),t=!0;for(let e of s)e()},h=async()=>{if(!(p||l||u||t.snapshot.phase!==`connected`||!d&&!i.theme.includes(`/`))){u=!0;try{let{createThemeCatalog:e}=await W(async()=>{let{createThemeCatalog:e}=await import(`./theme-catalog-DYK4R1_4.js`);return{createThemeCatalog:e}},__vite__mapDeps([91,1,92,30]),import.meta.url);p||(l=e(t,m),f=void 0)}catch(e){p||(f={themes:[],error:e instanceof Error?e.message:String(e)},m())}finally{u=!1}}},g=()=>{o?.(),o=void 0},_=()=>{g(),i.themeMode===`system`&&(o=u_(`(prefers-color-scheme: light)`,()=>{i.themeMode===`system`&&m()}))},v=u_(`(max-width: 768px), (max-width: 932px) and (max-height: 500px) and (orientation: landscape)`,()=>n_()),y=()=>{let e=fg(t.connection.gatewayUrl),n=f_(e)!==f_(i);i=e,n&&(h(),m(),_())},b=ug({gatewayUrl:()=>t.connection.gatewayUrl,refresh:y}),x=e=>{(e.key===null||e.key===Gh(t.connection.gatewayUrl))&&y()};globalThis.addEventListener?.(`storage`,x);let S=t.subscribe(()=>{h(),i.gatewayUrl!==t.connection.gatewayUrl&&y()});return _(),m(),h(),{get branding(){return l_(i,l?.theme(i.theme))},get catalog(){return d||(d=!0,h()),l?.snapshot(i.theme)??f},get settings(){return i},get mode(){return i.themeMode},get resolvedMode(){let e=l?.theme(i.theme)?.mode??i.themeMode;return xh(i.theme,e).endsWith(`light`)?`light`:`dark`},get serverSelection(){return a},recordServerSelection(e,t){a={revision:(a?.revision??0)+1,scope:t,theme:e},m()},setMode(e){mg({themeMode:e})},refresh:y,retryCatalog(){l?.refresh()??h()},subscribe:e=>io(s,e),dispose(){p=!0,l?.dispose(),b(),globalThis.removeEventListener?.(`storage`,x),S(),c+=1,g(),v?.(),s.clear()}}}function m_(){return(m_=e((()=>{wo(),c_(),hh(),Hg(),hl(),Ch(),Fh(),U()})))()}function h_(e,t){Si(t)&&ti(rn({agentsList:e.agents,hello:null,assistantAgentId:null,settings:{gatewayUrl:e.scope},client:{offlineRecoveryScope:e.recoveryScope}},{sessionKey:t}))}function g_(e,t){pp(e,t);let n=t.recoveryScope,r=C(u(e,n));if(!n)return r;let i=pi(`scope:${JSON.stringify([e,n])}\u0000`);return Promise.all([r,i]).then(()=>void 0)}function __(e,t,n){let r=e.connectionRevision,i=t?.profileId,a=t?.recoveryScope,o=t?ip(t):void 0,s=np(({scope:t,external:r,replacement:s,retiredOwner:c})=>{if(t===void 0||t===G(e.connection.gatewayUrl)){let t=e.snapshot,l=t.hello?.auth?.recoveryScope,u=l??mp({client:t.client})??a,d=o,f=u?{recoveryScope:u}:d;if(s&&!ap(s,d)&&(o=void 0),!f||c&&!ap(c,f)&&!ap(c,d)||ap(s,f))return;i=void 0,o=void 0,(r||!l||a!==void 0&&l===a)&&(dp(G(e.connection.gatewayUrl),f),e.snapshot.client?.retireOfflineRecoveryScope?.()),n(),r&&e.stop()}}),c=e.subscribe(t=>{if(t.phase===`connected`&&Lt(),e.connectionRevision!==r&&(i=void 0,o=void 0),i!==void 0&&(t.lastErrorAuthReason||typeof t.lastErrorCode==`string`&&t.lastErrorCode!==`GATEWAY_BUSY`)&&(n(),o&&pp(G(e.connection.gatewayUrl),o),i=void 0),t.phase!==`connected`||i===void 0)return;let s=a!==void 0&&t.hello?.auth?.recoveryScope!==a,c=a===void 0&&i!==(t.selfUser?.id??null);i=void 0,(c||s)&&(n(),o&&g_(G(e.connection.gatewayUrl),o)),a=t.hello?.auth?.recoveryScope});return()=>{s(),c()}}function v_({gateway:e,agents:t,sessions:n},r){let i=r?{gatewayScope:r.scope,recoveryScope:r.recoveryScope,mainKey:r.agents.mainKey,scope:r.agents.scope}:null,a=()=>{if(e.snapshot.phase!==`connected`||e.snapshot.client?.offlineRecoveryRetired)return;let r=G(e.connection.gatewayUrl),a=sp(e.snapshot.hello?.auth,e.connection.token);if(!a)return;let o=t.state.agentsList;o&&(i={gatewayScope:r,recoveryScope:e.snapshot.hello?.auth?.recoveryScope,mainKey:o.mainKey,scope:o.scope}),o&&n.groupsStatus()===`ready`&&gp({version:2,recoveryScope:e.snapshot.client?.recoveryScopeReady?e.snapshot.client.recoveryScope:e.snapshot.hello?.auth?.recoveryScope,...a,savedAt:Date.now(),scope:r,profileId:e.snapshot.selfUser?.id??null,agents:o,groups:[...n.state.groupSettings],sectionOrder:[...n.state.sectionOrder]})},o=[e,t,n].map(e=>e.subscribe(a));return{readSessionDefaults:()=>{let t=mp({client:e.snapshot.client});return e.snapshot.phase!==`connected`&&t&&i?.recoveryScope===t&&i.gatewayScope===G(e.connection.gatewayUrl)?{mainKey:i.mainKey,scope:i.scope}:null},dispose:()=>o.forEach(e=>e())}}function y_(){return(y_=e((()=>{Yn(),Pe(),Fe(),Xt(),Lr(),En(),Tp()})))()}function b_(e,t){if(e?.signal?.aborted)return Promise.resolve(e.value);let n=document.createElement(`div`);return document.body.append(n),new Promise(r=>{let i={host:n,settled:!1,render(e){i.settled||Oi(e(),n)},finish(t){i.settled||(i.settled=!0,e?.signal?.removeEventListener(`abort`,a),Oi(I,n),n.remove(),r(t))}},a=()=>e&&i.finish(e.value);e?.signal?.addEventListener(`abort`,a,{once:!0}),t(i)})}function x_(){return(x_=e((()=>{R(),af()})))()}function S_(e){return E_.add(e),()=>void E_.delete(e)}function C_(e){return D_.add(e),()=>void D_.delete(e)}function w_(){let e=[...D_];for(let t of e)t()}async function T_(e,t){let n=()=>{if(!t?.signal?.aborted)for(let t of E_)t(e)};try{let r=await fetch(e,t);return r.status===401&&n(),r}catch(e){throw n(),e}}var E_,D_;function O_(){return(O_=e((()=>{E_=new Set,D_=new Set})))()}async function k_(e,t){let n=null;try{n=es(await e.json())}catch{t.throwIfAborted()}let r=n?.error,i=typeof r==`string`?r:r&&typeof r==`object`&&`message`in r&&typeof r.message==`string`?r.message:``,a=en(i);return{data:n,response:e,errorMessage:a?`HTTP ${e.status}: ${a}`:`HTTP ${e.status}`}}function A_(e){return La([e.hello?.auth?.deviceToken,e.settings?.token,e.password]).filter(e=>!/[\r\n]/.test(e))}function j_(e){return A_(e)[0]??null}function M_(e){return{authTokens:A_(e),authReady:!!(e.hello||e.settings?.token?.trim()||e.password?.trim())}}async function N_(e,t,n,r){let i=n.length?n:[``],a=!t.method||t.method===`GET`||t.method===`HEAD`;for(let n=0;;n++){if(t.signal.throwIfAborted(),!r())throw new DOMException(`Gateway request is no longer current`,`AbortError`);let o=i[n],s=await T_(e,{...t,...o?{headers:{...t.headers,Authorization:`Bearer ${o}`}}:{}});if(t.signal.throwIfAborted(),n===i.length-1||s.status!==401&&!(a&&s.status===403))return s;s.body?.cancel().catch(()=>void 0)}}function P_(){return(P_=e((()=>{lo(),hi(),O_()})))()}function F_(e,t){return t.aborted?Promise.resolve():new Promise(n=>{let r=document.createElement(`iframe`);r.hidden=!0,r.setAttribute(`sandbox`,`allow-same-origin`),r.referrerPolicy=`no-referrer`,r.src=e.href;let i=()=>{window.clearTimeout(a),t.removeEventListener(`abort`,i),r.remove(),n()},a=window.setTimeout(i,1e4);r.addEventListener(`load`,i,{once:!0}),r.addEventListener(`error`,i,{once:!0}),t.addEventListener(`abort`,i,{once:!0}),document.body.append(r)})}function I_(e,t=()=>({})){let n=new URL(`${Aa(e)}/`,window.location.origin),r=new URL(ea.slice(1),n),i=new AbortController,a,o=-1/0,s=!1,c=!1,l=!1,u,d,f=()=>{u||c||i.signal.aborted||b_({signal:i.signal,value:void 0},e=>{let t=()=>{c=!0,e.finish(void 0)},r=()=>L`
        <openclaw-modal-dialog
          label=${F(`connection.browserSignIn.title`)}
          description=${F(`connection.browserSignIn.description`)}
          @modal-cancel=${t}
        >
          <div class="exec-approval-card">
            <div class="exec-approval-header">
              <div style="min-width: 0">
                <div class="exec-approval-title">${F(`connection.browserSignIn.title`)}</div>
                <div class="exec-approval-sub" style="white-space: normal">
                  ${F(`connection.browserSignIn.description`)}
                </div>
              </div>
            </div>
            ${l?L`<p>${F(`connection.browserSignIn.returnHint`)}</p>`:I}
            <p role="status" aria-live="polite">
              ${a?F(`connection.browserSignIn.checking`):d===`unavailable`?F(`connection.browserSignIn.unavailable`):d===`sign-in`?F(`connection.browserSignIn.stillRequired`):I}
            </p>
            <div class="exec-approval-actions">
              <button
                class="btn primary"
                @click=${async()=>{if(el()?.webkit?.messageHandlers?.openclawGateways){let{nativeGatewaysCapability:e}=await W(async()=>{let{nativeGatewaysCapability:e}=await import(`./control-ui-boot-shared-XreXSF7h.js`).then(e=>(e.va(),e.ya));return{nativeGatewaysCapability:e}},__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,30,31,32,33]),import.meta.url);if(i.signal.aborted||c)return;let t=e(),n=t?.snapshot?.currentId;if(t&&n){t.reconnect(n);return}}l=!0,d=void 0,sn(n.href),e.render(r)}}
              >
                ${F(`connection.browserSignIn.action`)}
              </button>
              ${l?L`<button class="btn" ?disabled=${!!a} @click=${()=>void p(!0)}>${F(`connection.browserSignIn.checkAgain`)}</button>`:I}
              <button class="btn" @click=${t}>
                ${F(`connection.browserSignIn.dismiss`)}
              </button>
            </div>
          </div>
        </openclaw-modal-dialog>
      `;u={close:()=>e.finish(void 0),update:()=>e.render(r)},e.render(r)}).finally(()=>{u=void 0})};function p(e=!1){if(i.signal.aborted||a||!e&&Date.now()-o<3e4)return a;o=Date.now();let n=A_(t()),p=()=>{let e=A_(t());return!i.signal.aborted&&e.length===n.length&&e.every((e,t)=>e===n[t])};return a=(async()=>{try{let e=()=>N_(r.href,{method:`HEAD`,credentials:`same-origin`,cache:`no-store`,redirect:`manual`,signal:AbortSignal.any([i.signal,AbortSignal.timeout(5e3)])},n,p),t=await e();if(!p())return;if(t.type===`opaqueredirect`&&!s){if(s=!0,await F_(r,i.signal),!p())return;t=await e()}if(!p())return;if(t.type===`opaqueredirect`)s=!0,d=l?`sign-in`:void 0,f();else if(t.ok&&t.headers.get(`content-type`)?.split(`;`)[0]?.trim()===`application/json`){let e=s;s=!1,c=!1,l=!1,u?.close(),e&&w_()}else d=`unavailable`}catch{p()&&(d=`unavailable`)}})().finally(()=>{a=void 0,u?.update()}),u?.update(),a}let m=S_(e=>{let t=URL.parse(e,window.location.href);t?.origin===n.origin&&t.pathname.startsWith(n.pathname)&&p()}),h=navigator.serviceWorker,g=e=>{h?.controller&&e.source===h.controller&&e.data?.type===`openclaw-http-request-failed`&&p()},_=()=>{s&&p(!0)};return h?.addEventListener(`message`,g,{signal:i.signal}),window.addEventListener(`focus`,_,{signal:i.signal}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&_()},{signal:i.signal}),()=>{i.abort(),m()}}function L_(){return(L_=e((()=>{R(),Sa(),Y(),x_(),N(),qr(),O_(),P_(),U()})))()}function R_(e,t){let{connection:n,snapshot:{client:r}}=e;return{canReload:()=>t?.()!==!1&&r!==null&&e.snapshot.client===r&&e.connection===n&&(!n.bootstrapToken||z_(n.gatewayUrl)),reload:()=>{let e=new URL(window.location.href);if(n.bootstrapToken){e.searchParams.delete(`gatewayUrl`);let t=new URLSearchParams(e.hash.slice(1));t.set(`gatewayUrl`,n.gatewayUrl),t.set(`bootstrapToken`,n.bootstrapToken),n.bootstrapProfile&&t.set(Ta,n.bootstrapProfile),e.hash=t.toString()}Bl(e)}}}function z_(e){let t=URL.parse(e.replace(/^ws/u,`http`));return t!==null&&t.origin===globalThis.location?.origin}function B_(){return(B_=e((()=>{Sa(),iu()})))()}function V_(e){let{recovery:t,attachments:n,createdAt:r,checking:i,reconnecting:a,error:o}=e,s={id:t.messageId,text:t.message,...t.mentions?.length?{mentions:t.mentions}:{},attachments:n,createdAt:r,sessionKey:t.sessionKey,agentId:t.agentId,sendRunId:t.messageId,sendAttempts:1,sendState:a?`waiting-reconnect`:i?`unconfirmed`:o?`failed`:t.phase===`paused`?t.reason===`unconfirmed`?`unconfirmed`:`failed`:`sending`,...o||t.phase===`paused`?{sendError:o??(t.phase===`paused`?t.error:void 0)}:{}},c=H_.get(t),l=Reflect.ownKeys(s);return c&&Reflect.ownKeys(c).length===l.length&&l.every(e=>Object.hasOwn(c,e)&&Object.is(Reflect.get(c,e),Reflect.get(s,e)))?c:(H_.set(t,s),s)}var H_;function U_(){return(U_=e((()=>{H_=new WeakMap})))()}function W_(e,{gatewayUrl:t,recoveryScope:n}){let r=e.connectionRevision,i=Ep(e);return()=>{let a=e.snapshot.client,o=e.snapshot.hello?.auth?.recoveryScope??(a?.recoveryScopeReady?a.recoveryScope:void 0);return e.connectionRevision===r&&Ep(e)===i&&e.connection.gatewayUrl===t&&(n===void 0||!o||o===n)}}function G_(e,t=()=>W(()=>import(`./control-ui-boot-shared-XreXSF7h.js`).then(e=>(e.ua(),e.da)),__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,30,31,32,33]),import.meta.url)){let n=new Map,{gateway:r}=e,i=!1,o,s,c=new Set,l,u,d=()=>c.forEach(e=>e()),f=()=>{let{client:e,phase:t}=r.snapshot;return t===`connected`&&e?.recoveryScopeReady?e:null},p=()=>[...n.values()].map(e=>e()).filter(e=>e!==void 0),m=()=>p().every(e=>e.persisted),h=()=>{let e=p(),t=e[0];if(!t)return;let a=s,o=W_(r,t.input.recovery),c=()=>!i&&s===a&&o();return()=>{let t=p();if(c()&&e.length===t.length&&!e.some((e,n)=>e!==t[n])){for(let{input:t,persisted:r}of e)r||n.delete(t.recovery.sessionKey);d(),c()&&Il(!0)&&Bl()}}},g=Fl(m,()=>oi({message:F(`newSession.placementReloadBlocked`),actionLabel:F(`newSession.discardUnsavedAndReload`),onAction:h()})),_=(c,p=!1)=>{if(i)return;if(l??=r.subscribe(()=>_()),(c||p)&&s?.error&&(s=void 0,c||d()),c){let{input:e}=c;if(o){o.start(e);return}let t=e.recovery.sessionKey;n.delete(t);let i=W_(r,e.recovery),s={...c,input:{...e,displayAttachments:e.displayAttachments??a(e.recovery.attachments)}};n.set(t,()=>i()?s:void 0),n.size>32&&n.delete(n.keys().next().value),d()}let m=f();if(o){if(m)for(let[e,t]of n){let r=t()?.input;n.delete(e),r&&o.start(r)}o?.resumeRecovery(),m&&u&&(u=void 0,d());return}if(m&&!c){if(!u?.current()){let e={gatewayUrl:r.connection.gatewayUrl,recoveryScope:m.recoveryScope},t=W_(r,e),n=[],i={startedAt:Date.now()};u={current:t,refresh:()=>{n=zr(e.gatewayUrl,e.recoveryScope)},read:r=>t()&&n.includes(pr(e.gatewayUrl,e.recoveryScope,r))?i:void 0}}u.refresh()}if(s)return;let h={};s=h,t().then(({default:t})=>{i||(o=t(e),o.subscribe(d),_())},e=>{h.error=Error(xi(e)),d()})};return{get(e){let t=n.get(e)?.()?.input,r=t?{targetKind:t.recovery.target.kind,startedAt:t.createdAt}:u?.read(e);if(!r)return o?.get(e)??null;let i=s?.error,a=zl(i)&&!m(),c=a?F(`newSession.placementReloadBlocked`):i?.message,l=!f();return!l||t?{sessionKey:e,...r,phase:l?`reconnecting`:i?`failed`:`pending`,error:c,retryable:!l&&!!i&&!a,...t?{initialTurn:V_({recovery:t.recovery,attachments:t.displayAttachments,createdAt:t.createdAt,error:c,reconnecting:l})}:{},...a&&!l?{discardAndReload:h()}:{}}:null},hasPendingTurn(e){return!!(n.get(e)?.()||o?.hasPendingTurn(e)||u?.read(e))},start:e=>_({input:e,persisted:e.persistRecovery}),pause(e,t,a){let s=f();if(i||!s)return;if(o){o.pause(e,t,a);return}let c=n.get(e)?.()?.input,l=c?.recovery??a.readSessionPlacementRecovery(r.connection.gatewayUrl,s.recoveryScope,e);if(!l)return;let{recovery:u,persisted:d}=a.pauseSessionPlacementRecovery(l,t,c?.persistRecovery??!0);_({input:{recovery:u,persistRecovery:c?.persistRecovery??!0,mode:`recover`,createdAt:c?.createdAt??Date.now(),displayAttachments:c?.displayAttachments},persisted:d})},retry(e){if(!f())return;let t=n.get(e)?.();if(t||u?.read(e)){let n=s,r=n?.error;if(zl(r)){_();let t=u;if(!t?.read(e))return;Gl({canReload:()=>(t.refresh(),!i&&s===n&&u===t&&!!t.read(e)&&m())});return}return _(t,!0)}o?.retry(e)},resumeRecovery:_,subscribe:e=>io(c,e),dispose(){l?.(),g(),i=!0,o?.dispose(),o=void 0,n.clear(),u=void 0,c.clear()}}}function K_(){return(K_=e((()=>{N(),hi(),pn(),Ht(),qe(),Rl(),kp(),U_(),iu(),U()})))()}function q_(e){let t=new Map,n=!1,r,i=e=>{let t=new Map(e.attachments.map(e=>[e.id,e]));for(let n of Object.values(e.fallbacks))for(let e of n.attachments)t.set(e.id,e);return[...t.values()]},a=(e,t=new Set)=>{e&&Fr(i(e).filter(e=>!t.has(e.id)))},o=(e,t)=>JSON.stringify([e,t]),s=e=>{let n=t.get(e);return n&&(t.delete(e),r?.key===e&&r.controller.abort()),n},c=e=>{if((e.incognito||e.newSessionDraft?.incognito)&&Y_(e))return{draft:e,fallbackKey:void 0};for(let[t,n]of Object.entries(e.fallbacks))if(n.incognito&&Y_(n))return{draft:n,fallbackKey:t}},l=()=>new Set([...t.values()].flatMap(i).map(e=>e.id)),u=()=>{for(let[e,n]of t)c(n)&&!n.isConnectionCurrent()&&a(s(e),l())},d=e.subscribe(u),f=()=>{u();for(let[e,n]of t){let t=c(n);if(t)return{key:e,entry:n,...t}}},p=async()=>{let i=f();if(!i||r)return;let{key:a,entry:o,draft:c,fallbackKey:u}=i,d=new AbortController;r={key:a,controller:d};let p=e.connection,m=e.snapshot.client,h=()=>!n&&!d.signal.aborted&&t.get(a)===o&&o.isConnectionCurrent()&&e.snapshot.client===m&&e.connection===p,g=R_(e);try{if(!h()||!await o.reviewPrivateDraft({text:c.message,attachments:c.attachments,hasGoal:!!c.goalMode,pendingReads:0,isCurrent:h,signal:d.signal})||!h())return;let e=[...c.attachments];u===void 0?(o.message=``,o.attachments=[],o.goalMode=null,o.replyTarget=null,o.mentions=[]):delete o.fallbacks[u],!o.message&&!o.attachments.length&&!o.goalMode&&!o.replyTarget&&!Object.keys(o.fallbacks).length&&s(a);let t=l();Fr(e.filter(e=>!t.has(e.id))),await Gl({timeoutMs:0,...g})}catch{h()&&oi({message:F(`chat.privateDraftReload.unavailable`)})}finally{r?.controller===d&&(r=void 0)}},m=Fl(()=>!f(),()=>oi({message:F(`chat.privateDraftReload.blocked`),actionLabel:F(`chat.privateDraftReload.review`),onAction:()=>void p()}));return{prepare:({owner:r,paneId:i,scopeKey:c,attachments:l,fallbacks:u,message:d=``,draftRevision:f,goalMode:p,replyTarget:m,mentions:h,newSessionDraft:g,incognito:_,reviewPrivateDraft:v})=>{let y=o(i,c),b=s(y),x=Object.entries(u);if(!d&&!p&&!m&&l.length===0&&x.length===0){a(b);return}let S=new Set(l.map(e=>e.id));for(let e of Object.values(u))for(let t of e.attachments)S.add(t.id);if(a(b,S),!r||n){Fr(l);for(let e of Object.values(u))Fr(e.attachments);return}t.set(y,{owner:r,reviewPrivateDraft:v,isConnectionCurrent:W_(e,{gatewayUrl:e.connection.gatewayUrl,recoveryScope:r.recoveryScope||void 0}),preparedAt:Date.now(),paneId:i,scopeKey:c,attachments:[...l],...g?{newSessionDraft:g}:{},..._?{incognito:_}:{},message:d,...f===void 0?{}:{draftRevision:f},...p?{goalMode:p}:{},...m?{replyTarget:{...m}}:{},...h?.length?{mentions:h.map(e=>({...e}))}:{},fallbacks:Object.fromEntries(x.map(([e,t])=>[e,{...t,attachments:[...t.attachments]}]))});for(let e of t.keys()){if(t.size<=J_)break;a(s(e))}},consume:({owner:e,paneId:t,scopeKey:n})=>{let r=s(o(t,n));return r?.owner===e&&r.isConnectionCurrent()?{attachments:r.attachments,fallbacks:r.fallbacks,...r.newSessionDraft?{newSessionDraft:r.newSessionDraft}:{},...r.message?{message:r.message}:{},...r.draftRevision===void 0?{}:{draftRevision:r.draftRevision},...r.goalMode?{goalMode:r.goalMode}:{},...r.replyTarget?{replyTarget:r.replyTarget}:{},...r.mentions?{mentions:r.mentions}:{}}:(a(r),null)},retainedAttachmentIds:e=>{let t=new Set(e.map(e=>e.id));return new Set([...l()].filter(e=>t.has(e)))},retireScope:(n,r)=>{for(let[i,o]of t)o.owner===e.snapshot.client&&o.isConnectionCurrent()&&o.scopeKey===n&&o.preparedAt<r&&a(s(i),l())},clearPane:e=>{for(let[n,r]of t)r.paneId===e&&a(s(n))},dispose:()=>{n=!0,m(),d(),r?.controller.abort();for(let e of t.values())a(e);t.clear()}}}var J_,Y_;function X_(){return(X_=e((()=>{N(),Ht(),Bn(),Rl(),B_(),K_(),iu(),J_=32,Y_=e=>!!(e.message||e.attachments.length||e.goalMode||e.replyTarget||e.mentions?.length)})))()}function Z_(e){Object.assign(e,{pending:!1,message:null})}function Q_(){let e=new Map,t,n=new Set,r=e=>{t=e;for(let e of n)e()},i=new WeakMap,a=t=>[...e.keys()].find(e=>ci(e,t)),o=(t,n,r)=>{let i=e.get(a(t)??``);return i?.kind===`initial`&&i.owner===n&&(!i.sessionId||!r||i.sessionId===r)?i:null};return{retain:t=>{if(!t)return;let n=t.kind===`initial`,r=n?e:i.get(t.owner)??new Map,o=n?a(t.sessionKey)??t.sessionKey:t.deliveryKey,s=r.get(o);if(n&&s?.kind===`initial`&&s.owner===t.owner&&s.pendingRunId===t.pendingRunId)return s.consumedByEventId??=t.consumedByEventId,s;n||i.set(t.owner,r);let c={...t,pending:!0};r.delete(o),r.set(o,c);let l=n?32:64;return r.size>l&&r.delete(r.keys().next().value),c},beginCreate:e=>(r(e),()=>{t===e&&r(void 0)}),get creation(){return t?.creation},readCreateMessage:e=>t?.creation.sessionKey===e&&t.canDisplay()?t.message:null,subscribeCreate:e=>io(n,e),readInitial:o,observeInitialSession:(e,t,n)=>{let r=o(e,t);r?.pending&&n&&(r.sessionId&&r.sessionId!==n?Z_(r):r.sessionId=n)},readDelivered:(e,t)=>i.get(t)?.get(e),clear:()=>{e.clear(),i=new WeakMap,r(void 0)}}}function $_(){return($_=e((()=>{Yn()})))()}function ev(){if(typeof document>`u`)return null;let e=document.documentElement.getAttribute(mo);return e===`true`||e!==`false`&&null}function tv(e,t,n){let r=document.documentElement;(e||t||r.hasAttribute(`data-openclaw-environment`)||r.style.getPropertyValue(`--ring`))&&W(async()=>{let{applyControlUiPresentation:e}=await import(`./control-ui-boot-shared-XreXSF7h.js`).then(e=>(e.Fa(),e.Pa));return{applyControlUiPresentation:e}},__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,30,31,32,33]),import.meta.url).then(({applyControlUiPresentation:r})=>{n()&&r({environment:e,seamColor:t})})}function nv(e){return{assistantIdentity:An({agentId:e.assistantAgentId,name:e.assistantName,avatar:e.assistantAvatar,avatarSource:e.assistantAvatarSource,avatarStatus:e.assistantAvatarStatus,avatarReason:e.assistantAvatarReason}),serverVersion:e.serverVersion??null,serverBuildId:e.serverBuildId??null,devGitBranch:e.devGitBranch?.trim()||null,environment:e.environment??null,embedSandboxMode:e.embedSandbox??`scripts`,allowExternalEmbedUrls:!!e.allowExternalEmbedUrls,automaticallyFetchFavicons:!!e.automaticallyFetchFavicons,communityInvite:e.communityInvite===!0,newSessionModelDefaults:e.newSessionModelDefaults??`last-used`,terminalEnabled:!!e.terminalEnabled,uploadsEnabled:e.uploadsEnabled!==!1,cliAgentsEnabled:!!e.cliAgentsEnabled,pluginAssetsRequireAuth:e.pluginAssetsRequireAuth!==!1,pluginFrameGrants:(e.pluginFrameGrants??[]).filter(e=>typeof e?.pluginId==`string`&&typeof e.path==`string`&&(e.match===`exact`||e.match===`prefix`)).map(e=>({pluginId:e.pluginId,path:uc(e.path),match:e.match}))}}async function rv(e){if(typeof window>`u`||typeof fetch!=`function`)return null;try{let t=null;for(let n of e.authCandidates.length?e.authCandidates:[``]){let r={Accept:`application/json`};if(n&&(r.Authorization=`Bearer ${n}`),t=await fetch(e.url,{method:`GET`,headers:r,credentials:`same-origin`,signal:e.signal}),t.ok)break;if(t.status!==401&&t.status!==403)return null}if(!t?.ok)return null;let n=await t.json();return{config:nv(n),seamColor:n.seamColor}}catch{return null}}function iv(e){let t=av,n=0,r=0,i=0,a=document.documentElement.getAttribute(vo);a&&(t={...t,environment:JSON.parse(a)},tv(t.environment,void 0,()=>i===0));let o=`${Aa(e.resourceBasePath)}${ea}`,s=new URL(o,window.location.origin).origin===window.location.origin,c=()=>s?A_(e.getAuth?.()??{}):[],l=[],u,d=new Set;return{get current(){return t},async refresh(e){let a=c();if((a.length!==l.length||a.some((e,t)=>e!==l[t]))&&(l=a,n++,u=void 0),e?.skipWithoutAuthCandidate&&s&&!a.length)return null;if(u&&u.signal===e?.signal)return u.promise;let f=++r,p=n,m=e?.signal,h=()=>{let e=c();return p===n&&!m?.aborted&&a.length===e.length&&a.every((t,n)=>t===e[n])},g=rv({url:o,authCandidates:a,signal:m}).then(e=>{if(!e||!h())return null;let n=e.config;if(f<i)return n;i=f,tv(n.environment,e.seamColor,()=>h()&&f===i);let r=ev();if(r!==null&&n.terminalEnabled!==r)return Il()&&window.location.reload(),n;t=n;for(let e of d)e(t);return n});u={promise:g,signal:m};try{return await g}finally{u?.promise===g&&(u=void 0)}},subscribe:e=>io(d,e)}}var av;function ov(){return(ov=e((()=>{ba(),Sa(),In(),P_(),Rl(),U(),av={assistantIdentity:An(),serverVersion:null,serverBuildId:null,devGitBranch:null,environment:null,embedSandboxMode:`strict`,allowExternalEmbedUrls:!1,automaticallyFetchFavicons:!1,communityInvite:!1,newSessionModelDefaults:null,terminalEnabled:ev()??!1,uploadsEnabled:!0,cliAgentsEnabled:!1,pluginAssetsRequireAuth:!0,pluginFrameGrants:[]}})))()}function sv(){let e=null,t=0,n=0,r=null,i,a=new Map,o=()=>{for(let[s,c]of a){if(!e||n>=cv)return;let l=r!==null&&(!i?.ready||i.client!==e||i.sessionKey!==r);if(c.started||l&&c.background)continue;c.started=!0,n++;let u=t,d=()=>{u===t&&(a.delete(s),n--),c.resolve(),u===t&&o()};try{c.run().then(d,d)}catch{d()}}},s=()=>{t+=1,e=null,n=0,i=void 0;for(let e of a.values())e.started||e.resolve();a.clear()};return{reset:s,synchronize(t){let n=t.connected?t.client:null;(!n||e&&e!==n)&&s(),e=n,o()},setForegroundRoute(e){r=e,o()},setForegroundPane(e,t){t&&(r===void 0||t.sessionKey===r)?i={owner:e,...t}:!t&&i?.owner===e&&(i=void 0),o()},run(e,t,n){let r=a.get(e);if(r)return r.promise;let i=Qo();return a.set(e,{...i,run:t,started:!1,background:n?.background===!0}),o(),i.promise}}}var cv;function lv(){return(lv=e((()=>{Pa(),cv=2})))()}function uv(e){let t=e.hello?.auth;return e.phase!==`connected`||t?.scopes===void 0||Xf(t)?{phase:`hidden`}:Vi(e,`device.scopes.requestUpgrade`)===!0&&Vi(e,`device.scopes.waitUpgrade`)===!0&&e.client?.scopeUpgradeReady===!0?{phase:`available`}:{phase:`guidance`}}function dv(){return(dv=e((()=>{Hi(),tp()})))()}function fv(e){let t=new Set,n=e.snapshot,r=null,i=uv(n),a=e=>{if(JSON.stringify(i)!==JSON.stringify(e)){i=e;for(let e of t)e()}},o=()=>{r&&a(r.state)},s=e.subscribe(e=>{n=e,r?.sync(n),a(r?.state??uv(n))});return{get state(){return i},activate(e){r??=new e(n,o),r.sync(n),a(r.state)},request:()=>r?.request(),retry:()=>r?.retry(),cancel:()=>r?.cancel(),subscribe:e=>io(t,e),dispose(){s(),r?.dispose(),r=null,t.clear()}}}function pv(){return(pv=e((()=>{dv()})))()}function mv(e,t,n){let r=!1,i=!1,a=!1,o=t.visibilityState===`hidden`,s=n=>{t.visibilityState!==`hidden`&&(a||=n,!i&&(i=!0,queueMicrotask(()=>{i=!1;let n=a;if(a=!1,r||t.visibilityState===`hidden`)return;let{client:o,phase:s}=e.snapshot;o&&![`stopped`,`offline`,`reload-required`].includes(s)&&(n||o.needsWakeReconnect)&&e.connect(),W(async()=>{let{refreshControlUiServiceWorker:e}=await import(`./control-ui-boot-shared-XreXSF7h.js`).then(e=>(e.ca(),e.la));return{refreshControlUiServiceWorker:e}},__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,30,31,32,33]),import.meta.url).then(({refreshControlUiServiceWorker:e})=>e()).catch(e=>{console.warn(`OpenClaw service worker refresh failed after page activation.`,e)})})))},c=()=>{if(t.visibilityState===`hidden`){o=!0;return}o&&(o=!1,s(!1))},l=e=>{e.persisted&&s(!0)},u=()=>s(!1);return t.addEventListener(`visibilitychange`,c),n.addEventListener(`pageshow`,l),n.addEventListener(`online`,u),()=>{r=!0,t.removeEventListener(`visibilitychange`,c),n.removeEventListener(`pageshow`,l),n.removeEventListener(`online`,u)}}function hv(){return(hv=e((()=>{U()})))()}function gv(e,t){let n=!1,r=-1/0,i=!1,a=()=>{let{client:a,phase:o}=e.snapshot;if(n||i||!a||o!==`connected`||t.visibilityState!==`visible`)return;let s=Date.now();if(s>=r&&s-r<_v)return;r=s,i=!0;let c=()=>{i=!1};a.request(`presence.activity`,{}).then(c,c)},o=()=>{e.snapshot.phase!==`connected`||yv.has(t)||(yv.add(t),a())},s=e=>{e.isTrusted&&a()};for(let e of vv)t.addEventListener(e,s,{capture:!0,passive:!0});let c=e.subscribe(o);return o(),()=>{n=!0,c();for(let e of vv)t.removeEventListener(e,s,!0)}}var _v,vv,yv;function bv(){return(bv=e((()=>{_v=3e4,vv=[`keydown`,`pointerdown`,`pointermove`,`wheel`,`touchstart`],yv=new WeakSet})))()}function xv(e,t){let n=null,r=null,i=null,a=0,o=!1,s=()=>r??=W(async()=>{let{createCanvasSurfaceLease:e}=await import(`./control-ui-boot-shared-XreXSF7h.js`).then(e=>(e.La(),e.Ia));return{createCanvasSurfaceLease:e}},__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,30,31,32,33]),import.meta.url).then(({createCanvasSurfaceLease:r})=>(n=r({request:(t,n)=>{let r=i;return!r||e()!==r?Promise.reject(Error(`canvas surface lease has no current gateway client`)):r.request(t,n)},onChange:n=>{i&&e()===i&&t(n)}}),n)).catch(e=>{throw r=null,e});return{begin:(e,t)=>(i=null,n?.stop(),a+=1,i=e,o=Yf(t),ke(),a),start:(t,n,r)=>{o&&s().then(o=>{a===n&&i===t&&e()===t&&o.start(r)}).catch(()=>{})},stop:()=>{i&&(a+=1,i=null,n?.stop(),ke())},get generation(){return a}}}function Sv(){return(Sv=e((()=>{ne(),tp(),U()})))()}function Cv(e){Tv.delete(e)}async function wv(e,t){Cv(e);try{return await e.request(`users.prefs.set`,t)}finally{Cv(e)}}var Tv;function Ev(){return(Ev=e((()=>{Tv=new WeakMap})))()}function Dv(e){return t=>{if(!e.isAttached())return;let n=e.project(t);if(n){try{e.record(n)}catch(e){console.error(`[gateway] event handler error:`,e)}Ov(e.listeners,n,`event listener`,e.isCurrent)}}}function Ov(e,t,n,r){for(let i of Array.from(e)){if(r&&!r(t))return;try{i(t)}catch(e){console.error(`[gateway] ${n} handler error:`,e)}}}function kv(){let e=[],t=0,n=null,r=()=>(t+=1,e=[],e);return{get entries(){return e},get revision(){return t},clear(){e=[]},resetConnection(){return n=null,r()},bindRecoveryScope(e){let t=e??``,i=n!==null&&n!==t;return n=t,i?r():null},record(t){return e=[{ts:Date.now(),event:t.event,payload:t.payload},...e].slice(0,250),e}}}function Av(e){let t,n,r=e=>JSON.stringify(`shortId`in e?[`short`,e.agentId,e.shortId,e.slugHint]:[`scope`,e.agentId,e.sessionKey]);return{captureTarget(e){return t=e,e},synchronize(r,i){let a=r.client!==i.client||r.hello!==i.hello;if(r.client&&(a||r.selfUser?.id!==i.selfUser?.id||r.phase===`connected`&&i.phase!==`connected`)&&(Cv(r.client),Er(r.client),Xr(r.client),$t(r.client),ai(r.client),!e(i)))return!1;if(!i.client||!i.hello||i.phase!==`connected`||!a&&r.phase===`connected`)return!0;let{client:o,hello:s}=i,c=t&&!(`shortId`in t)?t.sessionKey?_t({hello:s},t.sessionKey,t.agentId):{}:void 0;return n=t?bi(o,c,void 0,c?.agentId===void 0):void 0,!0},receive(e,i){if(i.client&&(e.event===`cron`||e.event===`config.changed`)&&Er(i.client),e.event!==`models.snapshot`)return e;let a=n;if(!a)return;let o=e.payload;if(!t||r(t)!==r(o.target))return;n=void 0;let s=o.scope.sessionKey?_t(i,o.scope.sessionKey,o.scope.agentId):o.scope,c=Te(a,s,o.catalog);return a.cache.reads.delete(a),c?{...e,payload:{...o,scope:s}}:void 0}}}function jv(){return(jv=e((()=>{kn(),xn(),tr(),b(),Yn(),Ev()})))()}function Mv(e){let t=null,n={},r=()=>{globalThis.clearTimeout(t??void 0),t=null},i=(t,r)=>{globalThis.clearTimeout(n[t]),delete n[t],r!==void 0&&(n[t]=globalThis.setTimeout(()=>{delete n[t],(t!==`restartPending`||e.getSnapshot().phase!==`connected`)&&e.applySnapshot({[t]:t!==`restartPending`&&void 0})},jo(r*3,{minMs:15e3})))};return{clearOfflineIndicatorTimer:r,setUnavailableDeadline:i,scheduleOfflineIndicator:()=>{let r=e.getSnapshot();e.isStopped()||r.phase===`connected`||(r.restartPending&&n.restartPending===void 0&&i(`restartPending`,0),!(r.offlineStable||t!==null)&&(t=globalThis.setTimeout(()=>{t=null,!e.isStopped()&&e.getSnapshot().phase!==`connected`&&e.applySnapshot({offlineStable:!0})},Nv)))},hasSuspensionDeadline:()=>n.suspensionPhase!==void 0}}var Nv;function Pv(){return(Pv=e((()=>{ya(),Nv=2e3})))()}function Fv(e){let t,n,r;return{prepare(r,i,a){t=G(r.gatewayUrl);let o=e&&!i&&!r.bootstrapToken&&!r.password?up(t,e=>e===`token`?r.token:r.token.trim()?null:e===`device-token`?It(r.gatewayUrl):``):null;return o&&(n=ip(o)),{offlineRecoveryScope:e&&!i?a?.offlineRecoveryScope??o?.recoveryScope:void 0,url:r.gatewayUrl,token:r.token.trim()?r.token:void 0,bootstrapToken:r.bootstrapToken.trim()?r.bootstrapToken:void 0,bootstrapProfile:r.bootstrapProfile,password:r.password.trim()?r.password:void 0}},acceptHello(t,n){if(!e)return;let i=sp(t,n);r=t?.recoveryScope?{recoveryScope:t.recoveryScope}:i?ip(i):void 0},retire(e){let i=t,a=n?[n]:[];if(r&&!ap(n,r)&&a.push(r),n=void 0,r=void 0,!i)return;let o=e?g_:pp;for(let e of a)o(i,e)}}}function Iv(){return(Iv=e((()=>{Tn(),Tp(),y_()})))()}function Lv(e){let t=()=>{let t=Yt();return t&&ei({deviceId:t,gatewayUrl:e.gatewayUrl(),role:`operator`})?t:null};return{hasStoredDeviceToken:()=>t()!==null,forgetDeviceToken:()=>{let n=t();if(!n)return!1;let r=e.gatewayUrl();return pp(G(r)),e.retireOfflineAccess(),Pn({deviceId:n,gatewayUrl:r,role:vm}),lg(r,``),Nt(r),e.isStopped()||e.connect({token:``,bootstrapToken:``,password:``}),!0}}}function Rv(){return(Rv=e((()=>{Nm(),St(),Tn(),Tp(),Hg()})))()}function zv(e,t){return e?.id===t?.id&&e?.identity?.id===t?.identity?.id&&e?.email===t?.email&&e?.name===t?.name&&e?.avatarUrl===t?.avatarUrl}function Bv(e){if(!e||typeof e!=`object`)return;let t=e.presence;return Array.isArray(t)?t:void 0}function Vv(e,t){if(!t)return null;let n=e.find(e=>e.instanceId===t&&e.reason!==`disconnect`);return n?.user?.id?n.user:null}function Hv({snapshotUser:e,presenceEntries:t,presenceInstanceId:n}){return e===void 0?Vv(t??[],n):e}function Uv(){return(Uv=e((()=>{})))()}function Wv(e){let t=null,n;return{load:()=>{let r=e.getSnapshot().client,i=e.getSnapshot().hello;if(!r||!i||e.getSnapshot().phase!==`connected`||!$f(i.auth??null))return Promise.resolve(null);if(t)return t;let a=e.getSnapshot().selfUser,o=()=>e.getSnapshot().client===r&&e.getSnapshot().hello===i&&e.getSnapshot().phase===`connected`&&t===s,s=r.request(`users.self`,{}).then(({profile:t})=>{if(!o())return null;let s=e.getSnapshot().selfUser,c=s?.id===t.id?s:null,l=c&&s!==a?c:null,u=Vv(Bv(i.snapshot)??[],r.instanceId),d=c?.avatarUrl??(u?.id===t.id?u.avatarUrl:void 0),f=Rr(e.getConnection().gatewayUrl,t.id,t.updatedAt,e.resourceBasePath)??void 0,p=d&&d!==n?d:f;n=f;let m={id:t.id,identity:{type:`profile`,id:t.id},name:l?l.name:t.displayName??void 0,email:t.emails[0],avatarUrl:p};return zv(e.getSnapshot().selfUser,m)||e.publish(m),o()?t:null}).catch(t=>{if(!o())return null;if(t instanceof mm&&t.code===`FORBIDDEN`)return e.publish(null),null;throw t}).finally(()=>{t===s&&(t=null)});return t=s,s},applyPresence:r=>{let i=e.getSnapshot(),a=i.selfUser;if(i.phase!==`connected`)return;let o=Vv(Bv(r)??[],i.client?.instanceId);if(o){if(Yf(i.hello?.auth??null)&&(o.id!==a?.id||o.identity&&o.identity.id!==a.identity?.id))t=null,n=void 0,e.publish(o);else if(o.id===a?.id){let t={...a,name:o.name,avatarUrl:o.avatarUrl??a.avatarUrl};zv(a,t)||e.publish(t)}}},invalidate:()=>{t=null,e.getSnapshot().phase!==`connected`&&(n=void 0)}}}function Gv(){return(Gv=e((()=>{Nm(),xr(),tp()})))()}function Kv(e){return e.features?.methods===void 0&&!e.controlUiTabs?.length&&!e.controlUiWidgetKinds?.length&&!e.controlUiLinkReaders?.length&&!Object.keys(e.pluginSurfaceUrls??{}).length?null:{ok:!0,descriptors:[],methods:e.features?.methods??[],controlUiTabs:e.controlUiTabs??[],controlUiWidgetKinds:e.controlUiWidgetKinds??[],controlUiLinkReaders:e.controlUiLinkReaders??[],pluginSurfaceUrls:e.pluginSurfaceUrls??{}}}function qv(e,t=``,n=``,r=Jv,i={}){let a=e,o=i.persistDefaultConnectionSettings!==!1,s={gatewayUrl:a.gatewayUrl,token:a.token,bootstrapToken:n,...i.bootstrapProfile?{bootstrapProfile:i.bootstrapProfile}:{},password:t},c=0,l=Fv(i.ownsWarmBoot!==!1),u={client:null,phase:`stopped`,offlineStable:!1,hello:null,pluginCapabilities:null,canvasPluginSurfaceUrl:null,assistantAgentId:null,sessionKey:a.sessionKey,lastError:null,lastErrorCode:null,lastErrorAuthReason:null,selfUser:null},d=null,f=Wv({getSnapshot:()=>u,getConnection:()=>s,publish:e=>O({selfUser:e}),resourceBasePath:i.resourceBasePath}),p=xv(()=>d,e=>O({canvasPluginSurfaceUrl:e})),m=!1,g=!0,_=e=>!g&&d===e,v=(e,t)=>_(e)&&u.hello===t&&u.phase===`connected`,y=Mv({isStopped:()=>g,getSnapshot:()=>u,applySnapshot:e=>O(e)}),{clearOfflineIndicatorTimer:b,setUnavailableDeadline:x,scheduleOfflineIndicator:S}=y,C=new Set,ee=new Set,w=new Set,T=kv(),E=Av(e=>e===u),D=e=>{Ov(w,e,`event`,e=>e===T.entries)},O=e=>{let t=u;u={...t,...e},u.phase!==`connecting`&&u.phase!==`reconnecting`&&(u.reconnectAt=void 0),(t.client!==u.client||t.hello!==u.hello||u.phase!==`connected`)&&f.invalidate(),u.phase===`connected`?(b(),u.offlineStable=!1):(u.suspensionPhase=y.hasSuspensionDeadline()?u.suspensionPhase:void 0,u.pluginCapabilities=null,u.usagePublications=void 0,S()),E.synchronize(t,u)&&Ov(C,u,`snapshot`,e=>e===u)},k=e=>O({hello:null,canvasPluginSurfaceUrl:null,selfUser:null,lastError:null,lastErrorCode:null,lastErrorAuthReason:null,...e}),A=()=>{let e=d,t=u.hello;f.load().catch(n=>{v(e,t)&&O({lastError:xi(n)})})},te=(e,t=!1)=>{if(!o&&!t){a={...a,...e};return}o=!0,a=mg(e,{selectGateway:t})},ne=e=>{let t=d;if((e.event===`plugins.changed`||e.event===`plugins.controlUi.changed`)&&t){let n=u.hello,r=()=>v(t,n)?u:null;W(async()=>{let{refreshPluginCapabilities:e}=await import(`./plugin-capabilities.runtime-cQeLLbWo.js`);return{refreshPluginCapabilities:e}},__vite__mapDeps([93,1,30]),import.meta.url).then(({refreshPluginCapabilities:n})=>n(e,t,r,O,e=>p.start(t,p.generation,e))).catch(e=>{r()&&O({lastError:xi(e)})})}else if(e.event===`chat.metadata.changed`){let t=Xo(e.payload),n=t?.agentId,r=t?.usageUpdatedAt;typeof n==`string`&&typeof r==`number`&&r>(u.usagePublications?.[n]?.usageUpdatedAt??0)&&O({usagePublications:{...u.usagePublications,[n]:{usageUpdatedAt:r,committedAt:t?.usageRefreshFailed===!0?u.usagePublications?.[n]?.committedAt??0:r,usageRefreshFailed:t?.usageRefreshFailed===!0||void 0}}})}else if(e.event===`gateway.suspension`){let t=Ym(e.payload);t&&O({suspensionPhase:t})}else if(e.event===`shutdown`){let t=Xo(e.payload)?.restartExpectedMs;typeof t==`number`&&(x(`restartPending`,t),O({restartPending:!0}))}else e.event===`presence`?f.applyPresence(e.payload):e.event===`sessions.changed`&&Xo(e.payload)?.reason===`profile-identity`&&(f.invalidate(),A());if(!_(t)||w.size===0)return;let n=T.record(e);Ov(w,n,`event`,e=>e===T.entries&&_(t))},re=(e={})=>{let t=e.gatewayUrl??s.gatewayUrl;x(`suspensionPhase`),g=!1;let{sessionKey:n,...f}=e,v=G(t)!==G(s.gatewayUrl),y=cg(s.gatewayUrl,t,s),b={...s,...f,...v&&f.token===void 0?{token:y.token}:{},...v&&f.password===void 0?{password:y.password}:{},...v&&f.bootstrapToken===void 0?{bootstrapToken:``,bootstrapProfile:void 0}:{},...f.bootstrapToken!==void 0&&f.bootstrapProfile===void 0?{bootstrapProfile:void 0}:{}},S=[`gatewayUrl`,`token`,`password`,`bootstrapToken`,`bootstrapProfile`].some(e=>b[e]!==s[e]),C=S?T.resetConnection():null;S&&(c+=1,l.retire(!0));let w=f.gatewayUrl!==void 0&&f.gatewayUrl!==s.gatewayUrl,ie=w?og(b.gatewayUrl):null,ae=n!==void 0,oe=ae?n.trim():ie?.sessionKey??u.sessionKey;w&&(m=!1),s=b;let se=e=>{h(b.gatewayUrl,A_({hello:e,settings:b,password:b.password}),i.resourceBasePath)};se(),te({gatewayUrl:b.gatewayUrl,token:b.token,...ae?{sessionKey:oe,lastActiveSessionKey:oe}:ie??{},...ie?{selectedAgentId:ie.selectedAgentId}:{}},o||w),p.stop(),d?.stop();let le=e=>{Ul({buildId:e,...R_(j,()=>_(M)&&z_(b.gatewayUrl))})},M=r({...l.prepare(b,S,d),clientName:i.clientOptions?.clientName??`openclaw-control-ui`,clientVersion:Nl.version??`dev`,clientBuildId:Nl.buildId,platform:i.clientOptions?.platform,deviceFamily:i.clientOptions?.deviceFamily,mode:i.clientOptions?.mode??`webchat`,instanceId:i.clientOptions?.instanceId??go(),scopes:i.clientOptions?.scopes,nativeConnectAuth:i.clientOptions?.nativeConnectAuth,get modelCatalog(){return d===M?E.captureTarget(i.getModelCatalogTarget?.(b.gatewayUrl)):void 0},onHello:e=>{if(d!==M)return;l.acceptHello(e.auth,b.token),lg(b.gatewayUrl,Xo(e.snapshot)?.authMode===`token`?b.token:``),x(`suspensionPhase`),s={...s,bootstrapToken:``,bootstrapProfile:void 0};let t=T.bindRecoveryScope(e.auth?.recoveryScope);if(t&&(D(t),!_(M)))return;let n=!!e.server?.buildId?.trim();if(z_(b.gatewayUrl)&&(n||m)&&Ml({version:e.server?.version,buildId:e.server?.buildId,controlUiBuildSource:e.server?.controlUiBuildSource})){k({client:M,phase:`reconnecting`,hello:e});let t=e.server?.buildId?.trim()||e.server?.version?.trim();t&&le(t);return}se(e),o&&(a=dg());let r=dt({hello:e}),i=st(u.sessionKey,e),c=st(a.lastActiveSessionKey,e);(i!==a.sessionKey||c!==a.lastActiveSessionKey)&&te({sessionKey:i,lastActiveSessionKey:c}),m=!0;let f=e.pluginSurfaceUrls?.canvas?.trim()||null,h=p.begin(M,e.auth);x(`restartPending`),k({client:M,phase:`connected`,restartPending:!1,suspensionPhase:Ym(Xo(e.snapshot)?.suspension),hello:e,pluginCapabilities:Kv(e),canvasPluginSurfaceUrl:f,assistantAgentId:r?.defaultAgentId?.trim()||null,sessionKey:i,selfUser:Vv(Bv(e.snapshot)??[],M.instanceId)}),_(M)&&!u.selfUser&&A(),p.start(M,h,f??void 0)},onRecoveryScopeChange:()=>{d===M&&u.phase===`connected`&&(Nt(b.gatewayUrl,M.recoveryScope),O({}))},onReconnectScheduled:e=>{d===M&&O({reconnectAt:Date.now()+e})},onClose:({code:e,reason:t,error:n,willRetry:r,busy:i})=>{if(d!==M)return;p.stop(),(ce(n?.details)||n?.code===`PAIRING_REQUIRED`)&&(M.retireOfflineRecoveryScope?.(),m=!1,l.retire(!1));let a=Go(n?.details);a&&le(a);let o=a===null&&!m&&r&&$i(n);if(o&&u.phase===`starting`)return;let c=pm(n)??n?.code??null;c===no.AUTH_BOOTSTRAP_TOKEN_INVALID&&(s={...s,bootstrapToken:``,bootstrapProfile:void 0});let f=Gi(n);f&&x(`restartPending`,0);let h=ao(n)?Ym(n?.details)??`prepared`:void 0;x(`suspensionPhase`,h?0:void 0);let g=en(t);k({client:M,phase:a===null?o?`starting`:m?r?`reconnecting`:`offline`:r?`connecting`:`stopped`:`reload-required`,restartPending:f||u.restartPending===!0,suspensionPhase:h,lastError:o?null:n?.message?xi(n.message):g?`disconnected (${e}): ${g}`:F(r?`connection.interruptedRetrying`:`connection.interrupted`,{code:String(e)}),lastErrorCode:o?null:i?`GATEWAY_BUSY`:c,lastErrorAuthReason:o?null:ce(n?.details)})},onGap:({expected:e,received:t})=>{_(M)&&(O({lastError:`event gap detected (expected seq ${e}, got ${t}); reconnecting`,lastErrorCode:null,lastErrorAuthReason:null}),_(M)&&re())},onEvent:Dv({isAttached:()=>d===M,isCurrent:()=>_(M),project:e=>E.receive(e,u),record:ne,listeners:ee})});d=M,k({client:M,phase:m?`reconnecting`:`connecting`,reconnectAt:void 0,assistantAgentId:null,sessionKey:oe}),C&&D(C),_(M)&&M.start()},j={get snapshot(){return u},get connection(){return s},get connectionRevision(){return c},get eventLog(){return T.entries},get eventLogRevision(){return T.revision},connect:re,setSessionKey:e=>{let t=e.trim();t&&t!==u.sessionKey&&(te({sessionKey:t,lastActiveSessionKey:t}),O({sessionKey:t}))},start:()=>re(),stop:()=>{g=!0,b(),x(`restartPending`),x(`suspensionPhase`),p.stop(),d?.stop(),d=null,m=!1,k({client:null,phase:`stopped`,offlineStable:!1,restartPending:!1,assistantAgentId:null})},subscribe:e=>io(C,e),subscribeEventLog:e=>(w.add(e),()=>{w.delete(e),w.size===0&&T.clear()}),subscribeEvents:e=>io(ee,e),loadSelfProfile:f.load,updateSelfUser:e=>{u.selfUser&&(f.invalidate(),O({selfUser:{...u.selfUser,...e}}))},...Lv({gatewayUrl:()=>s.gatewayUrl,connect:re,isStopped:()=>g,retireOfflineAccess:()=>{d?.retireOfflineRecoveryScope?.(),m=!1,c+=1}})};return j}var Jv;function Yv(){return(Yv=e((()=>{fo(),Fa(),ka(),Nm(),Pl(),N(),St(),pt(),hi(),be(),Zt(),Yn(),Ca(),P_(),Sv(),B_(),jv(),Qm(),Pv(),Iv(),Rv(),Gv(),Hg(),iu(),U(),Jv=e=>new Mm(e)})))()}function Xv(e){return e.phase===`connected`?(e.pluginCapabilities?.controlUiLinkReaders??Ff).filter(t=>e.pluginCapabilities?.methods?.includes(t.linkReader.detailMethod)===!0&&Bi(e,t.linkReader.detailMethod,`operator.read`,{requireAdvertisement:!1})):Ff}function Zv(e){return Xv(e).filter(t=>!!(t.linkReader.previewMethod&&e.pluginCapabilities?.methods?.includes(t.linkReader.previewMethod)))}function Qv(e,t={}){let n=n=>{if(t.shouldOpenExternally?.()||!se(n)||e().phase!==`connected`)return;let r=n.composedPath(),i=r.find(e=>e instanceof HTMLAnchorElement);if(!i||!r.some(e=>e instanceof Element&&e.localName===`openclaw-app-shell`)||i.hasAttribute(`download`)||i.hasAttribute(`data-file-path`)||i.hasAttribute(`data-link-reader-external`))return;let a=kf(i.href,Xv(e()));if(!a)return;let o=new CustomEvent(Hd,{cancelable:!0,detail:{url:a.href,open:!0,trigger:i,newTab:!r.some(e=>e instanceof Element&&e.localName===`openclaw-link-reader-panel`)}});window.dispatchEvent(o)||n.preventDefault()};return document.addEventListener(`click`,n),{dispose:()=>document.removeEventListener(`click`,n)}}function $v(){return($v=e((()=>{Lf(),Gd(),Hi()})))()}function ey(e){return/^(?:(?:codex|chatgpt|openclaw):\/\/plugins\/|https:\/\/chatgpt\.com\/plugins\/)[^/?#]+\/app\/[^/?#]+\/?(?:[?#]|$)/iu.test(e)}function ty(e){let t=!1,n=n=>{if(!se(n))return;let r=n.composedPath().find(e=>e instanceof HTMLAnchorElement);if(!r||r.hasAttribute(`download`))return;let i=r.href;ey(i)&&(n.preventDefault(),W(async()=>{let{navigateMcpAppLink:e}=await import(`./mcp-app-routing-DFzELUUu.js`).then(e=>(e.t(),e.n));return{navigateMcpAppLink:e}},__vite__mapDeps([94,11,1,3,2,4,5,8,7,6,9,12,13,14,15,30,31,32,33]),import.meta.url).then(({navigateMcpAppLink:n})=>{t||n(e,i)}).catch(e=>{t||console.error(`[openclaw] MCP app link failed to load; click to retry`,e)}))};return document.addEventListener(`click`,n),{dispose:()=>{t=!0,document.removeEventListener(`click`,n)}}}function ny(){return(ny=e((()=>{U()})))()}function ry(){return window.chrome?.webview}function iy(e){if(!e||typeof e!=`object`||!(`type`in e)||e.type!==`draft-text`)return null;let t=`payload`in e?e.payload:null,n=t&&typeof t==`object`&&`text`in t?t.text:null;return typeof n==`string`?n:null}function ay(){let e=ry();if(!e)return{subscribe:()=>()=>{},dispose:()=>{}};let t=null,n=new Set,r=e=>{let r=iy(e.data);if(r!==null){if(n.size===0){t=r;return}for(let e of n)e(r)}};return e.addEventListener(`message`,r),ry()?.postMessage({type:`ready`}),{subscribe(e){if(n.add(e),t!==null){let n=t;t=null,e(n)}return()=>n.delete(e)},dispose(){n.clear(),t=null,e.removeEventListener(`message`,r)}}}function oy(){let e=el()?.webkit?.messageHandlers?.openclawLink;return e?.postMessage.bind(e)}function sy(){return el()?.webkit?.messageHandlers?.openclawUpdate}function cy(){return sy()!==void 0}function ly(){let e=sy();return e?(e.postMessage.bind(e)({type:`start-update`}),window.dispatchEvent(new CustomEvent(vy)),!0):!1}function uy(e){if(!e.isTrusted)return null;let t=Xe(e);if(!t||t.hasAttribute(`download`)||t.hasAttribute(`data-file-path`))return null;let n=URL.parse(t.href,window.location.href);return n&&(n.protocol===`mailto:`||n.protocol===`tel:`)?{anchor:t,url:n}:null}function dy(e,t){try{return e({type:`open-link`,url:t.href,target:`external`}),!0}catch{return!1}}function fy(e){let t=oy();if(!t)return!1;let n=URL.parse(e);return n!==null&&dy(t,n)}function py(e){window.dispatchEvent(new CustomEvent(Fd,{detail:{open:!0,url:e.href,...Zd()?{native:!0}:{}}}))}function my(e){return!e.defaultPrevented&&!e.shiftKey&&!e.altKey&&(e.type===`click`&&e.button===0||e.type===`auxclick`&&e.button===1)}function hy(e={}){if(e.signal?.aborted||typeof window>`u`||typeof document>`u`)return{dispose(){}};let t=oy();if(!t&&!Zd()&&!e.shouldOpenInControlUiBrowser&&!e.onNativeUpdateDeclined)return{dispose(){}};let n=null,r=0,i=!1,a=!1,o=()=>{a=!0},s=()=>{a&&(a=!1,e.onNativeUpdateDeclined?.())},c=e=>{e&&n!==e||(r+=1,n?.remove(),n=null)},l=n=>{Zd()&&e.canPresentBrowserPanel?.()===!1?t&&dy(t,n):py(n)},u=async(a,o,s)=>{c();let u=r,d=a.composedPath(),{mountNativeLinkMenu:f}=await W(async()=>{let{mountNativeLinkMenu:e}=await import(`./native-link-menu.runtime-BzzSZCIb.js`);return{mountNativeLinkMenu:e}},__vite__mapDeps([95,1,12,3,2,4,5,8,7,6,9,11,13,14,15,30,31,32,33]),import.meta.url);i||e.signal?.aborted||u!==r||!o.isConnected||(n=f({path:d,anchor:o,url:s,x:a.clientX,y:a.clientY,close:c,openExternal:()=>t&&dy(t,s),openInline:()=>l(s)}))},d=n=>{let r=m(n);if(r&&(r.anchor.hasAttribute(`data-link-reader-external`)||e.shouldOpenExternally?.())){t&&se(n)&&dy(t,r.url)&&(c(),n.preventDefault());return}if(r&&(Zd()?se(n):my(n))&&(Zd()||e.shouldOpenInControlUiBrowser?.())){l(r.url),c(),n.preventDefault();return}if(!t||!se(n))return;let i=uy(n);i&&dy(t,i.url)&&(c(),n.preventDefault())},f=e=>{if(!t||e.defaultPrevented)return;let n=m(e);n&&(e.preventDefault(),e.stopPropagation(),u(e,n.anchor,n.url).catch(e=>{i||console.error(`[openclaw] native link menu failed to load; right-click to retry`,e)}))};window.addEventListener(`click`,d),window.addEventListener(`auxclick`,d),window.addEventListener(vy,o),window.addEventListener(gy,s),t&&document.addEventListener(`contextmenu`,f,!0);let p=()=>{i=!0,e.signal?.removeEventListener(`abort`,p),window.removeEventListener(`click`,d),window.removeEventListener(`auxclick`,d),window.removeEventListener(vy,o),window.removeEventListener(gy,s),document.removeEventListener(`contextmenu`,f,!0),c()};return e.signal?.addEventListener(`abort`,p,{once:!0}),{dispose:p}}var gy,_y,vy;function yy(){return(yy=e((()=>{Gd(),U(),gy=`openclaw:native-update-declined`,_y=`openclaw:native-update-availability-changed`,vy=`openclaw:native-update-posted`})))()}function by(e,t){return Hy.find(([n])=>e===`${n}.approval.${t}`)?.[1]}function xy(e,t){if(!Array.isArray(e))return;let n=e.filter(e=>{if(!q(e))return!1;let{startIndex:n,endIndex:r}=e;return Number.isSafeInteger(n)&&Number.isSafeInteger(r)&&typeof n==`number`&&typeof r==`number`&&n>=0&&r>n&&r<=t});return n.length>0?n:void 0}function Sy(e){if(!Array.isArray(e))return;let t=e.filter(e=>e===`allow-once`||e===`allow-always`||e===`deny`);return t.length>0?t:void 0}function Cy(e){if(!q(e))return null;switch(e.kind){case`standing-grant`:return typeof e.automation==`string`&&typeof e.command==`string`?{kind:`standing-grant`,automation:e.automation,command:e.command,...typeof e.expiresInDays==`number`?{expiresInDays:e.expiresInDays}:{}}:null;case`message-send`:return typeof e.target==`string`&&typeof e.recipientCount==`number`?{kind:`message-send`,target:e.target,recipientCount:e.recipientCount,...Array.isArray(e.recipients)&&e.recipients.every(e=>typeof e==`string`)?{recipients:e.recipients}:{},...e.audience===`internal`||e.audience===`external`?{audience:e.audience}:{}}:null;case`payment`:return typeof e.amount==`string`&&typeof e.currency==`string`&&typeof e.target==`string`?{kind:`payment`,amount:e.amount,currency:e.currency,target:e.target}:null;case`external-post`:return typeof e.target==`string`&&(e.visibility===`public`||e.visibility===`restricted`)?{kind:`external-post`,target:e.target,visibility:e.visibility}:null;default:return null}}function wy(e,t){if(!q(t)||!q(t.request))return null;let n=V(t.id),r=t.request,i=typeof t.createdAtMs==`number`?t.createdAtMs:0,a=typeof t.expiresAtMs==`number`?t.expiresAtMs:0;if(!n||!i||!a)return null;let o={id:n,kind:e,createdAtMs:i,expiresAtMs:a},s={agentId:xa(r.agentId)??null,sessionKey:xa(r.sessionKey)??null};if(e===`exec`){let e=ca(r.command);return e?{...o,request:{...s,command:e,cwd:xa(r.cwd)??null,host:xa(r.host)??null,security:xa(r.security)??null,ask:xa(r.ask)??null,resolvedPath:xa(r.resolvedPath)??null,runId:xa(r.runId)??null,commandSpans:xy(r.commandSpans,e.length),allowedDecisions:Sy(r.allowedDecisions),scope:Cy(r.scope)}}:null}let c=V(r.title);if(!c)return null;if(e===`plugin`)return{...o,request:{...s,command:c,allowedDecisions:Sy(r.allowedDecisions)},pluginTitle:c,pluginDescription:xa(r.description)??null,pluginDetail:xa(r.detail)??null,pluginSeverity:xa(r.severity)??null,pluginId:xa(r.pluginId)??null,pluginActions:r.actions};let l=V(r.description),u=V(r.command),d=V(r.proposalHash);return!l||!u||!d?null:{...o,request:{...s,command:u,allowedDecisions:[`allow-once`,`deny`]},pluginTitle:c,pluginDescription:l,proposalHash:d}}function Ty(e,t){if(!by(e,`resolved`)||!q(t))return null;let n=V(t.id);return n?{id:n}:null}function Ey(e,t){let n=by(e,`requested`);return n?wy(n,t):null}async function Dy(e,t,n){if(t.kind===`system-agent`){await e.request(`approval.resolve`,{id:t.id,kind:`system-agent`,decision:n});return}let r=t.kind===`plugin`?`plugin.approval.resolve`:`exec.approval.resolve`;await e.request(r,{id:t.id,decision:n})}function Oy(e){let t=Date.now();return e.filter(e=>e.expiresAtMs>t)}function ky(e){if(!(e instanceof Error))return!1;let t=q(e)?e:null,n=q(t?.details)?V(t.details.reason):void 0;return n===By||n===Vy||V(t?.gatewayCode)===Vy||/unknown or expired approval id/i.test(e.message)}function Ay(e,t,n){return e.status===`rejected`?Oy(n).filter(e=>e.kind===t):Array.isArray(e.value)?e.value.flatMap(e=>{let n=wy(t,e);return n?[n]:[]}):[]}function jy(e){return e.toSorted((e,t)=>e.createdAtMs-t.createdAtMs||e.id.localeCompare(t.id))}function My(e,t,n,r){let i=new Set(t.map(e=>e.id)),a=Oy(n),o=new Set(a.map(e=>e.id)),s=Oy(e).filter(e=>!r.has(e.id)&&(!i.has(e.id)||o.has(e.id))),c=new Set(s.map(e=>e.id)),l=a.filter(e=>!i.has(e.id)&&!c.has(e.id));return jy([...s,...l])}function Ny(e,t){let n=e.execApprovalExpiryTimers?.get(t);n!==void 0&&(globalThis.clearTimeout(n),e.execApprovalExpiryTimers?.delete(t))}function Py(e,t){Ny(e,t.id);let n=globalThis.setTimeout(()=>{let r=e.execApprovalExpiryTimers?.get(t.id);if(r!==void 0&&r!==n)return;e.execApprovalExpiryTimers?.delete(t.id);let i=e.execApprovalQueue.some(e=>e.id===t.id);Fy(e,t.id),i&&e.execApprovalChanged?.()},Math.max(0,t.expiresAtMs-Date.now()+500));e.execApprovalExpiryTimers?.set(t.id,n)}function Fy(e,t){Ny(e,t),e.execApprovalQueue=Oy(e.execApprovalQueue).filter(e=>e.id!==t),e.execApprovalErrors.delete(t)}function Iy(e){e.execApprovalExpiryTimers?.forEach(e=>globalThis.clearTimeout(e)),e.execApprovalExpiryTimers?.clear()}function Ly(e,t){let n=Oy(e.execApprovalQueue).filter(e=>e.id!==t.id);n.push(t),e.execApprovalQueue=jy(n),Py(e,t)}async function Ry(e,t){let n=e.client;if(!n||t?.isCurrentClient&&!t.isCurrentClient(n))return!1;let r={removedIds:new Set},i=e.execApprovalRefreshes??=new Set;i.add(r);let a=Oy(e.execApprovalQueue);try{let[i,o,s]=await Promise.allSettled([n.request(`exec.approval.list`,{}),n.request(`plugin.approval.list`,{}),n.request(`openclaw.approval.list`,{})]),c=My([...Ay(i,`exec`,e.execApprovalQueue),...Ay(o,`plugin`,e.execApprovalQueue),...Ay(s,`system-agent`,e.execApprovalQueue)],a,e.execApprovalQueue,r.removedIds);if(t?.isCurrentClient&&!t.isCurrentClient(n))return!1;e.execApprovalQueue=c;let l=new Set(c.map(e=>e.id));for(let t of e.execApprovalErrors.keys())l.has(t)||e.execApprovalErrors.delete(t);for(let t of e.execApprovalExpiryTimers?.keys()??[])l.has(t)||Ny(e,t);for(let t of c)Py(e,t);return!0}finally{i.delete(r),i.size===0&&(e.execApprovalRefreshes=void 0)}}function zy(e,t){Fy(e,t);for(let n of e.execApprovalRefreshes??[])n.removedIds.add(t)}var By,Vy,Hy;function Uy(){return(Uy=e((()=>{By=`APPROVAL_ALREADY_RESOLVED`,Vy=`APPROVAL_NOT_FOUND`,Hy=[[`exec`,`exec`],[`plugin`,`plugin`],[`openclaw`,`system-agent`]]})))()}function Wy(e){let t=qf(e);return t.canAdmin||t.canPair}function Gy(e,t){let n=qf(t);return{access:n,reviewChanged:e.canReviewApprovals!==n.canReviewApprovals,grantChanged:e.canGrantApprovals!==n.canGrantApprovals,grantRevoked:e.canGrantApprovals&&!n.canGrantApprovals,adminRevoked:e.canAdmin&&!n.canAdmin,pairingChanged:e.canPair!==n.canPair,pairingSetupRevoked:(e.canAdmin||e.canPair)&&!(n.canAdmin||n.canPair)}}function Ky(e){let t=0;return{invalidate(n={}){t+=1,n.clear&&(e.state.pendingCount=0)},async refresh(){let n=e.gateway.snapshot.client;if(!n||e.gateway.snapshot.phase!==`connected`||e.isDisposed()||!e.state.devicePairSetupOpen||!Wy(e.gateway.snapshot))return;let r=++t,i;try{i=await n.request(`device.pair.list`,{})}catch{return}!e.isDisposed()&&r===t&&e.gateway.snapshot.client===n&&e.gateway.snapshot.phase===`connected`&&e.state.devicePairSetupOpen&&Wy(e.gateway.snapshot)&&(e.state.pendingCount=Array.isArray(i.pending)?i.pending.length:0,e.publish())}}}function qy(e){return async(t,n=e.getConnectedEpoch(),r=e.getReviewGeneration())=>{e.canReview()&&r===e.getReviewGeneration()&&qf(e.gateway.snapshot).canReviewApprovals&&await Ry(e.state,{isCurrentClient:i=>i===t&&n===e.getConnectedEpoch()&&r===e.getReviewGeneration()&&e.canReview()&&qf(e.gateway.snapshot).canReviewApprovals&&e.isCurrentClient(t)})&&!e.isDisposed()&&e.publish()}}function Jy(){return(Jy=e((()=>{Uy(),tp()})))()}function Yy(e){let t=null,n=0,r=()=>{n+=1,t!==null&&(globalThis.clearTimeout(t),t=null)},i=async()=>{t=null;let r=n;e.canPoll()&&await e.refresh(),r===n&&a()},a=()=>{if(!e.canPoll()){r();return}t===null&&(t=globalThis.setTimeout(()=>void i(),5e3))};return{stop:r,sync:a}}function Xy(e){return!!e.selfUser?.id?.trim()&&Bi(e,`update.report`,`operator.admin`,{requireAdvertisement:!1})}function Zy(e){let t=null;return{invalidate:()=>{t=null},report:async n=>{let r=e.getClient();if(!r||t!==null||!e.isCurrent(n,r))return;let i={};t=i;let a=()=>t===i&&e.isCurrent(n,r);e.setBusy(!0);try{let{reportUpdateFailure:t}=await W(async()=>{let{reportUpdateFailure:e}=await import(`./update-failure-report-Cb61r3uI.js`);return{reportUpdateFailure:e}},__vite__mapDeps([96,1,12,3,2,4,5,8,7,6,9,11,13,14,15,97,30,31,32,33]),import.meta.url),i=await t({attemptId:n,client:r,isCurrent:a});i&&a()&&e.setResult(n,i)}catch(t){a()&&e.setResult(n,{status:`error`,message:xi(t)})}finally{t===i&&(t=null,e.setBusy(!1))}}}}function Qy(){return(Qy=e((()=>{hi(),Hi(),U()})))()}function $y(e,t){return typeof e==`number`&&Number.isInteger(e)&&e>=t}function eb(e){return tb(es(e?.snapshot)?.updateAvailable)}function tb(e){if(!q(e)||!Zo(e.currentVersion)||!Zo(e.latestVersion)||!Zo(e.channel))return null;let t=e.commits,n=Array.isArray(t)?t.filter(e=>q(e)&&Zo(e.sha)&&typeof e.subject==`string`).map(e=>({sha:e.sha,subject:e.subject})).slice(0,lb):void 0;return{currentVersion:e.currentVersion,latestVersion:e.latestVersion,channel:e.channel,...Zo(e.currentSha)?{currentSha:e.currentSha}:{},...Zo(e.upstreamRef)?{upstreamRef:e.upstreamRef}:{},...Zo(e.upstreamSha)?{upstreamSha:e.upstreamSha}:{},...Zo(e.repositoryUrl)?{repositoryUrl:e.repositoryUrl}:{},...$y(e.commitsBehind,0)?{commitsBehind:e.commitsBehind}:{},...n?.length?{commits:n}:{}}}function nb(e){return q(e)?e.kind===`package`?Zo(e.version)?{kind:`package`,version:e.version}:null:e.kind===`git`&&Zo(e.upstreamRef)&&Zo(e.upstreamSha)&&$y(e.commitsBehind,0)?{kind:`git`,upstreamRef:e.upstreamRef,upstreamSha:e.upstreamSha,commitsBehind:e.commitsBehind}:null:null}function rb(e){return{...Zo(e.currentSha)?{currentSha:e.currentSha}:{},...Zo(e.upstreamSha)?{upstreamSha:e.upstreamSha}:{},...Zo(e.repositoryUrl)?{repositoryUrl:e.repositoryUrl}:{},...$y(e.commitAtMs,0)?{commitAtMs:e.commitAtMs}:{},...$y(e.installedAtMs,0)?{installedAtMs:e.installedAtMs}:{}}}function ib(e){if(!q(e))return null;let t=rb(e);return e.status===`current`?{...t,status:`current`}:e.status===`behind`&&$y(e.commitsBehind,1)?{...t,status:`behind`,commitsBehind:e.commitsBehind}:e.status===`ahead`&&$y(e.commitsAhead,1)?{...t,status:`ahead`,commitsAhead:e.commitsAhead}:e.status===`diverged`&&$y(e.commitsAhead,1)&&$y(e.commitsBehind,1)?{...t,status:`diverged`,commitsAhead:e.commitsAhead,commitsBehind:e.commitsBehind}:e.status===`unavailable`&&(e.reason===`fetch-failed`||e.reason===`no-upstream`||e.reason===`no-upstream-sha`||e.reason===`comparison-failed`||e.reason===`git-unavailable`)?{...t,status:`unavailable`,reason:e.reason}:null}function ab(e){return!q(e)||!Zo(e.id)||e.state!==`waiting-for-idle`&&e.state!==`countdown`&&e.state!==`applying`||!$y(e.announcedAtMs,0)||!$y(e.forceAtMs,0)||!$y(e.updatedAtMs,0)?null:{id:e.id,state:e.state,announcedAtMs:e.announcedAtMs,...$y(e.applyAtMs,0)?{applyAtMs:e.applyAtMs}:{},...$y(e.holdUntilMs,0)?{holdUntilMs:e.holdUntilMs}:{},forceAtMs:e.forceAtMs,updatedAtMs:e.updatedAtMs}}function ob(e){if(!q(e)||!Zo(e.root)||typeof e.currentSha!=`string`||!/^[a-f0-9]{40}$/.test(e.currentSha)||!Zo(e.currentPath))return null;let t;if(e.prepared!==void 0){let n=e.prepared;if(!q(n)||typeof n.sha!=`string`||!/^[a-f0-9]{40}$/.test(n.sha)||!Zo(n.path)||typeof n.buildDigest!=`string`||!/^[a-f0-9]{64}$/.test(n.buildDigest)||!$y(n.preparedAtMs,0))return null;t={sha:n.sha,path:n.path,buildDigest:n.buildDigest,preparedAtMs:n.preparedAtMs}}return{root:e.root,currentSha:e.currentSha,currentPath:e.currentPath,...t?{prepared:t}:{}}}function sb(e){if(!q(e)||!Zo(e.channel)||typeof e.autoEnabled!=`boolean`)return null;let t=q(e.install)?e.install:null,n=t?.kind,r=n===`package`||n===`git`||n===`immutable`||n===`unknown`?n:void 0;if(e.install!==void 0&&r===void 0)return null;let i=t?.git===void 0?void 0:ib(t.git);if(t?.git!==void 0&&!i)return null;let a=t?.immutable===void 0?void 0:ob(t.immutable);if(t?.immutable!==void 0&&!a)return null;let o=e.target===void 0?void 0:nb(e.target),s=e.campaign===void 0?void 0:ab(e.campaign);return e.target!==void 0&&!o||e.campaign!==void 0&&!s?null:{channel:e.channel,autoEnabled:e.autoEnabled,...r?{install:{kind:r,...i?{git:i}:{},...a?{immutable:a}:{}}}:{},...o?{target:o}:{},...s?{campaign:s}:{}}}function cb(e){return sb(es(e?.snapshot)?.updateSchedule)}var lb;function ub(){return(ub=e((()=>{lb=5})))()}function db(e,t){let n=e.updateSchedule?.campaign,r=t?.campaign;return{updateSchedule:t,heldUpdateCampaignId:fb(t,e.heldUpdateCampaignId),updateCampaignStatusHydrated:!r||e.updateCampaignStatusHydrated&&n?.id===r.id&&n.updatedAtMs===r.updatedAtMs}}function fb(e,t){return e?.campaign?.holdUntilMs===void 0?t:e.campaign.id}function pb(e,t){return{updateAvailable:eb(t),...db(e,cb(t))}}function mb(e,t){let n=t&&Object.hasOwn(t,`schedule`)?sb(t.schedule):void 0;return{updateAvailable:tb(t?.updateAvailable),...n===void 0?{}:db(e,n)}}function hb(e,t=Date.now()){let n=e?.campaign;return n?n.state===`applying`?F(`updates.campaign.applying`):n.holdUntilMs!==void 0&&n.holdUntilMs>t?F(`updates.campaign.held`,{time:ze(n.holdUntilMs,t)}):n.state===`waiting-for-idle`?F(`updates.campaign.waitingForIdle`,{time:ze(n.forceAtMs,t)}):F(`updates.campaign.countdown`,{time:ze(n.applyAtMs??n.forceAtMs,t)}):null}function gb(e,t){let n=e?.target;if(n?.kind===`package`||e?.install?.kind===`package`)return null;let r=e?.install?.git;if(e?.campaign&&n?.kind===`git`){let e=t?.upstreamSha===n.upstreamSha&&(!r?.currentSha||r.currentSha===t.currentSha)?t.currentSha:void 0;return{upstreamSha:n.upstreamSha,...e?{currentSha:e,repositoryUrl:t?.repositoryUrl,commitsBehind:t?.commitsBehind}:{}}}return r&&r.status!==`unavailable`?{currentSha:r.currentSha,upstreamSha:r.upstreamSha,repositoryUrl:r.repositoryUrl,commitsBehind:`commitsBehind`in r&&r.commitsBehind}:t?.upstreamSha||t?.commitsBehind!==void 0?t:n?.kind===`git`?{upstreamSha:n.upstreamSha,commitsBehind:n.commitsBehind}:null}function _b(e,t){let n=e?.target,r=gb(e,t);if(r){let e=r.commitsBehind;return typeof e==`number`?F(e===1?`updates.target.commitBehind`:`updates.target.commitsBehind`,{count:String(e)}):null}let i=n?.kind===`package`?n.version:t?.latestVersion;return i?F(`updates.target.version`,{version:i}):null}function vb(e,t){let n=gb(e,t);if(!n?.upstreamSha||n.commitsBehind===!1)return null;let{currentSha:r,upstreamSha:i,repositoryUrl:a}=n;return{currentSha:r,targetSha:i,compareUrl:a&&/^https:\/\/github\.com\/[\w.-]+\/[\w.-]+$/u.test(a)&&r&&/^[a-f\d]{7,40}$/iu.test(r)&&/^[a-f\d]{7,40}$/iu.test(i)?`${a}/compare/${r}...${i}`:void 0}}function yb(e,t,n){let r=gb(t,e)?.commitsBehind;return!!(n||t?.campaign||r!==!1&&(e?.latestVersion!==e?.currentVersion||r))}function bb(){return(bb=e((()=>{N(),mt(),ub()})))()}function xb(e){let t=e?.stats?.runId?.trim()||e?.stats?.handoffId?.trim();return t&&t.length<=256?t:null}function Sb(e){if(e?.kind!==`update`||!e.status)return null;let t=e.stats,n=to({status:e.status,reason:t?.reason??void 0}),r=n!==`succeeded`&&n!==`pending`,i=r?wb(e):null,a=r&&typeof e.ts==`number`?{timestampMs:e.ts,status:e.status,reason:t?.reason?.trim()||`unexpected-error`,installKind:t?.mode?.trim()||null,beforeVersion:t?.before?.version?.trim()||null,beforeSha:t?.before?.sha?.trim()||null,afterVersion:t?.after?.version?.trim()||null,afterSha:t?.after?.sha?.trim()||null,failure:i}:null,o=r?Ab({status:e.status,reason:t?.reason??void 0,cause:i}):null;o&&n===`failed`&&(o.text+=` ${F(`updates.triage.hostHint`)}`);let s={id:xb(e)??(typeof e.ts==`number`?`recorded:${e.ts}`:null),timestampMs:e.ts??null};return{attempt:a,banner:o,failure:n===`failed`&&s.id&&o?{id:s.id,outcome:n,attempt:a,banner:o,reconciledRecord:s}:null}}function Cb(e){let t=en(e).split(`
`).map(e=>e.trim()).filter(Boolean).at(-1);return t?t.slice(0,Nb):null}function wb(e){let t=e?.stats?.steps,n=Array.isArray(t)?t.findLast(e=>typeof e?.log?.exitCode==`number`&&e.log.exitCode!==0):void 0,r=Cb(n?.log?.stderrTail)??Cb(n?.log?.stdoutTail),i=n?.name?.trim();return i&&r?{step:i,detail:r}:null}function Tb(e){let t=0,n=0,r=0,i=0,a=async(o=`manual`)=>{let s=e.getClient(),c=e.getEpoch();if(!s||!e.canRefresh()||!e.isCurrent(s,c))return!1;let l=o===`manual`,u=l?++n:++t,d=e.getRevision(),f=r,p=i,m=()=>u===(l?n:t)&&e.isCurrent(s,c),h=()=>m()&&e.canRefresh()&&d===e.getRevision();l&&e.onRefreshing(!0);try{let t=s.request(`update.status`,l?{refreshCheckout:!0}:{},l?void 0:{timeoutMs:5e3}).catch(t=>(o!==`background`&&h()&&e.onError(t,o),null)),n=l?a(`background`):null,c=await t;if(c&&h()){if(l){r++;let t=p!==i,{activeRun:o,lastRun:s,sentinel:l}=c;(!t||o||s)&&e.onStatus({activeRun:o,lastRun:s,...t?{}:{sentinel:l}}),e.onCheckout(c,t),n?.then(()=>{h()&&a(`background`)})}else i++,e.onError(null,`completion`),e.onStatus(c,f!==r);return!0}return!1}finally{l&&m()&&e.onRefreshing(!1)}};return a}function Eb(e,t,n=!1){let r=Sb(e.sentinel);return{failure:r?.failure??null,updateStatusBanner:r?r.banner:t.updateStatusBanner,recordedUpdateAttempt:r?r.attempt:t.recordedUpdateAttempt,...Db(e,t,n?`install`:void 0)}}function Db(e,t,n){let r=Object.hasOwn(e,`schedule`)?sb(e.schedule):void 0,i=n===`schedule`?t.updateSchedule:r,a=n===`schedule`?r:t.updateSchedule;return n&&i&&a?.channel===i.channel&&a.install&&(i={...i,install:a.install}),{...n!==`schedule`&&Object.hasOwn(e,`updateAvailable`)?{updateAvailable:tb(e.updateAvailable)}:{},...i===void 0?{}:{updateSchedule:i,heldUpdateCampaignId:fb(i,t.heldUpdateCampaignId)}}}function Ob(e){if(uo(e)||e.status!==`failed`&&e.status!==`rolled-back`)return null;let t=e.steps.findLast(e=>e.status===`failed`);return{id:e.runId,reconciledRecord:{id:e.runId,timestampMs:e.finishedAtMs??e.updatedAtMs},outcome:`failed`,banner:{tone:e.reason===`legacy-driver-expired`?`warn`:`danger`,text:Mo(e).markdown},attempt:{timestampMs:e.finishedAtMs??e.updatedAtMs,status:e.status,reason:e.reason??`unexpected-error`,installKind:e.target.kind??null,beforeVersion:e.before.version??null,beforeSha:e.before.sha??null,afterVersion:e.after.version??null,afterSha:e.after.sha??null,failure:t?{step:t.step,detail:t.detail??``}:null}}}function kb(e){return{tone:`warn`,text:F(`updates.checkError`,{error:xi(e)})}}function Ab(e){let t=(e.status??`error`).trim()||`error`,n=(e.reason??`unexpected-error`).trim()||`unexpected-error`,r=Object.hasOwn(Mb,n)?Mb[n]:void 0,i=F(r??`updates.failureReasons.default`),a=e.cause;return{tone:t===`skipped`?`warn`:`danger`,text:a?`${F(`updates.failedAtStep`,{step:a.step,cause:a.detail})} ${i}`:F(`updates.status`,{status:t,reason:n,guidance:i})}}function jb(){return{tone:`danger`,text:F(`updates.outcomeUnknown`)}}var Mb,Nb;function Pb(){return(Pb=e((()=>{Ya(),So(),Co(),oo(),N(),hi(),ub(),bb(),Mb={dirty:`updates.failureReasons.dirty`,"no-upstream":`updates.failureReasons.noUpstream`,"not-git-install":`updates.failureReasons.notGitInstall`,"not-openclaw-root":`updates.failureReasons.notOpenclawRoot`,"deps-install-failed":`updates.failureReasons.depsInstallFailed`,"build-failed":`updates.failureReasons.buildFailed`,"build-dirty":`updates.failureReasons.buildDirty`,"ui-build-failed":`updates.failureReasons.uiBuildFailed`,"global-install-failed":`updates.failureReasons.globalInstallFailed`,"restart-disabled":`updates.failureReasons.restartDisabled`,"restart-unavailable":`updates.failureReasons.restartUnavailable`,"external-supervisor-update-required":`updates.failureReasons.externalSupervisorUpdateRequired`,"restart-unhealthy":`updates.failureReasons.restartUnhealthy`,"restart-revision-mismatch":`updates.failureReasons.restartRevisionMismatch`,"restart-revision-unavailable":`updates.failureReasons.restartRevisionUnavailable`,"already-current":`updates.failureReasons.alreadyCurrent`,"managed-service-handoff-already-running":`updates.failureReasons.managedServiceHandoffAlreadyRunning`,"managed-service-handoff-unavailable":`updates.failureReasons.managedServiceHandoffUnavailable`,"doctor-failed":`updates.failureReasons.doctorFailed`,"managed-service-handoff-failed":`updates.failureReasons.managedServiceHandoffFailed`,"managed-service-handoff-spawn-failed":`updates.failureReasons.managedServiceHandoffSpawnFailed`,"managed-service-handoff-helper-failed":`updates.failureReasons.managedServiceHandoffFailed`,"managed-service-handoff-parent-timeout":`updates.failureReasons.managedServiceHandoffParentTimeout`},Nb=180})))()}function Fb(){let e=ge(),t=()=>{try{let t=e?.getItem(Ib);if(t==null)return[];let n=t.length<32768?JSON.parse(t):null;return Array.isArray(n)&&n.every(e=>typeof e==`string`)?n.slice(-32):null}catch{return null}},n=(e,t,n)=>JSON.stringify([e,t,n]);return{acknowledged:(e,r,i)=>(t()??[]).includes(n(e,r,i)),acknowledge:(r,i,a)=>{try{let o=t();if(!e||!o)return!1;let s=[...new Set([...o,n(r,i,a)])].slice(-32);return e.setItem(Ib,JSON.stringify(s)),!0}catch{return!1}}}}var Ib;function Lb(){return(Lb=e((()=>{Ib=`openclaw:control-ui:update-acknowledged:v1`})))()}function Rb(e,t,n={}){let r={updateAvailable:null,updateSchedule:null,heldUpdateCampaignId:null,updateRunning:!1,updateStatusRefreshing:!1,updateCampaignStatusHydrated:!0,updateReconciliationPending:!1,updateStatusBanner:null,updateStatusCheckBanner:null,recordedUpdateAttempt:null,diagnosableUpdateFailureId:null,reportableUpdateFailureId:null,updateFailureReportBusy:!1,updateFailureReportNotice:null,updateRun:null,updateRunAcknowledged:!1,controlUiRefreshRequired:!1},i=!1,a=e.snapshot.client,o=e.snapshot.hello,s=null,c=0,l=qf(e.snapshot),u=G(e.connection.gatewayUrl),d=e.snapshot.selfUser?.id??null,f=Fb(),p=!1,m=0,h=0,g=0,_=!1,v=null,y={kind:`unknown`},b=null,x=null,S=0,C=Zy({getClient:()=>e.snapshot.client,isCurrent:(t,n)=>T(n)&&!r.updateRunning&&!r.updateReconciliationPending&&r.reportableUpdateFailureId===t&&Xy(e.snapshot),setBusy:e=>{r={...r,updateFailureReportBusy:e},D()},setResult:(e,t)=>{r={...r,updateFailureReportNotice:{attemptId:e,result:t}}}});function ee(){C.invalidate(),r={...r,updateFailureReportBusy:!1,updateFailureReportNotice:null}}function w(e){JSON.stringify(x)!==JSON.stringify(e)&&(x=e,ee())}let T=t=>!i&&a===t&&e.snapshot.client===t&&e.snapshot.phase===`connected`&&qf(e.snapshot).canAdmin;function E(t){let i=x,o=u,s=d,l=a,f=c;if(!i||i.id!==t||!l||!T(l)||r.updateRunning||r.updateFailureReportBusy||r.updateReconciliationPending)return;let p=++S,m=()=>p===S&&f===c&&T(l)&&x===i&&G(e.connection.gatewayUrl)===o&&(e.snapshot.selfUser?.id??null)===s&&!r.updateRunning&&!r.updateReconciliationPending,h=!1;n.onUpdateFailure?.(i,{isCurrent:m,admit:()=>h||!m()?!1:(h=!0,!0)})}function D(e=!1){let n=r.updateSchedule?.campaign,i=n?.state===`applying`&&r.updateRun?.origin.campaignId!==n.id;r={...r,updateRunning:p||r.updateRun?.status===`running`||i,updateReconciliationPending:v!==null&&(!r.updateRun||r.updateRun.status===`running`)},i&&w(null),r={...r,diagnosableUpdateFailureId:x&&r.updateRun?.target.installationMethod!==`ocm`&&a&&T(a)&&!r.updateRunning&&!r.updateReconciliationPending?x.id:null,reportableUpdateFailureId:r.updateRunning||r.updateReconciliationPending||r.updateRun?.target.installationMethod===`ocm`?null:r.updateRun?!uo(r.updateRun)&&ko(r.updateRun)?r.updateRun.runId:null:x?.outcome===`failed`&&x.attempt?x.id:null},t(),e&&re.sync()}let O=(e,t)=>{r={...r,updateStatusBanner:{...t?{source:t}:{},tone:`danger`,text:F(`updates.error`,{error:xi(e)})}},D()},k=e=>{let t=r.updateRun;if(t?.runId===e.runId&&t.updatedAtMs>e.updatedAtMs){D();return}(t?.runId!==e.runId||t.updatedAtMs!==e.updatedAtMs)&&ee(),v=e.runId,b=null;let n=Ob(e);w(n),r={...r,updateRun:e,updateRunAcknowledged:uo(e)||f.acknowledged(u,d,e.runId),recordedUpdateAttempt:n?.attempt??null,updateStatusBanner:n?.banner??null},D(!0)},A=async()=>{let e=a,t=v;if(!e||!t||!T(e))return;let n=++g,i=c,o=()=>n===g&&i===c&&t===v&&T(e);try{let n=await e.request(`update.runs.get`,{runId:t});if(!o())return;n.run?(k(n.run),n.run.status!==`running`&&te(`completion`)):(v=null,w(null),r={...r,updateRun:null,updateStatusBanner:jb()},D())}catch(e){o()&&O(e,`read`)}},te=Tb({getClient:()=>a,getEpoch:()=>c,getRevision:()=>m,canRefresh:()=>!i&&l.canAdmin,isCurrent:(e,t)=>t===c&&T(e),onRefreshing:e=>{r={...r,updateStatusRefreshing:e},D()},onStatus:(e,t=!1)=>{let{failure:n,updateStatusBanner:i,recordedUpdateAttempt:a,...o}=Eb(e,r,t),s=e.activeRun??e.lastRun,c=b?.history,l=c!==void 0&&(!s||c.kind===`known`&&s.runId===c.runId||c.kind===`unknown`&&s.status!==`running`&&s.runId!==v);y={kind:`known`,runId:s?.runId??null},r={...r,...o,updateCampaignStatusHydrated:!0},s&&!l&&(!r.updateRun||s.runId===r.updateRun.runId||s.createdAtMs>=r.updateRun.createdAtMs)?k(s):(!r.updateRun&&!l&&(w(n),r={...r,updateStatusBanner:i,recordedUpdateAttempt:a}),D()),re.sync()},onCheckout:(e,t)=>{r={...r,...Db(e,r,t?`schedule`:void 0),updateStatusCheckBanner:null},D(!0)},onError:(e,t)=>{(t!==`completion`||r.updateStatusCheckBanner?.mode!==`manual`)&&(e!==null||r.updateStatusCheckBanner!==null)&&(r={...r,updateStatusCheckBanner:e===null?null:{...kb(e),mode:t}},D())}}),ne=()=>v?.startsWith(`ocm:`)&&r.updateReconciliationPending,re=Yy({canPoll:()=>!!(a&&T(a)&&(r.updateSchedule?.campaign||ne())),refresh:async()=>{ne()?await A():await te(`background`)}}),j=(e,t)=>n.connectionBootstrap?.run(e,t)??t();return{get snapshot(){return r},synchronizeGateway:t=>{let n=G(e.connection.gatewayUrl),i=t.selfUser?.id??null,f=qf(t),_=!l.canAdmin&&f.canAdmin,x=t.phase===`connected`,S=n!==u||x&&i!==d||!!t.hello?.auth&&!f.canAdmin;S&&(C.invalidate(),h++,g++,m++,v=null,y={kind:`unknown`},b=null,p=!1,w(null),r={...r,updateRun:null,updateRunAcknowledged:!1,updateStatusRefreshing:!1,updateStatusBanner:null,updateStatusCheckBanner:null,recordedUpdateAttempt:null,heldUpdateCampaignId:null}),u=n,x&&(d=i);let ee=x?t.client:null,T=s!==ee,E=o!==t.hello;if(l=f,a=t.client,o=t.hello,s=ee,T&&(C.invalidate(),r={...r,updateFailureReportBusy:!1},b?.requestSent&&!v&&!r.updateRun&&!r.updateStatusBanner&&(r={...r,updateStatusBanner:jb()}),c++,g++,m++,h++,p=!1),!x||!t.client){r={...r,updateAvailable:null,updateSchedule:null,updateStatusRefreshing:!1,updateCampaignStatusHydrated:!0},re.stop(),t.phase===`reload-required`?r={...r,controlUiRefreshRequired:!0}:t.client?t.hello&&(r={...r,controlUiRefreshRequired:!0}):(c=0,r={...r,controlUiRefreshRequired:!1}),D();return}let O={version:t.hello?.server?.version,buildId:t.hello?.server?.buildId,controlUiBuildSource:t.hello?.server?.controlUiBuildSource};r={...r,...T||E?pb(r,t.hello):{},controlUiRefreshRequired:T?!sc(e.connection.gatewayUrl)&&(!!O.buildId?.trim()||c>1)&&Ml(O):r.controlUiRefreshRequired},D(!0),(T||S||_)&&l.canAdmin&&j(`update-run`,()=>v?A():te(`background`))},handleUpdateRunChanged(e){let t=b?.history;if(!q(e)||typeof e.runId!=`string`||t?.kind===`known`&&e.runId===t.runId||!v&&t?.kind===`unknown`&&e.status!==`running`||typeof e.updatedAtMs!=`number`||!a||!T(a))return;let n=r.updateRun;n?.runId===e.runId&&e.updatedAtMs<=n.updatedAtMs||(w(null),C.invalidate(),r={...r,updateFailureReportBusy:!1},D(),m++,v&&v!==e.runId?te(`completion`):(v=e.runId,A()))},handleUpdateAvailable(e){if(i)return;let t=r.updateSchedule?.campaign;m++,r={...r,...mb(r,e)},D(!0),t?.state===`applying`&&r.updateSchedule?.campaign?.state!==`applying`&&te(`completion`)},refreshUpdateStatus:te,diagnoseUpdateFailure:E,acknowledgeUpdateRun(){let e=r.updateRun;e&&e.status!==`running`&&(f.acknowledge(u,d,e.runId),r={...r,updateRunAcknowledged:!0},D())},async runUpdate(){let e=a;if(!e||!T(e)||r.updateRunning||r.updateReconciliationPending)return;let t=++h,i=n.getActiveSessionKey?.();m++,g++;let o={history:r.updateRun?{kind:`known`,runId:r.updateRun.runId}:y,requestSent:!1};b=o,v=null,p=!0,w(null),r={...r,updateRun:null,updateRunAcknowledged:!1,updateStatusBanner:null,updateStatusCheckBanner:null,recordedUpdateAttempt:null},D();let s=()=>t===h&&T(e);try{if(await n.drainConfigWrites?.(),!s()||r.updateSchedule?.campaign?.state===`applying`)return;let t=await e.request(`update.run`,i?{sessionKey:i}:{},{onSent:()=>{o.requestSent=!0}});if(!s())return;if(t.runId)v=t.runId,await A();else{let e=Sb(t.sentinel?.payload);w(e?.failure??null),r={...r,recordedUpdateAttempt:e?.attempt??null,updateStatusBanner:e?.banner??Ab({status:t.result?.status??`error`,reason:t.result?.reason})}}}catch(e){s()&&(O(e),o.requestSent&&!(e instanceof mm)&&await te(`completion`))}finally{s()&&(p=!1,D(!0))}},async holdUpdate(){let t=e.snapshot.client,n=r.updateSchedule?.campaign,a=_||r.updateRunning||r.updateReconciliationPending;if(!t||e.snapshot.phase!==`connected`||i||a||!n||n.state===`applying`||r.heldUpdateCampaignId===n.id||!qf(e.snapshot).canAdmin)return!1;let o=h,s=m,c=()=>o===h&&T(t);_=!0;try{let e=await t.request(`update.hold`,{});if(!c())return!1;let i=e.schedule&&sb(e.schedule);return s===m&&(i!==void 0||e.ok)&&(m+=1,r={...r,...i===void 0?{}:{updateSchedule:i},heldUpdateCampaignId:e.ok?n.id:fb(i??r.updateSchedule,r.heldUpdateCampaignId)},D()),e.ok}catch(e){return c()&&s===m&&O(e),!1}finally{_=!1}},reportUpdateFailure:C.report,dispose(){i=!0,C.invalidate(),h++,g++,re.stop()}}}function zb(){return(zb=e((()=>{So(),oo(),Nm(),Pl(),N(),hi(),tp(),Qy(),Pb(),Lb(),ub(),bb()})))()}function Bb(e,t={}){let r=Rb(e,_,t),i=(e,n)=>t.connectionBootstrap?.run(e,n)??n(),a={...r.snapshot,approvalQueue:[],approvalBusy:!1,approvalCanGrant:!1,approvalErrors:new Map,devicePairSetupOpen:!1,devicePairSetupLifecycle:{phase:`selection`,access:`full`},devicePairPendingCount:0},o=new Set,s=!1,c=e.snapshot.client,l=null,u=0,d=qf(e.snapshot),f=0,p=0,m=null,h=wt({client:e.snapshot.client,connected:e.snapshot.phase===`connected`,onChange:()=>_()}),g={client:c,execApprovalQueue:[],execApprovalBusy:!1,execApprovalErrors:new Map,execApprovalExpiryTimers:new Map};function _(){a={...a,...r.snapshot,approvalQueue:g.execApprovalQueue,approvalBusy:g.execApprovalBusy,approvalCanGrant:qf(e.snapshot).canGrantApprovals,approvalErrors:new Map(g.execApprovalErrors),...Ur(h)};for(let e of o)e(a)}g.execApprovalChanged=_;let v=Ky({gateway:e,state:h,isDisposed:()=>s,publish:_}),y=async e=>{_(),await e,s||(Jt(h,_),_())},b=t=>!s&&c===t&&e.snapshot.client===t&&e.snapshot.phase===`connected`,x=qy({gateway:e,state:g,getConnectedEpoch:()=>u,getReviewGeneration:()=>f,canReview:()=>d.canReviewApprovals,isCurrentClient:b,isDisposed:()=>s,publish:_}),S=e=>{let t=c,n=e.phase===`connected`,a=n?e.client:null,o=l!==a,s=Gy(d,e);if(d=s.access,s.reviewChanged&&(f+=1),s.grantChanged&&(p+=1),s.grantRevoked){let e=m;e&&g.execApprovalQueue.some(t=>t.id===e.id)&&g.execApprovalErrors.set(e.id,F(`execApproval.reviewOnly`)),m=null,g.execApprovalBusy=!1}if((s.adminRevoked||s.pairingSetupRevoked)&&(Dr(h),v.invalidate({clear:!0})),s.pairingChanged&&v.invalidate({clear:!(d.canAdmin||d.canPair)}),c=e.client,l=a,g.client=e.client,h.client=e.client,h.connected=n,(t!==e.client||!n)&&(m=null,v.invalidate({clear:!0}),Dr(h)),n&&!d.canReviewApprovals&&(m=null),(!n||!e.client||!d.canReviewApprovals)&&(g.execApprovalQueue=[],g.execApprovalBusy=!1,g.execApprovalErrors.clear(),Iy(g)),!n||!e.client){e.phase!==`reload-required`&&!e.client&&(u=0),r.synchronizeGateway(e);return}let _=e.client;r.synchronizeGateway(e),s.pairingChanged&&h.devicePairSetupOpen&&(d.canAdmin||d.canPair)&&i(`pairing-pending-count`,()=>v.refresh()).catch(()=>void 0),o&&(u+=1),(o||s.reviewChanged)&&d.canReviewApprovals&&i(`approvals`,()=>x(_,u,f)).catch(()=>void 0)},C=e.subscribe(S),ee=e.subscribeEvents(t=>{if(s)return;if(t.event===`device.pair.setup.completed`){let e=n(t.payload);e&&de(h,e);return}if(t.event===`device.pair.setup.deliveryUncertain`){let e=gn(t.payload);e&&At(h,e);return}if(t.event===`device.pair.requested`||t.event===`device.pair.resolved`){v.refresh();return}if(t.event===`update.available`){r.handleUpdateAvailable(t.payload);return}if(t.event===`update.run.changed`){r.handleUpdateRunChanged(t.payload);return}if(!d.canReviewApprovals||!qf(e.snapshot).canReviewApprovals)return;let i=Ey(t.event,t.payload);if(i){Ly(g,i),_();return}let a=Ty(t.event,t.payload);a&&(zy(g,a.id),_())});return S(e.snapshot),{get snapshot(){return a},subscribe:e=>io(o,e),refreshUpdateStatus:r.refreshUpdateStatus,acknowledgeUpdateRun:r.acknowledgeUpdateRun,runUpdate:r.runUpdate,holdUpdate:r.holdUpdate,diagnoseUpdateFailure:r.diagnoseUpdateFailure,reportUpdateFailure:r.reportUpdateFailure,async decideApproval(t,n,r){let i=n?g.execApprovalQueue.find(e=>e.id===n)??(r?.id===n?r:void 0):g.execApprovalQueue[0],a=e.snapshot.client;if(!i||g.execApprovalBusy||s)return;let o=i===r;if(!a||e.snapshot.phase!==`connected`){g.execApprovalErrors.set(i.id,F(`sessionsView.actionRequiresConnection`)),_();return}if(!qf(e.snapshot).canGrantApprovals){g.execApprovalErrors.set(i.id,F(`execApproval.reviewOnly`)),_();return}g.execApprovalBusy=!0,g.execApprovalErrors.delete(i.id);let l={client:a,epoch:u,accessGeneration:f,grantGeneration:p,id:i.id};m=l;let d=()=>m===l&&l.epoch===u&&l.accessGeneration===f&&l.grantGeneration===p&&qf(e.snapshot).canGrantApprovals&&b(l.client);_();try{if(await Dy(a,i,t),!d())return;zy(g,i.id)}catch(e){if(ky(e)){if(!d())return;zy(g,i.id);let e=c,t=u;e&&d()&&await x(e,t);return}d()&&(o||g.execApprovalQueue.some(e=>e.id===i.id))&&g.execApprovalErrors.set(i.id,`Approval failed: ${xi(e)}`)}finally{m===l&&(m=null,g.execApprovalBusy=!1,_())}},async openDevicePairSetup(){let t=qf(e.snapshot);if(s||!t.canAdmin&&!t.canPair)return!1;h.pendingCount=0;let n=We(h);return v.refresh(),await y(n),h.devicePairSetupOpen},async refreshDevicePairSetup(){!s&&qf(e.snapshot).canAdmin&&await y(_r(h))},async setDevicePairSetupAccess(t){!s&&qf(e.snapshot).canAdmin&&await y(Un(h,t))},closeDevicePairSetup(){v.invalidate({clear:!0}),Dr(h),_()},dispose(){s=!0,m=null,r.dispose(),v.invalidate(),Dr(h),C(),ee(),Iy(g),g.execApprovalErrors.clear(),o.clear()}}}function Vb(){return(Vb=e((()=>{Yo(),N(),yt(),hi(),Uy(),tp(),Jy(),zb()})))()}function Hb(e,t){return e.phase===`connected`&&Xf(e.hello?.auth??null)&&Vi(e,t)===!0}function Ub(e){return Hb(e,`browser.request`)}function Wb(e){return Ub(e)||Bi(e,`browser.dashboard.request`,`operator.sessions.write`)}function Gb(e){return Zd()||Ub(e)}function Kb(e){return Hb(e,`desktop.observe`)}function qb(e){if(!e)return!1;let t=e.snapshot,n=e.connection.gatewayUrl;if(t.phase===`connected`){let r=Bi(t,`chat.history`,`operator.read`)&&Bi(t,`chat.send`,`operator.write`);return Jb.set(e,{gatewayUrl:n,allowed:r}),r}let r=Jb.get(e);return r?.gatewayUrl!==n||t.phase===`reload-required`?(Jb.delete(e),!1):r.allowed}var Jb;function Yb(){return(Yb=e((()=>{Hi(),tp(),Jb=new WeakMap})))()}function Xb(e){let t=e.snapshot,n=t.selfUser?.id;return t.phase===`connected`&&n&&e.connection.gatewayUrl?`${cx}${JSON.stringify([G(e.connection.gatewayUrl),n])}`:null}function Zb(e){if(!e)return{};let t=ge();if(!t)return{};try{let n=JSON.parse(t.getItem(e)??`null`),r=es(n);if(!r)return{};let i={};for(let e of sx){let t=r[e],n=Array.isArray(t)?t.filter(e=>typeof e==`string`):[];n.length>0&&(i[e]=[...new Set(n)])}return i}catch{return{}}}function Qb(e,t){if(!e)return;let n=ge();if(n)try{Object.keys(t).length===0?n.removeItem(e):n.setItem(e,JSON.stringify(t))}catch{}}function $b(e,t){if(!e)return{};let n=Zb(e),r={...n,[t.kind]:[...new Set([...n[t.kind]??[],t.signature])]};return Qb(e,r),r}function ex(e){return(e.state.phase===`guidance`||e.state.phase===`available`)&&e.scopes?{kind:`scopeUpgrade`,signature:JSON.stringify([e.state.phase,...e.scopes.toSorted()])}:null}function tx(e){let t=e.updateSchedule?.target,n=(t?.kind===`package`?t.version:t?.upstreamSha)??e.updateAvailable?.upstreamSha??e.updateAvailable?.latestVersion,r=e.gatewayBootId?.trim(),i=n?.trim();return r&&i?{kind:`updateAvailable`,signature:JSON.stringify([i,r])}:null}function nx(e){return e===`warn`||e===`danger`}function rx(e,t){return e[t.kind]?.includes(t.signature)===!0}function ix(e,t,n){let r={},i=!1;for(let a of sx){let o=e[a];if(!o)continue;let s=o.filter(e=>!(!n||(a===`modelAuthExpired`?n.modelAuthAgentId&&(!e.startsWith(`agent:`)||e.startsWith(`agent:${n.modelAuthAgentId}\n`)):a!==`cronFailed`&&a!==`cronOverdue`||n.cronInventoryComplete))||t.some(t=>t.kind===a&&t.signature===e));s.length>0&&(r[a]=s),s.length!==o.length&&(i=!0)}return i?r:e}function ax(e){let t=Zb(e.key),n=ix(t,e.active,e.scope);return n!==t&&Qb(e.key,n),n}function ox(e,t){let n=Zb(e);if(!n[t])return n;let r={...n};return delete r[t],Qb(e,r),r}var sx,cx;function lx(){return(lx=e((()=>{sx=[`outbox`,`cronFailed`,`cronOverdue`,`modelAuthExpired`,`scopeUpgrade`,`updateAvailable`],cx=`openclaw.control.sidebarAttention.v2:`})))()}function ux(e){let t=new Set,n=null,r=()=>{for(let e of t)e()},i=()=>{let t=e.gateway.snapshot,r=t.hello?.auth?.scopes;t.phase===`connected`&&r&&!ex({scopes:r,state:e.scopeUpgrade.state})&&ox(Xb(e.gateway),`scopeUpgrade`),n?.syncDismissals()},a=e.gateway.subscribe(i),o=e.scopeUpgrade.subscribe(i);return i(),{get entries(){return n?.entries??[]},activate(t){return n??=new t(e,r),n.mentions},dismiss(e){n?.dismiss(e)},subscribe:e=>io(t,e),dispose(){a(),o(),n?.dispose(),n=null,t.clear()}}}function dx(){return(dx=e((()=>{lx()})))()}function fx(){let e=new AbortController,t=new Set,n=n=>{if(e.signal.aborted){n();return}t.add(n)};return{signal:e.signal,addDisposer:n,async run(t){for(let r of t){if(e.signal.aborted)return;let t=await r();t&&n(t)}},trackDisposer(t,r){t.then(n).catch(t=>{e.signal.aborted||r(t)})},stop(){e.abort();for(let e of[...t].toReversed())e();t.clear()}}}function px(e,t){let n=t?`${t}/`:`/`;if(e.pathname!==n)return e;let r=new URLSearchParams(e.search);if(r.get(`view`)!==`terminal`)return e;r.delete(`view`);let i=r.toString();return{pathname:qa({kind:`terminal`},t),search:i?`?${i}`:``,hash:e.hash}}function mx(e,t){let n=e,r=!1,i=null,a=null,o=null,s=null,c=null,l=null,u=e=>{Object.entries(e).every(([e,t])=>n[e]===t)||(n={...n,...e},r=!0)},d=typeof window>`u`?void 0:window.__OPENCLAW_NATIVE_CONTROL_AUTH__,f=new URLSearchParams(t.hash.replace(/^#/,``)).get(`nativeControlAuth`),p=d??(f?{gatewayUrl:f,nativeConnectAuth:!0}:void 0);if(p){try{delete window.__OPENCLAW_NATIVE_CONTROL_AUTH__}catch{window.__OPENCLAW_NATIVE_CONTROL_AUTH__=void 0}let e=V(p.gatewayUrl),t=V(p.token),r=V(p.password),a=e?cg(n.gatewayUrl,e,{token:n.token,password:``}):null,o=p.client,s=yo(o?.id),c=qi(o?.mode),m=V(o?.platform),h=V(o?.deviceFamily),g=V(o?.instanceId),_=La(o?.scopes);s&&c&&m&&h&&_.length>0&&(l={clientName:s,mode:c,platform:m,deviceFamily:h,...g?{instanceId:g}:{},scopes:_}),p.nativeConnectAuth===!0&&e&&(l={nativeConnectAuth:Xp(e,{messagePort:!d&&!!f})}),u({...e?{gatewayUrl:e}:{},...p.nativeConnectAuth===!0?{token:``}:p.token===null||t?{token:t??``}:a?{token:a.token}:{}}),r&&p.nativeConnectAuth!==!0&&(i=r)}if(!t.search&&!t.hash)return{settings:n,password:i,pendingGatewayUrl:a,pendingGatewayToken:o,pendingBootstrapToken:s,pendingBootstrapProfile:c,nativeClient:l,location:t,changed:r};let m=new URL(`${t.pathname}${t.search}${t.hash}`,`http://openclaw.local`),h=new URLSearchParams(m.search),g=new URLSearchParams(m.hash.startsWith(`#`)?m.hash.slice(1):m.hash),_=h.get(`gatewayUrl`)??g.get(`gatewayUrl`),v=V(_)??``,y=!!(v&&v!==n.gatewayUrl),b=h.get(`token`),x=g.get(`token`),S=x!=null||b!=null,C=V(x??b),ee=g.has(`bootstrapToken`),w=V(g.get(`bootstrapToken`)),T=V(g.get(Ta)),E=Ds(t.pathname,Is(t.pathname)),D=!(!C||E||y);S&&(b!=null&&console.warn(`[openclaw] Auth token passed as query parameter (?token=). Use URL fragment instead: #token=<token>. Query parameters may appear in server logs.`),C&&y?o=C:C&&u({token:C})),ee&&(s=w??null,c=w&&T===`owner`?Ki:null),D&&u({sessionKey:`main`,lastActiveSessionKey:`main`}),_!=null&&(a=y?v:null,(!y||s)&&(o=null));let O=!1;for(let e of[h,g]){let t=[`token`,`password`,`gatewayUrl`];e===g&&t.push(`bootstrapToken`,Ta);for(let n of t)e.has(n)&&(e.delete(n),O=!0)}if(O){m.search=h.toString();let e=g.toString();m.hash=e?`#${e}`:``}return{settings:n,password:i,pendingGatewayUrl:a,pendingGatewayToken:o,pendingBootstrapToken:s,pendingBootstrapProfile:c,nativeClient:l,location:O?{pathname:m.pathname,search:m.search,hash:m.hash}:t,changed:r}}function hx(){return(hx=e((()=>{Ea(),lo(),la(),Sa(),Y(),Qp(),Hg()})))()}function gx(e,t){let n=async()=>{await e.refreshUpdateStatus(`completion`)},r=()=>{let r=e.snapshot;t.setWritesSuspended(r.updateRunning||r.updateReconciliationPending,n)},i=e.subscribe(r);return r(),i}async function _x(e,t,n){try{let{presentUpdateFailureTriage:r}=await W(async()=>{let{presentUpdateFailureTriage:e}=await import(`./update-triage.runtime-CQQNKtdD.js`);return{presentUpdateFailureTriage:e}},__vite__mapDeps([98,1,97,99,80,30]),import.meta.url);r(e,t,n)}catch{n.isCurrent()&&e.navigate(`updates`)}}function vx(){return(vx=e((()=>{U()})))()}function yx(e,t={}){let n=globalThis.navigator,r=!je()||n.standalone===!0,i=r&&`serviceWorker`in n&&`PushManager`in globalThis&&`Notification`in globalThis,a={supported:i,permission:r?i?Notification.permission:`unsupported`:`install-required`,subscription:`unknown`,loading:!1},o=new Set,s=e=>{Object.assign(a,e);for(let e of o)e()},c=a.supported?W(async()=>{let{createWebPushCapabilityRuntime:e}=await import(`./control-ui-boot-shared-XreXSF7h.js`).then(e=>(e.$i(),e.ea));return{createWebPushCapabilityRuntime:e}},__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,30,31,32,33]),import.meta.url).then(({createWebPushCapabilityRuntime:n})=>n({gateway:e,publish:s,connectionBootstrap:t.connectionBootstrap})).catch(e=>(s({supported:!1,permission:`unsupported`,subscription:`unknown`,preferences:null,error:xi(e)}),null)):null;return{snapshot:a,subscribe:e=>io(o,e),run:e=>c?c.then(t=>t?.run(e)):Promise.resolve(),dispose(){c?.then(e=>e?.dispose()),o.clear()}}}function bx(){return(bx=e((()=>{hi(),U()})))()}function xx(){let e=wc(),t=e.location(),[n,r]=yc(t.pathname||globalThis.location?.pathname||`/`),i=Gm(t.pathname,n),a=dg(),o=i?ng(a):a,s=mx(o,t),c=po(s.settings.gatewayUrl)===po(o.gatewayUrl)?null:og(s.settings.gatewayUrl),l=c?{...s.settings,...c,selectedAgentId:c.selectedAgentId}:s.settings;zs(s.location,t)||e.replace(s.location),s.changed&&!i&&gg(l);let u=px(s.location,n);u!==s.location&&e.replace(u);let d=Oa(u,n),f=i===null&&d===null,p=f&&Tr(u,n,Ps),m=s.pendingGatewayUrl!==null,h=qv(l,s.password??``,m?``:s.pendingBootstrapToken??``,void 0,{persistDefaultConnectionSettings:i===null,ownsWarmBoot:f,resourceBasePath:r,getModelCatalogTarget:t=>Kg(e.location(),n,t),...!m&&s.pendingBootstrapProfile?{bootstrapProfile:s.pendingBootstrapProfile}:{},...s.nativeClient?{clientOptions:s.nativeClient}:{}}),g=()=>({hello:h.snapshot.hello,settings:{token:h.connection.token},password:h.connection.password}),_=G(`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}${r}`),v=I_(r,()=>G(h.connection.gatewayUrl)===_?g():{}),y=sv(),b=Q_(),x=Bp(),S=f&&!m?up(G(l.gatewayUrl),e=>s.pendingBootstrapToken||s.password?null:[`trusted-proxy`,`tailscale`,`password`].includes(e)?l.token.trim()?null:``:e===`token`?l.token:l.token.trim()?null:It(l.gatewayUrl)):null,C=S!==null,ee=h.connectionRevision;S&&h_(S,l.sessionKey);let w=f?__(h,S,()=>{C=!1}):void 0,T=k(h),E=fx(),D=Si(l.sessionKey),O=p&&!D,A=null,te=O?new Promise(e=>{A=e}):null,ne=qg({fallback:u,signal:E.signal,resolve:()=>i||d?Promise.resolve(u):Jg({location:u,basePath:n,sessionKey:l.sessionKey,gateway:h,agentsList:()=>T.state.agentsList,ensureAgentsList:()=>T.ensureList(),selectedAgentId:l.selectedAgentId,signal:E.signal})}),re=p&&D?Gg(u,n,l.sessionKey,D.agentId):u,j=p?Promise.resolve(re):ne(),ae=ur(h),oe=p_(l,h),se=od(h,T,f?{load:e=>og(e).selectedAgentId??null,save:(e,t)=>{h.connection.gatewayUrl===e&&mg({selectedAgentId:t??void 0})}}:void 0,{get settings(){return oe.settings},subscribe:oe.subscribe,patch:mg}),ce=od(h,T,void 0,void 0,{requireConfiguredAgent:!0}),le=Ne(h),M=Yg({router:x,chatSubmissions:b,gateway:h,agents:T,agentSelection:se,connectionBootstrap:y,initialChatRoute:f&&so(u.pathname,n)?.namespace===`chat`}),ue=fv(h),de=iv({resourceBasePath:r,getAuth:g}),fe=vi(h,se,{bootRecord:S,connectionBootstrap:y}),pe=f?v_({gateway:h,agents:T,sessions:fe},S):void 0,me=ie(h),he=Bb(h,{connectionBootstrap:y,getActiveSessionKey:()=>h.snapshot.sessionKey||void 0,drainConfigWrites:()=>me.waitForPendingWrites(),onUpdateFailure:(e,t)=>void _x(We,e,t)}),ge=ux({gateway:h,agentSelection:se,agents:T,overlays:he,scopeUpgrade:ue,connectionBootstrap:y}),_e=gx(he,me),ve=Zg(oe),ye=ay(),be=()=>oe.settings.openLinksExternally===!0,xe=ty({navigate:(e,t)=>We.navigate(e,t)}),Se=Qv(()=>h.snapshot,{shouldOpenExternally:be}),Ce=hy({shouldOpenExternally:be,signal:E.signal,canPresentBrowserPanel:()=>{let e=document.querySelector(`openclaw-app-shell`);return e?.isConnected===!0&&!Bc(e.routeState.routeId)},onNativeUpdateDeclined:()=>{let e=he.snapshot,t=e.updateSchedule?.campaign,n=e.updateRunning||e.updateReconciliationPending||t?.state===`applying`;(e.updateAvailable||t)&&!n&&!e.controlUiRefreshRequired&&he.runUpdate()},shouldOpenInControlUiBrowser:()=>dg().openLinksInControlUiBrowser===!0&&Ub(h.snapshot)&&document.querySelector(`openclaw-app-shell`)?.isConnected===!0}),we=null,Te=null,Ee=yx(h,{connectionBootstrap:y}),De=G_({gateway:h,sessions:fe,chatSubmissions:b}),Oe=q_(h),ke=!1,Ae=null,je=s.pendingGatewayUrl===null?null:{gatewayUrl:s.pendingGatewayUrl,token:s.pendingGatewayToken,bootstrapToken:s.pendingBootstrapToken??``,...s.pendingBootstrapProfile?{bootstrapProfile:s.pendingBootstrapProfile}:{}},Me=null,Pe=null,Fe=!!(m||s.nativeClient||s.pendingBootstrapToken),Ie=h.connectionRevision,Le=h.subscribe(e=>{if(e.phase===`connected`&&(Fe=!0),!Fe&&e.phase===`stopped`&&(e.lastErrorCode===no.AUTH_TOKEN_MISSING||e.lastErrorCode===no.AUTH_PASSWORD_MISSING)&&(Fe=!0,E.trackDisposer(W(async()=>{let{startBrowserBootstrapRecovery:e}=await import(`./browser-bootstrap.runtime-BC9ZQczo.js`);return{startBrowserBootstrapRecovery:e}},__vite__mapDeps([100,1,101,2,3,4,5,6,7,8,9,30]),import.meta.url).then(({startBrowserBootstrapRecovery:t})=>h.snapshot.client===e.client&&h.connectionRevision===Ie&&!E.signal.aborted?t(h,n):()=>{}),()=>{})),e.phase!==`connected`||!e.client){Me=null,Pe=null;return}let t=e.client;Me!==t&&(Me=t,y.run(`config`,()=>de.refresh()),y.run(`session-observer`,()=>Dn(t,ri()!==`off`))),t.recoveryScopeReady&&Pe!==t&&(Pe=t,De.resumeRecovery())}),Re=(e,t)=>{let r=Ls(e,n),i=x.getState().matches[0],a=i?.routeId===e&&e===`workboard`?i.location.pathname:null;return t?.pathname!==void 0||t?.search!==void 0||t?.hash!==void 0?{...r,pathname:t?.pathname??a??r.pathname,search:t?.search??``,hash:t?.hash??``}:r},ze=()=>{let e=je;if(!e)return;je=null;let t=cg(h.connection.gatewayUrl,e.gatewayUrl,h.connection);h.connect({gatewayUrl:e.gatewayUrl,token:e.bootstrapToken?``:e.token??t.token,password:t.password,bootstrapToken:e.bootstrapToken,bootstrapProfile:e.bootstrapProfile})},Be=()=>{je=null},Ve=(t,n,r)=>{let i=Re(t,n);ke||(Ae={location:i,mode:r});let a=ke&&zs(e.location(),i)?`replace`:r,o=x.navigate(t,We,{history:a},i);return o.catch(e=>{console.error(`[openclaw] route navigation failed`,e)}),o},He=(e,t)=>Ve(e,t,`push`),Ue=new Yr(()=>We),N=null,We={basePath:n,resourceBasePath:r,lifecycleAbortSignal:E.signal,router:x,gateway:h,connectionBootstrap:y,agents:T,get offlineSessionDefaults(){return C&&h.connectionRevision===ee?pe?.readSessionDefaults()??null:null},agentIdentity:ae,agentSelection:se,settingsAgentSelection:ce,channels:le,config:de,scopeUpgrade:ue,sidebarAttention:ge,runtimeConfig:me,sessions:fe,placementStartup:De,plugins:Ue,assistantDock:new qm,overlays:he,navigation:ve,theme:oe,nativeChatDrafts:ye,get nativeConversation(){return N},get nativeDeviceSettings(){return we},get nativeNotifications(){return Te},webPush:Ee,chatSubmissions:b,chatAttachmentHandoff:Oe,navigate:(e,t)=>{He(e,t)},navigateAndWait:He,replace:(e,t)=>{Ve(e,t,`replace`)},revalidate:e=>x.revalidate(We,e),preload:e=>x.preloadLocation(Ls(e,n),We)};return{context:We,router:x,documentMode:i,get warmBoot(){return C&&h.connectionRevision===ee},focusLocation:d,get pendingGatewayConnection(){return je},confirmPendingGatewayConnection:ze,cancelPendingGatewayConnection:Be,start:()=>{let t=()=>x.stop();f&&E.addDisposer(t);let r=[()=>(h.start(),()=>h.stop()),()=>mv(h,document,window),()=>gv(h,document),()=>(Ue.start(),()=>Ue.dispose())];return f&&!p&&r.unshift(()=>Rp(x,u,n)),window.webkit?.messageHandlers&&r.unshift(async()=>{let{startNativeCapabilities:e}=await W(async()=>{let{startNativeCapabilities:e}=await import(`./native-startup.runtime-DxNLJFaO.js`);return{startNativeCapabilities:e}},__vite__mapDeps([102,1,30]),import.meta.url);return e(We,E,e=>{N=e.conversation,we=e.deviceSettings,Te=e.notifications})}),r.push(()=>sr({context:We,enabled:p,history:e,initialLocationReady:j,...O?{redirect:()=>e.replace({...Ls(`model-setup`,n),search:`?firstRun=1`}),onInitialDecision:()=>A?.()}:{}})),r.push(()=>{de.refresh({skipWithoutAuthCandidate:!0})}),f&&(te&&r.push(()=>te),r.push(async()=>{let r=Ae;return Ae=null,ke=!0,r&&e[r.mode](r.location),await Wp(x,e,n,We),t})),p&&r.push(()=>{E.trackDisposer(sr({context:We,enabled:!1,history:e,initialLocationReady:ne(),installLocation:async t=>{let r=Ps(t.pathname,n);r?await x.navigate(r,We,{history:`replace`},t):e.replace(t)},shouldInstallLocation:()=>D?zs(e.location(),re):Tr(e.location(),n,Ps)}),e=>{console.error(`[openclaw] initial session location failed`,e)})}),E.run(r)},stop:()=>{v(),E.stop(),w?.(),pe?.dispose(),Le(),M(),y.reset(),T.dispose(),se.dispose(),ce.dispose(),le.dispose(),ue.dispose(),ge.dispose(),De.dispose(),fe.dispose(),_e(),me.dispose(),he.dispose(),oe.dispose(),ye.dispose(),Se.dispose(),xe.dispose(),Ce.dispose(),Ee.dispose(),b.clear(),Oe.dispose()}}}function Sx(){return(Sx=e((()=>{la(),fo(),$c(),Y(),Kp(),qp(),Rn(),M(),l(),me(),Tn(),Zt(),Yn(),zt(),bn(),ln(),sd(),Km(),Jm(),Tp(),Xg(),$g(),m_(),y_(),L_(),Tc(),X_(),$_(),ov(),lv(),pv(),hv(),bv(),Yv(),$v(),ny(),yy(),Vb(),Yb(),K_(),Hg(),dx(),hx(),vx(),bx(),U()})))()}function Cx(){let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e instanceof HTMLTextAreaElement?!e.readOnly&&!e.disabled:e instanceof HTMLInputElement?!e.readOnly&&!e.disabled&&![`button`,`checkbox`,`color`,`file`,`hidden`,`image`,`radio`,`range`,`reset`,`submit`].includes(e.type):e instanceof HTMLElement&&e.isContentEditable}function wx(){let e=window.visualViewport;if(!e)return()=>{};let t=document.documentElement,n=new AbortController,r=null,i=null,a=t.clientWidth||window.innerWidth,o=()=>{r=null;let n=t.clientHeight||window.innerHeight,o=t.clientWidth||window.innerWidth,s=Cx();(a!==o||!s)&&(i=null),a=o,s&&(i??=Math.max(n,e.height));let c=e.scale===1;c&&s&&Math.max(n,i??0)-e.height>=Tx?t.style.setProperty(`--shell-safe-area-bottom`,`0px`):t.style.removeProperty(`--shell-safe-area-bottom`),c?t.style.setProperty(`--shell-viewport-height`,String(Math.max(0,e.height+e.offsetTop))+`px`):t.style.removeProperty(`--shell-viewport-height`)},s=()=>{r??=requestAnimationFrame(o)},c={signal:n.signal};return e.addEventListener(`resize`,s,c),e.addEventListener(`scroll`,s,c),window.addEventListener(`resize`,s,c),window.addEventListener(`orientationchange`,s,c),document.addEventListener(`focusin`,()=>{Cx()&&(i??=e.height),s()},c),document.addEventListener(`focusout`,s,c),o(),()=>{n.abort(),r!==null&&cancelAnimationFrame(r),t.style.removeProperty(`--shell-viewport-height`),t.style.removeProperty(`--shell-safe-area-bottom`)}}var Tx;function Ex(){return(Ex=e((()=>{Tx=80})))()}function Dx(e){return`${e.pathname}${e.search}${e.hash}`}function Ox(e){return`type`in e&&e.type===`notFound`}var kx;function Ax(){return(Ax=e((()=>{va(),la(),R(),ji(),Mi(),_f(),Hf(),Ad(),Sd(),Gf(),N(),hi(),Yn(),ue(),Ae(),_e(),Sx(),nd(),Ou(),$v(),_c(),Yb(),Hg(),Ex(),U(),kx=class extends qn{get context(){return this.runtime?.context}get focusTarget(){let e=this.runtime?.focusLocation;return e?.status===`valid`?e.target:null}get terminalOnly(){return this.focusTarget?.kind===`terminal`}constructor(){super(),this.startupPending=!1,this.loginGatePinned=!1,this.loginGatewayUrl=``,this.loginToken=``,this.loginPassword=``,this.loginShowGatewaySecret=!1,this.pendingGatewayUrl=null,this.onboarding=Ap(globalThis.location?.search??``),this.focusDashboardRoute={kind:`loading`},this.contextProvider=new da(this,{context:td}),this.subscriptions=new le(this),this.loginGatewaySource=null,this.loginConnectionClient=null,this.focusDashboardAbort=null,this.loginGateLoader=new cu(this),this.lazyCustomElements=new cu(this,()=>this.closeDocument(this.context?.basePath??``)),this.subscriptions.watchStore(()=>this.context?.gateway,e=>this.synchronizeGateway(e)).watchStore(()=>this.terminalOnly?this.context?.config:void 0).watchStore(()=>this.context?.agentSelection).watchStore(()=>this.terminalOnly?this.context?.theme:void 0).watchStore(()=>this.context?.router).effect(()=>this.ownerDocument,Wf)}connectedCallback(){super.connectedCallback(),this.disconnectViewport?.(),this.disconnectViewport=wx();let e=pc();this.ownerDocument.documentElement.classList.toggle(`openclaw-native-embed`,e!==null),this.toggleAttribute(`data-native-titlebar`,e?.platform===`macos`&&e.formFactor===`desktop`&&e.surface===`conversation`),e&&W(()=>Promise.resolve({}),__vite__mapDeps([103]),import.meta.url),W(()=>import(`./control-ui-boot-shared-XreXSF7h.js`).then(e=>(e.g(),e._)),__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,30,31,32,33]),import.meta.url),this.loginShowGatewaySecret=!1,this.runtime=xx();let t=this.runtime;this.startupPending=!0;let n=this.focusTarget;n&&this.requestLazyDocument({terminal:_u,desktop:bu,browser:yu,dashboard:Su}[n.kind]),this.runtime.documentMode?.kind===`approval`&&this.requestLazyDocument(Cu),this.runtime.documentMode?.kind===`question`&&this.requestLazyDocument(Tu);let r=this.runtime.context;this.pendingGatewayUrl=this.runtime.pendingGatewayConnection?.gatewayUrl??null,this.contextProvider.setValue(r),this.syncLoginConnection(),this.requestUpdate(),t.start().finally(()=>{this.runtime===t&&(this.startupPending=!1)}).then(()=>this.resolveFocusDashboard()).catch(e=>{console.error(`[openclaw] application start failed`,e)})}disconnectedCallback(){this.subscriptions.clear(),this.disconnectViewport?.(),this.disconnectViewport=void 0,this.focusDashboardAbort?.abort(),this.focusDashboardAbort=null,this.lazyCustomElements.abandon(),this.loginGateLoader.abandon(),this.runtime?.stop(),this.runtime=void 0,this.loginGatewaySource=null,this.loginConnectionClient=null,this.pendingGatewayUrl=null,this.loginShowGatewaySecret=!1,super.disconnectedCallback()}firstUpdated(){this.runtime&&globalThis.dispatchEvent(new Event(`openclaw-control-ui-rendered`))}synchronizeGateway(e){let t=e!==this.loginGatewaySource;t&&(this.loginGatewaySource=e,this.loginConnectionClient=null,this.loginShowGatewaySecret=!1);let n=e.snapshot,r=n.client!==this.loginConnectionClient;r&&(this.loginConnectionClient=n.client,this.loginShowGatewaySecret=!1),(t||r)&&this.syncLoginConnection(e),n.phase===`connected`&&(this.loginGatePinned=!1)}syncLoginConnection(e=this.context?.gateway){let t=e?.connection;t&&(this.loginGatewayUrl=t.gatewayUrl,this.loginToken=t.token,this.loginPassword=t.password)}updateLoginGatewayUrl(e){let t=cg(this.loginGatewayUrl,e,{token:this.loginToken,password:this.loginPassword});this.loginGatewayUrl=e,this.loginToken=t.token,this.loginPassword=t.password}closeDocument(e){globalThis.history.length>1?globalThis.history.back():globalThis.location.assign(e||`/`)}renderFocusEscape(e){return fc()?I:L`<button
      class="btn btn--ghost"
      type="button"
      @click=${()=>this.closeDocument(this.context?.basePath??``)}
    >
      ${e}
    </button>`}requestLazyDocument(e){ou(e)||this.lazyCustomElements.request(e)}renderLazyDocumentState(e){let t=this.lazyCustomElements.visibleState;return!t||t.element!==e?I:L`<main class="connect-splash">
      ${Ed(t,()=>this.lazyCustomElements.retry(),()=>this.lazyCustomElements.close())}
    </main>`}replaceFocusDashboardLocation(e,t){let n=this.context?.basePath??``,[r,i]=[t,e].map(e=>qa({kind:`dashboard`,path:Dx(e)},n)),a=`${globalThis.location.pathname}${globalThis.location.search}${globalThis.location.hash}`;r&&i&&a===r&&i!==a&&globalThis.history.replaceState(globalThis.history.state,``,i)}async resolveFocusDashboard(){let e=this.focusTarget,t=this.context;if(e?.kind!==`dashboard`||!t)return;this.focusDashboardAbort?.abort();let n=new AbortController;this.focusDashboardAbort=n,this.focusDashboardRoute={kind:`loading`};let r=e.route;try{let{loadChatRoute:e}=await W(async()=>{let{loadChatRoute:e}=await import(`./control-ui-boot-chat-B-b-JQel.js`).then(e=>(e.t(),e.n));return{loadChatRoute:e}},__vite__mapDeps([56,1,3,2,4,5,8,7,6,9,10,11,12,13,14,15,19,17,18,16,20,21,55,22,23,30,31,32,33,34,35,36,37,38,58]),import.meta.url),i=await e(t,r,`dashboard`,n.signal);if(n.signal.aborted||this.focusDashboardAbort!==n)return;if(Ox(i)||i.kind===`missing-session`){this.focusDashboardRoute={kind:`not-found`};return}if(i.kind===`route-error`){this.focusDashboardRoute={kind:`error`,message:i.message};return}if(i.kind===`ambiguous`){this.focusDashboardRoute={kind:`ambiguous`,data:{...i,candidates:i.candidates.map(e=>({...e,href:qa({kind:`dashboard`,path:e.href},t.basePath)??e.href}))}};return}this.focusDashboardRoute={kind:`session`,data:i},i.canonicalLocation&&i.canonicalLocationSource&&this.replaceFocusDashboardLocation(i.canonicalLocation,i.canonicalLocationSource);let a=i.canonicalLocationSource;i.canonicalLocationReady&&a&&i.canonicalLocationReady.then(e=>{e&&!n.signal.aborted&&this.focusDashboardAbort===n&&this.replaceFocusDashboardLocation(e,a)})}catch(e){!n.signal.aborted&&this.focusDashboardAbort===n&&(this.focusDashboardRoute={kind:`error`,message:xi(e)})}}renderFocusDashboard(e,t,n){let r=this.focusDashboardRoute;if(r.kind===`loading`)return xd(n);if(r.kind===`not-found`||r.kind===`error`){let e=r.kind===`error`;return Fi(r.kind,L`<main class="board-document">
          <section
            class=${e?`board-document__state board-document__state--error stack`:`board-document__state stack`}
            role=${e?`alert`:`status`}
          >
            <span
              >${e?F(`dashboardDocument.loadFailed`,{error:r.message}):F(`dashboardDocument.notFound`)}</span
            >
            ${this.renderFocusEscape(F(`dashboardDocument.close`))}
          </section>
        </main>`)}return r.kind===`ambiguous`?L`<main class="board-document">
        <section class="card board-document__state">
          <h2>${F(`chat.sessionRoute.chooseTitle`)}</h2>
          <p>
            ${r.data.candidates.length>1?F(`chat.sessionRoute.multipleMatches`,{shortId:r.data.shortId}):F(`chat.sessionRoute.additionalMatches`)}
          </p>
          ${r.data.candidates.map(e=>L`<p>
              <a href=${e.href}>${e.displayName}</a><br />
              <small>${e.agentId} · ${e.idPrefix}</small>
            </p>`)}
          ${r.data.truncated?L`<p><small>${F(`chat.sessionRoute.additionalMatches`)}</small></p>`:I}
          ${this.renderFocusEscape(F(`dashboardDocument.close`))}
        </section>
      </main>`:L`
      <openclaw-board-document
        .gatewaySnapshot=${e}
        .sessions=${this.context?.sessions}
        .sessionKey=${r.data.sessionKey}
        .preparedSession=${r.data.agentId?{sessionKey:r.data.sessionKey,agentId:r.data.agentId}:null}
        .onDocumentClose=${fc()?null:()=>this.closeDocument(this.context?.basePath??``)}
      ></openclaw-board-document>
      ${!t&&e.lastError===null?xd(n):I}
      ${t?this.renderLazyDocumentState(Su):I}
    `}render(){let e=this.context,t=this.runtime;if(!e||!t)return L`<main class="app-shell app-shell--booting" aria-busy="true"></main>`;let n=this.pendingGatewayUrl?L`
          <openclaw-gateway-url-confirmation
            .props=${{pendingGatewayUrl:this.pendingGatewayUrl,currentGatewayUrl:t.context.gateway.connection.gatewayUrl,linkCarriesToken:!!t.pendingGatewayConnection?.token,onConfirm:()=>{t.confirmPendingGatewayConnection(),this.pendingGatewayUrl=null},onCancel:()=>{t.cancelPendingGatewayConnection(),this.pendingGatewayUrl=null}}}
          ></openclaw-gateway-url-confirmation>
        `:I;return L`<openclaw-tooltip-provider>
      ${this.renderDocument(e,t)} ${n}
    </openclaw-tooltip-provider>`}renderDocument(e,t){let n=e.gateway.snapshot,r=n.phase===`connected`,i=n.phase===`starting`?F(`common.gatewayStarting`):void 0;if(t.focusLocation?.status===`unsupported`)return L`<main class="connect-splash" role="alert">
        <div class="stack">
          <span class="connect-splash__status">${F(`focus.unsupported`)}</span>
          ${this.renderFocusEscape(F(`common.back`))}
        </div>
      </main>`;let a=this.focusTarget;if(a?.kind===`browser`)return L`
        <openclaw-browser-document
          .props=${{context:e,target:a,renderEscape:e=>this.renderFocusEscape(e)}}
        ></openclaw-browser-document>
        ${this.renderLazyDocumentState(yu)}
      `;if(a?.kind===`terminal`||a?.kind===`desktop`){let t=a.kind===`terminal`,o=t?ye(n,e.config.current.terminalEnabled??!1):Kb(n),s=e.agentSelection.state.selectedId??n.assistantAgentId;return Fi(a.kind,L`
          ${t?L`<openclaw-terminal-panel
                    .client=${r?n.client:null}
                    .available=${o}
                    .agentId=${s?K(s):null}
                    .themeMode=${e.theme.resolvedMode}
                    fullscreen
                  ></openclaw-terminal-panel>
                  <openclaw-toast-host></openclaw-toast-host>`:L`<openclaw-desktop-panel
                  .client=${r?n.client:null}
                  .sessions=${e.sessions}
                  .available=${o}
                  .documentMode=${!0}
                  .requestedSource=${a.selector?.kind===`source`?a.selector.value:null}
                  .sessionKey=${a.selector?.kind===`session`?a.selector.value:null}
                  .documentControl=${a.control}
                  .onDocumentClose=${()=>this.closeDocument(e.basePath)}
                ></openclaw-desktop-panel>`}
          ${!r&&n.lastError===null?xd(i):I}
          ${o?this.renderLazyDocumentState(t?_u:bu):I}
          ${!o&&(r||n.lastError)?L`<div
                  class=${t?`terminal-view-unavailable`:`desktop-view-unavailable`}
                >
                  <div class="stack">
                    <span>${F(t?`terminal.unavailable`:`desktop.unavailable`)}</span>
                    ${this.renderFocusEscape(F(`common.back`))}
                  </div>
                </div>`:I}
        `)}if(a?.kind===`dashboard`)return this.renderFocusDashboard(n,r,i);let o=t.documentMode===null&&n.lastError===null&&(this.startupPending&&n.phase===`stopped`||n.phase===`starting`||n.phase===`connecting`&&!this.loginGatePinned),s=t.documentMode===null&&t.warmBoot&&!this.loginGatePinned&&(o||n.phase===`connecting`&&!n.lastErrorAuthReason&&(n.lastErrorCode===null||n.lastErrorCode===`GATEWAY_BUSY`));if(o&&!s)return xd(i);let c=e.router.getState(),l=(c.pendingMatches[0]??c.matches[0])?.routeId===`connection`&&(e.gateway.hasStoredDeviceToken?.()??!1)||n.phase===`reconnecting`||n.phase===`reload-required`||s,u=!r&&!l;if(u&&!ou(Du)){let e=this.loginGateLoader.visibleState;return e||this.loginGateLoader.preload(Du,{reportError:!0}),e?.status===`error`?Od({error:e.error,stale:e.stale,onRetry:()=>this.loginGateLoader.retry()}):xd()}if(u)return L`
        <openclaw-login-gate
          .props=${{resourceBasePath:e.resourceBasePath,branding:e.theme.branding,connected:r,lastError:n.lastError,reconnectAt:n.reconnectAt,reconnectPending:n.lastError!==null&&(n.phase===`connecting`||n.phase===`reconnecting`),lastErrorCode:n.lastErrorCode,lastErrorAuthReason:n.lastErrorAuthReason,hasToken:!!this.loginToken.trim(),hasPassword:!!this.loginPassword.trim(),gatewayUrl:this.loginGatewayUrl,secret:this.loginToken||this.loginPassword,showGatewaySecret:this.loginShowGatewaySecret,onGatewayUrlChange:e=>{this.updateLoginGatewayUrl(e)},onSecretChange:e=>{this.loginToken=e,this.loginPassword=``},onToggleGatewaySecret:()=>{this.loginShowGatewaySecret=!this.loginShowGatewaySecret},onOpenGatewaySettings:e.gateway.hasStoredDeviceToken?.()?()=>e.navigate(`connection`):void 0,onConnect:()=>{this.loginGatePinned=!0,e.gateway.connect({gatewayUrl:this.loginGatewayUrl,token:this.loginToken,password:this.loginPassword})}}}
        ></openclaw-login-gate>
      `;let d=t.documentMode;if(d){let e=d.kind===`approval`;if(e&&this.pendingGatewayUrl)return I;let t=e?Cu:Tu;return this.lazyCustomElements.visibleState?.element===t?this.renderLazyDocumentState(t):d.kind===`approval`?L`<openclaw-approval-page
            .approvalId=${d.approvalId??``}
          ></openclaw-approval-page>`:L`<openclaw-question-page
            .questionId=${d.questionId??``}
          ></openclaw-question-page>`}return L`
      <openclaw-link-reader-hovercard-provider
        .client=${r?n.client:null}
        .readers=${Zv(n)}
        .claimedReaders=${Xv(n)}
        .pagePreviewContext=${e}
        .agentId=${e.agentSelection.state.selectedId??n.assistantAgentId??void 0}
      >
        <openclaw-session-progress-hovercard-provider
          .client=${n.client}
          .context=${e}
          .gateway=${e.gateway}
        >
          <openclaw-app-shell
            .runtime=${t}
            .onboarding=${this.onboarding}
          ></openclaw-app-shell>
        </openclaw-session-progress-hovercard-provider>
      </openclaw-link-reader-hovercard-provider>
    `}},H([Li()],kx.prototype,`startupPending`,void 0),H([Li()],kx.prototype,`loginGatePinned`,void 0),H([Li()],kx.prototype,`loginGatewayUrl`,void 0),H([Li()],kx.prototype,`loginToken`,void 0),H([Li()],kx.prototype,`loginPassword`,void 0),H([Li()],kx.prototype,`loginShowGatewaySecret`,void 0),H([Li()],kx.prototype,`pendingGatewayUrl`,void 0),H([Li()],kx.prototype,`onboarding`,void 0),H([Li()],kx.prototype,`focusDashboardRoute`,void 0)})))()}function jx(e){let t=e instanceof CustomEvent?e.detail:void 0,n=t&&typeof t==`object`&&`trigger`in t?t.trigger:null;return n instanceof HTMLElement?n:void 0}function Mx(e){return Zn(P.commandPalette,e)}function Nx(e){return typeof e==`object`&&!!e&&`owner`in e&&e.owner instanceof Element&&`onSlashCommand`in e&&(e.onSlashCommand===null||typeof e.onSlashCommand==`function`)}function Px(e,t){let n=t instanceof CustomEvent?t.detail:void 0;Nx(n)&&(e.commandPaletteTarget=n.onSlashCommand?n:e.commandPaletteTarget?.owner===n.owner?void 0:e.commandPaletteTarget,e.requestUpdate())}var Fx,Ix,Lx,Rx;function zx(){return(zx=e((()=>{Re(),Fx=`--openclaw-modal-width: min(740px, calc(100vw - 32px));`,Ix=`openclaw-command-palette-target`,Lx=`openclaw:command-palette-open`,Rx=`openclaw:shell-nav-drawer-toggle`})))()}function Bx(e){let t=e.closest(`.cmd-palette__entry`),n=e.scrollHeight-e.clientHeight;t?.toggleAttribute(`data-scroll-fade-top`,n>1&&e.scrollTop>1),t?.toggleAttribute(`data-scroll-fade-bottom`,n>1&&e.scrollTop<n-1)}function Vx(e,t=!1){let n=e.closest(`.cmd-palette__entry`),r=n?.querySelector(`.cmd-palette__input-actions`);n&&r&&n.style.setProperty(`--cmd-palette-actions-width`,`${r.getBoundingClientRect().width}px`);let i=Number.parseFloat(getComputedStyle(e).lineHeight);if(!Number.isFinite(i)||i<=0)return;let a=e.scrollTop,o=t&&document.activeElement===e&&e.selectionStart===e.selectionEnd&&e.selectionEnd===e.value.length;e.style.overflowY=`hidden`,e.style.height=`0px`,e.style.height=`${Math.max(i,Math.min(i*3,e.scrollHeight))}px`;let s=e.scrollHeight>e.clientHeight+1;e.style.overflowY=s?`auto`:`hidden`,e.scrollTop=s?o?e.scrollHeight:a:0,Bx(e),Gx.set(e,e.value)}function Hx(e){let t=e.currentTarget;t instanceof HTMLTextAreaElement&&t.isConnected&&Bx(t)}function Ux(e){return L`
    <div class="cmd-palette__entry">
      <div class="cmd-palette__input-scroll">
        <textarea
          ${qx(e.value,e.placeholder)}
          autofocus
          rows="1"
          id=${Wx}
          class="cmd-palette__input"
          aria-label=${e.placeholder}
          aria-autocomplete=${e.controls?`list`:I}
          aria-haspopup=${e.controls?`listbox`:I}
          aria-controls=${e.controls??I}
          aria-activedescendant=${e.activeDescendant??I}
          aria-describedby=${e.describedBy??I}
          placeholder=${e.placeholder}
          .value=${e.value}
          ?disabled=${e.disabled}
          ?readonly=${e.readOnly}
          @scroll=${Hx}
          @paste=${e.onPaste??I}
          @beforeinput=${e.onBeforeInput??I}
          @select=${e.onSelectionChange??I}
          @pointerup=${e.onSelectionChange??I}
          @keyup=${t=>{(t.key.startsWith(`Arrow`)||t.key===`Home`||t.key===`End`)&&e.onSelectionChange?.(t)}}
          @compositionstart=${e.onCompositionStart??I}
          @compositionend=${e.onCompositionEnd??I}
          ${Pi(e.onInputRef)}
          @input=${t=>{t.currentTarget instanceof HTMLTextAreaElement&&(e.onValueChange(t.currentTarget.value,t),Vx(t.currentTarget,!0))}}
        ></textarea>
      </div>
      <div class="cmd-palette__input-actions">${e.actions??I}</div>
    </div>
  `}var Wx,Gx,Kx,qx;function Jx(){return(Jx=e((()=>{R(),Ri(),Ai(),Di(),Wx=`cmd-palette-input`,Gx=new WeakMap,Kx=class extends Ti{#e;#t;#n;#r;render(e,t){return I}update(e,[t,n]){let r=e.element instanceof HTMLTextAreaElement?e.element:void 0,i=r&&(this.#e!==r||this.#t!==n||Gx.get(r)!==t);return this.#e=r,this.#t=n,i&&this.#i(),I}#i=()=>{this.#r===void 0&&(this.#r=requestAnimationFrame(()=>{this.#r=void 0;let e=this.#e;if(this.isConnected&&e?.isConnected){if(!this.#n&&typeof ResizeObserver==`function`){this.#n=new ResizeObserver(this.#i);let t=e.closest(`.cmd-palette__entry`);if(t){this.#n.observe(t);let e=t.querySelector(`.cmd-palette__input-actions`);e&&this.#n.observe(e)}}Vx(e)}}))};disconnected(){this.#n?.disconnect(),this.#n=void 0,this.#r!==void 0&&(cancelAnimationFrame(this.#r),this.#r=void 0)}reconnected(){this.#i()}},qx=ki(Kx)})))()}function Yx(e,t){let n=t instanceof CustomEvent?t.detail:null;return q(n)?{eventType:e,detail:n}:{eventType:e}}function Xx(){try{let e=jr()?.getItem($x),t=e?JSON.parse(e):null;if(!q(t)||!Object.hasOwn(t,`eventType`))return Qx(),null;let n=Object.keys(t).length,r=tS.find(e=>e===t.eventType);if(r&&n===1)return{eventType:r};let i=t.detail;if(r&&n===2&&Object.hasOwn(t,`detail`)&&q(i))return{eventType:r,detail:i}}catch{}return Qx(),null}function Zx(e){try{let t=jr();return t?(t.setItem($x,JSON.stringify(e)),!0):!1}catch{}return Qx(),!1}function Qx(){try{jr()?.removeItem($x)}catch{}}var $x,eS,tS;function nS(){return(nS=e((()=>{zx(),Gd(),$x=`openclaw:lazy-event`,eS=`openclaw:approvals-open`,tS=[Lx,Bd,Vd,Nd,Fd,Hd,Id,zd,Rd,eS]})))()}function rS(e,t){let n=F(`palette.placeholder`);return L`<openclaw-modal-dialog
    class="cmd-palette-overlay palette"
    label=${n}
    style=${Fx}
    @modal-cancel=${t}
  >
    <div
      class="cmd-palette"
      aria-busy="true"
      @compositionstart=${e.handleCompositionStart}
      @compositionend=${e.handleCompositionEnd}
      @keydown=${e.handleKeydown}
    >
      ${Ux({value:e.value,placeholder:n,onInputRef:e.inputRef,onValueChange:e.captureInput,onPaste:e.handlePaste,readOnly:e.submitRequested})}
      <div class="cmd-palette__empty" role="status">${F(`common.loading`)}</div>
    </div>
  </openclaw-modal-dialog>`}var iS,aS;function oS(){return(oS=e((()=>{R(),zx(),Jx(),N(),Re(),Ht(),nr(),kp(),nS(),iS=class{#e;#t;#n;constructor(e,t){this.open=()=>{let e=this.#t.commandPalette,t=Yx(Lx);if(e){this.loading.handoff(()=>{if(this.loading.active){let t=this.loading.captureHandoff();e.openPalette(()=>(this.synchronizeScope(),t()))}else e.openPalette();this.#n.clear(t)});return}this.synchronizeScope(),this.loading.begin(),this.#n.request(this.#t.commandPaletteElement,t,this.open)},this.#t=e,this.#n=t,this.loading=new aS(e)}closePending(){this.#n.cancel(),this.#t.lazyCustomElements.abandon(),this.#t.requestUpdate()}synchronizeScope(){let e=this.#t.context?.gateway,t=e?Ep(e):void 0;this.#e&&this.#e!==t&&(this.loading.active||this.#n.pending())&&this.closePending(),this.#e=t}toggle(){this.loading.active||this.#t.lazyCustomElements.visibleState?.element===this.#t.commandPaletteElement?this.closePending():this.#t.commandPalette?this.#t.commandPalette.togglePalette():this.open()}handleSlashCommand(e){let t=this.#t,n=t.commandPaletteTarget?.owner.isConnected?t.commandPaletteTarget.onSlashCommand:null;if(n){n(e);return}let r=t.chatNavigationOptions(`chat`),i=new URLSearchParams(r?.search??``);i.set(`draft`,e.endsWith(` `)?e:`${e} `),t.navigate(`chat`,{...r,search:`?${i.toString()}`})}handlePendingShortcut(e){return e.defaultPrevented||e.isComposing||e.keyCode===229||!this.loading.active||!Mx(e)?!1:(e.preventDefault(),this.toggle(),!0)}},aS=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;constructor(e){this.submitRequested=!1,this.#t=[],this.#a=!1,this.#c=!1,this.#l=0,this.captureInput=(e,t)=>{if(!this.active||!this.#r)return;let n=this.#r;if(!this.#a&&!t?.isComposing&&t?.inputType===`insertText`&&t.data?.includes(`@`))this.#n=n.selectionStart-t.data.length+t.data.lastIndexOf(`@`);else if(this.#n!==void 0){let e=this.#n+1;(t?.inputType===`insertFromPaste`||t?.inputType===`insertFromDrop`||this.#e?.value.slice(0,e)!==n.value.slice(0,e))&&(this.#n=void 0)}this.#e=this.#d(),this.#u.requestUpdate()},this.inputRef=e=>{if(!(e instanceof HTMLTextAreaElement)){this.active&&this.#r&&(this.#e=this.#d()),this.#r=void 0;return}if(!this.active)return;this.#r=e;let t=this.#e;e.closest(`openclaw-modal-dialog`)?.setReturnFocusTarget(this.#i??null),t&&!this.#a&&e.setSelectionRange(t.selectionStart,t.selectionEnd,t.selectionDirection)},this.handleCompositionStart=()=>{this.active&&(this.#a=!0,this.#n=void 0,this.#s!==void 0&&(cancelAnimationFrame(this.#s),this.#s=void 0))},this.handleCompositionEnd=()=>{this.active&&(this.#a=!1,this.#s!==void 0&&cancelAnimationFrame(this.#s),this.#s=requestAnimationFrame(()=>{this.#s=void 0;let e=this.#o;this.#o=void 0,e?.()}))},this.handlePaste=e=>{if(!this.active||this.submitRequested)return;let t=Array.from(e.clipboardData?.items??[],e=>e.getAsFile()).filter(e=>e?.type.startsWith(`image/`)===!0);if(t.length){if(e.preventDefault(),!Sn(this.#u.context?.config)){oi({message:jn()});return}this.#t.push(...t)}},this.handleKeydown=e=>{if(this.#a||e.isComposing||e.keyCode===229){e.stopPropagation();return}e.key===`Enter`&&!e.shiftKey&&!e.altKey&&(e.preventDefault(),e.stopPropagation(),!e.repeat&&(this.value.trim()||this.#t.length>0)&&Zn(P.modifiedEnter,e)&&(this.submitRequested=!0,this.#u.requestUpdate()))},this.#u=e}get active(){return this.#i!==void 0}get waitingForComposition(){return this.#c}begin(){this.active||(this.#i=document.activeElement instanceof HTMLElement?document.activeElement:null)}get value(){return this.#e?.value??``}#d(){let e=this.#r;return e?{value:e.value,selectionStart:e.selectionStart,selectionEnd:e.selectionEnd,selectionDirection:e.selectionDirection}:this.#e}handoff(e){this.#a||this.#s!==void 0?(this.#c=!0,this.#o=e):e()}captureHandoff(){let e=this.#l;return()=>e===this.#l?this.#f():void 0}#f(){if(!this.active)return;let e=this.#d()??{value:``,selectionStart:0,selectionEnd:0,selectionDirection:`none`},t=this.#i,n=this.submitRequested,r=this.#t,i=this.#n;return this.#r?.closest(`openclaw-modal-dialog`)?.setReturnFocusTarget(null),this.clear(),this.#u.requestUpdate(),{...e,returnFocus:t,...n?{submitRequested:!0}:{},...r.length?{imageFiles:r}:{},...i===void 0?{}:{mentionTrigger:i}}}clear(){this.submitRequested=!1,this.#l+=1,this.#c=!1,this.#s!==void 0&&(cancelAnimationFrame(this.#s),this.#s=void 0),this.#o=void 0,this.#a=!1,this.#r=void 0,this.#e=void 0,this.#t=[],this.#n=void 0,this.#i=void 0}}})))()}function sS(e,t){let n=e.context;return e.onboardingMode||t===`shortcut`&&(document.openClawModalLayers?.size||document.querySelector(`.shell-nav[aria-modal='true']`))?!1:n?oe(n.gateway.snapshot,{method:`sessions.create`,params:{},sessionScope:!0}).allowed?(e.openNewSession(n.agentSelection.state.selectedId??``),t===`shortcut`&&e.querySelector(`openclaw-new-session-page`)?.focusComposer(),!0):!1:t===`native`&&(e.pendingNativeNewSession=!0,!0)}function cS(){return(cS=e((()=>{ft()})))()}var lS;function uS(){return(uS=e((()=>{yd(),lS=hd({storageKey:`openclaw.desktopPanel`,minHeight:240,minWidth:380,defaultDock:`right`,supportedDocks:[`bottom`,`right`],defaultHeight:420,defaultWidth:560})})))()}function dS(e,t,n){return`${e}:${e.startsWith(`plugin:`)&&n?`${n}:`:``}${t?ve(t):``}`}function fS(e){return e instanceof CustomEvent&&typeof e.detail?.sessionKey==`string`?e.detail.sessionKey:void 0}function pS(e,t){let n=Date.now();for(let[e,t]of _S){let r=t.filter(e=>n-e.createdAt<=gS);r.length?_S.set(e,r):_S.delete(e)}let r=dS(e,fS(t),t instanceof CustomEvent?t.detail?.agentId:void 0),i=t instanceof CustomEvent&&t.detail?.open===!1,a=e===`link-reader`&&!i?_S.get(r)??[]:[];a.push({event:t,createdAt:n}),_S.set(r,a)}function mS(e,t){let n=dS(e,fS(t),t instanceof CustomEvent?t.detail?.agentId:void 0),r=_S.get(n)?.filter(e=>e.event!==t);r?.length?_S.set(n,r):_S.delete(n)}function hS(e,t,n){let r=dS(e,t,n),i=_S.has(r)?r:_S.has(dS(e,t))?dS(e,t):dS(e),a=_S.get(i)?.filter(e=>Date.now()-e.createdAt<=gS)??[],o=a.shift();return a.length?_S.set(i,a):_S.delete(i),o?.event??null}var gS,_S;function vS(){return(vS=e((()=>{Yn(),gS=1e4,_S=new Map})))()}var yS;function bS(){return(bS=e((()=>{$c(),Y(),uS(),yd(),Lf(),Gd(),vS(),ue(),Ou(),nS(),$v(),_c(),Yb(),yS=class{constructor(e,t){this.host=e,this.requestLazyElement=t,this.restoredPanels=new Set,this.handleDeferredTerminalToggle=e=>this.handleDeferredToggle(`terminal`,e),this.handleDeferredBrowserToggle=e=>this.handleDeferredToggle(`browser`,e),this.handleDeferredLinkReaderToggle=e=>{let t=this.host,n=t.context?.gateway.snapshot,r=e instanceof CustomEvent?e.detail:null;if(!n||Bc(t.routeState.routeId)||mc())return;let i=Xv(n);if(r?.open===!1||i.length&&(r?.url===void 0||kf(r.url,i))){if(this.isSessionRoute()){pS(`link-reader`,e),e.preventDefault();return}ou(t.linkReaderPanelElement)||(e.preventDefault(),this.requestLazyElement(t.linkReaderPanelElement,Yx(Hd,e)))}},this.handleDeferredDesktopToggle=e=>{let t=this.host;if(t.routeState.routeId===`systems`)return;if(this.isSessionRoute()){pS(`desktop`,e);return}let n=t.context;if(!n||!Kb(n.gateway.snapshot)){e.preventDefault(),e.stopImmediatePropagation();return}ou(t.desktopPanelElement)||this.requestLazyElement(t.desktopPanelElement,Yx(Id,e))}}reset(){this.restoredPanels.clear()}restore(){let e=this.host,t=e.context,n=t?.gateway?.snapshot;if(!n)return;let r=Kb(n),i=Es(e.routeState.routeId),a=ye(n,t.config.current.terminalEnabled??!1),o=!i&&Gb(n);for(let[t,n,s]of[[e.terminalPanelElement,gd,a],[e.browserPanelElement,_d,o],[e.desktopPanelElement,lS,!i&&e.routeState.routeId!==`systems`&&r]]){if(!s)continue;let r=!this.restoredPanels.has(t)&&n.load().open;this.restoredPanels.add(t),r&&e.lazyCustomElements.preload(t,{reportError:!0})}}isSessionRoute(){return Es(Ps(globalThis.location?.pathname??``,this.host.context?.basePath??``)??this.host.routeState.routeId)}handleDeferredToggle(e,t){let n=this.host;if(this.isSessionRoute()){pS(e,t);return}let r=e===`terminal`?n.terminalPanelElement:n.browserPanelElement;if(ou(r))return;let i=n.context,a=i?.gateway?.snapshot;if(!a||!(e===`terminal`?ye(a,i.config.current.terminalEnabled??!1):Gb(a))){t.preventDefault();return}this.requestLazyElement(r,Yx(e===`terminal`?Nd:Fd,t))}}})))()}function xS(){return fc()?`(max-width: ${DS}px)`:`(max-width: ${ES}px), (max-width: 932px) and (max-height: 500px) and (orientation: landscape)`}function SS(){return globalThis.matchMedia?.(xS()).matches??!1}function CS(){return OS.some(e=>document.documentElement.classList.contains(e))}function wS(e){return e.mobileNavLayout&&Es(e.routeId)&&!e.onboarding&&!CS()}function TS(e,t){return wS({mobileNavLayout:e,routeId:`chat`,onboarding:t})}var ES,DS,OS;function kS(){return(kS=e((()=>{Y(),_c(),ES=900,DS=600,OS=[`openclaw-native-macos`,`openclaw-native-nav`,`openclaw-native-web-chrome`]})))()}var AS;function jS(){return(jS=e((()=>{U(),AS=class{constructor(e,t){this.host=e,this.requestOpen=t,this.pending=!1}load(){this.owner||this.pending||(this.pending=!0,W(async()=>{let{NavDrawerSwipeOwner:e}=await import(`./nav-drawer-swipe.runtime-BaBrg519.js`);return{NavDrawerSwipeOwner:e}},__vite__mapDeps([104]),import.meta.url).then(({NavDrawerSwipeOwner:e})=>{this.owner=new e(this.host,this.requestOpen),this.pending=!1,this.host.isConnected&&this.owner.connect()},()=>this.pending=!1))}connect(){this.owner?.connect()}disconnect(){this.owner?.disconnect()}opened(){return this.owner?.opened(),!!this.owner}closed(){this.owner?.reset()}}})))()}function MS(e){return[...e.querySelectorAll(HS)].filter(e=>e.checkVisibility())}function NS(e){let t=[...e.querySelectorAll(`openclaw-sidebar-attention:defined`)].map(e=>e.dismissPanel()).some(e=>e);return e.querySelector(`openclaw-app-sidebar:defined`)?.dismissTransientMenus()===!0||t}function PS(e,t){let n=e.querySelector(`.shell-nav`);if(!n||t.composedPath().some(e=>e instanceof Element&&e!==n&&e.matches(`dialog, [role='dialog']`)))return;let r=MS(n),i=t.shiftKey?r.at(-1):r[0],a=t.shiftKey?r[0]:r.at(-1);(!n.contains(document.activeElement)||document.activeElement===a||t.shiftKey&&document.activeElement===n)&&(t.preventDefault(),(i??n).focus({preventScroll:!0}))}function FS(e,t){t.defaultPrevented||Zn(P.escape,t)||(Zn(P.toggleSidebar,t)?(t.preventDefault(),e.closeNavDrawer({restoreFocus:!0})):t.key===`Tab`?PS(e,t):(Mx(t)||jd(t)||Zn(P.workspaceFiles,t)||Zn(P.sideChat,t))&&(t.preventDefault(),t.stopImmediatePropagation()))}function IS(e){let t=e.querySelector(`.shell-nav`),n=e.querySelector(`openclaw-toast-host`);t&&n&&n.parentElement!==t&&t.append(n)}function LS(e){let t=e.querySelector(`.shell`),n=e.querySelector(`openclaw-toast-host`);t&&n?.parentElement?.classList.contains(`shell-nav`)&&t.append(n)}function RS(e){return[...e.querySelectorAll(`.topbar-nav-toggle, .chat-pane__nav-toggle`)].find(e=>e.checkVisibility())}function zS(e){return e.onboarding||(e.mobileNavLayout?!e.navDrawerOpen:e.navCollapsed)}function BS(e){return e.navigationSurfaceHidden&&!e.mobileNavLayout&&!e.onboarding&&!e.compact}function VS(e){let t=BS(e),n=!e.compact&&e.refreshRequired;return!t&&!n?I:L`${t?L`<openclaw-sidebar-attention
          class="sidebar-attention--floating"
          .onNavigate=${e.onNavigate}
        ></openclaw-sidebar-attention>`:I}${n?L`<openclaw-sidebar-update-card
          class="sidebar-update-card--floating"
          .updateRun=${e.updateRun??null}
          .statusBanner=${e.statusBanner??null}
          .refreshRequired=${e.refreshRequired}
          .onRefresh=${e.onRefresh}
        ></openclaw-sidebar-update-card>`:I}`}var HS;function US(){return(US=e((()=>{R(),zx(),Gd(),Re(),HS=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])`})))()}var WS,GS;function KS(){return(KS=e((()=>{$c(),Y(),zx(),Gd(),Ju(),Hi(),Re(),ue(),O(),Qr(),oS(),cS(),bS(),Ou(),nS(),kS(),_c(),jS(),US(),Yb(),Hg(),iu(),GS=class{constructor(e){this.host=e,this.pendingLazyAction=Xx(),this.toggleNavigationSurface=e=>{let t=this.host,n=t.context;if(!n||t.onboardingMode||Bc(t.routeState.routeId)&&!SS())return;if(SS()){if(this.navDrawerSwipe.load(),t.navDrawerOpen){t.closeNavDrawer({restoreFocus:!0});return}t.navDrawerTrigger=e??RS(t)??null,t.navDrawerOpen=!0,IS(t),this.navDrawerSwipe.opened()||t.updateComplete.then(()=>{t.isConnected&&t.navDrawerOpen&&t.querySelector(`.shell-nav`)?.focus({preventScroll:!0})});return}let r=t.navDrawerOpen||!(n.navigation.snapshot.navCollapsed&&!t.desktopNavigationExpanded);t.desktopNavigationExpanded=!1,r&&this.dismissSidebarTransientMenus(),t.closeNavDrawer(),n.navigation.update({navCollapsed:r}),r&&t.updateComplete.then(()=>{this.restoreFocusTo(t.querySelector(`.shell-chrome-controls__nav-toggle`))})},this.restoreFocusTo=e=>Ru(e?.isConnected&&e.checkVisibility()?e:this.host.querySelector(`.content`)),this.closeNavDrawer=(e={})=>{let t=this.host,n=t.navDrawerOpen&&e.restoreFocus;t.navDrawerOpen&&(this.dismissSidebarTransientMenus(),this.navDrawerSwipe.closed()),LS(t);let r=n?t.navDrawerTrigger:null;t.navDrawerOpen=!1,t.navDrawerTrigger=null,n&&requestAnimationFrame(()=>this.restoreFocusTo(r))},this.resizeNavigation=e=>{let t=this.host,n=t.querySelector(`.shell`),r=t.context;if(!n||!r)return;let i=Math.round(Math.min(400,Math.max(240,e*n.clientWidth)));r.navigation.update({navWidth:i})},this.handleNativeToggleSidebar=()=>this.toggleNavigationSurface(),this.handleNativeOpenSearch=()=>this.openPalette(),this.handleNativeToggleSearch=e=>{e.preventDefault(),this.togglePalette()},this.handleNativeNewSession=()=>{sS(this.host,`native`)},this.handleNativeNavigate=e=>{let t=e.detail,n=t?.path,r=typeof n==`string`?n.slice(1):``;if(typeof n!=`string`||!n.startsWith(`/`)||n.startsWith(`//`)||/^[a-z][a-z\d+.-]*:/i.test(r))return;let i=Ps(n),a=this.host.context;if(!i||!a)return;e.preventDefault();let o={pathname:`${a.basePath}${n}`},s=t?.search;typeof s==`string`&&s.startsWith(`?`)&&!s.includes(`#`)&&(o.search=s),this.host.navigate(i,o)},this.handleNativeHistoryState=e=>{let t=e.detail;typeof t?.canGoBack==`boolean`&&typeof t.canGoForward==`boolean`&&(this.host.nativeHistoryState=t)},this.handleWindowResize=()=>{let e=this.host,t=SS(),n=t&&!e.navDrawerOpen&&this.dismissSidebarTransientMenus();t?(this.navDrawerSwipe.load(),e.desktopNavigationExpanded=!1):e.navDrawerOpen&&(e.closeNavDrawer({restoreFocus:!1}),e.desktopNavigationExpanded=e.context?.navigation.snapshot.navCollapsed??!1),e.requestUpdate(),e.updateComplete.then(()=>{SS()&&!e.navDrawerOpen&&n&&requestAnimationFrame(()=>{this.restoreFocusTo(RS(e))})})},this.handleUnhandledFileDrag=e=>{let t=e.composedPath().some(e=>e instanceof HTMLInputElement&&e.type===`file`&&!e.disabled);e.defaultPrevented||t||!Array.from(e.dataTransfer?.types??[]).includes(`Files`)||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`none`))},this.dismissSidebarTransientMenus=()=>NS(this.host),this.handleDocumentKeydownBubble=e=>{let t=this.host;!e.defaultPrevented&&Zn(P.escape,e)&&(t.navDrawerOpen&&SS()&&!document.openClawModalLayers?.size?(e.preventDefault(),t.closeNavDrawer({restoreFocus:!0})):Bc(t.routeState.routeId)&&!this.shouldIgnoreSettingsEscape(e)&&(e.preventDefault(),t.exitSettings()))},this.handleDocumentKeydown=e=>{let t=this.host;if(t.lazyCustomElements.visibleState?.element===uu&&g(e,this.pendingDebugOverlayMode,t.querySelector(`.debug-overlay`))){e.preventDefault(),t.lazyCustomElements.close();return}if(!this.palette.handlePendingShortcut(e)&&!document.openClawModalLayers?.size){if(t.navDrawerOpen&&SS()){FS(t,e);return}if(!t.commandPalette&&Mx(e)){e.preventDefault(),this.togglePalette();return}if(jd(e)&&!Es(t.routeState.routeId)&&!e.defaultPrevented&&!t.onboardingMode&&!Bc(t.routeState.routeId)&&t.context&&ye(t.context.gateway.snapshot,t.context.config.current.terminalEnabled??!1)){e.preventDefault(),window.dispatchEvent(new CustomEvent(Nd));return}if(Md(e)&&qb(t.context?.gateway)){e.preventDefault(),window.dispatchEvent(new CustomEvent(Rd));return}if(!e.defaultPrevented){if(Zn(P.newSession,e)){!e.repeat&&sS(this.host,`shortcut`)&&e.preventDefault();return}if(Zn(P.keyboardShortcuts,e)){e.preventDefault(),window.dispatchEvent(new CustomEvent(Vd));return}if(Zn(P.debugOverlay,e)){let t=e.target;if(t instanceof Element&&t.closest(`input, textarea, [contenteditable]:not([contenteditable='false'])`))return;e.preventDefault(),window.dispatchEvent(new CustomEvent(Bd));return}if(Zn(P.escape,e)&&Bc(t.routeState.routeId)){if(t.navDrawerOpen){e.preventDefault(),t.closeNavDrawer({restoreFocus:!0});return}if(e.eventPhase===Event.CAPTURING_PHASE||this.shouldIgnoreSettingsEscape(e))return;e.preventDefault(),t.exitSettings();return}if(Zn(P.appearanceSettings,e)){e.preventDefault(),t.navigate(`appearance`);return}Zn(P.toggleSidebar,e)&&(e.preventDefault(),this.toggleNavigationSurface())}}},this.handleDebugOverlayRequest=e=>{let t=this.host;if(t.navDrawerOpen&&SS()&&t.closeNavDrawer({restoreFocus:!1}),t.lazyCustomElements.visibleState?.element===uu){this.pendingDebugOverlayMode===`minimized`?this.togglePendingDebugOverlayMode():t.lazyCustomElements.close();return}let n=Yx(Bd,e),r=ou(uu)?t.querySelector(uu.tagName):null;if(r){this.clearPendingLazyAction(n),n.detail&&`mode`in n.detail?r.open(gi(n)):r.toggle();return}this.requestLazyElement(uu,n,()=>{if(this.pendingLazyAction!==n)return;let e=t.querySelector(uu.tagName);if(!e)return;let r=this.pendingDebugOverlayMode;this.clearPendingLazyAction(n),e.open(r)})},this.handleAssistantToggleBeforeMount=e=>{let t=this.host;if(t.querySelector(`openclaw-assistant-panel`))return;let n=e.type===Rd;if(n?!qb(t.context?.gateway):!Bi(t.context?.gateway.snapshot,`openclaw.chat`,`operator.admin`)){e.preventDefault();return}let r=Yx(n?Rd:zd,e);this.pendingLazyAction=r,Zx(r),t.requestUpdate()},this.handleKeyboardShortcutsRequest=e=>{let t=Yx(Vd,e);if(ou(du)){this.host.querySelector(du.tagName)?.toggle(),this.clearPendingLazyAction(t);return}this.requestLazyElement(du,t)},this.openPalette=()=>this.palette.open(),this.closePendingPalette=()=>this.palette.closePending(),this.togglePalette=()=>this.palette.toggle(),this.handleShellNavDrawerToggle=e=>{this.toggleNavigationSurface(jx(e))},this.handleApprovalsOpen=e=>{let t=this.host,n=Yx(eS,e);if(ou(t.execApprovalElement)){t.approvalOverlay?.show(),this.clearPendingLazyAction(n);return}this.requestLazyElement(t.execApprovalElement,n)},this.restorePendingLazyAction=()=>{let e=this.pendingLazyAction;if(!e||this.host.lazyCustomElements.visibleState||this.commandPaletteLoading.waitingForComposition)return;let t=this.host,n={[Lx]:t.commandPaletteElement.tagName,[Bd]:uu.tagName,[Vd]:du.tagName,[Nd]:t.terminalPanelElement.tagName,[Fd]:t.browserPanelElement.tagName,[Hd]:t.linkReaderPanelElement.tagName,[Id]:t.desktopPanelElement.tagName,[zd]:`openclaw-assistant-panel`,[Rd]:`openclaw-assistant-panel`,[eS]:t.execApprovalElement.tagName}[e.eventType];(!customElements.get(n)||this.host.querySelector(n))&&this.dispatchLazyShellEvent(e)&&!this.host.lazyCustomElements.visibleState&&this.clearPendingLazyAction(e)},this.handleCommandPaletteSlashCommand=e=>this.palette.handleSlashCommand(e),this.handleCommandPaletteTarget=e=>Px(this.host,e),this.nativeNavCollapsed=()=>{let e=this.host,t=SS();return e.onboardingMode||t||Bc(e.routeState.routeId)&&!t||!e.navDrawerOpen&&!e.desktopNavigationExpanded&&(e.context?.navigation.snapshot.navCollapsed??!1)},this.palette=new iS(e,{request:(e,t,n)=>this.requestLazyElement(e,t,n),clear:e=>this.clearPendingLazyAction(e),cancel:()=>this.cancelPendingLazyAction(),pending:()=>this.pendingLazyAction?.eventType===Lx}),this.panels=new yS(e,(e,t)=>this.requestLazyElement(e,t)),this.navDrawerSwipe=new AS(e,()=>this.toggleNavigationSurface())}connect(){this.disconnect(),this.listeners=new AbortController;let e={signal:this.listeners.signal},t=this.host;t.nativeHistoryState=hc(),t.addEventListener(Ix,this.handleCommandPaletteTarget,e);for(let n of[c,Gn])t.addEventListener(n,()=>t.requestUpdate(),e);document.addEventListener(`keydown`,this.handleDocumentKeydown,{capture:!0,signal:this.listeners.signal}),document.addEventListener(`keydown`,this.handleDocumentKeydownBubble,e),window.addEventListener(`dragover`,this.handleUnhandledFileDrag,e),window.addEventListener(`drop`,this.handleUnhandledFileDrag,e);for(let[t,n]of[[Lx,this.palette.open],[Rx,this.handleShellNavDrawerToggle],[Bd,this.handleDebugOverlayRequest],[Vd,this.handleKeyboardShortcutsRequest],[`resize`,this.handleWindowResize],[gc,this.handleNativeHistoryState],[`openclaw:native-toggle-sidebar`,this.handleNativeToggleSidebar],[`openclaw:native-open-search`,this.handleNativeOpenSearch],[`openclaw:native-toggle-search`,this.handleNativeToggleSearch],[`openclaw:native-new-session`,this.handleNativeNewSession],[`openclaw:native-navigate`,this.handleNativeNavigate],[Nd,this.panels.handleDeferredTerminalToggle],[Fd,this.panels.handleDeferredBrowserToggle],[Hd,this.panels.handleDeferredLinkReaderToggle],[Id,this.panels.handleDeferredDesktopToggle],[zd,this.handleAssistantToggleBeforeMount],[Rd,this.handleAssistantToggleBeforeMount],[eS,this.handleApprovalsOpen]])window.addEventListener(t,n,e);this.navDrawerSwipe.connect(),SS()&&this.navDrawerSwipe.load(),WS=this.listeners,Object.assign(window,{__OPENCLAW_NATIVE_COMMANDS_READY__:!0}),window.dispatchEvent(new Event(`openclaw:native-commands-state`))}disconnect(){this.commandPaletteLoading.clear();let e=this.listeners;this.listeners?.abort(),this.listeners=void 0,this.navDrawerSwipe.disconnect(),e&&WS===e&&(WS=void 0,Object.assign(window,{__OPENCLAW_NATIVE_COMMANDS_READY__:!1}),window.dispatchEvent(new Event(`openclaw:native-commands-state`)))}get pendingDebugOverlayMode(){return gi(this.pendingLazyAction)}togglePendingDebugOverlayMode(){let e=this.pendingLazyAction;e?.eventType===`openclaw:debug-overlay-request`&&this.host.lazyCustomElements.visibleState?.element===uu&&(e.detail={mode:this.pendingDebugOverlayMode===`minimized`?`expanded`:`minimized`},Zx(e),this.host.requestUpdate())}shouldIgnoreSettingsEscape(e){let t=this.host,n=t.context?.overlays.snapshot;if(t.commandPalette?.isOpen||t.querySelector(du.tagName)?.isOpen||n?.devicePairSetupOpen||t.approvalOverlay?.dialogOpen===!0||document.openClawModalLayers?.size)return!0;let r=e.target;return r instanceof Element&&r.closest(`input, textarea, select, wa-select[open], wa-dropdown[open], [contenteditable], dialog, [role='dialog'], [role='menu'], [role='listbox']`)!==null}get commandPaletteLoading(){return this.palette.loading}synchronizeCommandPaletteScope(){this.palette.synchronizeScope()}requestLazyElement(e,t,n=()=>this.dispatchLazyShellEvent(t)){e!==this.host.commandPaletteElement&&this.commandPaletteLoading.clear(),this.pendingLazyAction=t,Zx(t),this.host.lazyCustomElements.request(e,()=>{n(),this.clearPendingLazyAction(t)})}retryPendingLazyAction(e){let t=this.pendingLazyAction;return Gl({canReload:()=>e()&&this.pendingLazyAction===t&&(!t||Zx(t))})}dispatchLazyShellEvent({eventType:e,detail:t}){return window.dispatchEvent(new CustomEvent(e,{cancelable:!0,detail:t}))}clearPendingLazyAction(e){JSON.stringify(this.pendingLazyAction)===JSON.stringify(e)&&(Qx(),this.pendingLazyAction=null)}cancelPendingLazyAction(){this.commandPaletteLoading.clear();let e=this.pendingLazyAction;e&&this.clearPendingLazyAction(e)}abandonPendingLazyActionForContext(){this.commandPaletteLoading.clear(),this.panels.reset(),this.pendingLazyAction=null,Qx(),this.host.lazyCustomElements.abandon()}preservePendingLazyActionForReload(){this.panels.reset(),this.host.lazyCustomElements.abandon()}}})))()}function qS(e){return Object.hasOwn(Ma,e)}function JS(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e===t}function YS(e,t,n){let r=(n,r)=>{JS(t[n],r)||(e[n]=r)};for(let e of Object.keys(n))r(e,n[e])}function XS(e){let t=es(es(es(e)?.ui)?.prefs);if(!t)return{};let n={};for(let e of iC){if(rC[e].configSync===!1)continue;let r=rC[e].extract(t[e]);r!==void 0&&(n[e]=r)}return n}function ZS(e,t,n,r,i,a){let o=rC[t],s=o.local(r),c=o.write?.(void 0),l=c?o.local({...r,...c}):void 0,u=e=>{let t=!JS(s,e);return{overridden:t,provenance:t||o.configSync===!1&&i===!1?`device-local`:`default`,resetValue:e,value:s}},d=es(es(es(e)?.ui)?.prefs),f=o.configSync!==!1&&d&&Object.hasOwn(d,t)?o.extract(d[t]):void 0,p=a?.[t]??void 0,m=p??f,h=p!==void 0,g=a!=null&&qS(t)?f??l:l,_=m!==void 0&&(!o.canApply||o.canApply(m,r)),v=_?m:l;if(i===null&&a!=null&&qS(t)||i===!1&&n&&t in n)return{...u(v),provenance:`device-local`};if(n&&t in n){let e=n[t];return e===null?{...u(g),provenance:`pending`}:{overridden:!0,provenance:`pending`,resetValue:g,value:e}}return m===void 0||!_&&i===!1?u(l):!_||JS(s,m)?{overridden:!0,provenance:h?`profile`:`synced`,resetValue:g,value:_?m:s}:u(m)}function QS(e,t,{appearanceReady:n,scopeChanged:r,firstSnapshot:i,shadowPrefs:a,retainedLocalKeys:o}){let s={};for(let c of iC){if(a&&c in a||o.has(c))continue;let l=qS(c),u=n||!l;Object.hasOwn(e,c)?u&&(r||i||!JS(e[c],t[c]))&&Object.assign(s,{[c]:e[c]}):!(c in e)&&rC[c].write&&(u&&Object.hasOwn(t,c)||r&&l)&&(s[c]=null)}return s}function $S(e,t){let n={};for(let r of iC){let i=rC[r],a=e[r];if(a!==void 0){if(a===null){let e=i.write?.(void 0);e&&YS(n,t,e);continue}JS(a,i.local(t))||(!i.canApply||i.canApply(a,t))&&(n[r]=a)}}return Object.keys(n).length>0?n:null}var eC,tC,nC,rC,iC;function aC(){return(aC=e((()=>{Zi(),Fo(),$c(),N(),Hg(),Fh(),eC=e=>e,tC=(e,t,n=!0)=>eC({configSync:n,extract:t,local:n=>t(n[e]),write:t=>({[e]:t})}),nC=e=>eC({extract:e=>typeof e==`boolean`?e:void 0,local:e}),rC={theme:eC({extract:e=>e===`custom`||bo(e)?e:void 0,local:e=>e.theme,write:e=>({theme:e??Rg.theme}),canApply:(e,t)=>e!==`custom`||!!t.customTheme}),themeMode:eC({extract:Ho,local:e=>e.themeMode,write:e=>({themeMode:e??Rg.themeMode})}),accent:tC(`accent`,Zh),fontUi:tC(`fontUi`,wh,!1),fontChat:tC(`fontChat`,wh,!1),tabIcon:tC(`tabIcon`,_o,!1),locale:eC({extract:e=>typeof e==`string`&&ut(e)?e:void 0,local:e=>e.locale,write:e=>({locale:e})}),chatShowThinking:nC(e=>e.chatShowThinking),chatShowToolCalls:nC(e=>e.chatShowToolCalls),chatPersistCommentary:nC(e=>e.chatPersistCommentary!==!1),chatSendShortcut:eC({extract:e=>e===`enter`||e===`modifier-enter`?e:void 0,local:e=>Mg(e.chatSendShortcut),write:e=>({chatSendShortcut:e})}),chatFollowUpMode:tC(`chatFollowUpMode`,Xh),sidebarEntries:eC({extract:e=>Pc(e)??void 0,local:e=>e.sidebarEntries})},iC=Object.keys(rC)})))()}function oC(e,t){(t===`device-local`?dC:uC).add(e)}function sC(){uC.clear(),dC.clear(),fC.clear()}function cC(e,t){let n={};for(let r of iC){let i=fC.delete(r),a=uC.delete(r);if(dC.delete(r))continue;if(a){n[r]=null;continue}let o=rC[r],s=o.local(e),c=o.local(t);if(i||!JS(s,c)){if(c===void 0){o.write&&(n[r]=null);continue}n[r]=c}}return Object.keys(n).length>0?n:null}function lC(e,t={}){return e===dg().theme?mg({...t,theme:e}):(fC.add(`accent`),uC.add(`fontUi`),uC.add(`fontChat`),mg({...t,theme:e,fontUi:void 0,fontChat:void 0,accent:`theme`}))}var uC,dC,fC;function pC(){return(pC=e((()=>{aC(),Hg(),uC=new Set,dC=new Set,fC=new Set})))()}function mC(e,t){return t?`${e}:profile:${t}`:e}function hC(e,t){return t&&bC?.profileId===t&&bC.scope===e?bC.prefs:null}function gC(e){return xC?.scope===e?xC.profileId:null}function _C(e,t){xC={scope:e,profileId:t}}function vC(){bC=null,xC=null,SC+=1}async function yC(e,t,n){_C(n,t);let r=++SC,{readProfileAppearancePrefs:i}=await W(async()=>{let{readProfileAppearancePrefs:e}=await import(`./server-prefs-profile-runtime-CL2b8ykJ.js`).then(e=>(e.n(),e.r));return{readProfileAppearancePrefs:e}},__vite__mapDeps([105,1,106,30]),import.meta.url);if(r!==SC)return!1;let a=await i(e,t);return r!==SC||!a?!1:(bC={profileId:t,scope:n,prefs:a},!0)}var bC,xC,SC;function CC(){return(CC=e((()=>{U(),bC=null,xC=null,SC=0})))()}function wC(e,t){try{let n=globalThis.localStorage;return n?{available:!0,value:n.getItem(`${e}:${t}`)}:{available:!1,value:null}}catch{return{available:!1,value:null}}}function TC(e,t){return wC(e,t).value}function EC(e,t,n){try{let r=globalThis.localStorage;if(!r)return!1;let i=`${e}:${t}`;return n===null?r.removeItem(i):r.setItem(i,n),!0}catch{return!1}}function DC(e){let t=es(ta(e??`null`));return t&&Object.keys(t).length?t:null}function OC(e,t){let n=wC(e,t);return{available:n.available,prefs:DC(n.value)}}function kC(e){let t=DC(TC(NC,e));if(!t)return new Set;let n=Object.keys(t).filter(e=>Object.hasOwn(rC,e));return new Set(n)}function AC(e,t){EC(NC,e,t.size?JSON.stringify(Object.fromEntries([...t].map(e=>[e,!0]))):null)}var jC,MC,NC;function PC(){return(PC=e((()=>{Qa(),aC(),jC=`openclaw.control.serverPrefs.v1`,MC=`openclaw.control.serverPrefs.pending.v1`,NC=`openclaw.control.serverPrefs.retained-local.v1`})))()}function FC(e,t,n=``,r=dg(n||void 0),i={}){let a=!i.profileId&&qS(t)&&i.canSync===null,o=i.profileId??(a?gC(n):null),s=mC(n,o),c=s===Q?$:DC(TC(MC,s)),l=hC(n,o),u=o&&qS(t)&&l===null,d=u?DC(TC(`openclaw.control.serverPrefs.v1`,s))??{}:l,f=ZS(e,t,c,r,i.canSync,d);return u&&f.provenance===`profile`?{...f,provenance:`synced`}:f}function IC(){mw!==null&&(clearTimeout(mw),mw=null),hw=0}function LC(e,t,n){let r=kC(e);for(let e of t)n?r.add(e):r.delete(e);AC(e,r),n&&e===gw&&(_w=null)}function RC(e,t=!1){if(!t&&e===Q)return;Q=e;let n=OC(MC,e);$=n.prefs,aw=new Set(n.available&&n.prefs?Object.keys(n.prefs):[])}function zC(e){EC(`openclaw.control.serverPrefs.pending.v1`,Q,e?JSON.stringify(e):null)?aw=new Set($?Object.keys($):[]):aw.clear()}function BC(e,t){e===Q&&HC();let n=e===Q?$:null,r={...DC(TC(MC,e)),...n};for(let e of t)delete r[e];let i=Object.keys(r).length?r:null;if(e===Q){$=i,zC(i);return}EC(MC,e,i?JSON.stringify(i):null)}function VC(e={}){let t=DC(TC(`openclaw.control.serverPrefs.pending.v1`,Q))??{};for(let n of Object.keys(e))JS(t[n],e[n])&&delete t[n];let n={...t,...$};zC(Object.keys(n).length?n:null)}function HC(){if(!$||aw.size===0)return;let e=OC(MC,Q);if(!e.available)return;let t=e.prefs??{};for(let e of aw){if(!Object.hasOwn(t,e)){delete $[e],aw.delete(e);continue}let n=t[e];JS($[e],n)||($[e]=n)}Object.keys($).length||($=null)}function UC(e){let t=$;return!!(t&&Object.keys(e).every(n=>Object.hasOwn(t,n)&&JS(t[n],e[n])))}function WC(){IC(),iw=dw=fw=!1,Q=``,$=ow=null,aw.clear(),sw=``,cw=null,lw=!1,gw=``,_w=null,vC(),sC()}function GC(e,t,n=Q,r){let i=rC[e],a=t=>e===`theme`&&t.theme!==void 0?lC(t.theme):mg(t),o=mC(n,qS(e)?r??gC(n):null),s=i.write;if(!s)throw Error(`Server UI preference is not resettable: ${e}`);if(t?.provenance===`device-local`){let r=s(t.resetValue),i=e===`theme`&&r.theme!==dg().theme?[e,`accent`,`fontUi`,`fontChat`]:[e];BC(o,i),o!==n&&BC(n,i),LC(o,i,!1);for(let e of i)oC(e,`device-local`);return a(r)}return oC(e,`server`),a(s(t?.resetValue))}function KC(e,t){let n=t.scope??``,r=mC(n,t.profileId);if(r===gw&&e===_w)return!1;let i=gw!==``&&r!==gw,a=hC(n,t.profileId),o=!t.profileId||a!==null||i,s=r===Q?$:DC(TC(MC,r)),c=kC(r),l=[...c].filter(e=>o||!qS(e)),u=()=>{l.length&&LC(r,l,!1),gw=r,_w=e},d={...XS(e),...a},f=TC(jC,r),p=DC(f)??{};if(!o)for(let e of iC)qS(e)&&(delete d[e],Object.hasOwn(p,e)&&Object.assign(d,{[e]:p[e]}));let m=JSON.stringify(d);if(!i&&m===f)return u(),!1;let h=QS(d,p,{appearanceReady:o,scopeChanged:i,firstSnapshot:f===null,shadowPrefs:s,retainedLocalKeys:c});EC(jC,r,m),u(),Object.hasOwn(h,`theme`)&&t.onThemeChanged?.(h.theme??null);let g=$S(h,dg(n||void 0));if(!g)return!1;iw=!0;try{mg(g)}finally{iw=!1}return t.onApplied(g),!0}async function qC(e){let t=e.scope??e.client.gatewayUrl;return await yC(e.client,e.profileId,t)?(_w=null,KC(e.configObject,{...e,scope:t})):!1}function JC(){return iw}function YC(e,t){let n=t.profileId??t.profile?.selfUser?.id??null,r=e.state.client?.gatewayUrl??``;n&&_C(r,n);let i=mC(r,n);if(lw=t.canWrite??Jf(t.profile?.hello?.auth??null),ow===e&&sw===i&&cw===n)return;HC();let a=Q===``?{...DC(TC(MC,``)),...$}:null;IC(),pw+=1,ow=e,sw=i,cw=n,dw=!1,RC(i,!0),i&&a&&Object.keys(a).length&&($={...$,...a},VC(),EC(MC,``,null))}function XC(e){if($){for(let t of Object.keys(e))JS($[t],e[t])&&(delete $[t],aw.delete(t));Object.keys($).length||($=null)}}function ZC(e,t){mw!==null||hw>=rw||(hw+=1,mw=setTimeout(()=>{mw=null,ow===e&&pw===t&&$&&$C(e)},nw))}async function QC(e,t){for(;$;){if(ow!==e||pw!==t||(HC(),!$))return;let n=iC.filter(e=>$?.[e]!==void 0&&(rC[e].configSync===!1||e===`theme`&&typeof $.theme==`string`&&$.theme.includes(`/`))&&!(cw&&lw));if(n.length){if(!e.state.connected)return;BC(Q,n),LC(Q,n,!0),uw?.({needsRefresh:!1,retainedLocal:!0});continue}if(cw&&$.theme===`custom`){BC(Q,[`theme`]),LC(Q,[`theme`],!0);continue}let r={};if(cw&&lw)for(let e of iC)qS(e)&&Object.hasOwn($,e)&&Object.assign(r,{[e]:$[e]});let i=Object.keys(r).length>0,a=i?r:{...$},o=uw;for(let n=0;n<2;n+=1){if(ow!==e||pw!==t)return;i&&e.state.client&&Cv(e.state.client);let r=i?await W(async()=>{let{writeProfileAppearancePrefs:e}=await import(`./server-prefs-profile-runtime-CL2b8ykJ.js`).then(e=>(e.n(),e.r));return{writeProfileAppearancePrefs:e}},__vite__mapDeps([105,1,106,30]),import.meta.url).then(({writeProfileAppearancePrefs:n})=>n(e.state.client,a,ow===e&&pw===t&&e.state.connected&&lw&&UC(a))):await e.runExternalMutation(e=>e.request(`config.patch`,{raw:JSON.stringify({ui:{prefs:a}}),...a.sidebarEntries===void 0?{}:{replacePaths:[`ui.prefs.sidebarEntries`]},note:`control-ui prefs sync`}),{waitForWritesResumed:!0,configWriteAck:e=>e,canDispatch:()=>e.canPatch!==!1&&(HC(),UC(a)?!0:(fw=!!$,!1)),dispatchError:`Access changed before preferences could sync.`});if(ow!==e||pw!==t)return;let s=`batch`in r?r.batch:a;if(r.ok){XC(s);let n={...DC(TC(`openclaw.control.serverPrefs.v1`,Q))??{},...s},a=hC(e.state.client?.gatewayUrl??``,cw);if(i&&a){let t=XS(e.state.configSnapshot?.config);for(let e of iC)Object.hasOwn(s,e)&&(s[e]===null?(delete a[e],t[e]===void 0?delete n[e]:Object.assign(n,{[e]:t[e]})):Object.assign(a,{[e]:s[e]}));_w=null}if(EC(jC,Q,JSON.stringify(n)),VC(s),IC(),ow!==e||pw!==t||(r.refresh.ok&&o&&gw===Q&&(_w=null),o?.({needsRefresh:!r.refresh.ok}),ow!==e||pw!==t))return;break}if(r.reason===`conflict`&&n===0){await _a(250);continue}if(r.reason===`conflict`){ZC(e,t);return}if(r.reason===`error`||r.reason===`unavailable`||r.reason===`suspended`)return;XC(s),VC(s),o?.({needsRefresh:!1,retainedLocal:!0});break}}}function $C(e){if(dw){fw=!0;return}if(!$||e.state.connected&&e.canPatch===!1&&!(cw&&lw&&Object.keys($).some(qS)))return;dw=!0;let t=pw;QC(e,t).catch(()=>void 0).finally(()=>{ow===e&&pw===t&&(dw=!1,fw&&(fw=!1,$C(e)))})}function ew(e,t,n={}){YC(e,n),IC(),uw=n.afterCommit;let r=iC.filter(e=>Object.hasOwn(t,e)),i=e.state.connected?r.filter(n=>rC[n].configSync===!1&&!cw?!0:cw&&qS(n)?!lw||n===`theme`&&t.theme===`custom`:e.canPatch===!1):[];if(i.length&&(BC(Q,i),LC(Q,i,!0),n.afterCommit?.({needsRefresh:!1,retainedLocal:!0}),i.length===r.length))return;let a=i.length?Object.fromEntries(Object.entries(t).filter(([e])=>!i.some(t=>t===e))):t;HC(),$={...$,...a},VC(),$C(e)}function tw(e,t={}){YC(e,t),IC(),pw+=1,dw=fw=!1,uw=t.afterCommit,$C(e)}var nw,rw,iw,Q,$,aw,ow,sw,cw,lw,uw,dw,fw,pw,mw,hw,gw,_w;function vw(){return(vw=e((()=>{Ra(),tp(),pC(),CC(),aC(),PC(),Hg(),Ev(),U(),nw=1e3,rw=5,iw=!1,Q=``,$=null,aw=new Set,ow=null,sw=``,cw=null,lw=!1,dw=!1,fw=!1,pw=0,mw=null,hw=0,gw=``,_w=null})))()}function yw(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[],i=[];for(let t of e){let e=n.get(t.id);e?JSON.stringify(e)!==JSON.stringify(t)&&(r.push(t.id),i.push(t.id)):r.push(t.id)}return{invalidatedIds:r,changedIds:i}}var bw,xw;function Sw(){return(Sw=e((()=>{Y(),Gd(),vS(),N(),kn(),tr(),b(),Yn(),tp(),vw(),Ev(),bw=100,xw=class{constructor(e){this.host=e,this.agentsListClient=null,this.agentsListSource=null,this.sessionKeyClient=null,this.runtimeConfigClient=null,this.runtimeConfigSource=null,this.previousGatewayPhase=null,this.agentRosterRefreshTimer=null,this.runtimeConfigProfileId=null,this.profileAppearanceSource=null}observeSessions(e,t){let n=!0,r=()=>{n&&this.host.context?.sessions===e&&(this.host.observeDeletedSessions(e.state),this.host.recoverDeletedActiveSession(),t())};r();let i=e.subscribe(r);return()=>{n=!1,i()}}reconcileServerUiPrefs(e){let t=e.state.configSnapshot,n=this.host.context;if(!t?.config||!n||n.runtimeConfig!==e||n.gateway.snapshot.phase!==`connected`)return;let r=n.gateway.connection.gatewayUrl;KC(t.config,{scope:r,profileId:n.gateway.snapshot?.selfUser?.id,onThemeChanged:e=>n.theme.recordServerSelection(e,r),onApplied:()=>n.theme.refresh()}),this.refreshProfileAppearancePrefs(n).catch(()=>void 0);let i=FC(t.config,`locale`,r),a=JSON.stringify([r,i.overridden,i.value]);if(a!==this.host.lastLocalePrefSignature){if(this.host.lastLocalePrefSignature=a,i.overridden&&ut(i.value)){xe.setLocale(i.value);return}xe.useSystemLocale()}}reconcileCommittedServerUiPrefs(e,t,n=!1){if(this.host.context?.runtimeConfig===e){if(t){e.refresh();return}this.reconcileServerUiPrefs(e),n&&this.host.context?.theme.refresh()}}handleGatewayEvent(e){let t=this.host.context,n=t?.gateway?.snapshot.client;n&&e.event===`sessions.changed`&&Vt(n,e.payload,{hello:t?.gateway.snapshot.hello,agentsList:t?.agents.state.agentsList});let r=Le(e),i=e.event!==`chat.metadata.changed`||es(e.payload)?.commandsChanged!==!1;if(n&&un(e)&&Xr(n),n&&(r||e.event===`chat.metadata.changed`&&i)&&ai(n,void 0,void 0,r??`preserve`,i),e.event===`sessions.changed`){this.host.recoverDeletedActiveSession();return}if(e.event===`config.changed`){this.host.context?.config.refresh();let e=this.host.context?.runtimeConfig;e&&!e.state.configFormDirty&&e.refresh({background:!0}),this.scheduleAgentRosterRefresh();return}if(e.event===`users.prefs.changed`){let e=this.host.context,t=e?.gateway.snapshot.selfUser?.id;e&&t&&(e.gateway.snapshot.client&&Cv(e.gateway.snapshot.client),this.refreshProfileAppearancePrefs(e,!0).catch(()=>void 0));return}if(e.event!==`ui.command`||!e.payload)return;let a=this.host.context;if(!a)return;let o=e.payload,{command:s}=o;if(s){if(s.kind===`agent-github-settings`){let e=o.agentId?.trim();e&&a.navigate(`agents`,{pathname:gs(e,`tools`,a.basePath)});return}if(s.kind===`sidebar`){this.host.desktopNavigationExpanded=!1,a.navigation.update({navCollapsed:!s.visible});return}if(s.kind===`panel`){let e=o.sessionKey??(s.panel===`portal`||s.panel===`plugin`?this.host.activeSessionKey:void 0);e&&(!ci(e,this.host.activeSessionKey)||!Es(this.host.routeState.routeId)||s.panel===`plugin`&&o.agentId!==void 0&&o.agentId!==a.agentSelection.state.selectedId)&&this.host.selectChatSession(e,o.agentId);let t=new CustomEvent({terminal:Nd,browser:Fd,desktop:Id,portal:Ld,plugin:Ud}[s.panel],{detail:{open:s.open,...s.panel===`plugin`?{pluginId:s.pluginId,panelId:s.panelId,agentId:o.agentId}:{},...e?{sessionKey:e}:{},...s.dock?{dock:s.dock}:{},...s.panel===`terminal`&&s.terminalSessionId?{terminalSessionId:s.terminalSessionId}:{},...`environmentId`in s&&s.environmentId?{environmentId:s.environmentId}:{},...`portalId`in s&&s.portalId?{portalId:s.portalId}:{}}});e&&pS(s.panel===`plugin`?`plugin:${s.pluginId}/${s.panelId}`:s.panel,t),window.dispatchEvent(t);return}window.dispatchEvent(new CustomEvent(`openclaw:ui-command`,{detail:o,cancelable:!0}))&&(s.kind===`navigate`||s.kind===`split`)&&this.host.selectChatSession(s.sessionKey,o.agentId)}}scheduleAgentRosterRefresh(){this.agentRosterRefreshTimer!==null&&globalThis.clearTimeout(this.agentRosterRefreshTimer),this.agentRosterRefreshTimer=globalThis.setTimeout(()=>{this.agentRosterRefreshTimer=null,this.refreshAgentRoster()},bw)}async refreshAgentRoster(){let e=this.host.context;if(!e)return;let t=e.agents.state.agentsList,n=e.agentSelection.state.selectedId,r=await e.agents.refreshList();if(!r||this.host.context!==e)return;let i=yw(t?.agents??[],r.agents);i.invalidatedIds.length>0&&(e.agents.invalidateFiles(i.invalidatedIds),e.agentIdentity.invalidate(i.invalidatedIds)),i.changedIds.length>0&&e.agentIdentity.ensure(i.changedIds);let a=new Set(r.agents.map(e=>e.id));n&&e.agentSelection.state.selectedId===n&&r.agents.length>0&&!a.has(n)&&e.agentSelection.set(r.defaultId,{background:!0})}synchronizeGateway(e){let t=this.previousGatewayPhase;this.previousGatewayPhase=e.phase,this.updateGatewaySessionKey(e);let n=this.host.context;if(this.host.recoverDeletedActiveSession(),e.phase===`connected`&&n){let t=n.connectionBootstrap;t.run(`runtime-config`,async()=>(await this.ensureRuntimeConfig(e,n.runtimeConfig),this.refreshProfileAppearancePrefs(n))),this.host.routeState.routeId&&!n.agents.state.agentsList&&t.run(`agents`,()=>this.ensureAgentsList(e,n.agents)),t.run(`outbox`,()=>this.host.outboxStoreImport.load())}t!==`connected`&&e.phase===`connected`&&xe.retryPendingLocale()}ensureRuntimeConfig(e,t=this.host.context?.runtimeConfig){if(e.phase!==`connected`||!e.client||!t)return this.runtimeConfigClient=null,this.runtimeConfigProfileId=null,this.profileAppearanceSource=null,Promise.resolve();let n=e.selfUser?.id??null;return this.runtimeConfigClient===e.client&&this.runtimeConfigSource===t&&this.runtimeConfigProfileId===n?Promise.resolve():(this.runtimeConfigClient=e.client,this.runtimeConfigSource=t,this.runtimeConfigProfileId=n,tw(t,{profileId:n,canWrite:Jf(e.hello?.auth??null),afterCommit:({needsRefresh:e,retainedLocal:n})=>this.reconcileCommittedServerUiPrefs(t,e,n)}),t.ensureLoaded())}ensureAgentsList(e,t=this.host.context?.agents){if(e.phase!==`connected`||!e.client)return this.agentsListClient=null,Promise.resolve();let n=this.host.routeState.routeId;return!t||!n||t.state.agentsList||this.agentsListClient===e.client&&this.agentsListSource===t?Promise.resolve():(this.agentsListClient=e.client,this.agentsListSource=t,t.ensureList().then(()=>void 0))}updateGatewaySessionKey(e){let t=e.sessionKey.trim();(e.client!==this.sessionKeyClient||t!==this.host.activeSessionKey)&&(this.sessionKeyClient=e.client,t&&(this.host.activeSessionKey=t))}refreshProfileAppearancePrefs(e,t=!1){let n=e.gateway.snapshot,r=n?.selfUser?.id;if(!r)return Promise.resolve();let i=n.client,a=e.runtimeConfig.state.configSnapshot?.config;if(n.phase!==`connected`||!i||!a)return Promise.resolve();let o=this.profileAppearanceSource;if(!t&&o?.client===i&&o.profileId===r)return Promise.resolve();let s={client:i,profileId:r};this.profileAppearanceSource=s;let c=e.gateway.connection.gatewayUrl,l=()=>this.host.context===e&&e.gateway.snapshot.client===i&&e.gateway.snapshot.selfUser?.id===r&&this.profileAppearanceSource===s;return qC({client:i,profileId:r,configObject:a,scope:c,onApplied:()=>{l()&&e.theme.refresh()},onThemeChanged:t=>{l()&&e.theme.recordServerSelection(t,c)}}).then(t=>{!t&&l()&&e.theme.refresh()}).catch(e=>{l()&&console.error(`[gateway] profile appearance preference refresh failed:`,e)})}reset(){this.agentsListClient=null,this.agentsListSource=null,this.sessionKeyClient=null,this.runtimeConfigClient=null,this.runtimeConfigSource=null,this.runtimeConfigProfileId=null,this.profileAppearanceSource=null,this.previousGatewayPhase=null,this.agentRosterRefreshTimer!==null&&(globalThis.clearTimeout(this.agentRosterRefreshTimer),this.agentRosterRefreshTimer=null),WC()}dispose(){this.host.lastLocalePrefSignature=null,this.reset()}}})))()}function Cw(e,t){let n=e.placementStartup.get(t);return n?.initialTurn&&(n.phase===`cancelled`||e.sessions.deletionState(t)===`confirmed`)?n:null}function ww(){return(ww=e((()=>{})))()}function Tw(e){let t=e??ge();if(!t)return null;try{let e=t.getItem(kw);if(e===null)return null;let n=JSON.parse(e);if(typeof n.routeId==`string`&&ls(n.routeId)&&typeof n.pathname==`string`&&typeof n.search==`string`)return{routeId:n.routeId,pathname:n.pathname,search:n.search};t.removeItem(kw)}catch{try{t.removeItem(kw)}catch{}}return null}function Ew(e){let t=new URLSearchParams(e);t.delete(`draft`);let n=t.toString();return n?`?${n}`:``}function Dw(e,t,n,r,i=fc()){let a=i?r??ge():null;if(a)try{a.setItem(kw,JSON.stringify({routeId:e,pathname:t,search:Ew(n)}))}catch{}}function Ow(e,t,n,r,i=fc()){if(!i||e!==`chat`||!t.endsWith(`/chat`)||n!==``)return null;let a=Tw(r);return!a||a.routeId===e&&a.pathname===t&&a.search===n?null:a}var kw;function Aw(){return(Aw=e((()=>{Kp(),_c(),kw=`openclaw.native.lastRoute`})))()}var jw;function Mw(){return(Mw=e((()=>{$c(),Y(),Kp(),gt(),Yn(),sd(),Aw(),jw=class{constructor(e){this.host=e,this.navigate=(e,t)=>{let n=this.host.context;n&&ls(e)&&(this.host.closeNavDrawer({restoreFocus:!0}),n.navigate(e,Es(e)?this.chatNavigationOptions(e,t):t))}}selectChatSession(e,t){let n=this.host.context;if(!n)return;ad({selection:n.agentSelection,gateway:n.gateway,sessionKey:e,agentId:t});let r=Et(n,e,t);this.navigate(r,xt({context:n,face:r,sessionKey:e,...t?{agentId:t}:{},preferenceDerivedFace:!0}).options)}chatNavigationOptions(e,t){let n=this.host.activeSessionKey.trim(),r=this.host.context;return t??(n&&r?xt({context:r,face:e,sessionKey:n}).options:void 0)}recoverNotFoundRoute(){let e=this.host.context,t=this.host.routeState.location??window.location;if(e&&as(t.pathname,e.basePath)){if(e.gateway.snapshot.phase!==`connected`)return!1;if(os(t.pathname,e.basePath))return e.replace(`plugin`,{pathname:t.pathname,search:t.search,hash:t.hash}),!0}return this.replaceChatWithCurrentSession()}replaceChatWithCurrentSession(){let e=this.host.context,t=this.host.activeSessionKey.trim();if(!e)return!0;if(!Si(t)&&e.gateway.snapshot.phase!==`connected`)return!1;let n=this.host.routeState.routeId===`dashboard`?`dashboard`:`chat`;if(n===`chat`&&Cw(e,t))return!0;let r=e.sessions.deletionState(t),i=at(e,t),a=this.host.routeState.location?.pathname,o=!a||a===xt({context:e,face:n,sessionKey:t}).options.pathname,s=Si(t)?.agentId,c=e.agents.state.agentsList?.agents,l=s&&(!c||c.some(e=>K(e.id)===s))?s:kr(e),u=!r&&(i?.key||!o)?t:No({agentId:l,mainKey:ot({agentsList:e.agents.state.agentsList,hello:e.gateway.snapshot.hello})});return r&&u===t?!0:(u!==t&&(this.host.activeSessionKey=u,ad({selection:e.agentSelection,gateway:e.gateway,sessionKey:u})),e.replace(n,xt({context:e,face:n,sessionKey:u}).options),!0)}recoverDeletedActiveSession(){let e=this.host.context,t=this.host.routeState.routeId,n=this.host.activeSessionKey.trim();e&&t&&Es(t)&&n&&e.sessions.deletionState(n)&&this.replaceChatWithCurrentSession()}updateRouteState(e){this.host.routeState=e,e.routeId!==void 0&&(this.host.lastConcreteRouteId===`custodian`&&e.routeId!==`custodian`&&(this.host.custodianMinimizeRequestId+=1),this.host.lastConcreteRouteId=e.routeId);let t=e.committedRouteId,n=e.committedLocation?.pathname??``,r=e.committedLocation?.search??``,i=this.host.context;if(t&&i){let a=i.chatSubmissions.creation||e.routeId!==t||(e.location?.pathname??``)!==n||(e.location?.search??``)!==r;if(!this.host.didConsiderNativeRouteRestore){this.host.didConsiderNativeRouteRestore=!0;let e=a?null:Ow(t,n,r);if(e){i.replace(e.routeId,{pathname:e.pathname,search:e.search});return}}if(!a){let a=e.committedSessionKey;if(a!==void 0&&i.sessions.deletionState(a)){if(t===`chat`&&Cw(i,a))return;this.replaceChatWithCurrentSession();return}Dw(t,n,r),a&&(this.host.activeSessionKey=a,ad({selection:i.agentSelection,gateway:i.gateway,sessionKey:a,background:!0}))}}let a=this.host.context;a&&this.host.ensureAgentsList(a.gateway.snapshot),e.routeId&&!zc(e.routeId)&&(this.host.settingsSearchQuery=``,this.host.lastWorkspaceLocation={routeId:e.routeId,pathname:e.location?.pathname??``,search:e.location?.search??``,hash:e.location?.hash??``})}newSessionRouteAgentId(){return this.host.routeState.routeId===`new-session`?new URLSearchParams(this.host.routeState.location?.search??``).get(`agent`)?.trim()??``:``}openNewSession(e,t){this.navigate(`new-session`,{search:br(e,t)})}exitSettings(){let e=this.host.lastWorkspaceLocation;if(e){let{routeId:t,...n}=e;this.navigate(t,n);return}this.navigate(`chat`)}}})))()}function Nw(e){return t=>{let n=()=>{let n=e.overlays.snapshot,r=n.updateStatusBanner;t({run:n.updateRun,busy:n.updateRunning||n.updateReconciliationPending,connected:e.gateway.snapshot.phase===`connected`,failure:r&&r.tone!==`info`&&r.source!==`read`?r.text:null,readError:n.updateStatusCheckBanner?.text??(r?.source===`read`?r.text:null)})},r=e.overlays.subscribe(n),i=e.gateway.subscribe(n);return n(),()=>{r(),i()}}}async function Pw(e){let{confirmAndStartUpdateRuntime:t}=await W(async()=>{let{confirmAndStartUpdateRuntime:e}=await import(`./update-confirmation.runtime-Bk-68DSg.js`);return{confirmAndStartUpdateRuntime:e}},__vite__mapDeps([107,1,12,3,2,4,5,8,7,6,9,11,13,14,15,97,108,109,30,31,32,33,110]),import.meta.url);await t(e)}function Fw(){return(Fw=e((()=>{U()})))()}function Iw(e){return{retryGateway:()=>e.context?.gateway.connect(),toggleSidebar:()=>e.toggleNavigationSurface(),updateSidebarEntries:t=>e.context?.navigation.update({sidebarEntries:t}),openDevicePairSetup:()=>void e.context?.overlays.openDevicePairSetup(),preloadRoute:t=>ls(t)?e.context?.preload(t)??Promise.resolve():Promise.resolve(),requestOpenNewSession:(t,n)=>{let r=e.context;r&&oe(r.gateway.snapshot,{method:`sessions.create`,params:{},sessionScope:!0}).allowed&&e.openNewSession(t,n)},watchUpdateProgress:t=>{let n=e.context;return n?Nw(n)(t):()=>void 0}}}function Lw(){return(Lw=e((()=>{Kp(),ft(),Fw()})))()}function Rw(e){return e===`reconnecting`||e===`offline`}function zw(e){let{kind:t}=e;if(!t)return I;let n=F(`connection.${t}`),r=L`<span class="gateway-status__state"
    ><span class="gateway-status__icon" aria-hidden="true"
      >${t===`suspending`||t===`suspended`?Sl.pause:t===`offline`?Sl.alertTriangle:Sl.refresh}</span
    ><span class="gateway-status__label">${n}</span></span
  >`,i=`gateway-status gateway-status--${t}`,a=e.onRetry&&Rw(t)?L`<button
        type="button"
        class=${i}
        aria-label=${[n,F(`connection.retryNow`)].filter(Boolean).join(` — `)}
        @click=${e.onRetry}
      >
        ${r}
      </button>`:L`<span class=${i}>${r}</span>`;return L`<openclaw-tooltip
    class="gateway-status-tooltip"
    .content=${e.lastError&&Rw(t)?lt(e.lastError):``}
    ><span
      role=${e.announce===!1?I:`status`}
      aria-live=${e.announce===!1?I:`polite`}
      >${a}</span
    ></openclaw-tooltip
  >`}function Bw(){return(Bw=e((()=>{R(),N(),pt(),Cl()})))()}function Vw(e){let t=!!e.disabledReason,n=`${J(`new-session`,e.basePath)}${br(e.agentId,e.target)}`,r=e.showShortcut?`${e.label} (${D(P.newSession)})`:e.label;return L`<openclaw-tooltip
    .content=${e.disabledReason??r}
    .contentTemplate=${e.disabledReason==null&&e.showShortcut?Ol(e.label,P.newSession):void 0}
  >
    <a
      class=${e.className}
      role="link"
      href=${t?I:n}
      aria-label=${e.label}
      aria-disabled=${t?`true`:I}
      tabindex=${t?`-1`:I}
      @contextmenu=${e=>{e.stopPropagation()}}
      @click=${n=>{if(t){n.preventDefault();return}se(n)&&(n.preventDefault(),e.onOpen?.(e.agentId,e.target))}}
    >
      ${Sl.plus}
    </a>
  </openclaw-tooltip>`}function Hw(){return(Hw=e((()=>{R(),Y(),Re(),Cl(),Al(),Ju()})))()}function Uw(e,t){let n=e.renderer;if(n)return n(t);let r=e.failed;return r||e.load(),t.presentation===`embed-list`||t.presentation===`embed-page`?L`<section
      class=${t.presentation===`embed-list`?`settings-embed-list`:`native-embed-header`}
      aria-busy=${r?`false`:`true`}
    >
      ${t.presentation===`embed-page`?L`<button class="native-embed-header__back btn btn--ghost" type="button" @click=${t.onExit}>${F(`common.back`)}</button>`:I}
      <h1 class="page-title">
        ${t.presentation===`embed-list`?F(`nav.settings`):Hc(t.activeRouteId)}
      </h1>
      <p role=${r?`alert`:`status`}>
        ${F(r?`nav.settingsLoadFailed`:`common.loading`)}
      </p>
      ${r?L`<button class="btn" @click=${()=>e.retry()}>${F(`common.retry`)}</button>`:I}
    </section>`:L`<aside class="settings-sidebar" aria-busy=${r?I:`true`}>
    <header class="settings-sidebar__header" @mousedown=${rl}>
      <button type="button" class="settings-sidebar__back" @click=${t.onExit}>
        <span class="settings-sidebar__back-icon" aria-hidden="true">${Sl.arrowLeft}</span>
        ${F(`nav.exitSettings`)}
      </button>
      <h1 class="settings-sidebar__title">${F(`nav.settings`)}</h1>
    </header>
    ${r?L`<div class="settings-sidebar__empty" role="alert">
            ${F(`nav.settingsLoadFailed`)}
            <button class="btn btn--sm" type="button" @click=${()=>e.retry()}>
              ${F(`common.retry`)}
            </button>
          </div>`:Ww(t)}
  </aside>`}function Ww(e){let t=Rc(!!e.canAdmin,e.nativeDeviceSettings??null);return L`<div class="settings-sidebar__agent" aria-hidden="true">
      <span class="skeleton settings-sidebar__loading-agent"></span>
    </div>
    <div class="settings-sidebar__search" aria-hidden="true">
      <span class="skeleton settings-sidebar__loading-search"></span>
    </div>
    <div
      class="settings-sidebar__nav settings-loading-skeleton settings-sidebar__loading"
      role="status"
      aria-busy="true"
      aria-label=${F(`common.loading`)}
    >
      ${t.map(e=>L`<div class="settings-sidebar__group" aria-hidden="true">
          ${e.labelKey?L`<span class="skeleton settings-sidebar__loading-group-label"></span>`:I}
          ${e.routes.map(()=>L`<span class="settings-sidebar__item settings-sidebar__loading-item">
              <span class="skeleton settings-sidebar__loading-icon"></span>
              <span class="skeleton settings-sidebar__loading-label"></span>
            </span>`)}
        </div>`)}
    </div>`}function Gw(){return(Gw=e((()=>{R(),$c(),al(),N(),Cl()})))()}function Kw(e,t){if(!t.open)return I;let n=e.renderer;if(n)return n(t);let r=e.failed;r||e.load();let i=F(`devices.pairing.title`),a=F(r?`devices.pairing.loadFailed`:`common.loading`);return L`<openclaw-modal-dialog
    label=${i}
    description=${a}
    @modal-cancel=${t.onClose}
  >
    <section class="device-pair-setup" aria-busy=${r?I:`true`}>
      <header class="device-pair-setup__header">
        <div>
          <h2>${i}</h2>
          <p role=${r?I:`status`}>${a}</p>
        </div>
      </header>
      <footer class="device-pair-setup__footer">
        ${r?L`<button class="btn btn--primary" type="button" @click=${()=>e.retry()}>
                ${F(`common.retry`)}
              </button>`:I}
        <button class="btn btn--ghost" type="button" @click=${t.onClose}>
          ${F(`common.close`)}
        </button>
      </footer>
    </section>
  </openclaw-modal-dialog>`}function qw(){return(qw=e((()=>{R(),N()})))()}function Jw(e,t,n,r,i){let a=e.gateway.snapshot,o=a.phase===`connected`;return L` <openclaw-browser-panel
      ?inert=${t}
      data-chat-autotype-exempt
      .client=${o?a.client:null}
      .available=${Gb(a)}
      .remoteAvailable=${Ub(a)}
      .suppressed=${n}
      .resourceBasePath=${e.resourceBasePath}
      .authToken=${j_({hello:a.hello,settings:{token:e.gateway.connection.token},password:e.gateway.connection.password})}
    ></openclaw-browser-panel>
    <openclaw-desktop-panel
      ?inert=${t}
      data-chat-autotype-exempt
      .client=${o?a.client:null}
      .available=${Kb(a)}
      .suppressed=${n||i===`systems`}
      .basePath=${e.basePath}
    ></openclaw-desktop-panel>
    <openclaw-link-reader-panel
      ?inert=${t}
      data-chat-autotype-exempt
      .client=${o?a.client:null}
      .available=${o}
      .readers=${Xv(a)}
      .agentId=${r}
      .suppressed=${n}
    ></openclaw-link-reader-panel>`}function Yw(){return(Yw=e((()=>{R(),P_(),$v(),Yb()})))()}function Xw(e,t,n,r){let i=e.lazyCustomElements.visibleState,a=e.context?.theme.settings;return L`
    ${e.commandPaletteLoading.active&&(!i||i.status===`loading`&&i.element===e.commandPaletteElement)?rS(e.commandPaletteLoading,()=>e.closePendingPalette()):i?.element===uu?Ze(e,i):Dd(e.lazyCustomElements)}
    ${ou(e.commandPaletteElement)?L`<openclaw-command-palette
            .desktopAvailable=${t}
            .custodianAvailable=${n}
            .onNavigate=${(t,n)=>e.navigate(t,n)}
            .onSelectSession=${t=>e.selectChatSession(t)}
            .onSlashCommand=${t=>e.handleCommandPaletteSlashCommand(t)}
          ></openclaw-command-palette>`:I}
    ${ou(uu)?Pt:I}
    ${!r&&ou(du)?L`<openclaw-keyboard-shortcuts-dialog
            .sendShortcut=${Mg(a?.chatSendShortcut)}
            .newSessionHost=${e}
          ></openclaw-keyboard-shortcuts-dialog>`:I}
  `}function Zw(){return(Zw=e((()=>{R(),Ad(),Qr(),oS(),Ou(),Hg()})))()}function Qw(){return L`<openclaw-tooltip
    .content=${`${F(`assistantPanel.toggle`)} (${D(P.homePanel)})`}
  >
    <button
      type="button"
      class="shell-chrome-controls__button shell-chrome-controls__home"
      aria-label=${F(`assistantPanel.toggle`)}
      @click=${()=>window.dispatchEvent(new CustomEvent(Rd))}
    >
      ${Sl.home}
    </button>
  </openclaw-tooltip>`}function $w(){return($w=e((()=>{R(),Cl(),Gd(),N(),Re()})))()}function eT(e){let t=e.context,n=e.runtime,r=e.viewCallbacks;if(!t||!n)return I;if(e.routeState.routeId===void 0&&!e.routeState.routeFailed)return xd();let i=t.gateway.snapshot,a=t.config.current,o=i.phase===`connected`,s=qf(i),c=t.navigation.snapshot,l=t.overlays.snapshot,u=l.controlUiRefreshRequired,d=[...e.querySelectorAll(`openclaw-chat-pane`)].some(e=>e.conversationPresented&&e.historyRecovering),f=_n(i,u,d),p=Ep(t.gateway),m=!p.readyOnce&&!i.offlineStable&&(f===`connecting`||f===`starting`||f===`restoring`),h=l.updateRunning||l.updateReconciliationPending,g=ye(i,a.terminalEnabled??!1),_=Kb(i),v=qb(t.gateway),y=Bi(i,`openclaw.chat`,`operator.admin`),b=e.routeState.routeId??`chat`,x=Es(b),S=i.phase===`reload-required`,C=!S&&!o&&!x&&b!==`new-session`&&b!==`appearance`&&b!==`connection`,ee=b===`plugin`?pe(e.routeState.location?.search??``,e.routeState.location?.pathname,t.basePath):null,w=mc(),T=w&&b===`settings`,E=w&&(b===`settings`||zc(b)||b===`skills`||b===`cron`),O=Bc(b)&&!e.onboardingMode&&!w,k=t.runtimeConfig.state,A=e.onboardingMode,te=A&&b!==`custodian`;e.lazyCustomElements.requestWhileActive(e.onboardingMemoryImportElement,te);let ne=e.navDrawerOpen&&!A&&!w,j=SS(),ie=fc()&&!w;ie&&!A&&e.lazyCustomElements.preload(hu,{reportError:!0});let ae=wS({mobileNavLayout:j,routeId:b,onboarding:A}),se=!w&&c.navCollapsed&&!e.desktopNavigationExpanded&&!ne&&!O,ce=zS({onboarding:A,navCollapsed:se,navDrawerOpen:ne,mobileNavLayout:j}),le=!w&&BS({navigationSurfaceHidden:ce,mobileNavLayout:j,onboarding:A,compact:ae});!w&&(A||le)&&e.lazyCustomElements.preload(gu,{reportError:!0});let M=Math.max(globalThis.innerWidth||0,400),ue=e.newSessionRouteAgentId(),de=ue?K(ue):null,fe=de!==null&&t.agents.state.agentsList?.agents.some(e=>K(e.id)===de)===!0?de:K(t.agentSelection.state.selectedId??i.assistantAgentId),me=oe(i,{method:`sessions.create`,params:{},sessionScope:!0}),he=t.theme.settings,ge=x||b===`new-session`||b===`systems`;!O&&!w&&Object.assign(e.navigationSidebar,{basePath:t.basePath,activeRouteId:b,router:e.runtime.router,activePluginTabId:ee?re(ee):``,enabledRouteIds:Xs,sessionKey:e.activeSessionKey,connected:o,connectionStatus:f,lastError:i.lastError,storedOutboxes:e.storedOutboxes,terminalAvailable:g,catalogOpenTarget:Ig(he.catalogOpenTarget),canPairDevice:o&&(s.canAdmin||s.canPair),preferencesBrowserOnly:o&&t.runtimeConfig.canPatch===!1,sidebarEntries:c.sidebarEntries,navigationVisible:!ce,sidebarAgentsMode:he.sidebarAgentsMode??`chip`,sidebarLiveActivity:he.sidebarLiveActivity!==!1,pinnedAgentIds:c.pinnedAgentIds,themeMode:t.theme.mode,gatewayVersion:a.serverVersion??i.hello?.server?.version??null,devGitBranch:a.devGitBranch,watchUpdateProgress:r.watchUpdateProgress,onOpenPalette:e.openPalette,onRetryConnect:r.retryGateway,onToggleSidebar:r.toggleSidebar,onOpenNewSession:r.requestOpenNewSession,onUpdateSidebarEntries:r.updateSidebarEntries,onPairMobile:r.openDevicePairSetup,onNavigate:e.navigate,onPreloadRoute:r.preloadRoute});let _e=w&&(pc()?.surface!==`conversation`||b!==`chat`),ve=!w&&se&&!A&&!O&&!j,be=(ce||(O?e.settingsSidebar.renderer===null:!ou(pu)))&&!w&&!A&&!m?f:null,xe={navigationSurfaceHidden:ce,mobileNavLayout:j,onboarding:A,compact:ae&&!u,statusBanner:l.updateStatusBanner,updateRun:l.updateRun,refreshRequired:u,onRefresh:e.refreshControlUi,onNavigate:e.navigate},Se=O||_e?Uw(e.settingsSidebar,{presentation:w?T?`embed-list`:`embed-page`:`sidebar`,basePath:t.basePath,activeRouteId:b,agents:t.agents.state.agentsList?.agents??[],agentIdentity:t.agentIdentity,settingsAgentSelection:t.settingsAgentSelection,activePathname:e.routeState.location?.pathname??``,activeSearch:e.routeState.location?.search??``,activeHash:e.routeState.location?.hash??``,connectionStatus:f,lastError:i.lastError,gatewayVersion:a.serverVersion??i.hello?.server?.version??``,searchQuery:T?``:e.settingsSearchQuery,searchParams:{query:e.settingsSearchQuery,schema:k.configSchema,value:k.configForm??k.configSnapshot?.config??null,uiHints:k.configUiHints,identityAvailable:!!i.selfUser,multipleProfiles:i.hello?.policy?.hasMultipleSessionSharingIdentities===!0,basePath:t.basePath,canAdmin:s.canAdmin,nativeDeviceSettings:t.nativeDeviceSettings},onExit:()=>{w?Cc()?window.history.back():b===`memory-import`?t.replace(`memory`):e.navigate(`settings`):e.exitSettings()},onRetryConnect:r.retryGateway,onNavigate:e.navigate,onPreload:r.preloadRoute,onSearchQueryChange:t=>void e.handleSettingsSearchQueryChange(t),preloadTimers:e.settingsPreloadTimers,saveIndicator:{status:k.configRecoveryError?`recovery`:k.configAutoSaveStatus,lastError:k.configRecoveryError??k.lastError,needsApply:k.configNeedsApply,applying:k.configApplying,applyDisabled:t.runtimeConfig.canApply===!1||k.configLoading||k.configSaving||k.configFormDirty&&k.configFormMode===`raw`||h,onRetry:()=>void t.runtimeConfig.retry(),onSave:()=>void t.runtimeConfig.save(),onReload:()=>void t.runtimeConfig.discardDraft(),onApply:()=>void t.runtimeConfig.apply()},canAdmin:s.canAdmin,nativeDeviceSettings:t.nativeDeviceSettings}):e.navigationSidebar,Ce=L`
    ${Xw(e,_,y,w)}
    <div
      class="shell ${ge?`shell--chat`:``} ${se?`shell--nav-collapsed`:``} ${j?`shell--mobile-nav`:``} ${ae?`shell--merged-chat-chrome`:``} ${ne?`shell--nav-drawer-open`:``} ${A?`shell--onboarding`:``} ${w?`shell--embed`:``} ${E?`shell--embed-settings`:``} ${O?`shell--settings`:``} ${ve&&v?`shell--home-control`:``} ${be?`shell--connection-status`:``} ${BS(xe)?`shell--floating-attention`:``} ${e.navResizing?`shell--nav-resizing`:``}"
      style=${`--shell-nav-expanded-width: ${c.navWidth}px`}
      @theme-change=${t=>e.handleThemeChange(t)}
    >
      <a class="shell-skip-link" href="#control-ui-main" ?inert=${ne}>
        ${F(`common.skipToMainContent`)}
      </a>
      ${ie&&!A?L`
              <openclaw-macos-titlebar-controls
                ?inert=${ne}
                .navCollapsed=${e.nativeNavCollapsed()}
                .historyOnly=${O}
                .canGoBack=${e.nativeHistoryState.canGoBack}
                .canGoForward=${e.nativeHistoryState.canGoForward}
                .newSessionDisabledReason=${me.allowed?void 0:me.reason}
                .onToggleSidebar=${r.toggleSidebar}
                .onOpenPalette=${e.openPalette}
                .onOpenNewSession=${e.handleNativeNewSession}
              ></openclaw-macos-titlebar-controls>
            `:I}
      ${w?I:L`<openclaw-app-topbar
              ?inert=${ne}
              .resourceBasePath=${t.resourceBasePath}
              .environment=${a.environment}
              .navDrawerOpen=${ne}
              .onOpenPalette=${e.openPalette}
              .onToggleDrawer=${e.toggleNavigationSurface}
            ></openclaw-app-topbar>`}
      ${ve?L`
              <div class="shell-chrome-controls">
                <openclaw-tooltip
                  .content=${`${F(`nav.expand`)} (${D(P.toggleSidebar)})`}
                >
                  <button
                    type="button"
                    class="shell-chrome-controls__button shell-chrome-controls__nav-toggle"
                    aria-label=${F(`nav.expand`)}
                    aria-expanded="false"
                    data-env-avatar=${a.environment?a.assistantIdentity.name.charAt(0):I}
                    @click=${r.toggleSidebar}
                  >
                    ${Sl.panelLeftOpen}
                  </button>
                </openclaw-tooltip>
                ${Vw({basePath:t.basePath,agentId:fe,className:`shell-chrome-controls__button shell-chrome-controls__new-thread`,label:F(`chat.runControls.newSession`),showShortcut:!0,disabledReason:me.allowed?void 0:me.reason,onOpen:r.requestOpenNewSession})}
                <openclaw-tooltip
                  .content=${`${F(`chat.openCommandPalette`)} (${D(P.commandPalette)})`}
                >
                  <button
                    type="button"
                    class="shell-chrome-controls__button shell-chrome-controls__search"
                    aria-label=${F(`chat.openCommandPalette`)}
                    @click=${e.openPalette}
                  >
                    ${Sl.search}
                  </button>
                </openclaw-tooltip>
                ${v?Qw():I}
              </div>
            `:I}
      ${w?I:L`<button
                type="button"
                class="shell-nav-backdrop"
                tabindex="-1"
                aria-hidden="true"
                ?inert=${!ne}
                @click=${()=>e.closeNavDrawer({restoreFocus:!0})}
              ></button>
              <div
                class="shell-nav ${j?`nav-drawer`:``}"
                role=${j?`dialog`:I}
                aria-modal=${j&&ne?`true`:I}
                aria-label=${j?F(`palette.categories.navigation`):I}
                aria-hidden=${j&&ce?`true`:I}
                tabindex=${j?-1:I}
                ?inert=${ce}
              >
                ${Se}
              </div>`}
      ${!w&&!se&&!A&&!O?L`
              <resizable-divider
                class="sidebar-resizer"
                .label=${F(`nav.resize`)}
                .splitRatio=${c.navWidth/M}
                .minRatio=${240/M}
                .maxRatio=${400/M}
                aria-valuetext=${`${c.navWidth} pixels`}
                title=${F(`nav.resize`)}
                @resize-start=${()=>{e.navResizing=!0}}
                @resize-end=${()=>{e.navResizing=!1}}
                @resize=${t=>e.resizeNavigation(t.detail.splitRatio)}
              ></resizable-divider>
            `:I}
      <main
        id="control-ui-main"
        class="content ${ge?`content--chat`:``} ${b===`custodian`?`content--custodian`:``} ${b===`workboard`?`content--workboard`:``} ${C?`content--actions-blocked`:``} ${e.shellLayout.className}"
        ${Pi(e.shellLayout.contentRef)}
        .tabIndex=${-1}
        @mousedown=${rl}
        ?inert=${!w&&C||j&&ne}
      >
        ${C?L`<div class="connection-action-block" role="status" aria-live="polite">
                <span class="connection-action-block__icon" aria-hidden="true"
                  >${Sl.globeOff}</span
                >
                <span class="connection-action-block__text">
                  ${F(O?`connection.settingsChangesUnavailable`:`connection.actionsUnavailable`)}
                </span>
              </div>`:I}
        ${VS(xe)}
        ${_e?Se:I}
        <openclaw-router-outlet
          ?inert=${C||S}
          aria-disabled=${C||S?`true`:I}
          .router=${n.router}
          .retryContext=${t}
          .retryEnabled=${o}
          .retentionScope=${p}
          .onNotFound=${e.recoverNotFoundRoute}
          .notFoundRecoveryReady=${o}
        ></openclaw-router-outlet>
      </main>
      ${be?L`<div class="shell-connection-status">
              ${zw({kind:be,lastError:i.lastError,onRetry:r.retryGateway})}
            </div>`:I}
      <openclaw-terminal-panel
        ?inert=${ne}
        .client=${o?i.client:null}
        .available=${g}
        .agentId=${fe}
        .sessionKey=${x?e.activeSessionKey:null}
        .suppressed=${O||w}
        .themeMode=${t.theme.resolvedMode}
        .basePath=${t.basePath}
      ></openclaw-terminal-panel>
      ${x?I:Jw(t,ne,O||w,fe,b)}
      <openclaw-assistant-panel
        ?inert=${ne}
        .custodianAvailable=${y&&!w}
        .homeAvailable=${v&&!w}
        .custodianSuppressed=${b===`custodian`}
        .pageSessionKey=${e.activeSessionKey}
        .pageAgentId=${fe}
        .pageRouteId=${b}
        .pageRouteFailed=${e.routeState.routeFailed===!0}
        .minimizeRequestId=${e.custodianMinimizeRequestId}
      ></openclaw-assistant-panel>
      ${ou(e.execApprovalElement)?L`<openclaw-exec-approval
              .props=${{queue:l.approvalQueue,busy:l.approvalBusy,canGrant:l.approvalCanGrant,errors:l.approvalErrors,onDecision:(e,n)=>t.overlays.decideApproval(n,e)}}
            ></openclaw-exec-approval>`:I}
      ${Kw(e.devicePairSetup,{open:l.devicePairSetupOpen,lifecycle:l.devicePairSetupLifecycle,nowMs:Date.now(),pendingCount:l.devicePairPendingCount,onRefresh:()=>void t.overlays.refreshDevicePairSetup(),onAccessChange:e=>void t.overlays.setDevicePairSetupAccess(e),onClose:()=>t.overlays.closeDevicePairSetup(),onManageDevices:()=>{t.overlays.closeDevicePairSetup(),e.navigate(`devices`)},onGetApps:()=>{t.overlays.closeDevicePairSetup(),e.navigate(`apps`)}})}
      ${te&&ou(e.onboardingMemoryImportElement)?L`<openclaw-onboarding-memory-import
              .active=${!0}
              .context=${t}
            ></openclaw-onboarding-memory-import>`:I}
      <openclaw-toast-host></openclaw-toast-host>
    </div>
  `;return b===`plugins`||b===`plugin-settings`?Ce:Ln(`workspace`,{sessionKey:e.activeSessionKey,agentId:Dt({assistantAgentId:t.agentSelection.state.selectedId??i.assistantAgentId,agentsList:t.agents.state.agentsList,hello:i.hello},e.activeSessionKey),routeId:b},Ce)}function tT(){return(tT=e((()=>{R(),Di(),$c(),Y(),Kp(),Bw(),Cl(),Sd(),Hw(),Gw(),N(),Hi(),Re(),ft(),Yn(),ue(),it(),lr(),qw(),Yw(),Zw(),Tc(),kp(),Ou(),kS(),_c(),al(),US(),tp(),Yb(),Hg(),$w()})))()}var nT;function rT(){return(rT=e((()=>{nT=class{constructor(e,t){this.host=e,this.importRenderer=t,this.renderer=null,this.failed=!1,this.pending=null}load(){this.pending??=this.importRenderer().then(e=>{this.renderer=e,this.failed=!1,this.host.requestUpdate()}).catch(()=>{this.failed=!0,this.pending=null,this.host.requestUpdate()})}retry(){this.failed&&(this.failed=!1,this.host.requestUpdate()),this.load()}}})))()}function iT(e){try{el()?.webkit?.messageHandlers?.openclawNav?.postMessage({type:`nav-state`,...e})}catch{}}function aT(){return(aT=e((()=>{})))()}function oT(e){return typeof Reflect.get(e,`restartAfterTeardown`)==`function`&&typeof Reflect.get(e,`teardown`)==`function`}function sT(e){let t=new Set;for(let n of e){n instanceof Element&&n.matches(`mcp-app-view`)&&oT(n)&&t.add(n);for(let e of n.querySelectorAll(`mcp-app-view`))oT(e)&&t.add(e)}return[...t]}var cT;function lT(){return(lT=e((()=>{cT=class{constructor(e){this.host=e,this.renderedKey=null,this.pending=!1,this.restartTargets=null}get retiring(){return this.pending||this.restartTargets!==null}apply(e,t){return this.renderedValue=t(),this.renderedKey=e,this.renderedValue}render(e,t,n,r={}){if(this.pending)return this.renderedValue;if(this.restartTargets){let n=this.restartTargets;return this.restartTargets=null,queueMicrotask(()=>{for(let e of n)e.isConnected&&e.restartAfterTeardown()}),this.renderedKey===e&&r.retainRenderedValue?this.renderedValue:this.apply(e,t)}if(this.renderedKey===e&&r.retainRenderedValue)return this.renderedValue;if(this.renderedKey===null||this.renderedKey===e)return this.apply(e,t);let i=sT(n());return i.length===0?this.apply(e,t):(this.pending=!0,Promise.allSettled(i.map(e=>e.teardown())).then(()=>{this.pending=!1,this.restartTargets=i,this.host.requestUpdate()}),this.renderedValue)}}})))()}function uT(e,t){let n=globalThis.performance?.now()??0,r=t(),i=Math.round((globalThis.performance?.now()??n)-n);return i>=16&&console.debug(`[openclaw] routed render`,{routeId:e,durationMs:i}),r}function dT(e){if(!e)return()=>{};let t=e.textContent;return e.disabled=!0,e.textContent=F(`lazyView.reloading`),()=>{e.disabled=!1,e.textContent=t}}function fT(e,t,n,r,i){if(he(n))return Td();let a=zl(n);return a&&Ul(),Od({error:n,onRetry:n=>{if(!a){t!==void 0&&e.revalidate(t,r).catch(()=>void 0);return}let i=dT(n.currentTarget instanceof HTMLButtonElement?n.currentTarget:null);Gl().then(e=>{e||i()})},render:i,stale:a})}function pT(e,t,n,r={}){if(!n||n.status===`notFound`||n.status===`redirected`)return I;let i=n.routeId;if(!n.module)return n.error?fT(e,r.retryContext,n.error,i):t?Cd():I;let a=n.module,o=()=>uT(i,()=>r.presented===!1?a.render(n.data,n.isFetching===`loader`,!1):a.render(n.data,n.isFetching===`loader`));return n.error?fT(e,r.retryContext,n.error,i,a.retainOnNavigate?void 0:o):o()}var mT,hT;function gT(){return(gT=e((()=>{R(),ji(),Mi(),Di(),Y(),Ad(),wd(),lT(),N(),ae(),Ae(),df(),iu(),mT=class extends qn{constructor(...e){super(...e),this.ownerKey=``,this.renderPage=()=>I,this.presentedValue=!1}get presented(){return this.presentedValue}set presented(e){let t=this.presentedValue;this.presentedValue=e,this.style.display=e?`contents`:`none`,this.toggleAttribute(`inert`,!e),this.setAttribute(`aria-hidden`,e?`false`:`true`),this.requestUpdate(`presented`,t)}render(){return this.renderPage(this.presented)}},H([B({attribute:!1})],mT.prototype,`ownerKey`,void 0),H([B({attribute:!1})],mT.prototype,`renderPage`,void 0),H([B({attribute:!1})],mT.prototype,`presented`,null),hT=class extends qn{constructor(...e){super(...e),this.retryEnabled=!0,this.outlet=new uf(()=>this.requestUpdate()),this.retainedUnmountGate=new cT(this),this.transientUnmountGate=new cT(this),this.retainedPresentation=Ei(),this.retainedPresented=!1,this.scopeInitialized=!1,this.scopeGeneration=0,this.scopeRefreshing=!1,this.retiredSessionMatches=new Set}connectedCallback(){super.connectedCallback(),this.synchronizeOutletInputs(),this.outlet.connect()}disconnectedCallback(){super.disconnectedCallback(),this.outlet.disconnect()}willUpdate(){this.synchronizeOutletInputs()}synchronizeOutletInputs(){this.outlet.setInputs({router:this.router,onNotFound:this.onNotFound,notFoundRecoveryReady:this.notFoundRecoveryReady,retryContext:this.retryContext,retryEnabled:this.retryEnabled})}synchronizeRetentionScope(e){let t=this.scopeRouter!==e,n=this.scopeInitialized&&(t||this.scopeOwner!==this.retentionScope);if(this.scopeInitialized=!0,this.scopeRouter=e,this.scopeOwner=this.retentionScope,!n)return;let r=++this.scopeGeneration;if(this.retainedMatch=void 0,this.retainedOwnerKey=void 0,this.retainedPresented=!1,this.scopeRefreshing=!1,this.retiredSessionMatches=new Set(t?[]:[...e.getState().matches,...e.getState().pendingMatches].filter(e=>Es(e.routeId)).map(e=>e.id)),t)return;let i=this.retryContext,a=this.retentionScope,o=e.getState(),s=o.pendingMatches[0]??o.matches[0];i!==void 0&&s&&Es(s.routeId)&&(this.scopeRefreshing=!0,e.navigate(s.routeId,i,{history:`none`,revalidate:!0},s.location).finally(()=>{this.router===e&&this.retentionScope===a&&this.scopeGeneration===r&&(this.scopeRefreshing=!1,this.requestUpdate())}).catch(()=>void 0))}render(){let e=this.router;if(!e)return I;let t=this.outlet.snapshot,n=of(t.active,t.pending);this.synchronizeRetentionScope(e);let r=n?.status===`success`&&n.error===void 0,i=n!==void 0&&this.retiredSessionMatches.has(n.id),a=!this.scopeRefreshing&&!i,o=n?`${n.routeId}:${n.status}`:`empty`,s=n?.module,c=n?s?.renderOwnerKey?.(n,t.settled):void 0,l=n?.error===void 0?c:void 0,u=n?.status===`pending`||n?.isFetching===`loader`,d=u&&this.retainedPresented&&this.retainedOwnerKey===l,f=a&&s?.retainOnNavigate===!0&&l!==void 0&&(r||d);f&&r?(this.retainedMatch=n,this.retainedOwnerKey=l):(t.status===`idle`||a&&s?.retainOnNavigate&&!u)&&(this.retainedMatch=void 0,this.retainedOwnerKey=void 0),this.retainedPresented=f;let p=this.retainedMatch,m=`${this.scopeGeneration}:${this.retainedOwnerKey??`empty`}`,h=f?`empty`:l??o,g=()=>t.startupPending?Td():Es(n?.routeId)&&!a?!i&&n?.error!==void 0?fT(e,this.retryContext,n.error,n.routeId):Cd():s?.retainOnNavigate&&u?n?.routeId===`chat`&&t.settled?.routeId===`new-session`?pT(e,t.showPending,t.settled,{retryContext:this.retryContext}):Cd():pT(e,t.showPending,n,{retryContext:this.retryContext}),_=L`
      ${this.retainedUnmountGate.render(m,()=>p?Fi(m,L`<openclaw-route-presentation
                  ${Pi(this.retainedPresentation)}
                  .ownerKey=${m}
                  .presented=${f}
                  .renderPage=${n=>pT(e,t.showPending,p,{retryContext:this.retryContext,presented:n})}
                ></openclaw-route-presentation>`):I,()=>this.retainedPresentation.value?[this.retainedPresentation.value]:[])}
      ${this.transientUnmountGate.render(h,()=>f?I:g(),()=>[...this.children].filter(e=>e!==this.retainedPresentation.value),{retainRenderedValue:!s?.retainOnNavigate&&l!==void 0&&n?.status===`pending`&&n.data===void 0})}
      ${f&&this.retainedUnmountGate.retiring?Cd():I}
    `;return this.retainedPresentation.value&&(this.retainedPresentation.value.presented=f&&!this.retainedUnmountGate.retiring&&this.retainedPresentation.value.ownerKey===m),_}},H([B({attribute:!1})],hT.prototype,`router`,void 0),H([B({attribute:!1})],hT.prototype,`retryContext`,void 0),H([B({attribute:!1})],hT.prototype,`onNotFound`,void 0),H([B({attribute:!1})],hT.prototype,`notFoundRecoveryReady`,void 0),H([B({attribute:!1})],hT.prototype,`retryEnabled`,void 0),H([B({attribute:!1})],hT.prototype,`retentionScope`,void 0),customElements.get(`openclaw-route-presentation`)||customElements.define(`openclaw-route-presentation`,mT),customElements.get(`openclaw-router-outlet`)||customElements.define(`openclaw-router-outlet`,hT)})))()}var _T;function vT(){return(vT=e((()=>{ji(),$c(),Y(),Xu(),Xd(),af(),fd(),qd(),N(),$n(),Cr(),dr(),Yn(),Ht(),Ae(),_e(),Mt(),hf(),Ax(),KS(),Sw(),Mw(),Lw(),tT(),c_(),B_(),Ou(),rT(),aT(),_c(),gT(),pC(),vw(),K_(),Hg(),Lp(),iu(),U(),xe.setLocaleLoadRecovery({isUnrecoverableError:zl,onUnrecoverableLocaleLoad:()=>{Ul()}}),_T=class extends qn{get context(){return this.runtime?.context}get onboardingMode(){let e=this.routeState.location?.search;return e===void 0?this.onboarding:Ap(e)}get workspaceChromeVisible(){let e=this.routeState.routeId;return e!==void 0&&!zc(e)&&!this.onboardingMode}storedOutboxScopeHost(e){let t=e.gateway.snapshot;return{client:t.client,connected:t.phase===`connected`,settings:{gatewayUrl:e.gateway.connection.gatewayUrl},assistantAgentId:t.assistantAgentId,agentsList:e.agents.state.agentsList,hello:t.hello}}chatTitleContext(e,t){let n=this.activeSessionKey,r=Si(n),i=A(n)?Ar(t):r?.rest===ot(t)?K(r.agentId):void 0,a=i?e.agents.state.agentsList?.agents.find(e=>K(e.id)===i):void 0;return a?on(a):Wt(n,e.sessions.presentation.result?.sessions.find(e=>e.key===n))}constructor(){super(),this.onboarding=!1,this.navDrawerOpen=!1,this.navResizing=!1,this.shellLayout=new Ip(this),this.desktopNavigationExpanded=!1,this.activeSessionKey=``,this.settingsSearchQuery=``,this.routeState={},this.nativeHistoryState=hc(),this.commandPaletteElement=lu,this.terminalPanelElement=_u,this.browserPanelElement=vu,this.linkReaderPanelElement=xu,this.desktopPanelElement=bu,this.execApprovalElement=Eu,this.onboardingMemoryImportElement={tagName:`openclaw-onboarding-memory-import`,label:F(`onboarding.memoryImport.title`),loadModule:()=>W(()=>import(`./onboarding-memory-import-BFv_cxJE.js`),__vite__mapDeps([111,1,5,4,30,112]),import.meta.url)},this.lazyCustomElements=new cu(this,()=>this.shellChrome.cancelPendingLazyAction(),e=>this.shellChrome.retryPendingLazyAction(e)),this.queryRenderedElement=e=>this.renderRoot?.querySelector(e)??null,this.navDrawerTrigger=null,this.navigationSidebar=document.createElement(pu.tagName),this.lastWorkspaceLocation=null,this.custodianMinimizeRequestId=0,this.lastLocalePrefSignature=null,this.outboxStoreRuntime=null,this.outboxStoreUnsubscribe=null,this.lastDeletedSessions=null,this.outboxStoreImport=Gr(()=>W(()=>import(`./control-ui-boot-shared-UG5ko-VG.js`).then(e=>(e.br(),e.Sr)).then(e=>e.createStoredChatOutboxReader()),__vite__mapDeps([11,1,3,2,4,5,8,7,6,9,12,13,14,15,30,31,32,33]),import.meta.url),e=>this.installOutboxStoreRuntime(e)),this.didConsiderNativeRouteRestore=!1,this.pendingNativeNewSession=!1,this.settingsPreloadTimers=new Map,this.settingsSidebar=new nT(this,()=>W(()=>import(`./settings-sidebar-DKAdrNKF.js`).then(e=>e.renderSettingsSidebar),__vite__mapDeps([113,1,12,3,2,4,5,8,7,6,9,11,13,14,15,99,22,20,23,26,27,114,115,10,116,117,30,31,32,33,34,37,38]),import.meta.url)),this.sidebarUpdateCardImport=Gr(()=>W(()=>import(`./sidebar-update-runtime-DQZboSgD.js`).then(e=>(e.t(),e.n)),__vite__mapDeps([15,1,11,3,2,4,5,8,7,6,9,12,13,14,30,31,32,33]),import.meta.url)),this.devicePairSetup=new nT(this,()=>W(()=>import(`./view-pairing.runtime-D1dMw8JZ.js`).then(e=>e.renderDevicePairSetup),__vite__mapDeps([118,1,11,3,2,4,5,8,7,6,9,12,13,14,15,119,30,31,32,33]),import.meta.url)),this.subscriptions=new le(this),this.shellNavigation=new jw(this),this.shellChrome=new GS(this),this.shellGateway=new xw(this),this.viewCallbacks=Iw(this),this.refreshStoredOutboxPresentation=()=>{this.refreshStoredOutboxSummary(),this.requestUpdate()},this.selectChatSession=this.shellNavigation.selectChatSession.bind(this.shellNavigation),this.handleGatewayEvent=this.shellGateway.handleGatewayEvent.bind(this.shellGateway),this.handleThemeChange=e=>{let t=this.context;t&&t.theme.setMode(e.detail.mode,e.detail.element)},this.chatNavigationOptions=this.shellNavigation.chatNavigationOptions.bind(this.shellNavigation),this.navigate=this.shellNavigation.navigate,this.recoverNotFoundRoute=this.shellNavigation.recoverNotFoundRoute.bind(this.shellNavigation),this.recoverDeletedActiveSession=this.shellNavigation.recoverDeletedActiveSession.bind(this.shellNavigation),this.exitSettings=this.shellNavigation.exitSettings.bind(this.shellNavigation),this.toggleNavigationSurface=this.shellChrome.toggleNavigationSurface,this.closeNavDrawer=this.shellChrome.closeNavDrawer,this.resizeNavigation=this.shellChrome.resizeNavigation,this.openNewSession=this.shellNavigation.openNewSession.bind(this.shellNavigation),this.handleNativeToggleSidebar=this.shellChrome.handleNativeToggleSidebar,this.handleNativeOpenSearch=this.shellChrome.handleNativeOpenSearch,this.handleNativeToggleSearch=this.shellChrome.handleNativeToggleSearch,this.handleNativeNewSession=this.shellChrome.handleNativeNewSession,this.handleNativeNavigate=this.shellChrome.handleNativeNavigate,this.handleWindowResize=this.shellChrome.handleWindowResize,this.handleDocumentKeydown=this.shellChrome.handleDocumentKeydown,this.togglePendingDebugOverlayMode=this.shellChrome.togglePendingDebugOverlayMode.bind(this.shellChrome),this.openPalette=this.shellChrome.openPalette,this.closePendingPalette=this.shellChrome.closePendingPalette,this.refreshControlUi=()=>{let e=this.context;return e?Gl({timeoutMs:0,...R_(e.gateway,()=>this.context===e&&e.overlays.snapshot.controlUiRefreshRequired)}):Promise.resolve(!1)},this.handleShellNavDrawerToggle=this.shellChrome.handleShellNavDrawerToggle,this.handleCommandPaletteSlashCommand=this.shellChrome.handleCommandPaletteSlashCommand,this.restorePendingLazyAction=this.shellChrome.restorePendingLazyAction,this.nativeNavCollapsed=this.shellChrome.nativeNavCollapsed,this.newSessionRouteAgentId=this.shellNavigation.newSessionRouteAgentId.bind(this.shellNavigation),this.subscriptions.effect(()=>this.context,e=>(this.pendingNativeNewSession&&(this.pendingNativeNewSession=!1,this.handleNativeNewSession()),()=>{this.context!==e&&this.resetForContextEpoch()})).effect(()=>this.context,e=>{let t=Date.now(),n=!0,r,i=Gr(()=>W(()=>import(`./control-ui-boot-shared-XreXSF7h.js`).then(e=>(e.xa(),e.ba)),__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,30,31,32,33]),import.meta.url),({connectControlUiFavicon:i})=>{n&&(r=i(this,e,t))});return i.schedule(),()=>{n=!1,i.dispose(),r?.()}}).watchStore(()=>this.context?.nativeDeviceSettings).watchStore(()=>this.context?.navigation).watchStore(()=>this.context?.plugins).watchStore(()=>this.context?.agentSelection).watchStore(()=>this.context?.settingsAgentSelection).watchStore(()=>this.context?.agentIdentity).watchStore(()=>this.context?.gateway,e=>{this.shellChrome.synchronizeCommandPaletteScope(),this.shellGateway.synchronizeGateway(e.snapshot),this.refreshStoredOutboxSummary()}).effect(()=>this.context?.gateway,e=>e.subscribeEvents(this.handleGatewayEvent)).watchStore(()=>this.context?.config).watchStore(()=>this.context?.theme).watchStore(()=>this.context?.agents,e=>{this.refreshStoredOutboxSummary();let t=this.context?.gateway.snapshot;t&&this.ensureAgentsList(t,e)}).effect(()=>this.runtime?.router,e=>(this.shellNavigation.updateRouteState(pf(e.getState())),e.subscribeSelector(pf,e=>this.shellNavigation.updateRouteState(e),mf))).watchStore(()=>this.context?.overlays).effect(()=>this.context?.sessions,e=>this.shellGateway.observeSessions(e,()=>this.syncDocumentTitle())).watchStore(()=>this.context?.placementStartup,()=>this.recoverDeletedActiveSession()).watch(()=>this.context?.runtimeConfig,(e,t)=>e.subscribe(()=>{this.shellGateway.reconcileServerUiPrefs(e),t()}),e=>{let t=this.context?.gateway.snapshot;t&&this.ensureRuntimeConfig(t,e),this.shellGateway.reconcileServerUiPrefs(e)})}connectedCallback(){super.connectedCallback(),this.outboxStoreRuntime&&this.installOutboxStoreRuntime(this.outboxStoreRuntime),this.outboxStoreImport.schedule(),this.shellChrome.connect(),pg((e,t)=>{if(JC())return;let n=cC(e,t),r=this.context?.runtimeConfig;n&&r&&ew(r,n,{profile:this.context?.gateway.snapshot,afterCommit:({needsRefresh:e,retainedLocal:t})=>this.shellGateway.reconcileCommittedServerUiPrefs(r,e,t)})})}disconnectedCallback(){this.shellChrome.disconnect(),n_(),this.outboxStoreImport.dispose(),this.sidebarUpdateCardImport.dispose(),this.outboxStoreUnsubscribe?.(),this.outboxStoreUnsubscribe=null,this.lastLocalePrefSignature=null,pg(null),this.resetForDocumentDisconnect(),super.disconnectedCallback()}installOutboxStoreRuntime(e){this.outboxStoreRuntime=e,e.invalidate(),this.isConnected&&(this.outboxStoreUnsubscribe?.(),this.outboxStoreUnsubscribe=e.subscribe(this.refreshStoredOutboxPresentation),this.refreshStoredOutboxPresentation())}refreshStoredOutboxSummary(){let e=this.context;this.storedOutboxes=e?this.outboxStoreRuntime?.read(this.storedOutboxScopeHost(e)):void 0,e?.nativeConversation?.publishSessionFacts(this.storedOutboxes?.sessions??null)}resetForContextEpoch(){this.shellChrome.abandonPendingLazyActionForContext(),this.resetShellState()}resetForDocumentDisconnect(){this.shellChrome.preservePendingLazyActionForReload(),this.resetShellState()}resetShellState(){this.outboxStoreRuntime?.invalidate(),this.navDrawerOpen=!1,this.desktopNavigationExpanded=!1,this.navDrawerTrigger=null,this.lastWorkspaceLocation=null,this.activeSessionKey=``,this.settingsSearchQuery=``,this.commandPaletteTarget=void 0,this.lastDeletedSessions=null,this.storedOutboxes=void 0,this.shellGateway.reset();for(let e of this.settingsPreloadTimers.values())globalThis.clearTimeout(e);this.settingsPreloadTimers.clear()}async handleSettingsSearchQueryChange(e){this.settingsSearchQuery=e;let t=this.context?.runtimeConfig;if(t&&e.trim())try{await t.ensureLoaded(),this.context?.runtimeConfig===t&&await t.ensureSchemaLoaded()}catch{}}observeDeletedSessions(e){let t=this.context,n=e.deletedSessions;if(!t||Object.is(n,this.lastDeletedSessions)||(this.lastDeletedSessions=n,n.length===0))return;let{client:r,assistantAgentId:i,hello:a}=t.gateway.snapshot;fn(t,n);for(let{key:e,agentId:r,retireBeforeRevision:i}of n)t.chatAttachmentHandoff.retireScope(ir({sessionKey:e,agentId:r}),i);let o=t.gateway.connection.gatewayUrl,s=W_(t.gateway,{gatewayUrl:o,recoveryScope:r?.recoveryScope||void 0}),c={client:r,gatewayUrl:o,isCurrent:()=>t.gateway.snapshot.client===r&&s(),assistantAgentId:i,hello:a,agentsList:t.agents.state.agentsList};W(async()=>{let{retireDeletedComposerDrafts:e}=await import(`./composer-draft-retirement.runtime-CP_a6HdR.js`);return{retireDeletedComposerDrafts:e}},__vite__mapDeps([120,1,11,3,2,4,5,8,7,6,9,12,13,14,15,30,31,32,33]),import.meta.url).then(({retireDeletedComposerDrafts:e})=>e(t,c,n),()=>oi({message:F(`sessionsView.draftCleanupFailed`)}))}get pendingDebugOverlayMode(){return this.shellChrome.pendingDebugOverlayMode}get commandPaletteLoading(){return this.shellChrome.commandPaletteLoading}syncDocumentTitle(){let e=this.routeState.routeId,t=this.context;if(!e||!t)return;let n=this.storedOutboxScopeHost(t),r=e===`custodian`?Kd():Hc(e);Es(e)&&this.activeSessionKey&&(r=this.chatTitleContext(t,n)||r);let{phase:i,lastError:a}=t.gateway.snapshot,o=i!==`connected`&&(!!a||i===`reconnecting`||i===`offline`||i===`reload-required`),s=Uc({context:r,brandName:t.theme.branding.brandName,attentionCount:i===`connected`?t.overlays.snapshot.approvalQueue.length:0,gatewayDisconnected:o}),c=t.config?.current.environment;c&&(s+=` · ${c.label}`),document.title!==s&&(document.title=s)}updated(e){this.syncDocumentTitle(),(e.has(`routeState`)||e.has(`runtime`))&&n_(),this.restorePendingLazyAction(),!customElements.get(`openclaw-sidebar-update-card`)&&this.querySelector(`openclaw-sidebar-update-card`)&&this.sidebarUpdateCardImport.load().catch(e=>{zl(e)&&Ul()});let t=this.querySelector(`openclaw-chat-page`);t&&(t.navDrawerOpen=this.navDrawerOpen&&!this.onboardingMode);let n=this.context;if(!n)return;this.querySelector(`.settings-sidebar__agent`)&&n.agentIdentity.ensure([n.settingsAgentSelection.state.selectedId]),this.workspaceChromeVisible&&this.shellChrome.panels.restore(),(n.overlays?.snapshot.approvalQueue.length??0)>0&&this.lazyCustomElements.preload(this.execApprovalElement),this.restorePendingLazyAction();let r={collapsed:this.nativeNavCollapsed(),width:n.navigation.snapshot.navWidth};(r.collapsed!==this.lastNativeNavState?.collapsed||r.width!==this.lastNativeNavState.width)&&(this.lastNativeNavState=r,iT(r))}ensureRuntimeConfig(e,t=this.context?.runtimeConfig){this.shellGateway.ensureRuntimeConfig(e,t).catch(()=>void 0)}ensureAgentsList(e,t=this.context?.agents){this.shellGateway.ensureAgentsList(e,t).catch(()=>void 0)}render(){return this.refreshStoredOutboxSummary(),this.workspaceChromeVisible&&this.lazyCustomElements.preload(pu),eT(this)}},H([B({attribute:!1})],_T.prototype,`runtime`,void 0),H([B({attribute:!1})],_T.prototype,`onboarding`,void 0),H([Li()],_T.prototype,`navDrawerOpen`,void 0),H([Li()],_T.prototype,`navResizing`,void 0),H([Li()],_T.prototype,`desktopNavigationExpanded`,void 0),H([Li()],_T.prototype,`activeSessionKey`,void 0),H([Li()],_T.prototype,`settingsSearchQuery`,void 0),H([Li()],_T.prototype,`routeState`,void 0),H([Li()],_T.prototype,`nativeHistoryState`,void 0),H([Ni(`openclaw-command-palette`)],_T.prototype,`commandPalette`,void 0),H([Ni(`openclaw-exec-approval`)],_T.prototype,`approvalOverlay`,void 0),customElements.get(`openclaw-app`)||customElements.define(`openclaw-app`,kx),customElements.get(`openclaw-app-shell`)||customElements.define(`openclaw-app-shell`,_T)})))()}export{nx as $,dc as $a,jl as $i,Nm as $n,Fd as $r,A_ as $t,fS as A,$c as Aa,nd as Ai,Nh as An,ss as Ao,Mf as Ar,Bv as At,Xx as B,Hc as Ba,au as Bi,oh as Bn,xf as Br,uv as Bt,MS as C,al as Ca,md as Ci,Qh as Cn,ws as Co,Jf as Cr,yy as Ct,xS as D,Xc as Da,id as Di,Bh as Dn,Cs as Do,Vf as Dr,Xv as Dt,TS as E,Kc as Ea,ad as Ei,Wh as En,hs as Eo,Hf as Er,Zv as Et,cS as F,Vc as Fa,Ju as Fi,Th as Fn,zs as Fo,kf as Fr,Ev as Ft,Lx as G,Tc as Ga,Kl as Gi,Qm as Gn,of as Gr,V_ as Gt,Jx as H,Ec as Ha,ou as Hi,rh as Hn,Sf as Hr,Z_ as Ht,sS as I,Mc as Ia,Au as Ii,yh as In,As as Io,Of as Ir,Cv as It,zx as J,mc as Ja,Ul as Ji,Bm as Jn,$d as Jr,B_ as Jt,Ix as K,yc as Ka,zl as Ki,Zm as Kn,rf as Kr,U_ as Kt,Qx as L,Nc as La,ku as Li,gh as Ln,js as Lo,Cf as Lr,wv as Lt,hS as M,Ac as Ma,ed as Mi,Oh as Mn,Rs as Mo,jf as Mr,Vv as Mt,lS as N,zc as Na,qu as Ni,Eh as Nn,Ps as No,Af as Nr,jv as Nt,mS as O,Gc as Oa,rd as Oi,zh as On,Ts as Oo,Ff as Or,$v as Ot,uS as P,Ic as Pa,Ru as Pi,wh as Pn,us as Po,Nf as Pr,Ov as Pt,rx as Q,lc as Qa,Nl as Qi,Lm as Qn,qd as Qr,k_ as Qt,nS as R,Fc as Ra,Su as Ri,_h as Rn,Ef as Rr,Tv as Rt,US as S,rl as Sa,pd as Si,Mg as Sn,Ss as So,Yf as Sr,cy as St,SS as T,el as Ta,sd as Ti,cg as Tn,Os as To,qf as Tr,ly as Tt,Ux as U,Dc as Ua,iu as Ui,ih as Un,bf as Ur,W_ as Ut,Wx as V,Rc as Va,Ou as Vi,hh as Vn,yf as Vr,$_ as Vt,Fx as W,Oc as Wa,ql as Wi,nh as Wn,df as Wr,K_ as Wt,$b as X,pc as Xa,Rl as Xi,Um as Xn,Qd as Xr,N_ as Xt,Mx as Y,fc as Ya,Il as Yi,zm as Yn,Zd as Yr,z_ as Yt,lx as Z,oc as Za,Fl as Zi,Im as Zn,Kd as Zr,P_ as Zt,pC as _,cl as _a,xd as _i,dg as _n,ls as _o,np as _r,Xy as _t,Vw as a,kl as aa,Ud as ai,x_ as an,Ws as ao,qp as ar,Yb as at,aC as b,sl as ba,yd as bi,Xh as bn,gs as bo,Qf as br,Ty as bt,zw as c,Cl as ca,Nd as ci,c_ as cn,Ks as co,jp as cr,Gb as ct,Fw as d,yl as da,Ad as di,$g as dn,qs as do,kp as dr,hb as dt,Pl as ea,zd as ei,j_ as en,sc as eo,mm as er,Zb as et,ww as f,_l as fa,Od as fi,Qg as fn,ms as fo,ip as fr,_b as ft,FC as g,fl as ga,Sd as gi,hg as gn,Y as go,ap as gr,yb as gt,GC as h,hl as ha,Cd as hi,Hg as hn,Is as ho,sp as hr,bb as ht,Hw as i,Ol as ia,Hd as ii,C_ as in,Bs as io,am as ir,tx as it,pS as j,kc as ja,Zu as ji,Fh as jn,os as jo,Lf as jr,Hv as jt,vS as k,Lc as ka,td as ki,Rh as kn,as as ko,Pf as kr,Uv as kt,Pw as l,bl as la,Wd as li,e_ as ln,Us as lo,Ap as lr,Kb as lt,vw as m,dl as ma,wd as mi,Rg as mn,_s as mo,mp as mr,vb as mt,cT as n,El as na,Id as ni,T_ as nn,rc as no,pm as nr,ex as nt,Rw as o,xl as oa,Ld as oi,b_ as on,Gs as oo,Lp as or,Wb as ot,Cw as p,gl as pa,kd as pi,Cg as pn,ps as po,Tp as pr,gb as pt,Rx as q,_c as qa,Gl as qi,Rm as qn,af as qr,R_ as qt,lT as r,Dl as ra,Rd as ri,O_ as rn,Vs as ro,im as rr,Xb as rt,Bw as s,Sl as sa,Pd as si,i_ as sn,ec as so,Fp as sr,Ub as st,vT as t,Al as ta,Bd as ti,M_ as tn,uc as to,hm as tr,ax as tt,Nw as u,Z as ua,Gd as ui,t_ as un,Hs as uo,Ep as ur,qb as ut,lC as v,ll as va,_d as vi,Ig as vn,Es as vo,ep as vr,Qy as vt,kS as w,tl as wa,fd as wi,mg as wn,J as wo,tp as wr,fy as wt,qS as x,nl as xa,gd as xi,Jh as xn,vs as xo,Zf as xr,_y as xt,rC as y,ol as ya,hd as yi,Pg as yn,ys as yo,Xf as yr,Uy as yt,Zx as z,Wc as za,cu as zi,uh as zn,Df as zr,dv as zt};