UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

2 lines • 111 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./markdown-runtime-CtlJb8xA.js","./_1____________________________.css","./_0____________________________________.css","./progressive-list-CF1z_CZ0.js","./config-form.tiers-MvbiZwtM.js","./config-form.search-Z0jyQfrJ.js","./config-form.node-CrgTELhZ.js","./json-schema-QgwGaU4v.js","./schema-VvtGzI60.js","./system-CeTchkPd.js","./config-form.node.shared-D-tDfw5e.js","./phone-runtime-CzuAxQYL.js","./settings-disclosure-C2Lxm_wL.js","./route-chrome-styles-3PguhbQm.css","./settings-targets-bvwku6ua.js","./settings-select-row-DhCp1sjn.js","./setup-schema-DK0FbwGW.js"])))=>i.map(i=>d[i]);
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{$n as t,$t as n,$u as r,Ai as i,B as a,Ci as o,Ct as s,Dn as c,Ei as l,Fu as u,Gn as d,Gr as f,Hn as p,It as m,Jn as h,Ju as g,K as _,Mi as v,Mn as y,On as b,Qn as x,Qu as S,Rt as ee,Sn as C,Tn as w,Tt as T,U as te,Un as E,Uu as D,Vn as O,Wn as ne,Wo as re,Xn as ie,Xt as k,Y as A,Ya as ae,Yn as oe,Z as se,Zn as ce,Zt as le,_n as ue,bi as j,bt as de,en as M,fn as N,ii as fe,jn as pe,li as me,nn as P,nr as he,oi as ge,on as _e,qn as ve,qs as ye,rc as be,si as xe,sn as Se,sr as Ce,vc as we,vi as Te,vn as Ee,wn as De,xn as Oe}from"./_4____________________________.js";import{$k as ke,AE as F,AN as Ae,B as je,Bi as Me,CD as Ne,CE as Pe,DE as Fe,Dj as Ie,Dw as Le,EE as Re,EN as ze,Ey as Be,FE as Ve,FN as He,GN as I,Gy as Ue,H as We,HS as Ge,Hh as Ke,JN as L,JT as qe,Kn as Je,Ky as Ye,OE as Xe,Oj as Ze,PE as Qe,PN as $e,QN as et,Qc as tt,Qy as nt,RC as rt,RS as it,Rh as at,SE as ot,Sw as st,TE as ct,Tp as lt,Tw as ut,Ty as dt,U as ft,UN as pt,US as mt,Uh as ht,V as gt,VS as _t,Vh as vt,Vi as yt,WS as bt,XM as xt,XT as St,Xn as Ct,YC as wt,YN as Tt,Yn as Et,ZN as Dt,_D as Ot,_E as kt,bD as At,bE as jt,dD as R,dT as Mt,do as Nt,eA as Pt,eD as Ft,eb as It,fD as Lt,fN as z,fT as Rt,fo as zt,fr as Bt,gD as Vt,hD as Ht,ib as Ut,jj as Wt,kE as Gt,kj as Kt,mD as qt,mo as Jt,oN as Yt,oS as Xt,or as Zt,pD as Qt,pN as $t,po as en,pr as tn,qN as nn,qn as rn,qy as an,rb as on,sS as sn,sr as cn,tD as ln,uD as un,wE as dn,wp as fn,xE as pn,xw as mn,zC as hn}from"./_2_____________________________.js";import{Qt as gn,en as _n}from"./deferred-ui-support-DZEPWjAk.js";import{$ as vn,B as yn,C as B,Ct as bn,Dt as xn,F as V,I as Sn,J as Cn,L as wn,O as H,P as Tn,R as En,Rt as Dn,S as U,St as On,U as W,V as kn,W as An,_ as jn,_t as Mn,a as Nn,b as Pn,d as G,f as K,g as q,gt as Fn,j as J,l as Y,m as In,o as Ln,p as Rn,s as zn,u as X,v as Bn,w as Z,x as Q,yt as Vn}from"./_6____________________.js";import{n as Hn,t as Un}from"./response-body-CTiqMXEi.js";import{n as Wn,t as Gn}from"./server-prefs-profile-runtime-CMyNoQ-O.js";import{_ as Kn}from"./route-controls-runtime-LXiVRSj4.js";import{a as qn,i as Jn}from"./config-page-H1n4Cu7G.js";import{n as Yn,r as Xn,t as Zn}from"./theme-palette-Dps8CLSX.js";import{n as Qn,t as $n}from"./en-settings-DEvavpke.js";import{n as er,r as tr}from"./en-preferences-BxI3BUpx.js";import{d as nr,g as rr,h as ir,i as ar,m as or,p as sr,r as cr,t as lr,u as ur}from"./lobster-pet-identity-DgA0FbCN.js";import{n as dr,t as fr}from"./provider-presentation-K1_wXrAZ.js";import{n as pr,t as mr}from"./session-source-presentation-BxM1DLlv.js";import{t as hr}from"./_3_____________________________.js";import{S as gr,f as _r,g as vr,m as $,n as yr,s as br,t as xr,u as Sr,v as Cr,w as wr,x as Tr}from"./settings-controls-runtime-CwXZmgDo.js";import{T as Er,h as Dr,m as Or,p as kr,y as Ar}from"./config-form-utils-runtime-CqcGJa6w.js";import{a as jr,c as Mr,i as Nr,n as Pr,o as Fr,s as Ir,t as Lr}from"./config-form-analysis-runtime-oVfDtt-o.js";import{c as Rr,s as zr}from"./route-chrome-Dr9fhzjf.js";import{a as Br,f as Vr,r as Hr}from"./lobster-dex-BAaz3U8C.js";import{r as Ur}from"./lobster-pet-audio-waE6qgq0.js";import{n as Wr,r as Gr,t as Kr}from"./session-background-image-Cr_LwQ3x.js";import{n as qr,t as Jr}from"./hub-tabs-B2BTtoLm.js";import{c as Yr,u as Xr}from"./config-draft-model-CVR-RCQl.js";import{n as Zr,t as Qr}from"./model-picker-CyKYy0Cu.js";import{a as $r,i as ei,o as ti,r as ni,t as ri}from"./model-setting-DB0kHEqD.js";import{r as ii,t as ai}from"./model-runtime-label-HaaZiSxS.js";import{n as oi,r as si}from"./session-DRwGE9vt.js";import{n as ci,t as li}from"./config-secret-fields-Cq1gduCe.js";import{c as ui,d as di,f as fi,l as pi,p as mi,s as hi,u as gi}from"./mcp-schema-DcQIZVvj.js";import{n as _i,r as vi}from"./memory-schema-BcMM2rqV.js";import{a as yi,i as bi,n as xi}from"./settings-model-NIDYQJwk.js";import{n as Si,t as Ci}from"./events-browser-DH7D6URk.js";function wi(){return(wi=e((()=>{})))()}function Ti(e,t){let n=null,r=null,i={value:null},a=e=>{i.value!==e&&(i={value:e},t())},o=Kn(t,{task:({client:t,params:n},{signal:r})=>{let i=t.request(e,n,{signal:r});return a(i),i},onComplete:e=>{r=e},onError:()=>{}});return{get read(){return i},retire(){o.cancel(),n=null,a(r)},synchronize(e,t,i={}){n!==e&&(o.cancel(),n=e,r=null,a(null),t&&o.run({client:t,params:i}))}}}function Ei(e){let t=Ti(`plugins.list`,e),n=Ti(`sessions.catalog.list`,e);return{get pluginsRead(){return t.read},get labelsRead(){return n.read},retire(){t.retire(),n.retire()},synchronize(e,r,i,a){let o=t=>e&&A(r,t,`operator.read`)?r.client:null,s=o(`plugins.list`);t.synchronize(s,s);let c=a.size>0?o(`sessions.catalog.list`):null;n.synchronize(c?`${i}\0${[...a].toSorted().join(`\0`)}`:null,c,{...i?{agentId:i}:{},metadataOnly:!0})}}}function Di(){return(Di=e((()=>{se()})))()}function Oi(e){let[t,n]=yn(void 0,{ownedWrite:!0}),r=En(()=>{let e=t();return e===null?[]:e},[],{key:e=>`${e.provider}/${e.id}`}),i=null,a=null,o=null,s=!1,c=null,l=!1,u;function d(){let t=e.gateway().snapshot;return e.active()&&document.visibilityState!==`hidden`&&!l&&zt(t)?t.client:null}function f(){clearInterval(u),u=setInterval(()=>void m(),Nt)}let p=Kn(e.invalidate,{task:async(t,{signal:n})=>{let r=await Jt(e.gateway(),n);return d()===t?r:null},onComplete:e=>{e&&(c=e.value,f(),g(!0))},onError:e=>{St(e)&&(c=null,l=!0)}});function m(){let e=d();return e&&!p.pending?p.run(e):Promise.resolve()}function h(){let e=i;i=null,e?.abort(),n(void 0)}function g(t=!1){let r=c===null?null:d(),l=e.selectedAgent();if(!r||!l){h(),n(null),s=!l,l||(a=null);return}if(a===l&&(i||s||!t))return;let u=a!==l;a=l,h(),u&&(o={},s=!1);let f=new AbortController;i=f;let p=yt(r,{agentId:l,preparedOnly:!0,signal:f.signal}).then(({models:t})=>i===f&&d()===r&&e.selectedAgent()===l?t:void 0).catch(e=>{if(i===f)throw s=St(e),e});n(p),e.invalidate();let m=()=>{i===f&&(i=null)};p.then(m,m)}return{models:r,get scope(){return o},get unavailable(){return s},get resolvedModel(){return c?.defaultAgentUtilityModel},refreshStatus:m,synchronize(){d()?!c||!u?(f(),m()):g():(clearInterval(u),u=void 0,p.cancel(),h())},retire(){e.active()||(clearInterval(u),u=void 0),p.cancel(),h(),a=null},reset(){c=null,l=!1,n(null),o=null,s=!1}}}function ki(){return(ki=e((()=>{W(),qe(),Me(),en()})))()}function Ai(e,t,n){let r=n??_e(t),i=Se(t,r),a=i===R.pendingScope?R.pendingPrefs:Ht(Ot(Qt,i)),o=R.preferenceWriteFailures.get(i)?.get(e),c=a&&Object.hasOwn(a,e)?a[e]:N[e].local(s(t||void 0))??null;return o&&Oe(o.value,c)?{status:`error`,error:o.error}:a&&Object.hasOwn(a,e)?{status:`pending`}:Vt(i).has(e)?{status:`error`,error:me(`quickSettings.personal.deviceOnly`)}:{status:`saved`}}function ji(e){let t=e.scope??e.client.gatewayUrl;if(!e.isCurrent()||!e.client.connected||_e(t)!==e.profileId)return!1;let n=e.preference??void 0,r=Se(t,e.profileId);r===R.pendingScope&&R.reconcilePersistedPendingPrefs();let i=r===R.pendingScope?R.pendingPrefs:Ht(Ot(Qt,r)),a=s(t).background;if(i&&Object.hasOwn(i,`background`)||!Oe(a,e.expectedPreference??void 0)&&!Oe(a,n))return!1;M(),ln(e.client),P(t,e.profileId,{background:n??null});let o={...bt(R,r)};n?o.background=n:delete o.background,mt(R,r,o),R.preferenceWriteFailures.get(r)?.delete(`background`),R.updateRetainedLocalKeys(r,[`background`],!1),R.lastReconciledConfigObject=null;let c=R.applyingServerPrefs;R.applyingServerPrefs=!0;try{T({gatewayUrl:t,background:n},{selectGateway:!1})}finally{R.applyingServerPrefs=c}return R.publishPreferenceWrites(),!0}function Mi(e,t,n){let r=R.pushWriter,i=n===void 0?_e(t):n,a=Se(t,i);if(!r?.state.connected||!r.state.client?.connected||r.state.client.gatewayUrl!==t||R.pushScope!==a||R.pendingScope!==a||R.pushProfileId!==i||_e(t)!==i)return!1;let o=N[e],c=o.local(s(t));if(i&&Ee(e)?!R.pushCanWrite||e===`theme`&&c===`custom`:o.configSync===!1||r.canPatch===!1)return!1;R.reconcilePersistedPendingPrefs();let l=R.pendingPrefs!==null&&Object.hasOwn(R.pendingPrefs,e),u=R.preferenceWriteFailures.get(a)?.get(e),d=l?R.pendingPrefs?.[e]:c??null;return d===null&&!o.write||d!==null&&!Oe(d,c)||!l&&!(u?.retained&&Oe(u.value,d))&&!Vt(a).has(e)?!1:(R.preferenceWriteFailures.get(a)?.delete(e),R.updateRetainedLocalKeys(a,[e],!1),R.pendingPrefs={...R.pendingPrefs,[e]:d},R.mergePendingIntoStorage(),R.publishPreferenceWrites(),R.startPendingDrain(r),!0)}function Ni(e,t,n=R.pendingScope,r){let i=N[e],a=t=>e===`theme`&&t.theme!==void 0?Pi(t.theme):T(t),o=Ee(e)?r??_e(n):null,c=Se(n,o),l=i.write;if(!l)throw Error(`Server UI preference is not resettable: ${e}`);if(t?.provenance===`device-local`){let r=l(t.resetValue),i=e===`theme`&&r.theme!==s().theme?[e,`accent`,`fontUi`,`fontChat`]:[e];R.cancelPendingKeys(c,i),c!==n&&R.cancelPendingKeys(n,i),R.updateRetainedLocalKeys(c,i,!1);for(let e of i)Ne(e,`device-local`);return a(r)}return Ne(e,`server`),a(l(t?.resetValue))}function Pi(e,t={}){return e===s().theme?T({...t,theme:e}):(Ne(`accent`,`write`),Ne(`fontUi`,`server`),Ne(`fontChat`,`server`),T({...t,theme:e,fontUi:void 0,fontChat:void 0,accent:`theme`}))}function Fi(){return(Fi=e((()=>{ge(),er(),I(),Ge(),At(),n(),ue(),qt(),un(),de(),Ft(),nn(tr)})))()}function Ii(e,t){let n=()=>e.theme.settings;function r(e,n){n?Pi(n,e):T(e),t()}function i(t){let r=Ee(t);return _t(Ze(e.runtimeConfig.state),t,e.gateway.connection.gatewayUrl,n(),{canSync:Gn(e,r?t:void 0),profileId:r?e.gateway.snapshot?.selfUser?.id:void 0})}function a(e,t){let n=i(e);n.overridden&&t===n.resetValue?o(e):r({[e]:t})}function o(n){let r=Ni(n,i(n),e.gateway.connection.gatewayUrl,e.gateway.snapshot?.selfUser?.id);n===`locale`?j(r.locale)?xe.setLocale(r.locale):xe.useSystemLocale():t()}return{apply:r,read(){let s=i(`theme`),c=i(`themeMode`),l=i(`accent`),u=i(`locale`),d=i(`chatSendShortcut`),f=i(`chatFollowUpMode`);return{onAppearanceChange:r,setTabIconMode:t=>{(!t.startsWith(`lobster:`)||e.theme.branding.lobsterdex&&ur.some(e=>e.id===t.slice(8))&&Hr().has(t.slice(8)))&&r({tabIcon:t})},theme:n().theme,themeOverridden:s.overridden,themeProvenance:s.provenance,themeResetValue:s.resetValue??p.theme,themeMode:n().themeMode,themeModeOverridden:c.overridden,themeModeProvenance:c.provenance,themeModeResetValue:c.resetValue??p.themeMode,accent:n().accent,accentProvenance:l.provenance,accentResetValue:l.resetValue,fontUi:n().fontUi,fontChat:n().fontChat,fontUiProvenance:i(`fontUi`).provenance,fontChatProvenance:i(`fontChat`).provenance,setFontUi:e=>a(`fontUi`,e),setFontChat:e=>a(`fontChat`,e),systemLocale:xe.getSystemLocale(),localeOverride:j(u.value)?u.value:void 0,localeOverridden:u.overridden,localeProvenance:u.provenance,localeResetValue:j(u.resetValue)?u.resetValue:void 0,onLocaleChange:e=>{e===void 0?o(`locale`):(T({locale:e}),xe.setLocale(e),t())},setTheme:e=>{let t=i(`theme`);t.overridden&&e===t.resetValue?o(`theme`):r({},e)},setThemeMode:t=>{let n=i(`themeMode`);n.overridden&&t===n.resetValue?o(`themeMode`):e.theme.setMode(t)},setAccent:e=>e===void 0?o(`accent`):r({accent:e}),chatSendShortcut:h(n().chatSendShortcut),chatSendShortcutOverridden:d.overridden,chatSendShortcutProvenance:d.provenance,chatSendShortcutResetValue:d.resetValue??p.chatSendShortcut,chatFollowUpMode:n().chatFollowUpMode,chatFollowUpModeOverridden:f.overridden,chatFollowUpModeProvenance:f.provenance,resetChatFollowUpMode:()=>o(`chatFollowUpMode`)}}}}function Li(){return(Li=e((()=>{Fi(),Wn(),it(),ue(),de(),Br(),nr(),ge(),Wt()})))()}var Ri;function zi(){return(zi=e((()=>{Ri=class{constructor(e){this.publish=e,this.currentImport=null,this.gatewayScope=``,this.state={url:``,message:null,expanded:!1}}get snapshot(){return this.state}get completedImport(){return this.currentImport?void 0:this.state.completion}synchronize(e,t){let n=this.gatewayScope&&e!==this.gatewayScope||t!==this.importedAt;this.gatewayScope=e,this.importedAt=t,n&&this.retireImport()}open(){this.update({expanded:!0})}setUrl(e){(e!==this.state.url||!this.currentImport&&this.state.completion)&&this.retireImport(),this.update({url:e,...this.state.message?.kind===`error`?{message:null}:{}})}retireForConfigMutation(e){this.currentImport&&(this.retireImport(),this.update({message:{kind:`error`,text:e}}))}import(e){let t=this.blockedReason(e.config);if(t){this.update({expanded:!0,completion:void 0,message:{kind:`error`,text:e.messages.blocked(t)}});return}let n=Promise.withResolvers(),r=e.readTheme();this.currentImport=n;let i=this.state.url,a=(async()=>{try{let t=await e.load(i);if(this.currentImport!==n)return;let a=e.readTheme();e.apply(t,!e.hasCustomTheme&&(a===r||a===`custom`)),this.update({url:``,message:{kind:`success`,text:e.messages.imported(t.label)}})}catch(e){if(this.currentImport!==n)return;throw e}finally{this.currentImport===n&&(this.currentImport=null,this.update({}))}})(),o=Promise.race([a,n.promise]);return this.update({expanded:!0,message:null,completion:o}),o}clear(e){this.retireImport(),e.apply(),this.update({expanded:!0,message:{kind:`success`,text:e.message}})}retireImport(){(this.currentImport||this.state.completion)&&(this.currentImport?.resolve(),this.currentImport=null,this.update({completion:void 0}))}blockedReason(e){return e.connected&&(e.configLoading||!e.configSnapshot)?`loading`:e.configFormDirty||e.configSaving||e.configApplying||e.configAutoSaveStatus===`saving`?`unsaved`:null}update(e){this.state={...this.state,...e},this.publish(this.state)}}})))()}function Bi(e){let t=e.split(`/`).filter(Boolean),n=t.at(-1);return n&&(t.length===2&&t[0]===`themes`||t.length===3&&t[0]===`r`&&t[1]===`themes`)?(he(n),n):null}function Vi(e){let t=u(e);if(!t)throw Error(L(`configView.appearance.importErrors.empty`));let n=t.replace(/[.,;:]+$/,``);return ie.test(n)?`https://tweakcn.com/themes/${n}`:n.startsWith(`/themes/`)||n.startsWith(`/r/themes/`)?`https://tweakcn.com${n}`:/^(?:www\.)?tweakcn\.com\//i.test(n)?`https://${n}`:n.match(/https?:\/\/(?:www\.)?tweakcn\.com\/[^\s<>"')]+/i)?.[0]?.replace(/[.,;:]+$/,``)??n}function Hi(e){return e instanceof Zn?L(`configView.appearance.themeImport.missingToken`,{token:e.message}):e instanceof ce?e.message?L(`configView.appearance.themeImport.invalidToken`,{token:e.message}):L(`configView.appearance.themeImport.invalidLink`):ze(e)}async function Ui(e){try{return await Wi(e)}catch(e){throw e instanceof ce?Error(Hi(e),{cause:e}):e}}async function Wi(e){let t=Vi(e),n;try{n=new URL(t)}catch{throw Error(L(`configView.appearance.importErrors.invalidUrl`))}if(!Gi.has(n.hostname))throw Error(L(`configView.appearance.importErrors.unsupportedHost`));let r=Bi(n.pathname);if(!r){if(r=n.searchParams.get(`theme`)??n.searchParams.get(`themeId`)??n.searchParams.get(`id`),!r)throw Error(L(`configView.appearance.importErrors.unsupportedLink`));he(r)}let i=`https://tweakcn.com/themes/${r}`,a=`https://tweakcn.com/r/themes/${r}`,o=new AbortController,s=setTimeout(()=>o.abort(),qi);try{let e=await fetch(a,{headers:{accept:`application/json`},redirect:`error`,signal:o.signal}),t=e.url;if(t){let e;try{e=new URL(t)}catch{throw Error(L(`configView.appearance.importErrors.responseUrl`))}if(e.protocol!==`https:`||!Gi.has(e.hostname))throw Error(L(`configView.appearance.importErrors.redirect`))}if(!e.ok)throw Error(L(`configView.appearance.importErrors.http`,{status:String(e.status)}));let n=await Hn(e,{maxBytes:Ki,tooLargeMessage:L(`configView.appearance.importErrors.tooLarge`),missingBodyMessage:L(`configView.appearance.importErrors.unreadable`)}),s;try{s=JSON.parse(n)}catch{throw Error(L(`configView.appearance.importErrors.invalidJson`))}let c=D(s),l=D(c?.cssVars),d=D(l?.light),f=D(l?.dark),p=l?.theme===void 0?void 0:D(l.theme);if(!c||!l||!d||!f||p===null)throw Error(L(`configView.appearance.importErrors.invalidTheme`));return{sourceUrl:i,themeId:r,label:x(u(c.name)),importedAt:new Date().toISOString(),light:Xn(`light`,d,p),dark:Xn(`dark`,f,p)}}catch(e){throw o.signal.aborted?Error(L(`configView.appearance.importErrors.timeout`),{cause:e}):e}finally{clearTimeout(s)}}var Gi,Ki,qi;function Ji(){return(Ji=e((()=>{t(),Yn(),$n(),Ae(),I(),Un(),nn(Qn),Gi=new Set([`tweakcn.com`,`www.tweakcn.com`]),Ki=2e5,qi=1e4})))()}function Yi(e,t){let n={microphone:pi(),camera:pi()},r=n.camera,i=null,a=Promise.withResolvers();function o(){a.resolve(),a=Promise.withResolvers();for(let e of Object.values(n))e.requestsPermission=!1}function s(e,r){let i=n[e];if(i.activeDiscovery)return i.requestsPermission||=r,i.activeDiscovery;i.requestsPermission=r,i.selection=null;let a=e===`microphone`?`audioinput`:`videoinput`,o=Je(()=>i.requestsPermission,a).then(e=>(i.devices=e.devices,i.permissionRequired=e.permissionRequired,e.issue?Ct(e.issue,a):null),ze).finally(()=>{i.activeDiscovery=null,i.selection=null,i.discovery=o,i.requestsPermission=!1,t()});return i.activeDiscovery=o,i.discovery=o,t(),o}return{devices:n,selectCamera:n=>{let o=a.promise;i?.resolve();let s=Promise.withResolvers();i=s;let c=n.trim()||void 0;return r.selection=s.promise,r.discovery=null,s.promise.catch(()=>{}),t(),si(c).then(()=>{i===s&&(e(c),s.resolve())}).catch(e=>{i===s&&(r.selection=s.promise,s.reject(e),t())}),Promise.race([s.promise,o])},retire:o,refresh:s,load(){for(let e of[`microphone`,`camera`])n[e].loaded||(n[e].loaded=!0,s(e,!1))},observe(e){let t=e.subscribe(()=>{let t=e.getState();(t.pendingMatches[0]??t.matches[0])?.routeId!==`appearance`&&o()}),n=Et(()=>{s(`microphone`,!1),s(`camera`,!1)});return()=>{t(),n()}}}}function Xi(){return(Xi=e((()=>{Ae(),rn(),oi(),gi()})))()}function Zi(e){return{gateway:{controlUi:{sessionObserver:e?null:!1}}}}function Qi(e,t=null){return{agents:{defaults:{utilityModel:ni(ti(t,e.kind===`auto`?null:e.kind===`disabled`?``:e.model))}}}}function $i(){return($i=e((()=>{ri()})))()}function ea(e){let t=null,n=Promise.withResolvers();function r(){n.resolve(),n=Promise.withResolvers()}Fn(()=>{let t=e.router.subscribe(r);return()=>{t(),r()}});let[i,a]=yn(null,{ownedWrite:!0});function o(){let t=e.overlays.refreshUpdateStatus();return a(()=>t),t}return{busy(){let t=e.overlays.snapshot;return t.updateRunning||t.updateReconciliationPending},read:i,refresh:o,captureCommandPresentation(){let e=n;return{retired:e.promise,isCurrent:()=>e===n}},reset(){r(),t=null,a(null)},synchronize(n){let r=e.gateway.snapshot,i=n===`updates`&&A(r,`update.status`,`operator.admin`)?r.client:null;i!==t&&(t=i,a(null),i&&o())}}}function ta(){return(ta=e((()=>{W(),se()})))()}function na(e){return g(e)?e:null}function ra(e,t){let n=na(e);return n?ct(n,``,t):e}function ia(e,t,n){let r=e;if(e&&Er(e)===`object`&&e.properties){let i={};for(let[r,a]of Object.entries(e.properties))a&&(!t?.size||t.has(r))&&!n?.has(r)&&(i[r]=a);r={...e,properties:i}}return Lr(r)}function aa(e,t){if(!e||t===`<root>`)return!1;let n=t.split(`.`),r=(e,t)=>{if(t===n.length)return e!==void 0;if(typeof e!=`object`||!e)return!1;let i=n[t];return i===`*`?Object.values(e).some(e=>r(e,t+1)):!i||!Object.hasOwn(e,i)?!1:r(e[i],t+1)};return r(e,0)}function oa(e){let t=()=>{let t=`__OPENCLAW_CONFIG_PATHS__`,n=e.paths.length===1?`configView.formUnsafeCount`:`configView.formUnsafeCountPlural`;return L(n,{count:String(e.paths.length),paths:t}).split(t)};var n=sa(),r=n.firstChild,i=r.nextSibling,a=i.nextSibling,o=a.nextSibling;return G(n,()=>t()[0],r),G(n,J(B,{get each(){return e.paths.slice(0,3)},children:(e,t)=>[K(()=>t()>0?`, `:``),(()=>{var t=ca();return G(t,e),t})()]}),i),G(n,()=>t()[1]??``,a),G(n,(()=>{var t=K(()=>e.paths.length>3);return()=>t()?` ${L(`configView.formUnsafeMore`,{count:String(e.paths.length-3)})}`:null})(),o),n}var sa,ca;function la(){return(la=e((()=>{X(),W(),Pr(),Fr(),I(),Pe(),sa=Q(`<span class=config-content-callout__text><!><!><!><!>`),ca=Q(`<code>`)})))()}function ua(e,t,n){let r=Dt(e.agents,e=>e.state),i=Dt(e.agentIdentity,e=>e),o=Dt(e.config,e=>e.current),s=et(Vr,{read:Hr,subscribe:(e,t)=>e(t),equality:`revision`}),c=Dt(e.webPush,e=>e.snapshot),l=e.nativeNotifications?Dt(e.nativeNotifications,e=>e.snapshot):null,[u,d]=yn(0,{ownedWrite:!0}),f=V(()=>(u(),e.runtimeConfig.state.configSchema)),m=V(()=>o.read().openclawIdEnabled===!0),h=V(()=>ra(f(),m())),g=()=>{d(e=>e+1),Fn(Re)},[_,v]=kn({formModes:{},selections:{}}),y=`advanced`,b=null,x=ae(),S={read:()=>b,subscribe:x.subscribe},C=!1,w=!1,T=!1,E=()=>e.theme.settings,O=Ii(e,g),ie=Ke(),k=Oi({invalidate:g,gateway:()=>e.gateway,active:()=>C&&y===`appearance`&&w,selectedAgent:()=>e.settingsAgentSelection.state.selectedId}),A=Ei(g),se=V(()=>(u(),A.pluginsRead)),ce=V(async()=>{let e=await se().value;return e?new Set(e.plugins.filter(e=>e.installed).map(e=>e.id)):null}),le=V(()=>(u(),A.labelsRead)),ue=V(async()=>{let e=await le().value;return e?new Map(e.catalogs.map(e=>[e.id,e.label])):da}),j=new Ri(g),de=ui(),M=null,N=Promise.withResolvers();function pe(){N.resolve(),N=Promise.withResolvers()}let me=ea(e),P=Yi(e=>O.apply({realtimeTalkVideoDeviceId:e}),g),he=P.devices,ge=null,_e=null,ve,ye=null,xe=tn(1e3,g),Se=!1,Ce=``,Te=null,Ee=null;function De(){return u(),Date.now()}function Oe(){u();let t=e.runtimeConfig.state;return D(t.configForm??t.configSnapshot?.config)??{}}function ke(){let t=e.runtimeConfig.state;return F()||t.configLoading||!e.runtimeConfig.canSet}function F(){u();let t=e.runtimeConfig.state;return!t.connected||t.configSaving||t.configApplying||me.busy()||e.overlays.snapshot.updateStatusRefreshing||!a(e.gateway.snapshot.hello?.auth??null)}function Ae(){return u(),me.busy()}function je(t,n){if(Se&&t===y&&n===b)return;if(Se=!0,pe(),y===`appearance`&&t!==`appearance`&&(j.retireImport(),P.retire(),w=!1,T=!1),Ne(),y=t,b=n,y!==`memory`)Ce=``;else if(b){let t=new URLSearchParams(b.search).get(`agent`)?.trim(),n=b.agentSelectionIntent,r=e.settingsAgentSelection;t&&n?.owner===r&&n.revision===r.intentRevision&&r.set(t);let i=_i(b,e.basePath);if(!i)Ce=``;else{let t=`${b.pathname}${b.search}${b.hash}`;Ce!==t&&(Ce=t,e.replace(`memory`,i))}}let r=b?dn(y,b.section,null):pn(y,globalThis.location?.search??``);v(e=>{e.selections[y]=r}),Ee!==null&&(cancelAnimationFrame(Ee),Ee=null),Te=b?.targetBlockId??Qe(globalThis.location?.hash??``),w||=y===`appearance`&&Xe(Te),Pe(),g(),x.publish()}let Me=()=>{ie=Ke(),Pe(),g()};function Ne(){k.retire(),A.retire()}function Pe(){if(!C)return;let t=e.gateway,n=t.snapshot;(t!==ge||n.client!==_e||n.hello!==ve||n.phase!==ye)&&(pe(),Ne(),k.reset(),Be(),me.reset(),ge=t,_e=n.client,ve=n.hello,ye=n.phase),ze(e.runtimeConfig),j.synchronize(t.connection.gatewayUrl,E().customTheme?.importedAt),k.synchronize(),A.synchronize(y===`appearance`&&w,n,e.settingsAgentSelection.state.selectedId,ie),me.synchronize(y);let r=e.overlays.snapshot.updateSchedule?.campaign;y===`updates`&&(r?.state===`countdown`||r?.state===`waiting-for-idle`)?xe.start():xe.stop(),y===`appearance`&&(P.load(),n.phase===`connected`&&e.agentIdentity.ensure([e.agentSelection.state.selectedId]))}function Fe(){y===`appearance`&&!w&&(w=!0,He())}function Le(){y!==`appearance`||T||(T=!0,Pe(),g())}function Re(){C&&Te&&Ee===null&&(Ee=requestAnimationFrame(()=>{Ee=null;let e=Te?n().ownerDocument.getElementById(Te):null;e&&n().contains(e)&&(e.scrollIntoView?.({behavior:tt(),block:`start`}),Te=null)}))}function ze(e){let t=e!==M;t&&(pe(),M&&j.retireImport(),M=e,Be());let n=_.selections[y]??ot(y);Gt(e,y,n.activeSection,{data:w,importer:T,sourceChanged:t})}function Be(){de=ui(),g()}function Ve(){u();let{pageId:n,routeData:a}=t(),o=Oe(),d=e.runtimeConfig,f=d.state,m=jt(n),y=_.selections[n]??(a?dn(n,a.section,null):pn(n,globalThis.location?.search??``)),b=D(D(o.gateway)?.controlUi),x=D(D(o.agents)?.defaults),S=$r(x?.utilityModel),C=e.agentSelection.state.selectedId,T=r.read().agentsList?.agents.find(e=>e.id===C),re=s.read(),A=N.promise,ae=e=>{if(!e&&A===N.promise&&f.lastError)throw Error(f.lastError);return e},M=e=>(...t)=>{j.retireForConfigMutation(L(`common.unsavedChanges`)),e(...t)};return{...O.read(),raw:_.formModes[n]===`raw`?Yr(f):f.configRaw,originalRaw:f.configRawOriginal,valid:f.configValid,issues:f.configIssues,loading:f.configLoading,configLoaded:f.configSnapshot!==null,configReadAccess:e.gateway.snapshot.hello?te(e.gateway.snapshot.hello.auth)?`available`:`denied`:`pending`,appearanceDataRequested:w,onAppearanceDataNeeded:Fe,configRecoveryError:f.configRecoveryError,configRead:Ie(f)?.completion.promise??null,onRetryConfig:()=>void d.refresh(),saving:f.configSaving,applying:f.configApplying,updating:me.busy()||e.overlays.snapshot.updateStatusRefreshing,connected:f.connected,mutationAllowed:d.canSet,openFileAllowed:d.canOpenFile,schema:h(),schemaLoading:f.configSchemaLoading,schemaRead:d.schemaRead,onRetrySchema:()=>void d.refreshSchema(),uiHints:f.configUiHints,formMode:_.formModes[n]??`form`,rawDraftPending:f.configFormMode===`raw`&&f.configFormDirty,viewState:de,rawAvailable:!!(f.configSnapshot?.config||f.configForm||f.configRaw),showModeToggle:n===`advanced`,formValue:f.configForm,activeSection:n===`mcp`?`mcp`:y.activeSection,activeSubsection:n===`mcp`?null:y.activeSubsection,onRawChange:M(e=>d.setRaw(e)),onFormModeChange:e=>{e!==(f.configFormMode===`raw`&&f.configFormDirty?`raw`:_.formModes[n]??`form`)&&pe(),v(t=>{t.formModes[n]=e}),g()},onViewStateChange:()=>g(),secretFields:li(e),onFormPatch:M((e,t)=>d.patchForm(e,t)),onFormRemove:M(e=>d.removeFormValue(e)),onSectionChange:e=>{pe(),n===`appearance`&&e===`ui`&&(d.ensureLoaded().catch(()=>void 0),d.ensureSchemaLoaded().catch(()=>void 0)),v(t=>{t.selections[n]=dn(n,e,null)}),g()},onSubsectionChange:e=>{pe(),v(t=>{t.selections[n]={...t.selections[n]??ot(n),activeSubsection:e}}),g()},onSave:()=>d.save(),presentationRetired:()=>N.promise,onRawDiscard:()=>d.discardDraft(),onOpenFile:()=>d.openFile(),themeCatalog:n===`appearance`?e.theme.catalog:void 0,onRetryThemeCatalog:()=>e.theme.retryCatalog?.(),hasCustomTheme:!!E().customTheme,customThemeLabel:E().customTheme?.label??null,customThemeSourceUrl:E().customTheme?.sourceUrl??null,customThemeImportUrl:j.snapshot.url,customThemeImportCompletion:j.completedImport,customThemeImportMessage:j.snapshot.message,customThemeImportExpanded:j.snapshot.expanded,onCustomThemeImportFocus:Le,onCustomThemeImportUrlChange:e=>{Le(),j.setUrl(e)},onImportCustomTheme:()=>(Le(),j.import({config:e.runtimeConfig.state,hasCustomTheme:!!E().customTheme,readTheme:()=>E().theme,load:Ui,apply:(e,t)=>O.apply({customTheme:e},t?`custom`:E().theme),messages:{blocked:e=>L(e===`loading`?`common.loading`:`common.unsavedChanges`),imported:e=>L(`configPage.themeImported`,{name:e})}})),onClearCustomTheme:()=>{j.clear({apply:()=>O.apply({customTheme:void 0},E().theme===`custom`?`claw`:E().theme),message:L(`configPage.themeRemoved`)})},onOpenCustomThemeImport:()=>{Le(),j.open()},tabIcon:E().tabIcon,lobsterdexEnabled:e.theme.branding.lobsterdex,tabIconAgentAvatar:T?ee(T,i.read().get(C)):null,tabIconLobsters:ur.filter(e=>re.has(e.id)),textScale:E().textScale??p.textScale,textScaleOverridden:E().textScale!==void 0,setTextScale:e=>O.apply({textScale:e===p.textScale?void 0:oe(e)}),sidebarLiveActivity:E().sidebarLiveActivity??p.sidebarLiveActivity,hiddenSessionCatalogIds:ie,hiddenSessionCatalogLabels:{read:ue,scope:le().value},setSessionCatalogHidden:ht,terminalFontFamily:E().terminalFontFamily,setTerminalFontFamily:e=>O.apply({terminalFontFamily:e}),chatMessageMaxWidth:E().chatMessageMaxWidth,chatShowTaskProgress:E().chatShowTaskProgress??p.chatShowTaskProgress,openLinksExternally:E().openLinksExternally===!0,openLinksInControlUiBrowser:E().openLinksInControlUiBrowser===!0,chatCollapseTaskProgress:E().chatCollapseTaskProgress===!0,showAdvancedSettings:E().showAdvancedSettings===!0,forceShowAdvanced:n===`advanced`,forceAdvancedSection:a?.advanced?a.section??ot(n).activeSection:null,sessionObserverEnabled:b?.sessionObserver!==!1,sessionObserverUtilityModel:ei(S),sessionObserverResolvedModel:k.resolvedModel,sessionObserverModels:k.models,sessionObserverModelsScope:k.scope,sessionObserverModelsUnavailable:k.unavailable,sessionObserverDisabled:F()||f.configLoading||f.configSnapshot===null,setSessionObserverEnabled:e=>d.patch({raw:Zi(e),note:L(`configView.sessionObserver.toggleNote`)}).then(ae),setSessionObserverUtilityModel:e=>{let t=N.promise;return d.patch({raw:Qi(e,S),note:L(`configView.sessionObserver.modelNote`),replacePaths:[`agents.defaults.utilityModel.fallbacks`]}).then(async e=>(ae(e),e&&t===N.promise&&await k.refreshStatus(),e))},lobsterPetVisits:E().lobsterPetVisits??p.lobsterPetVisits,sessionDeleteConfirm:E().sessionDeleteConfirm??p.sessionDeleteConfirm,lobsterPetSounds:E().lobsterPetSounds??p.lobsterPetSounds,lobsterdexHref:be(`lobsterdex`,e.basePath),onOpenLobsterdex:()=>e.navigate(`lobsterdex`),serverQueueMode:_n(Kt(f),{configNeedsApply:f.configNeedsApply}),catalogOpenTarget:ne(E().catalogOpenTarget),pluginsHref:be(`plugin-settings`,e.basePath),sessionSourcePlugins:{read:ce,scope:se().value},microphone:{...he.microphone,selectedDeviceId:E().realtimeTalkInputDeviceId??``},composerHoldToRecord:E().composerHoldToRecord!==!1,onMicrophoneRefresh:()=>void P.refresh(`microphone`,!0),onMicrophoneSelect:e=>O.apply({realtimeTalkInputDeviceId:e.trim()||void 0}),camera:{...he.camera,selectedDeviceId:E().realtimeTalkVideoDeviceId??``},onCameraRefresh:()=>void P.refresh(`camera`,!0),onCameraSelect:P.selectCamera,gatewayUrl:e.gateway.connection.gatewayUrl,configPath:f.configSnapshot?.path??null,navRootLabel:n===`advanced`?void 0:fe(n),showSectionDocs:n!==`communications`,showRootTab:!m?.length,includeSections:m,excludeSections:n===`advanced`?kt:void 0,includeVirtualSections:n===`appearance`||n===`notifications`,settingsLayout:n===`advanced`?`accordion`:void 0,nativeNotifications:l?.read(),onNativeNotificationsRequestPermission:()=>e.nativeNotifications?.requestPermission(),onNativeNotificationsSendTest:()=>e.nativeNotifications?.sendTest(),webPush:{...c.read()},onWebPushSubscribe:()=>e.webPush.run({kind:`enable`}),onWebPushUnsubscribe:()=>e.webPush.run({kind:`disable`}),onWebPushTest:()=>e.webPush.run({kind:`test`}),onWebPushSetUserPreferences:t=>e.webPush.run({kind:`set`,scope:`user`,preferences:t}),onWebPushSetDevicePreferences:t=>e.webPush.run({kind:`set`,scope:`device`,preferences:t})}}let He=()=>{Pe(),g()};return Tn(t,e=>je(e.pageId,e.routeData)),Fn(()=>{let t=[e.gateway,e.runtimeConfig,e.settingsAgentSelection,e.agentSelection,e.overlays].map(e=>e.subscribe(He));t.push(e.theme.subscribe(He));let n=e.router.getState().location;return t.push(e.router.subscribe(()=>{let t=e.router.getState().location;we(t,n)||(n=t,pe())})),C=!0,Me(),t.push(re(window,at,Me),re(document,`visibilitychange`,Pe),re(window,`focus`,Pe)),t.push(P.observe(e.router)),Pe(),()=>{N.resolve(),t.forEach(e=>e()),C=!1,j.retireImport(),P.retire(),xe.stop(),Ne(),Ee!==null&&(cancelAnimationFrame(Ee),Ee=null),M=null,Be()}}),{admittedRoute:S,application(){return u(),e},configProps:V(Ve),configObject:V(Oe),nowMs:De,mutationDisabled:ke,updateBusy:Ae,updates:me}}var da;function fa(){return(fa=e((()=>{W(),f(),ye(),_(),de(),vt(),Br(),nr(),$n(),m(),gn(),Xr(),ci(),Wt(),ri(),I(),Tt(),Bt(),Di(),ki(),Li(),Fe(),Pe(),zi(),Ji(),Xi(),vi(),Ve(),$i(),ta(),la(),gi(),nn(Qn),da=new Map})))()}function pa(e){return e===`__appearance__`?Promise.resolve():e===`__notifications__`?ga.preload():Promise.all([ha.preload(),...e===null?[_a.preload()]:[]])}var ma,ha,ga,_a;function va(){return(va=e((()=>{W(),r(),ma=An(()=>S(()=>import(`./highlighted-json-D6aXHzzz.js`),__vite__mapDeps([0,1,2]),import.meta.url),{export:`HighlightedJson`}),ha=An(()=>S(()=>import(`./config-form.render-B4Hi0ZGk.js`).then(e=>(e.r(),e.n)),__vite__mapDeps([3,4,5,6,7,8,9,10,11,12,1,2,13]),import.meta.url),{export:`ConfigForm`}),ga=An(()=>S(()=>import(`./notifications-section-DwXJlFdV.js`),__vite__mapDeps([14,15,1,2,13]),import.meta.url),{export:`NotificationsSection`}),_a=An(()=>S(()=>import(`./setup-DhQ7-n5U.js`),__vite__mapDeps([6,3,7,8,9,10,5,11,12,16,1,2,13]),import.meta.url),{export:`SetupSection`})})))()}function ya(e){return J(H,{get when(){return e.embedded},get fallback(){var t=wa(),n=t.firstChild.nextSibling;return G(n,()=>e.message),t},get children(){return J(_r,{get children(){return J(vr,{get title(){return e.title},get children(){return J(Sr,{rows:2})}})}})}})}function ba(e){return e instanceof Ea&&e.denied}function xa(e){var t=Ta();return G(t,J(Mt,{tone:`danger`,role:`alert`,get children(){return[K(()=>e.message),` `,K(()=>K(()=>!!e.onRetry)()?J(br,{type:`button`,onRetry:()=>e.onRetry?.()}):null)]}})),t}function Sa(e){let t=V(()=>e.config.configRead??void 0),n=()=>{if(!e.config.configLoaded&&!e.config.configRecoveryError){let e=t();if(e?.ok===!1)throw new Ea(e.error,e.denied)}return!0};return J(H,{get when(){return e.displayReady||e.config.configReadAccess!==`denied`},get fallback(){return J(gr,{get message(){return L(`configView.readRestricted`)}})},get children(){return J(H,{get when(){return e.displayReady||e.config.connected||e.config.configLoaded},get fallback(){return J(gr,{get message(){return L(`configView.readDisconnected`)}})},get children(){return J(H,{get when(){return e.displayReady},get fallback(){return J(Z,{get on(){return K(()=>!e.config.configLoaded)()?e.config.configRead:void 0},get fallback(){return e.fallback??J(ya,{get message(){return L(`common.loading`)}})},get children(){return J(U,{fallback:(t,n)=>J(xa,{get message(){return ze(t())},get onRetry(){return ba(t())?void 0:()=>{e.config.onRetryConfig(),n()}}}),get children(){return K(()=>!!n())()?e.children:null}})}})},get children(){return e.children}})}})}})}function Ca(e){let t=()=>J(Sr,{rows:2});return J(Sa,{get config(){return e.config},get fallback(){return t()},get children(){return K(()=>!(e.config.configLoaded||!e.config.loading||e.config.configRead))()?t():null}})}var wa,Ta,Ea;function Da(){return(Da=e((()=>{X(),W(),Rt(),wr(),Ae(),I(),wa=Q(`<div class=config-loading aria-busy=true><span class="btn__spinner config-loading__spinner"aria-hidden=true></span><span>`),Ta=Q(`<div class=config-content-callout>`),Ea=class extends Error{constructor(e,t=!1){super(e),this.denied=t}}})))()}async function Oa(e){let t=await Be(e,`Image could not be read`);return t.slice(t.indexOf(`,`)+1)}function ka(e,t,n,r){let[i,a]=yn(0,{ownedWrite:!0}),o=()=>a(e=>e+1),[s,c]=yn(null),u=!1,d=null,f=null,p,m=[],h,g,_=()=>u&&t().isConnected,y=()=>ie!==null,b=()=>O!==null,x=()=>(i(),b()?ce():void 0);async function S(){p?.abort(),h?.retire(),h=void 0;let e=ae(),t=ne;if(!e){f=null;return}let n=new AbortController;p=n;let r=Promise.withResolvers();h={completion:r.promise,retire:()=>r.resolve(void 0)};try{let r=await e.client.request(`users.background.get`,{},{signal:n.signal});if(!oe(e)||n.signal.aborted)return;f=r.status===`ok`?{...e,revision:t,snapshot:r}:null,M(),o()}catch(t){oe(e)&&!n.signal.aborted&&r.resolve({error:t})}finally{r.resolve(void 0)}}let ee,C=null,w=null,E=!1,O=null,ne=0,ie=null,k=null,A=null;function ae(){let t=e.gateway.snapshot;return t.phase===`connected`&&t.client&&t.selfUser?.id&&te(t.hello?.auth??null)?{client:t.client,profileId:t.selfUser.id}:null}function oe(e){let t=ae();return _()&&t?.client===e.client&&t.profileId===e.profileId}function se(){let e=f;return e&&e.revision===ne&&oe(e)?e.snapshot:null}function ce(){return e.theme.settings.background??l}function le(){return Ai(`background`,e.gateway.connection.gatewayUrl,ae()?.profileId)}function ue(){return!!(ae()&&Gn(e,`background`)===!0)}function j(){A?.retire(),A?.controller.abort(),A=null,g=void 0,d&&URL.revokeObjectURL(d),d=null,o()}function de(){let t=se()?.asset?.assetId,n=t?Kr(e,t):null;A&&A.identity!==n&&j()}function M(){if(!_())return;let t=ae(),n=ce().source,r=[t?.client??null,t?.profileId??null,ne,n.kind===`custom`?n.assetId:null];(r.some((e,t)=>e!==m[t])||r.length!==m.length)&&(m=r,S()),pe(),de();let i=e,a=se()?.asset?.assetId,s=a?Kr(i,a):null;if(!a||!s||A)return;let c=Promise.withResolvers(),l=()=>c.resolve(void 0),u={identity:s,controller:new AbortController,retire:l};A=u,g={completion:c.promise,retire:l},Gr(i,a,{signal:u.controller.signal,isCurrent:()=>_()&&A===u&&se()?.asset?.assetId===a}).then(e=>{!_()||A!==u?URL.revokeObjectURL(e):(d=e,o())}).catch(()=>{A===u&&!u.controller.signal.aborted&&c.resolve({error:Error(L(`configView.appearance.background.unavailable`))})}).finally(()=>c.resolve(void 0))}function N(){h?.retire(),g?.retire(),h=void 0,g=void 0}function fe(){ie?.retire(),ie=null,k=null,N(),o(),c(null)}function pe(){let t=O,n=e;t&&(t.client!==n.gateway.snapshot.client||t.phase!==n.gateway.snapshot.phase||t.profileId!==n.gateway.snapshot.selfUser?.id||t.gatewayUrl!==n.gateway.connection.gatewayUrl||ce().source.kind===`none`)&&P()}function me(){ee!==void 0&&(clearTimeout(ee),ee=void 0)}let P=()=>{me();let e=C;C=null,E||=e!==null,w?.disconnect(),w=null,O?.canvas.removeAttribute(`data-background-preview`),O=null,o(),t().removeAttribute(`data-background-preview`);for(let e of[`top`,`left`,`width`,`height`])t().style.removeProperty(`--settings-background-preview-${e}`);n().presented=!1};function he(){let r=e;if(!_()||y()||E||ce().source.kind===`none`)return;let i=t().closest(`.content`);if(i){if(!b()){let e=i.getBoundingClientRect(),n=i.clientWidth,r=i.clientHeight;t().style.setProperty(`--settings-background-preview-top`,`${e.top}px`),t().style.setProperty(`--settings-background-preview-left`,`${e.left+i.clientLeft}px`),t().style.setProperty(`--settings-background-preview-width`,`${n}px`),t().style.setProperty(`--settings-background-preview-height`,`${r}px`),w=new ResizeObserver(()=>{(i.clientWidth!==n||i.clientHeight!==r)&&P()}),w.observe(i)}me(),O={canvas:i,client:r.gateway.snapshot.client,phase:r.gateway.snapshot.phase,profileId:r.gateway.snapshot.selfUser?.id,gatewayUrl:r.gateway.connection.gatewayUrl},n().presented=!0,o(),i.setAttribute(`data-background-preview`,``),t().setAttribute(`data-background-preview`,``),C===null&&(ee=setTimeout(P,1200))}}let ge=e=>{e.button===0&&e.isPrimary&&(e.currentTarget.disabled||(E=!1,C=e.pointerId,he()))},_e=e=>{E=!1,C===e.pointerId&&(C=null,b()&&he())},ve=e=>{e.key===`Escape`&&P()},ye=e=>{[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`PageUp`,`PageDown`].includes(e.key)&&(E=!1,he())};function be(e){y()||(N(),T({background:{...ce(),...e}}),k=null,c(null))}let xe=()=>r()?.click();function Se(t){let n=se()?.asset;t===`custom`?n?be(v({kind:t,assetId:n.assetId},e.theme.settings.background)):xe():be(v({kind:t},e.theme.settings.background))}function Ce(e){let t=ae();if(!t||!ue()||y()||le().status!==`saved`)return;if(k=null,e&&(!e.size||e.size>8388608||e.type!==``&&![`image/jpeg`,`image/png`,`image/webp`].includes(e.type))){c({kind:`error`,text:L(`configView.appearance.background.invalidFile`)});return}N(),P();let n,r=new Promise(e=>{n=()=>e(null)}),i={...t,retire:n};ie=i,c(null);let a=Promise.race([we(i,e),r]);return k={kind:e?`uploading`:`removing`,completion:a},a.catch(()=>void 0),o(),a}async function we(t,n){let r=()=>oe(t)&&ie===t;try{let i=n?await Oa(n):void 0;if(!r())return null;let a=await t.client.request(`users.background.get`,{});if(!r())return null;if(a.status!==`ok`)throw Error(L(`configView.appearance.background.profileRequired`));let o={expectedAssetId:a.asset?.assetId??null,expectedPreference:a.preference},s=await t.client.request(n?`users.background.upload`:`users.background.remove`,n?{...o,imageBase64:i}:o);if(!r())return null;if(s.status!==`ok`)throw Error(L(s.status===`conflict`?`configView.appearance.background.conflict`:`configView.appearance.background.profileRequired`));return ji({client:t.client,profileId:t.profileId,scope:e.gateway.connection.gatewayUrl,preference:s.preference,expectedPreference:a.preference,isCurrent:r}),f={...t,revision:ne,snapshot:s},e.theme.refresh(),null}catch(e){if(r())throw e;return null}finally{r()&&(o(),ie=null)}}function Te(){i();let t=ae(),n=le(),r=s()??(n.status===`error`&&ue()?{kind:`error`,text:n.error??L(`configView.appearance.background.saveFailed`)}:n.status===`pending`?{kind:`status`,text:L(`common.saving`)}:null);return{preference:ce(),imageUrl:d,hasImage:!!se()?.asset,mutation:k,uploadAllowed:ue()&&n.status===`saved`,scopeHint:e.gateway.snapshot.selfUser?.id?ue()?L(`configView.appearance.background.private`):L(`configView.appearance.background.readOnly`):L(`configView.appearance.background.browserOnly`),message:r,onSource:e=>Se(e),onChange:e=>be(e),onChooseImage:xe,onRemoveImage:()=>Ce(),onFile:e=>Ce(e),onPreviewStart:ge,onPreviewInput:()=>he(),onPreviewEnd:_e,onPreviewKey:ye,onPreviewCancel:P,onRetry:!s()&&n.status===`error`&&ue()?()=>{Mi(`background`,e.gateway.connection.gatewayUrl,t?.profileId),o()}:void 0}}return Fn(()=>{u=!0;let n=t().ownerDocument.defaultView??window,r=t().ownerDocument,i=[e.theme.subscribe(()=>{pe(),M(),o()}),e.gateway.subscribe(()=>{(ie&&!oe(ie)||f&&!oe(f))&&(f=null,fe()),de(),pe(),M(),o()}),e.gateway.subscribeEvents(e=>{if(e.event!==`users.prefs.changed`||!_()||!ae())return;let t=D(e.payload)?.keys;(!Array.isArray(t)||t.includes(`ui.background`))&&(ne+=1,j(),M(),o())}),Lt(o),e.router.subscribe(P),re(n,`blur`,P),re(n,`resize`,P),re(r,`keydown`,{handleEvent:ve},!0),re(r,`visibilitychange`,()=>{r.visibilityState===`hidden`&&P()}),re(r,`pointerup`,{handleEvent:_e},!0),re(r,`pointercancel`,P,!0)];return M(),o(),()=>{u=!1;for(let e of i)e();p?.abort(),P(),fe(),j()}}),{viewProps:V(Te),metadataRead:V(()=>(i(),h)),thumbnailRead:V(()=>(i(),g)),previewPreference:x,previewPresented:()=>(i(),b())}}function Aa(){return(Aa=e((()=>{W(),i(),_(),Fi(),Wn(),un(),de(),Wr(),$n(),dt(),I(),nn(Qn)})))()}function ja(e){let t=V(()=>e.preference),n=V(()=>e.busy||t().source.kind===`none`),r=()=>t().presentation??`faded`,i=V(()=>Math.round(t().visibility*100)),a=()=>t().source.kind===`none`?`noneHint`:!t().showOnNewSession&&!t().showInSessions?`placementOffHint`:t().visibility===0?`visibilityZeroHint`:void 0;var o=Ma(),s=o.firstChild,c=s.firstChild,l=s.nextSibling,u=l.firstChild,d=u.nextSibling,f=d.nextSibling,p=f.nextSibling,m=l.nextSibling,h=m.nextSibling,g=h.firstChild,_=g.nextSibling,v=h.nextSibling;return G(c,()=>L(`configView.appearance.background.title`)),G(l,J($,{get title(){return L(`configView.appearance.background.source`)},get description(){return L(`configView.appearance.background.formats`)},stacked:!0,get control(){var n=Na(),r=n.firstChild,i=r.nextSibling,a=i.firstChild;return G(r,J(B,{each:[`none`,`theme`,`custom`],children:n=>(()=>{var r=Pa(),i=r.firstChild,a=i.firstChild,o=a.nextSibling,s=i.nextSibling;return r._$$click=()=>e.onSource(n),q(r,`data-background-source`,n),G(i,(()=>{var t=K(()=>!!(n===`custom`&&e.imageUrl));return()=>t()?(()=>{var t=Fa();return Y(()=>e.imageUrl,e=>{q(t,`src`,e)}),t})():n===`custom`?J(z,{name:`image`}):void 0})(),a),G(i,(()=>{var e=K(()=>t().source.kind===n);return()=>e()?(()=>{var e=Ia();return G(e,J(z,{name:`check`})),e})():void 0})(),o),G(s,()=>L(`configView.appearance.background.${n===`none`?`none`:`${n}Choice`}`)),Y(()=>({e:[`settings-background-option`,`settings-background-option--${n}`],t:L(`configView.appearance.background.${n}`),a:t().source.kind===n?`true`:`false`,o:e.busy||n===`custom`&&!e.hasImage&&!e.uploadAllowed}),({e,t,a:n,o:i},a)=>{Ln(r,e,a?.e),t!==a?.t&&q(r,`aria-label`,t),n!==a?.a&&q(r,`aria-pressed`,n),i!==a?.o&&q(r,`disabled`,i)}),r})()})),a._$$click=()=>e.onChooseImage(),G(a,()=>L(e.hasImage?`configView.appearance.background.replace`:`configView.appearance.background.choose`)),G(i,(()=>{var t=K(()=>!!e.hasImage);return()=>t()?(()=>{var t=La();return t._$$click=()=>e.onRemoveImage(),G(t,()=>L(`configView.appearance.background.remove`)),Y(()=>e.busy||!e.uploadAllowed,e=>{q(t,`disabled`,e)}),t})():void 0})(),null),Y(()=>({e:L(`configView.appearance.background.source`),t:e.busy||!e.uploadAllowed}),({e,t},n)=>{e!==n?.e&&q(r,`aria-label`,e),t!==n?.t&&q(a,`disabled`,t)}),n}}),u),G(l,J($,{get title(){return L(`configView.appearance.background.presentation`)},get description(){return L(`configView.appearance.background.${r()}Hint`)},stackedOnNarrow:!0,get control(){return J(Cr,{mode:`buttons`,get value(){return r()},get disabled(){return n()},get ariaLabel(){return L(`configView.appearance.background.presentation`)},get options(){return[`faded`,`full-bleed`].map(e=>({value:e,label:L(`configView.appearance.background.${e}`),testId:`background-presentation-${e}`}))},onChange:t=>e.onChange({presentation:t})})}}),d),G(l,J($,{get title(){return L(`configView.appearance.background.visibility`)},get description(){var e=Ra();return G(e,()=>L(`configView.appearance.background.visibilityHint`)),e},stackedOnNarrow:!0,get control(){var t=za(),r=t.firstChild,a=r.nextSibling,o=a.firstChild;return r._$$input=t=>{e.onChange({visibility:Number(t.currentTarget.value)/100}),e.onPreviewInput()},r.addEventListener(`blur`,()=>e.onPreviewCancel()),r._$$keydown=t=>e.onPreviewKey(t),r.addEventListener(`lostpointercapture`,t=>e.onPreviewEnd(t)),r.addEventListener(`pointercancel`,()=>e.onPreviewCancel()),r._$$pointerup=t=>e.onPreviewEnd(t),r._$$pointerdown=t=>e.onPreviewStart(t),G(a,i,o),Y(()=>({e:`${i()}%`,t:L(`configView.appearance.background.visibility`),a:`${i()}%`,o:String(i()),i:n()}),({e,t:n,a:i,o:a,i:o},s)=>{e!==s?.e&&Bn(t,`--settings-range-fill`,e),n!==s?.t&&q(r,`aria-label`,n),i!==s?.a&&q(r,`aria-valuetext`,i),r.value=a??``,o!==s?.i&&q(r,`disabled`,o)}),t}}),f),G(l,J(B,{each:[[`showOnNewSession`,`newSession`],[`showInSessions`,`sessions`]],children:([r,i])=>J(Tr,{get title(){return L(`configView.appearance.background.${i}`)},get checked(){return t()[r]},get disabled(){return n()},onChange:t=>e.onChange({[r]:t})})}),p),m.addEventListener(`change`,t=>{let n=t.currentTarget,r=n.files?.[0];n.value=``,r&&e.onFile(r)}),In(()=>t=>e.fileRef?.(t),m),G(h,(()=>{var e=K(()=>!!a());return()=>e()?[K(()=>L(`configView.appearance.background.${a()}`)),` `]:void 0})(),g),G(h,()=>e.scopeHint,_),G(v,()=>e.status??(e.message?(()=>{var t=Ba(),n=t.firstChild,r=n.nextSibling;return G(t,()=>e.message.text,n),G(t,(()=>{var t=K(()=>!!e.onRetry);return()=>t()?(()=>{var t=Va();return t._$$click=()=>e.onRetry?.(),G(t,()=>L(`common.retry`)),t})():void 0})(),r),Y(()=>({e:e.message.kind===`error`?`alert`:`status`,t:e.message.kind===`error`,a:e.message.kind!==`error`}),({e,t:n,a:r},i)=>{e!==i?.e&&q(t,`role`,e),n!==i?.t&&t.classList.toggle(`settings-status--danger`,n),r!==i?.a&&t.classList.toggle(`settings-status--muted`,r)}),t})():void 0)),Y(()=>F.background,e=>{q(o,`id`,e)}),o}var Ma,Na,Pa,Fa,Ia,La,Ra,za,Ba,Va;function Ha(){return(Ha=e((()=>{X(),W(),$t(),wr(),I(),Ve(),Ma=Q(`<section class=settings-section><div class=settings-section__header><h2 class=settings-section__heading></h2></div><div class=settings-group><!><!><!><!></div><input type=file data-background-file hidden accept=image/jpeg,image/png,image/webp><p class="settings-section__desc settings-section__scope settings-background-note"><!><!></p><div class=settings-background-status>`),Na=Q(`<div class=settings-background-artwork><div class=settings-background-options role=group></div><div class=settings-background-actions><button type=button class="btn btn--sm"data-background-upload>`),Pa=Q(`<button type=button><span class=settings-background-option__sample aria-hidden=true><!><!></span><span class=settings-background-option__label>`),Fa=Q(`<img alt>`),Ia=Q(`<span class=settings-background-option__check>`),La=Q(`<button type=button class="btn btn--sm"data-background-remove>`),Ra=Q(`<span id=settings-background-visibility-hint>`),za=Q(`<div class=settings-background-visibility><input type=range min=0 max=100 step=5 aria-describedby=settings-background-visibility-hint><span class=settings-background-visibility__value aria-hidden=true>%`),Ba=Q(`<p class=settings-status> <!>`),Va=Q(`<button type=button class="btn btn--sm"data-background-retry>`),zn([`click`,`pointerdown`,`pointerup`,`keydown`,`input`])})))()}function Ua(){let e,t=He(),n,r,i=ka(t,()=>e,()=>n,()=>r),[a,o]=Sn(!1,{equals:!1}),s=V(()=>({metadata:i.metadataRead(),thumbnail:i.thumbnailRead()})),c=V(async()=>{let e=await i.metadataRead()?.completion;if(e)throw e.error}),l=V(async()=>{let e=await i.thumbnailRead()?.completion;if(e)throw e.error}),u=Vn(function*(e){o(!0),yield e});function d(e){let t=e?i.viewProps().onFile(e):i.viewProps().onRemoveImage();t&&Fn(()=>{u(t).catch(()=>void 0)})}var f=Wa(),p=f.firstChild,m=p.nextSibling;return In(()=>t=>e=t,f),f._$owner=Dn(),G(f,J(Zt,{class:`settings-background-preview`,"data-background-preview-canvas":!0,ref:e=>{n=e},context:t,surface:`preview`,get presented(){return i.previewPresented()},get preferenceOverride(){return i.previewPreference()}}),p),G(f,J(ja,Cn(()=>i.viewProps(),{get busy(){return a()},onFile:d,onRemoveImage:()=>d(),get status(){return K(()=>!i.viewProps().message)()?J(H,{get when(){return s()},keyed:!0,children:e=>J(U,{fallback:e=>(()=>{var t=Ga();return G(t,()=>ze(e())),t})(),get children(){return[J(Z,{fallback:void 0,get children(){return[K(()=>c()),K(()=>l())]}}),J(H,{get when(){return i.viewProps().mutation},keyed:!0,children:e=>{let t=V(()=>e.completion);return J(U,{fallback:e=>(()=>{var t=Ka(),n=t.firstChild,r=n.nextSibling;return G(n,()=>L(`configView.appearance.background.saveFailed`)),G(r,()=>ze(e())),t})(),get children(){return J(Z,{get fallback(){var t=qa();return G(t,()=>L(`configView.appearance.background.${e.kind}`)),t},get children(){return K(()=>!!t())()?(()=>{var e=qa();return G(e,t),e})():void 0}})}})}})]}})}):void 0},fileRef:e=>{r=e}})),m),f}var Wa,Ga,Ka,qa;function Ja(){return(Ja=e((()=>{X(),W(),cn(),Ae(),$e(),I(),Aa(),Ha(),Wa=Q(`<openclaw-appearance-background><!><!>`,1),Ga=Q(`<p role=alert class="settings-status settings-status--danger">`),Ka=Q(`<div role=alert class="settings-status settings-status--danger"><div></div><div>`),qa=Q(`<p role=status class="settings-status settings-status--muted">`)})))()}function Ya(e){let t=V(()=>e.sessionSourcePlugins?.scope),n=V(()=>e.schemaRead??void 0),r=()=>{if(e.schema)return null;let t=n();if(t?.ok===!1)throw new Ea(t.error,t.denied);return e.schemaLoading?J(Sr,{rows:2}):null},i=()=>e.sessionSourcePlugins?.read(),a=()=>{let t=na(e.schema);return pr.filter(e=>i()?.has(e.pluginId)).map(e=>Object.assign({},e,{enabledSchema:bi(t,e.pluginId)?.properties?.[e.key]?.properties?.enabled}))},o=()=>!e.connected||!e.configLoaded||!e.formValue||e.mutationAllowed===!1||e.loading||e.schemaLoading||e.saving||e.applying||e.updating||e.rawDraftPending===!0;var s=Xa(),c=s.firstChild,l=c.firstChild;return s._$$focusin=()=>e.onAppearanceDataNeeded?.(),In(()=>t=>e.sectionRef?.(t),s),G(l,()=>L(`configView.sessionSources.title`)),G(c,(()=>{var t=K(()=>!!(e.pluginsHref&&e.configReadAccess!==`denied`));return()=>t()?(()=>{var t=Za(),n=Dn();return G(t,()=>L(`configView.sessionSources.managePlugins`)),Y(()=>e.pluginsHref,e=>{q(t,`href`,e),Nn(t,n)}),t})():null})(),null),G(s,J(H,{get when(){return e.appearanceDataRequested!==!1||e.configReadAccess===`denied`},get children(){return J(Sa,{config:e,get displayReady(){return K(()=>e.configReadAccess!==`denied`)()&&(e.configLoaded||e.loading)},get fallback(){return J(Sr,{rows:2})},get children(){return J(U,{fallback:e=>(()=>{var e=Qa();return G(e,()=>L(`configView.sessionSources.unavailable`)),e})(),get children(){return J(Z,{get on(){return t()},get fallback(){return J(Sr,{rows:2})},get children(){return[J(U,{fallback:(t,n)=>J(xa,{get message(){return ze(t())},get onRetry(){return ba(t())?void 0:()=>{e.onRetrySchema?.(),n()}}}),get children(){return K(()=>!!e.configLoaded)()?r():null}}),K(()=>K(()=>!!a().length)()?[(()=>{var e=Qa();return G(e,()=>L(`configView.sessionSources.hint`)),e})(),(()=>{var t=$a();return G(t,J(B,{get each(){return a()},keyed:e=>e.pluginId,children:t=>{let n=()=>D(D(yi(e.formValue,t().pluginId).config)?.[t().key])?.enabled;return J(H,{get when(){return!e.configLoaded||e.schemaLoading||typeof n()==`boolean`||t().enabledSchema},get fallback(){return J($,{get title(){return L(t().labelKey)},get description(){return L(`configView.sessionSources.unavailable`)}})},get children(){return J(Tr,{get icon(){return J(fr,{get provider(){return t().icon},class:`session-source__icon`})},get title(){return L(t().labelKey)},get description(){return K(()=>!!t().enabledSchema)()?L(`configView.sessionSources.sourceHint`,{plugin:t().plugin}):L(e.schemaLoading?`common.loading`:`configView.sessionSources.unavailable`)},get pending(){return!e.configLoaded||typeof n()!=`boolean`&&!t().enabledSchema},get checked(){return K(()=>typeof n()==`boolean`)()?n()===!0:t().enabledSchema?.default===!0},get disabled(){return o()||!t().enabledSchema},onChange:n=>e.onFormPatch([`plugins`,`entries`,t().pluginId,`config`,t().key,`enabled`],n)})}})}})),t})(),(()=>{var e=eo();return G(e,()=>L(`configView.sessionSources.scope`)),e})()]:(()=>{var e=Qa();return G(e,()=>L(i()?`configView.sessionSources.empty`:`configView.sessionSources.unavailable`)),e})())]}})}})}})}}),null),Y(()=>F.sessionSources,e=>{q(s,`id`,e)}),s}var Xa,Za,Qa,$a,eo;function to(){return(to=e((()=>{X(),W(),wr(),Ae(),I(),dr(),xi(),Ve(),mr(),Da(),la(),Xa=Q(`<section class=settings-section><div class=settings-section__header><h2 class=settings-section__heading>`),Za=Q(`<a class="btn btn--sm">`),Qa=Q(`<p class=settings-section__desc>`),$a=Q(`<div class=settings-group>`),eo=Q(`<p class="settings-section__desc settings-section__scope">`),zn([`focusin`])})))()}function no(e){return J(Tr,{get title(){return e.title},get description(){return[K(()=>e.hint),K(()=>e.extraDescription)]},get checked(){return e.config[e.setting]},onChange:t=>e.config.onAppearanceChange({[e.setting]:t}),onAct:t=>e.onAct?.(t),get disabled(){return e.disabled}})}function ro(){return(ro=e((()=>{X(),wr(),er(),I(),nn(tr)})))()}function io(e){if(!e)return L(`configView.sessionObserver.modelNotLoaded`);if(e.status===`unavailable`)return L(`configView.sessionObserver.modelUnavailable`);if(e.status===`disabled`)return L(`configView.sessionObserver.modelDisabled`);let t=ai(e.runtime)?.label;return L(e.status===`auto`?`configView.sessionObserver.modelAuto`:`configView.sessionObserver.modelConfigured`,{model:t?`${e.model} · ${t}`:e.model})}function ao(e){return hr(e.filter(e=>e.available!==!1).map(e=>({value:e.id.startsWith(`${e.provider}/`)?e.id:`${e.provider}/${e.id}`,label:e.name||e.id,provider:e.provider})),e=>e.value).toSorted((e,t)=>e.label.localeCompare(t.label))}function oo(e){let t=V(()=>({retired:e.config.presentationRetired()}),{equals:(e,t)=>e.retired===t.retired}),n=V(()=>e.config.sessionObserverModelsScope),r=V(()=>{let{retired:n}=t(),[r,i]=wn(()=>({enabled:e.config.sessionObserverEnabled!==!1,model:e.config.sessionObserverUtilityModel,resolved:e.config.sessionObserverResolvedModel})),[a,o]=Sn(null);return{retired:n,values:r,setValues:i,saving:a,setSaving:o}}),[i,a]=yn(null),o=V(async()=>(await i(),null)),s=t=>t.retired===e.config.presentationRetired(),c=Vn(function*(e,t,n,r){try{s(e)&&(e.setSaving(`enabled`in r?`enabled`:`model`),e.setValues(e=>{`enabled`in r?e.enabled=r.enabled:e.model=r.model.kind===`auto`?void 0:r.model.kind===`disabled`?``:r.model.model}),`model`in r&&vn(e.values,`resolved`)),yield Promise.race([t,n]),s(e)&&(yield Mn(e.values))}catch(t){if(s(e))throw t}});function l(t){if(e.config.sessionObserverDisabled)return;let n=r(),i=e.config.presentationRetired(),o=`enabled`in t?e.config.setSessionObserverEnabled?.(t.enabled):e.config.setSessionObserverUtilityModel?.(t.model);o&&a(Promise.resolve().then(()=>c(n,o,i,t)))}let u=()=>J(Z,{get children(){return io(bn(()=>r().values.resolved))}}),d=()=>!e.config.configLoaded,f=()=>!e.config.configLoaded||e.config.loading||r().saving()!==null||e.config.sessionObserverDisabled===!0;return J(H,{get when(){return K(()=>e.config.configReadAccess!==`denied`)()&&e.config.appearanceDataRequested!==!1},get children(){return J(Sa,{get config(){return e.config},get displayReady(){return e.config.configLoaded||e.config.loading},get fallback(){return J(Sr,{rows:2})},get children(){return J(H,{get when(){return e.config.configLoaded||e.config.loading},get children(){return[(()=>{var t=co(),i=t.firstChild,a=i.nextSibling;return G(t,J(Tr,{get title(){return L(`configView.sessionObserver.toggle`)},get description(){return L(`configView.sessionObserver.toggleHint`)},get checked(){return r().values.enabled},get pending(){return!e.config.configLoaded},get disabled(){return!e.config.configLoaded||e.config.loading||e.config.sessionObserverDisabled===!0||r().saving()===`model`},get saving(){return r().saving()===`enabled`},onChange:e=>l({enabled:e})}),i),G(t,J(U,{fallback:e=>J(so,{get value(){return r().values.model},get disabled(){return f()},get pending(){return d()},onChange:e=>l({model:e}),models:[],unavailable:!0,get resolved(){return u()}}),get children(){return J(Z,{get on(){return n()},get fallback(){return J(so,{get value(){return r().values.model},get disabled(){return f()},get pending(){return d()},onChange:e=>l({model:e}),models:[],get unavailable(){return e.config.sessionObserverModelsUnavailable===!0},get resolved(){return u()}})},get children(){return J(so,{get value(){return r().values.model},get disabled(){return f()},get pending(){return d()},onChange:e=>l({model:e}),get models(){return e.config.sessionObserverModels??[]},get unavailable(){return e.config.sessionObserverModelsUnavailable===!0},get resolved(){return u()}})}})}}),a),t})(),(()=>{var e=lo();return G(e,()=>L(r().saving()?`common.saving`:`configView.sessionObserver.scope`)),Y(()=>r().saving()?`status`:void 0,t=>{q(e,`role`,t)}),e})(),J(H,{get when(){return!r().saving()},get children(){return J(U,{fallback:e=>(()=>{var t=uo();return G(t,()=>ze(e())),t})(),get children(){return J(Z,{get children(){return o()}})}})}})]}})}})}})}function so(e){let t=()=>e.value===void 0?mo:e.value,n=V(()=>{let n=ao(e.models);return[{value:mo,label:L(`configView.sessionObserver.auto`)},{value:``,label:L(`configView.sessionObserver.disabled`)},...t()!==mo&&t()!==``&&!n.some(e=>e.value===t())?[{value:t(),label:t(),disabled:e.unavailable}]:[],...n.map(t=>Object.assign({},t,{disabled:e.unavailable}))]});return J($,{get title(){return L(`configView.sessionObserver.modelPicker`)},get description(){return[(()=>{var t=fo();return G(t,()=>L(e.unavailable?`configView.sessionObserver.modelCatalogUnavailable`:`configView.sessionObserver.modelPickerHint`)),t})(),po(),K(()=>e.resolved)]},get controlPending(){return e.pending},get control(){return J(Qr,{get label(){return L(`configView.sessionObserver.modelPicker`)},get value(){return t()},get options(){return n()},get disabled(){return e.disabled},onChange:t=>e.onChange(t===mo?{kind:`auto`}:t===``?{kind:`disabled`}:{kind:`model`,model:t})})}})}var co,lo,uo,fo,po,mo;function ho(){return(ho=e((()=>{X(),W(),Zr(),wr(),Ae(),ii(),I(),Da(),co=Q(`<div class=settings-group><!><!>`),lo=Q(`<p class="settings-section__desc settings-section__scope">`),uo=Q(`<p role=alert>`),fo=Q(`<span>`),po=Q(`<br>`),mo=`__openclaw_observer_auto__`})))()}function go(e){let t=V(()=>Jn.find(t=>t.id===e.theme)??e.themeCatalog?.themes.find(t=>t.id===e.theme)),n=V(()=>Pt(t())),r=V(()=>n().mascot===`none`?[_o(),K(()=>L(`quickSettings.appearance.lobsterVisitsThemeHidden`,{theme:t()?.source===`builtin`?L(`configView.themes.${t()?.id}.label`):t()?.name??e.theme}))]:void 0),i=Si(),a=()=>i.read(),o=V(()=>ur.filter(e=>a().has(e.id)).length);return J(H,{get when(){return n().lobsterdex},children:t=>{var n=vo(),i=n.firstChild,a=i.firstChild,s=a.nextSibling,c=s.nextSibling;return G(n,J(xr,{get title(){return L(`configView.appearance.tabIcon.lobster`)}}),i),G(i,J(no,{config:e,setting:`lobsterPetVisits`,get title(){return L(`quickSettings.appearance.lobsterVisits`)},get hint(){return L(e.lobsterPetVisits?`quickSettings.appearance.lobsterVisitsOn`:`quickSettings.appearance.lobsterVisitsOff`)},get extraDescription(){return r()}}),a),G(i,J(no,{config:e,setting:`lobsterPetSounds`,get title(){return L(`quickSettings.appearance.lobsterSounds`)},get hint(){return L(e.lobsterPetSounds?`quickSettings.appearance.lobsterSoundsOn`:`quickSettings.appearance.lobsterSoundsOff`)},onAct:e=>{e&&Ur()}}),s),G(i,J(H,{get when(){return e.lobsterdexHref},children:t=>(()=>{var n=yo(),r=n.firstChild,i=r.firstChild,a=i.nextSibling,s=r.nextSibling.firstChild,c=Dn();return n._$$click=t=>Yt(t,()=>e.onOpenLobsterdex?.()),G(i,()=>L(`quickSettings.appearance.lobsterdex`)),G(a,()=>L(`quickSettings.appearance.lobsterdexSeen`,{seen:String(o()),total:String(ur.length)})),G(s,J(z,{name:`chevronRight`})),Y(()=>t(),e=>{q(n,`href`,e),Nn(n,c)}),n})()}),c),n}})}var _o,vo,yo;function bo(){return(bo=e((()=>{X(),W(),ke(),qn(),nr(),$t(),er(),Ci(),I(),ro(),yr(),_o=Q(`<br>`),vo=Q(`<section class=settings-section><div class=settings-group><!><!><!>`),yo=Q(`<a class="settings-row settings-row--nav lobsterdex__open"><span class=settings-row__text><span class=settings-row__title></span><span class=settings-row__desc></span></span><span class=settings-row__control><span class=settings-row__chevron>`),nn(tr),zn([`click`])})))()}function xo(e){let t=e.replace(/-([a-zA-Z])/g,(e,t)=>t.toUpperCase());return L(`languages.${t}`)}function So(e){return L(e===`profile`?`configView.profileSyncedHint`:e===`device-local`?`quickSettings.personal.browserOnly`:e===`pending`?`configView.syncPendingHint`:`configView.syncedHint`)}function Co(e){for(let t of[`pending`,`device-local`,`profile`])if(e.includes(t))return So(t);return So(`synced`)}function wo(e){var t=ko();return G(t,J($,{get title(){return L(`quickSettings.language`)},get control(){return J(fn,{get params(){return{label:L(`quickSettings.language`),value:e.localeOverride??`system`,options:[{value:`system`,label:`${L(`common.system`)} (${xo(e.systemLocale)})`},...Te.map(e=>({value:e,label:xo(e)}))],showOptionTooltips:!1,onChange:t=>e.onLocaleChange(Te.find(e=>e===t))}}})}})),Y(()=>F.language,e=>{q(t,`id`,e)}),t}function To(e){let t=V(()=>e.config[e.kind]),n=V(()=>L(`chat.composer.${e.kind}Input`)),r=()=>e.kind===`microphone`?e.config.onMicrophoneSelect:e.config.onCameraSelect,[i,a]=Sn(()=>t()?.selectedDeviceId.trim()??``),[o,s]=Sn(!1),c=Vn(function*(e,t){a(e),s(!0),yield t?.catch(()=>{})}),l=V(()=>{let n=t()?.devices??[];return[{label:L(e.kind===`microphone`?`chat.composer.systemDefaultMicrophone`:`chat.composer.systemDefaultCamera`),value:``},...n.map(e=>({label:e.label,value:e.deviceId})),...i()&&!n.some(e=>e.deviceId===i())?[{label:L(`chat.composer.${e.kind}Fallback`,{number:String(n.length+1)}),value:i()}]:[]]}),u,d=()=>{let n=t();u!==n&&n?.permissionRequired&&(u=n,(e.kind===`microphone`?e.config.onMicrophoneRefresh:e.config.onCameraRefresh)?.())},f=V(()=>({promise:t()?.discovery,selection:t()?.selection}),{equals:(e,t)=>e.promise===t.promise&&e.selection===t.selection});return J(H,{get when(){return K(()=>!!t())()?r():t()},get children(){return J($,{get title(){return n()},get description(){return J(H,{get when(){return!o()},get children(){return J(H,{get when(){return f()},keyed:!0,children:n=>{let r=V(async()=>{await n.selection;let e=await n.promise;if(e)throw Error(e);return!0});return J(U,{fallback:e=>(()=>{var t=Ao();return G(t,()=>ze(e())),t})(),get children(){return J(Z,{fallback:null,get children(){return K(()=>!!(r()&&t()?.devices.length===0))()?L(e.kind===`microphone`?`chat.composer.noMicrophones`:`chat.composer.noCameras`):r()&&t()?.devices.length===0}})}})}})}})},get control(){var t=jo();return t.addEventListener(`change`,t=>{let n=t.currentTarget.value;e.kind===`camera`?c(n,e.config.onCameraSelect?.(n)):e.config.onMicrophoneSelect?.(n)}),t._$$keydown=e=>{[`Enter`,` `,`ArrowDown`,`ArrowUp`,`F4`].includes(e.key)&&d()},t._$$pointerdown=e=>{e.button===0&&d()},G(t,J(B,{get each(){return l()},keyed:e=>e.value,children:e=>(()=>{var t=Mo();return G(t,()=>e().label),Y(()=>({e:e().value,t:e().value===i()}),({e,t:n},r)=>{t.value=e,t.selected=n}),t})()})),Y(()=>({e:e.kind===`microphone`?``:void 0,t:e.kind===`camera`?``:void 0,a:n(),o:i()}),({e,t:n,a:r,o:i},a)=>{e!==a?.e&&q(t,`data-settings-microphone`,e),n!==a?.t&&q(t,`data-settings-camera`,n),r!==a?.a&&q(t,`aria-label`,r),jn(t,`value`,i)}),t}})}})}function Eo(e){let t=V(()=>e.chatFollowUpMode??`server`),n=V(()=>e.serverQueueMode??L(`chat.followUpModeLoading`)),r=()=>e.chatFollowUpMode?L(`chat.followUpModeOverriding`,{mode:n()}):void 0,i=V(()=>e.chatMessageMaxWidth??``),a=()=>So(e.chatSendShortcutProvenance),o=()=>So(e.chatFollowUpModeProvenance);var s=No(),c=s.firstChild,l=c.firstChild,u=l.nextSibling,f=u.nextSibling,p=f.nextSibling,m=p.nextSibling,g=m.nextSibling,_=g.nextSibling;return G(s,J(xr,{get title(){return L(`configView.chatPrefs.title`)}}),c),G(c,J($,{get title(){return L(`chat.sendShortcut`)},get description(){return[K(()=>L(`chat.sendShortcutHint`)),Po(),K(a)]},stackedOnNarrow:!0,get control(){return J(Cr,{get value(){return e.chatSendShortcut},get ariaLabel(){return L(`chat.sendShortcut`)},get options(){return[{value:`enter`,label:L(`chat.sendShortcutEnter`),testId:`send-shortcut-enter`},{value:`modifier-enter`,label:L(`chat.sendShortcutModifierEnter`),testId:`send-shortcut-modifier-enter`}]},onChange:t=>e.onAppearanceChange({chatSendShortcut:h(t)})})}}),l),G(c,J($,{get title(){return L(`chat.followUpMode`)},get description(){var t=Fo(),n=t.firstChild,i=n.nextSibling,a=i.nextSibling;return G(t,o,n),G(t,r,i),G(t,(()=>{var t=K(()=>!!e.chatFollowUpModeOverridden);return()=>t()?(()=>{var t=Io();return t._$$click=()=>e.resetChatFollowUpMode(),G(t,()=>L(`chat.followUpModeReset`)),t})():void 0})(),a),t},get control(){return J(zr,{"data-settings-follow-up-mode":!0,get"aria-label"(){return L(`chat.followUpMode`)},get value(){return t()},onChange:t=>{let n=t.currentTarget.value;e.onAppearanceChange({chatFollowUpMode:n===`server`?void 0:d(n)})},get options(){return[{value:`server`,label:L(`chat.followUpModeServer`,{mode:n()})},{value:`steer`,label:L(`chat.followUpModeSteer`)},{value:`queue`,label:L(`chat.followUpModeQueue`)}]}})}}),u),G(c,J($,{get title(){return L(`configView.chatPrefs.messageWidth`)},get description(){return L(`configView.chatPrefs.messageWidthHint`)},get control(){var t=Lo();t.addEventListener(`change`,t=>{let n=t.currentTarget,r=ve(n.value);n.value.trim()&&!r?(n.setCustomValidity(L(`configView.chatPrefs.messageWidthInvalid`)),n.reportValidity()):(n.setCustomValidity(``),n.value=r??``,e.onAppearanceChange({chatMessageMaxWidth:r}))});var n=st(i);return(typeof n==`function`||Array.isArray(n))&&In(()=>n,t),Y(()=>L(`configView.chatPrefs.messageWidth`),e=>{q(t,`aria-label`,e)}),t}}),f),G(c,J(no,{config:e,setting:`chatShowTaskProgress`,get title(){return L(`configView.chatPrefs.showTaskProgress`)},get hint(){return L(`configView.chatPrefs.showTaskProgressHint`)}}),p),G(c,J(no,{config:e,setting:`chatCollapseTaskProgress`,get title(){return L(`configView.chatPrefs.collapseTaskProgress`)},get hint(){return L(`configView.chatPrefs.collapseTaskProgressHint`)},get disabled(){return!e.chatShowTaskProgress}}),m),G(c,J($,{get title(){return L(`chat.catalogOpenTarget`)},stackedOnNarrow:!0,get control(){return J(Cr,{get value(){return e.catalogOpenTarget},get ariaLabel(){return L(`chat.catalogOpenTarget`)},get options(){return[{value:`viewer`,label:L(`chat.catalogOpenTargetViewer`)},{value:`terminal`,label:L(`chat.catalogOpenTargetTerminal`)}]},onChange:t=>e.onAppearanceChange({catalogOpenTarget:ne(t)})})}}),g),G(c,J(Tr,{get title(){return L(`configView.chatPrefs.openLinksExternally`)},get description(){return L(`configView.chatPrefs.openLinksExternallyHint`)},get checked(){return e.openLinksExternally},onChange:t=>e.onAppearanceChange({openLinksExternally:t})}),_),Y(()=>F.chat,e=>{q(s,`id`,e)}),s}function Do(e){var t=Ro(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=i.nextSibling;return G(t,J(xr,{get title(){return L(`configView.chatPrefs.devices`)}}),n),G(n,J(To,{config:e,kind:`microphone`}),r),G(n,J(To,{config:e,kind:`camera`}),i),G(n,J(no,{config:e,setting:`composerHoldToRecord`,get title(){return L(`chat.composer.holdToRecordSetting`)},get hint(){return L(`chat.composer.holdToRecordSettingDescription`)}}),a),Y(()=>F.devices,e=>{q(t,`id`,e)}),t}function Oo(e){let t=V(()=>e.hiddenSessionCatalogLabels.scope),n=V(()=>[...e.hiddenSessionCatalogIds].toSorted());var r=zo(),i=r.firstChild,a=i.firstChild,o=a.nextSibling,s=i.nextSibling,c=s.nextSibling;return r._$$focusin=()=>e.onAppearanceDataNeeded?.(),In(()=>t=>e.sectionRef?.(t),r),G(r,J(xr,{get title(){return L(`configView.sidebarPrefs.title`)}}),i),G(i,J(no,{config:e,setting:`sidebarLiveActivity`,get title(){return L(`configView.sidebarPrefs.liveActivity`)},get hint(){return L(`configView.sidebarPrefs.liveActivityHint`)}}),a),G(i,J(no,{config:e,setting:`sessionDeleteConfirm`,get title(){return L(`configView.sidebarPrefs.deleteConfirm`)},get hint(){return L(`configView.sidebarPrefs.deleteConfirmHint`)}}),o),G(r,J(oo,{config:e}),s),G(r,(()=>{var r=K(()=>n().length>0);return()=>r()?[(()=>{var e=Bo(),t=e.firstChild;return G(t,()=>L(`chat.sidebar.hiddenSessionSections`)),e})(),(()=>{var r=Vo();return G(r,J(B,{get each(){return n()},children:n=>J($,{get title(){return J(U,{fallback:e=>n,get children(){return J(Z,{get on(){return t()},fallback:n,get children(){return e.hiddenSessionCatalogLabels.read().get(n)??n}})}})},get control(){var t=Ho();return t._$$click=()=>e.setSessionCatalogHidden(n,!1),G(t,()=>L(`chat.sidebar.showSessionSection`)),t}})})),r})()]:void 0})(),c),Y(()=>F.sidebar,e=>{q(r,`id`,e)}),r}var ko,Ao,jo,Mo,No,Po,Fo,Io,Lo,Ro,zo,Bo,Vo,Ho;function Uo(){return(Uo=e((()=>{X(),W(),E(),lt(),Rr(),wr(),ge(),Xt(),$n(),Ae(),I(),mn(),ro(),Ve(),ho(),yr(),bo(),ko=Q(`<div>`),Ao=Q(`<span role=alert>`),jo=Q(`<select class="settings-select settings-select--media-device">`),Mo=Q(`<option>`),No=Q(`<section class=settings-section><div class=settings-group><!><!><!><!><!><!><!>`),Po=Q(`<br>`),Fo=Q(`<span class=settings-follow-up-status><br> <!>`),Io=Q(`<button type=button class=settings-row__desc-action>`),Lo=Q(`<input class=settings-input data-settings-chat-message-width type=text spellcheck=false placeholder=48rem>`),Ro=Q(`<section class=settings-section><div class=settings-group><!><!><!>`),zo=Q(`<section class=settings-section><div class=settings-group><!><!></div><!><!>`),Bo=Q(`<div class="settings-section__header settings-section__header--subsection"><h3 class=settings-section__heading>`),Vo=Q(`<div class=settings-group>`),Ho=Q(`<button type=button class="btn btn--sm">`),nn(sn),nn(Qn),zn([`pointerdown`,`keydown`,`click`,`focusin`])})))()}function Wo(e){let t=Ut,n=V(()=>Object.entries(C).map(([e,t])=>({value:e,label:e===`system`?L(`configView.appearance.fonts.system`):t.label,description:L(`configView.appearance.fontNotes.${e}`),labelStyle:`font-family: ${t.stack}`}))),r=V(()=>e.terminalFontFamily??``);var i=Go(),a=i.firstChild,o=a.firstChild,s=o.nextSibling,l=s.nextSibling,u=l.firstChild.firstChild,d=u.nextSibling,f=d.nextSibling,p=a.nextSibling;return G(i,J(xr,{get title(){return L(`configView.appearance.languageAndText`)}}),a),G(a,J(wo,e),o),G(o,J($,{get title(){return L(`configView.appearance.textSize`)},get description(){return L(`quickSettings.personal.browserOnly`)},stackedOnNarrow:!0,get control(){return J(Cr,{get value(){return String(e.textScale)},get ariaLabel(){return L(`configView.appearance.textSize`)},get options(){return O.map(e=>({value:String(e),label:`${e}%`,title:L(Yo[e])}))},onChange:t=>e.setTextScale(oe(Number(t)))})}})),G(a,J(B,{each:[`ui`,`chat`],children:t=>{let r=t===`ui`,i=()=>L(`configView.appearance.fonts.${t}`),a=V(()=>b(e.presentedTheme.id)[t]);return J($,{get title(){return i()},stackedOnNarrow:!0,get control(){var o=Ko();return o._$owner=Dn(),Y(()=>({id:`settings-font-${t}`,label:i(),value:(r?e.fontUi:e.fontChat)??`theme`,options:[{value:`theme`,label:L(`configView.appearance.fonts.themeDefault`),description:L(`configView.appearance.fonts.themeFace`,{theme:e.presentedTheme.label,face:a()===`system`?L(`configView.appearance.fonts.system`):C[a()].label}),labelStyle:`font-family: ${C[a()].stack}`},...n()],onOpen:w,onChange:t=>(r?e.setFontUi:e.setFontChat)(c(t))}),e=>{o.params=e}),o}})}}),s),G(a,J($,{get title(){return L(`configView.appearance.fonts.terminal`)},get description(){return[K(()=>L(`configView.appearance.fonts.terminalHint`)),` `,K(()=>L(`configView.appearance.fonts.terminalLigatures`)),` `,K(()=>L(`quickSettings.personal.browserOnly`))]},stackedOnNarrow:!0,get control(){return[(()=>{var t=qo();t.addEventListener(`change`,t=>{let n=t.currentTarget,r=le(n.value);n.value.trim()&&!r?(n.setCustomValidity(L(`configView.appearance.fonts.terminalInvalid`)),n.reportValidity()):(n.setCustomValidity(``),n.value=r??``,e.setTerminalFontFamily(r))}),t._$$input=e=>e.currentTarget.setCustomValidity(``);var n=st(r);return(typeof n==`function`||Array.isArray(n))&&In(()=>n,t),Y(()=>({e:L(`configView.appearance.fonts.terminal`),t:L(`configView.appearance.fonts.terminalDefault`)}),({e,t:n},r)=>{e!==r?.e&&q(t,`aria-label`,e),n!==r?.t&&q(t,`placeholder`,n)}),t})(),(()=>{var t=Jo();return t._$$click=()=>e.setTerminalFontFamily(void 0),G(t,()=>L(`configView.appearance.fonts.terminalReset`)),Y(()=>!e.terminalFontFamily,e=>{q(t,`disabled`,e)}),t})()]}}),l),G(u,()=>L(`configView.appearance.fonts.brandedPreviewCaption`,{brand:t.read().brandName})),G(d,()=>L(`configView.appearance.fonts.previewProse`)),G(f,()=>L(`configView.appearance.fonts.previewCode`)),G(p,()=>Co([e.localeProvenance,e.fontUiProvenance,e.fontChatProvenance])),Y(()=>({e:F.typography,t:F.textSize}),({e,t},n)=>{e!==n?.e&&q(i,`id`,e),t!==n?.t&&q(o,`id`,t)}),i}var Go,Ko,qo,Jo,Yo;function Xo(){return(Xo=e((()=>{X(),W(),de(),k(),De(),wr(),lt(),I(),mn(),on(),Ve(),yr(),Uo(),Go=Q(`<section class=settings-section><div class=settings-group><div></div><!><div class="settings-row settings-row--stacked"><div class=settings-typography-preview><div class=settings-typography-preview__caption></div><p class=settings-typography-preview__prose></p><code class=settings-typography-preview__code></code></div></div></div><p class="settings-section__desc settings-section__scope">`),Ko=Q(`<openclaw-select-picker class="settings-select picker-select"style=width:100%;min-width:min(138px,100%)>`,1),qo=Q(`<input class=settings-input data-settings-terminal-font maxlength=100 spellcheck=false>`),Jo=Q(`<button class="btn btn--sm"type=button>`),Yo={90:`configView.textSizes.small`,100:`configView.textSizes.default`,110:`configView.textSizes.large`,125:`configView.textSizes.xl`,140:`configView.textSizes.xxl`},zn([`input`,`click`])})))()}function Zo(e){let t=Ut;return J(H,{get when(){return t.read().brandIcon===`claw`||t.read().brandIcon===`mark`},get fallback(){var e=rs();return G(e,J(nt,{get branding(){return t.read()},"aria-hidden":`true`})),e},get children(){var t=ns();return Y(()=>e.fallbackUrl,e=>{q(t,`src`,e)}),t}})}function Qo(e){let t=V(()=>({imageUrl:e.imageUrl,pending:!1})),n=Ye(t);return J(H,{get when(){return!e.fallbackOnly},get fallback(){return J(Zo,{get fallbackUrl(){return e.fallbackUrl}})},get children(){var r=is(),i=r.firstChild;return G(r,J(H,{get when(){return!!t().imageUrl},get children(){return J(Ue,{get view(){return t()},get onStateChange(){return n.onStateChange},class:`identity-avatar__image`})}}),i),G(i,J(Zo,{get fallbackUrl(){return e.fallbackUrl}})),Y(()=>({e:n.state(),t:Rn([`identity-avatar--agent settings-tab-icon__preview`,n.classes()]),a:e.shape??`square`}),({e,t,a:n},i)=>{e!==i?.e&&q(r,`data-avatar-state`,e),Ln(r,t,i?.t),n!==i?.a&&q(r,`data-avatar-shape`,n)}),r}})}function $o(e){let t=V(()=>lr(e.palette));var n=as();return G(n,J(ir,{get look(){return t()},standalone:!0})),Y(()=>({e:[`lobster-pet settings-tab-icon__lobster`,`lobster-pet--palette-${e.palette.id}`],t:Rn(ar(t()))}),({e,t},r)=>{Ln(n,e,r?.e),Pn(n,t,r?.t)}),n}function es(e){var t=os();return t._$$click=()=>e.onSelect(),G(t,()=>e.children),Y(()=>({e:e.pressed?`true`:`false`,t:e.label,a:e.label}),({e,t:n,a:r},i)=>{e!==i?.e&&q(t,`aria-pressed`,e),n!==i?.t&&q(t,`aria-label`,n),r!==i?.a&&q(t,`title`,r)}),t}function ts(e){let t=V(()=>rt()??pe(`favicon.svg`)),n=()=>e.lobsterdexEnabled!==!1,r=V(()=>n()?e.tabIconLobsters??[]:[]),i=()=>n()&&(e.tabIcon?.startsWith(`lobster:`)??!1),a=V(()=>o(e.tabIcon)),s=V(()=>r().find(t=>e.tabIcon===`lobster:${t.id}`)),c=()=>{let e=s(),t=a();return e?or(e.id):L(t?`configView.appearance.tabIcon.agent`:`configView.appearance.tabIcon.default`)},l=()=>i()&&!s()?L(`configView.appearance.tabIcon.unavailable`):s()?`${c()} · ${L(`configView.appearance.tabIcon.localCollection`)}`:n()&&r().length===0?`${c()} · ${L(`configView.appearance.tabIcon.empty`)}`:c();var u=ss();return G(u,J($,{get title(){return L(`configView.appearance.tabIcon.title`)},get description(){return l()},get stacked(){return r().length>0},stackedOnNarrow:!0,get control(){var n=cs(),i=n.firstChild,o=i.nextSibling,c=o.nextSibling;return G(n,J(es,{get label(){return L(`configView.appearance.tabIcon.default`)},get pressed(){return K(()=>!a())()&&!s()},onSelect:()=>e.setTabIconMode(`default`),get children(){return J(Qo,{imageUrl:null,get fallbackUrl(){return t()}})}}),i),G(n,J(es,{get label(){return L(`configView.appearance.tabIcon.agent`)},get pressed(){return a()!==null},onSelect:()=>e.setTabIconMode(`agent`),get children(){return J(Qo,{get imageUrl(){return e.tabIconAgentAvatar??null},shape:`circle`,get fallbackUrl(){return t()}})}}),o),G(n,J(B,{get each(){return r()},keyed:e=>e.id,children:t=>J(es,{get label(){return or(t().id)},get pressed(){return s()?.id===t().id},onSelect:()=>e.setTabIconMode(`lobster:${t().id}`),get children(){return J($o,{get palette(){return t()}})}})}),c),Y(()=>L(`configView.appearance.tabIcon.title`),e=>{q(n,`aria-label`,e)}),n}})),Y(()=>F.tabIcon,e=>{q(u,`id`,e)}),u}var ns,rs,is,as,os,ss,cs;function ls(){return(ls=e((()=>{X(),W(),hn(),y(),rr(),cr(),sr(),an(),wr(),It(),I(),on(),Ve(),ns=Q(`<img alt>`),rs=Q(`<span style=display:contents>`),is=Q(`<span aria-hidden=true><span class=identity-avatar__fallback>`),as=Q(`<span aria-hidden=true>`),os=Q(`<button type=button class=settings-tab-icon__pick>`),ss=Q(`<div class=settings-tab-icon>`),cs=Q(`<div class=settings-tab-icon__picks role=group><!><!><!>`),zn([`click`])})))()}function us(e){let t=V(()=>{let t=e.palette;return t?{"--theme-chip-bg":`light-dark(${t.light.bg}, ${t.dark.bg})`,"--theme-chip-ink":`light-dark(${t.light.text}, ${t.dark.text})`,"--theme-chip-accent":`light-dark(${t.light.accent}, ${t.dark.accent})`,"--theme-chip-accent-2":`light-dark(${t.light[`accent-2`]}, ${t.dark[`accent-2`]})`}:e.id.includes(`/`)?{"--theme-chip-bg":`var(--bg-hover)`,"--theme-chip-accent":`var(--muted)`,"--theme-chip-accent-2":`var(--muted)`}:void 0});var n=ms(),r=n.firstChild,i=r.nextSibling;return G(n,J(H,{get when(){return e.id!==`custom`||e.activeTheme===e.id},get fallback(){var e=hs();return G(e,J(z,{name:`download`})),e},get children(){return fs()}}),r),G(n,J(H,{get when(){return e.selected},get children(){var e=ps();return G(e,J(z,{name:`check`})),e}}),i),Y(()=>Rn(t()),(e,t)=>{Pn(n,e,t)}),n}function ds(e){let t,n,r;ut(()=>[n,r],t=>{t.some(e=>e.isIntersecting)&&e.onAppearanceDataNeeded?.()},{rootMargin:`400px 0px`});let[i,a]=Sn(!1,{equals:!1}),o=V(()=>e.customThemeImportCompletion),s=Vn(function*(e){a(!0),yield e});function c(){let t=e.onImportCustomTheme();t&&Fn(()=>{s(t).catch(()=>void 0)})}let l=()=>{o();let t=e.customThemeImportMessage;return t?.kind===`error`?t:null},u=0,d=()=>e.hasCustomTheme||e.customThemeImportExpanded===!0;function f(){let e=t;e?.isConnected&&(cancelAnimationFrame(u),u=requestAnimationFrame(()=>{e.isConnected&&(e.scrollIntoView({block:`center`,behavior:tt()}),e.focus(),e.select())}))}Fn(()=>(d()&&f(),()=>cancelAnimationFrame(u)));let m=V(()=>e.hasCustomTheme&&e.customThemeLabel?e.customThemeLabel:L(`configView.appearance.customTheme`)),h=V(()=>[...(e.themeCatalog?.themes.length?e.themeCatalog.themes:Jn).map(e=>({id:e.id,label:e.source===`builtin`?L(`configView.themes.${e.id}.label`):e.name,description:e.source===`builtin`?L(`configView.themes.${e.id}.description`):e.description})),{id:`custom`,label:e.hasCustomTheme?m():L(`configView.appearance.import`),description:e.hasCustomTheme?L(`configView.appearance.importedFrom`,{name:m()}):L(`configView.appearance.importHint`)}]),g=V(()=>h().find(t=>t.id===e.theme)),_=()=>e.themeCatalog?.unavailableId===e.theme||e.theme.includes(`/`)&&!!e.themeCatalog?.themes.length&&!g(),v=V(()=>g()??{id:p.theme,label:L(`configView.themes.claw.label`)}),y=()=>Co([e.themeProvenance,e.themeModeProvenance,e.accentProvenance]),b=()=>e.accent===`theme`,x=V(()=>b()?void 0:e.accent),S=()=>e.accent===e.accentResetValue||b()&&e.accentResetValue===void 0,ee=()=>e.accentResetValue&&e.accentResetValue!==`theme`?e.accentResetValue:`var(--theme-chip-accent)`,C=V(()=>ks.find(t=>t.hex!==void 0&&t.hex===e.accent)),w=()=>!(S()||b()||!e.accent||C()),T=V(()=>{let e=C();return w()?L(`configView.appearance.customAccent`):L(`configView.appearance.accents.${e&&!S()?e.id:`default`}`)});return J(_r,{get children(){return[(()=>{var n=gs(),r=n.firstChild,a=r.nextSibling,o=a.nextSibling,s=o.firstChild,u=s.firstChild,p=s.nextSibling,g=p.nextSibling,b=o.nextSibling;return G(n,J(xr,{get title(){return L(`configView.appearance.theme`)}}),r),G(r,()=>L(`configView.appearance.chooseTheme`)),G(n,(()=>{var t=K(()=>!!_());return()=>t()?(()=>{var t=_s();return G(t,()=>L(`configView.appearance.themeUnavailable`,{id:e.theme})),t})():void 0})(),a),G(n,J(H,{get when(){return e.themeCatalog?.read??e.themeCatalog},keyed:!0,children:t=>{let n=V(()=>`result`in t?t.result:t),r=()=>{let e=n()?.error;if(e)throw e instanceof Error?e:Error(e)};return J(U,{fallback:t=>(()=>{var n=vs(),r=n.firstChild,i=r.nextSibling;return G(n,()=>Hi(t()),r),i._$$click=()=>e.onRetryThemeCatalog?.(),G(i,()=>L(`common.retry`)),n})(),get children(){return J(Z,{fallback:void 0,get children(){return r()}})}})}}),o),G(o,J($,{get title(){return L(`common.colorMode`)},stackedOnNarrow:!0,get control(){return J(Cr,{get value(){return e.themeMode},get options(){return[{value:`system`,label:L(`common.system`)},{value:`light`,label:L(`common.light`)},{value:`dark`,label:L(`common.dark`)}]},get ariaLabel(){return L(`common.colorMode`)},onChange:t=>e.setThemeMode(t),onReselect:t=>{e.themeModeOverridden&&t===e.themeModeResetValue&&e.setThemeMode(t)}})}}),s),G(u,J(B,{get each(){return h()},keyed:e=>e.id,children:t=>(()=>{var n=ys(),r=n.firstChild;return n._$$click=()=>{t().id===`custom`&&!e.hasCustomTheme?(e.onOpenCustomThemeImport?.(),Fn(f)):(t().id!==e.theme||t().id===e.themeResetValue&&e.themeOverridden)&&e.setTheme(t().id)},G(n,J(us,{get id(){return t().id},get activeTheme(){return v().id},get selected(){return t().id===v().id},get palette(){return e.themeCatalog?.palettes?.get(t().id)}}),r),G(r,()=>t().label),Y(()=>({e:[`settings-theme-card`,`settings-theme-card--${t().id.includes(`/`)?`catalog`:t().id}`,{"settings-theme-card--active":t().id===v().id}],t:t().id===`custom`&&!e.hasCustomTheme?void 0:t().id===v().id?`true`:`false`,a:t().description,o:t().id}),({e,t,a:r,o:i},a)=>{Ln(n,e,a?.e),t!==a?.t&&q(n,`aria-pressed`,t),r!==a?.a&&q(n,`title`,r),i!==a?.o&&q(n,`data-theme-id`,i)}),n})()})),G(o,(()=>{var n=K(()=>!!d());return()=>n()?(()=>{var n=bs(),r=n.firstChild,a=r.firstChild,o=a.firstChild,s=o.firstChild,u=s.nextSibling,d=o.nextSibling,f=d.firstChild,p=f.nextSibling,h=a.nextSibling,g=h.firstChild,_=g.nextSibling,v=h.nextSibling,y=v.nextSibling;return r._$$focusin=()=>e.onCustomThemeImportFocus?.(),G(s,()=>L(`configView.appearance.importFromTweakcn`)),G(u,()=>L(`configView.appearance.tweakcnInstructions`)),Nn(d),G(d,()=>L(`configView.appearance.browseTweakcn`),f),G(d,J(z,{name:`externalLink`}),p),G(r,J(Ca,{config:e}),h),g._$$input=t=>e.onCustomThemeImportUrlChange(t.currentTarget.value),In(()=>e=>t=e,g),_._$$click=c,G(_,(()=>{var t=K(()=>!!i());return()=>t()?L(`common.importing`):K(()=>!!e.hasCustomTheme)()?L(`configView.appearance.replace`,{name:m()}):L(`configView.appearance.importTheme`)})()),G(r,(()=>{var t=K(()=>!!e.hasCustomTheme);return()=>t()?(()=>{var t=xs(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=i.nextSibling.nextSibling,o=n.nextSibling;return G(n,()=>L(`configView.appearance.loaded`),r),G(n,m,i),G(n,()=>e.customThemeSourceUrl??`tweakcn`,a),o._$$click=()=>e.onClearCustomTheme(),G(o,()=>L(`configView.appearance.clear`,{name:m()})),t})():void 0})(),v),G(r,J(U,{fallback:e=>(()=>{var t=Ss(),n=t.firstChild,r=n.nextSibling;return G(n,()=>L(`configView.appearance.importFailed`)),G(r,()=>Hi(e())),t})(),get children(){return J(Z,{get children(){return J(H,{get when(){return l()},children:e=>(()=>{var t=Cs();return G(t,()=>e().text),Y(()=>({e:[`settings-theme-import__message`,`settings-theme-import__message--${e().kind}`],t:e().kind===`error`?`alert`:`status`}),({e,t:n},r)=>{Ln(t,e,r?.e),n!==r?.t&&q(t,`role`,n)}),t})()})}})}}),y),Y(()=>({e:L(`configView.appearance.themeLink`),t:e.customThemeImportUrl,a:i()||e.connected&&(!e.configLoaded||e.loading)||e.customThemeImportUrl.trim().length===0}),({e,t,a:n},r)=>{e!==r?.e&&q(g,`aria-label`,e),g.value=t??``,n!==r?.a&&q(_,`disabled`,n)}),n})():void 0})(),p),G(p,J($,{get title(){return L(`configView.appearance.accent`)},get description(){var e=ws();return G(e,T),e},stackedOnNarrow:!0,get control(){var t=Ts(),n=t.firstChild,r=n.firstChild,i=r.nextSibling;return G(t,J(B,{each:ks,children:t=>{let n=t.hex===void 0,r=()=>n?S():!S()&&t.hex===e.accent,i=()=>L(`configView.appearance.accents.${t.id}`),a=()=>n?`settings-accent-theme--${v().id.includes(`/`)?`custom`:v().id}`:``;var o=Es();return o._$$click=()=>e.setAccent(t.hex),G(o,(()=>{var e=K(()=>!(!n||S()));return()=>e()?(()=>{var e=Ds();return G(e,J(z,{name:`rotateCcw`})),e})():K(()=>!!r())()?(()=>{var e=Os();return G(e,J(z,{name:`check`})),e})():void 0})()),Y(()=>({e:Rn([`settings-accent-swatch`,a(),{"settings-accent-swatch--active":r()}]),t:t.hex??ee(),a:t.id,o:i(),i:r()?`true`:`false`,n:i()}),({e,t,a:n,o:r,i,n:a},s)=>{Ln(o,e,s?.e),t!==s?.t&&Bn(o,`--settings-accent-swatch`,t),n!==s?.a&&q(o,`data-accent-preset`,n),r!==s?.o&&q(o,`aria-label`,r),i!==s?.i&&q(o,`aria-pressed`,i),a!==s?.n&&q(o,`title`,a)}),o}}),n),r._$$input=t=>e.setAccent(t.currentTarget.value),G(i,J(z,{name:`pipette`})),Y(()=>({e:!!w(),t:x()??ks[1].hex,a:wt(x()??ks[1].hex),o:L(`configView.appearance.customAccent`),i:L(`configView.appearance.customAccent`),n:x()??ks[1].hex}),({e,t,a:i,o:a,i:o,n:s},c)=>{e!==c?.e&&n.classList.toggle(`settings-accent-swatch--active`,e),t!==c?.t&&Bn(n,`--settings-accent-swatch`,t),i!==c?.a&&Bn(n,`--settings-accent-swatch-ink`,i),a!==c?.o&&q(r,`aria-label`,a),o!==c?.i&&q(r,`title`,o),r.value=s??``}),t}})),G(o,J(ts,e),g),G(b,y),Y(()=>({e:F.theme,t:F.accent}),({e,t},r)=>{e!==r?.e&&q(n,`id`,e),t!==r?.t&&q(p,`id`,t)}),n})(),J(Wo,Cn(e,{get presentedTheme(){return v()}})),J(Ua,{}),J(Eo,e),J(Do,e),J(Oo,Cn(e,{sectionRef:e=>n=e})),J(Ya,Cn(e,{sectionRef:e=>r=e})),J(go,e)]}})}var fs,ps,ms,hs,gs,_s,vs,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds,Os,ks;function As(){return(As=e((()=>{X(),W(),qn(),de(),$t(),wr(),I(),Le(),Ja(),Ji(),Ve(),to(),yr(),Uo(),Xo(),Da(),ls(),fs=Q(`<span class=settings-theme-card__palette><span class=settings-theme-card__line></span><span class="settings-theme-card__line settings-theme-card__line--short"></span><span class=settings-theme-card__chips><span class="settings-theme-card__chip settings-theme-card__chip--accent"></span><span class="settings-theme-card__chip settings-theme-card__chip--accent-2">`),ps=Q(`<span class=settings-theme-card__check>`),ms=Q(`<span class=settings-theme-card__swatch aria-hidden=true><!><!>`),hs=Q(`<span class=settings-theme-card__icon>`),gs=Q(`<section class=settings-section><p class=settings-section__desc></p><!><div class=settings-group><div class="settings-row settings-row--stacked"><div class=settings-theme-grid></div></div><div></div><!></div><p class="settings-section__desc settings-section__scope">`),_s=Q(`<p class=settings-section__desc role=status>`),vs=Q(`<p class="settings-status settings-status--error"role=alert> <button type=button class="btn btn--sm">`),ys=Q(`<button><span class=settings-theme-card__label>`),bs=Q(`<div class="settings-row settings-row--stacked"><div class=settings-theme-import><div class=settings-theme-import__head><div class=settings-row__text><span class=settings-row__title></span><span class=settings-row__desc></span></div><a class="btn btn--sm settings-theme-import__external"href=https://tweakcn.com/editor/theme target=_blank rel="noreferrer noopener"> <!></a></div><div class=settings-theme-import__field><input class="settings-input settings-theme-import__input"data-custom-theme-import-input type=text spellcheck=false placeholder="https://tweakcn.com/editor/theme?theme=... or amethyst-haze"><button class="btn btn--sm primary"></button></div><!><!>`),xs=Q(`<div class=settings-theme-import__meta><span class="settings-row__desc settings-theme-import__meta-value"> · <!> · <!></span><button class="btn btn--sm danger">`),Ss=Q(`<div class="settings-theme-import__message settings-theme-import__message--error"role=alert><div></div><div>`),Cs=Q(`<div>`),ws=Q(`<span id=settings-accent-status>`),Ts=Q(`<div class=settings-accent-swatches><span class="settings-accent-swatch settings-accent-swatch--custom"><input type=color class=settings-accent-swatch__input data-accent-custom aria-describedby=settings-accent-status><span class=settings-accent-swatch__picker aria-hidden=true>`),Es=Q(`<button type=button>`),Ds=Q(`<span class=settings-accent-swatch__reset aria-hidden=true>`),Os=Q(`<span class=settings-accent-swatch__check aria-hidden=true>`),ks=[{id:`default`,hex:void 0},{id:`claw`,hex:`#ff5c5c`},{id:`coral`,hex:`#ff8066`},{id:`amber`,hex:`#f5b942`},{id:`mint`,hex:`#52c99a`},{id:`teal`,hex:`#35b9b0`},{id:`blue`,hex:`#5b9cf6`},{id:`violet`,hex:`#a78bfa`},{id:`pink`,hex:`#f472b6`},{id:`slate`,hex:`#8795a8`}],zn([`click`,`focusin`,`input`])})))()}function js(e){return e.length>0?e.join(`.`):L(`configView.root`)}function Ms(e,t){let n=[],r=0;function i(e,t,r){n.length<Vs&&n.push({path:e,from:t,to:r})}function a(e,t,n){if(e.length!==t.length||e.length>Hs)return!0;for(let r=0;r<e.length;r+=1)if(o(e[r],t[r],null,n+1))return!0;return!1}function o(e,t,s,c){if(r+=1,r>Bs||c>zs)return s===null;if(s!==null&&n.length>=Vs||e===t)return!1;let l=!0;if(typeof e==typeof t&&typeof e==`object`&&e&&t!==null){if(Array.isArray(e)||Array.isArray(t))l=!Array.isArray(e)||!Array.isArray(t)||a(e,t,c+1);else{let n=e,r=t,i=Object.keys(n),a=Object.keys(r);if(s===null)return i.length!==a.length||i.some(e=>!Object.hasOwn(r,e)||o(n[e],r[e],null,c+2));for(let e of new Set([...i,...a]))o(n[e],r[e],[...s,e],c+1);return!1}}return l&&s!==null&&i(s,e,t),l}return o(e,t,[],0),n}function Ns(e,t,n){if(e.rawDiffCache?.original===t&&e.rawDiffCache.current===n)return e.rawDiffCache.diff;if(t.length>Us||n.length>Us)return e.rawDiffCache={original:t,current:n,diff:[]},e.rawDiffCache.diff;try{let r=D(We(t)),i=D(We(n));if(!r||!i)return e.rawDiffCache={original:t,current:n,diff:[]},[];let a=Ms(r,i);return e.rawDiffCache={original:t,current:n,diff:a},a}catch{return gt()&&(e.rawDiffCache={original:t,current:n,diff:[]}),[]}}function Ps(e){if(Array.isArray(e))return L(e.length===1?`configView.itemCount`:`configView.itemCountPlural`,{count:String(e.length)});let t;try{t=JSON.stringify(e)??String(e)}catch{t=String(e)}return t.length<=40?t:Ce(t,37)+`...`}function Fs(e,t){let n=e.split(`.`);return n.length===t.length&&n.every((e,n)=>e===`*`||e===t[n])}function Is(e,t){return Object.entries(t).some(([t,n])=>!!n.sensitive&&Fs(t,e))}function Ls(e,t){for(let n=1;n<=e.length;n+=1){let r=e.slice(0,n),i=js(r);if((kr(r,t)?.sensitive??!1)||Is(r,t)||Mr(i))return!0}return!1}function Rs(e,t,n,r){let i=jr(t,e,n);return!r&&t!=null&&(Ls(e,n)||i)?L(`configForm.redactedPlaceholder`):Ps(t)}var zs,Bs,Vs,Hs,Us;function Ws(){return(Ws=e((()=>{Ir(),Fr(),je(),I(),zs=64,Bs=2e4,Vs=1e3,Hs=2e3,Us=2e5})))()}function Gs(e){return Ks.has(e)}var Ks;function qs(){return(qs=e((()=>{Ks=new Set([`defaults`,`modelByChannel`])})))()}function Js(e,t){let n=Object.entries(e.properties??{}),r=n.filter(([e])=>!Gs(e)).map(([e,n])=>({key:e,label:Ar([`channels`,e],t)?.label??n.title??Or(e),keys:[e]})).toSorted((e,t)=>e.label.localeCompare(t.label)||e.key.localeCompare(t.key)),i=n.filter(([e])=>Gs(e)).map(([e])=>e);return[...r,...i.length>0?[{key:null,label:L(`configView.categories.other`),keys:i}]:[]]}function Ys(e){var t=Xs();return G(t,J(B,{get each(){return e.categories},keyed:e=>e.id,children:t=>{let n=()=>t().sections.some(t=>t.key===e.activeSection),r=()=>`config-accordion-panel-${t().id}`;var i=Zs(),a=i.firstChild,o=a.firstChild,s=o.firstChild,c=o.nextSibling.firstChild,l=a.nextSibling;return a._$$click=r=>{e.onSectionChange(n()?null:t().sections[0]?.key??null),e.resetContentScroll(r.currentTarget)},G(s,()=>t().label),G(c,J(z,{name:`chevronRight`})),G(l,J(B,{get each(){return t().sections},keyed:e=>e.key,children:t=>(()=>{var n=Qs(),r=n.firstChild.firstChild;return n._$$click=n=>{e.onSectionChange(t().key),e.resetContentScroll(n.currentTarget)},G(r,()=>t().label),Y(()=>({e:e.activeSection===t().key,t:e.activeSection===t().key?`true`:void 0}),({e,t},r)=>{e!==r?.e&&n.classList.toggle(`config-accordion-group__item--active`,e),t!==r?.t&&q(n,`aria-current`,t)}),n})()})),Y(()=>({e:n()?`true`:`false`,t:r(),a:r(),o:!n()}),({e,t,a:n,o:r},i)=>{e!==i?.e&&q(a,`aria-expanded`,e),t!==i?.t&&q(a,`aria-controls`,t),n!==i?.a&&q(l,`id`,n),r!==i?.o&&q(l,`hidden`,r)}),i}})),t}var Xs,Zs,Qs,$s,ec;function tc(){return(tc=e((()=>{X(),W(),qs(),Fr(),$t(),I(),Xs=Q(`<div class="settings-group config-accordion-nav">`),Zs=Q(`<div class=config-accordion-group><button type=button class="settings-row settings-row--nav config-accordion-group__header"><span class=settings-row__text><span class=settings-row__title></span></span><span class=settings-row__control><span class=settings-row__chevron></span></span></button><div class=config-accordion-group__items>`),Qs=Q(`<button type=button class="settings-row settings-row--nav config-accordion-group__item"><span class=settings-row__text><span class=settings-row__title>`),$s=[{id:`core`,sections:[`env`,`auth`,`update`,`meta`,`logging`,`diagnostics`,`cli`,`secrets`,`wizard`]},{id:`ai`,sections:[`agents`,`models`,`skills`,`tools`,`memory`,`session`]},{id:`communication`,sections:[`channels`,`messages`,`broadcast`,`__notifications__`,`talk`,`tts`,`transcripts`]},{id:`security`,sections:[`security`,`approvals`]},{id:`automation`,sections:[`commands`,`hooks`,`bindings`,`cron`,`plugins`]},{id:`infrastructure`,sections:[`gateway`,`browser`,`nodeHost`,`discovery`,`acp`,`mcp`]},{id:`appearance`,sections:[`__appearance__`,`ui`]}],ec=new Set($s.flatMap(e=>e.sections)),zn([`click`])})))()}function nc(e,t,n){let r=t&&!n.includes(`__OPENCLAW_REDACTED__`);return`${L(e===1?`configView.secretCount`:`configView.secretCountPlural`,{count:String(e)})} ${L(r?`configView.visible`:`configView.redacted`)}`}function rc(){return(rc=e((()=>{Dr(),I()})))()}function ic(e){let t=()=>J(ya,{get message(){return L(`common.loading`)},get embedded(){return e.embeddedEditor},get title(){return e.sectionTitle}}),n=()=>(()=>{var t=ac();return G(t,()=>JSON.stringify(e.issues,null,2)),t})(),r;function i(){queueMicrotask(()=>{for(let e of[r,r?.closest(`.shell--settings .content`)])typeof e?.scrollTo==`function`?e.scrollTo({top:0,left:0,behavior:`auto`}):e&&(e.scrollTop=0,e.scrollLeft=0)})}let[a,o]=yn(0),s=()=>{o(e=>e+1),e.onViewStateChange()},c=()=>(a(),e.viewState),l=V(()=>na(e.schema)),u=V(()=>e.includeSections),d=V(()=>e.excludeSections),f=V(()=>u()?.length?new Set(u()):null),p=V(()=>d()?.length?new Set(d()):null),m=V(()=>ia(l(),f(),p())),h=V(()=>e.activeSection),g=V(()=>e.activeSubsection),_=V(()=>e.uiHints),v=V(()=>{let e=m().schema,t=h()===`channels`?e?.properties?.channels:void 0;t&&pt();let n=t?Js(t,_()):[],r=n.find(({key:e})=>e===g())??n[0],i=t&&r?{...e,properties:{...e?.properties,channels:{...t,properties:Object.fromEntries(Object.entries(t.properties??{}).filter(([e])=>r.keys.includes(e))),required:t.required?.filter(e=>r.keys.includes(e)),additionalProperties:!1}}}:e,a=i?.properties?.wizard,o=a?{...i,properties:Object.fromEntries(Object.entries(i.properties??{}).filter(([e])=>e!==`wizard`))}:i;return{channelGroups:n,channelGroup:r,editorSchema:o&&Re(o),setupSchema:a}}),y=V(()=>{let t=c(),n=e.showModeToggle??!1,r=m(),a=r.unsupportedPaths.filter(t=>t!==`<root>`&&(!e.activeSection||t===e.activeSection||t.startsWith(`${e.activeSection}.`))&&aa(e.formValue,t)),o=e.rawAvailable??!0,l=!!e.rawDraftPending&&o,u=l?`raw`:n&&o?e.formMode:`form`;t.lastFormModeForScroll!==null&&t.lastFormModeForScroll!==u&&i(),t.lastFormModeForScroll=u;let d=hi(e);t.lastConfigContextKey!==d&&(fi(t),t.lastConfigContextKey=d);let h=r.schema?.properties??{},g=new Set([`__appearance__`,`__notifications__`]),_=t=>(e.includeVirtualSections??!0)&&g.has(t)&&(t===`__appearance__`||f()?.has(t)===!0),y=e=>L(`configView.sections.${e===`__appearance__`?`theme`:e===`__notifications__`?`notifications`:e}`),b=$s.map(e=>({id:e.id,label:L(`configView.categories.${e.id}`),sections:e.sections.filter(e=>(_(e)||e in h||e===`ui`&&f()?.has(`__appearance__`))&&f()?.has(e)!==!1&&!p()?.has(e)).map(e=>({key:e,label:y(e)}))})).filter(e=>e.sections.length>0),x=Object.keys(h).filter(e=>!ec.has(e)).map(e=>({key:e,label:e.charAt(0).toUpperCase()+e.slice(1)}));x.length&&b.push({id:`other`,label:L(`configView.categories.other`),sections:x});let S=[...e.showRootTab??!0?[{key:null,label:e.navRootLabel??L(`nav.settings`)}]:[],...b.flatMap(e=>e.sections)],ee=u===`raw`&&e.raw!==e.originalRaw;ee||(t.rawDiffOpen=!1),(!ee||!t.rawDiffOpen)&&(t.rawDiffCache=void 0);let C=ee&&t.rawDiffOpen?Ns(t,e.originalRaw,e.raw):[];ee&&t.rawDiffOpen&&!gt()&&ft().then(s).catch(()=>void 0);let w=e.loading||e.saving||e.applying||e.updating,T=w||e.schemaLoading,te=e.mutationAllowed!==!1,E=e.settingsLayout!==`accordion`&&e.settingsLayout!==`stack`&&S.length>1,D=n||E,O=e.valid===!1&&!t.validityDismissed;return{displayReady:[`__appearance__`,`__notifications__`].includes(e.activeSection??``),showModeToggle:n,includeVirtualSections:e.includeVirtualSections??!0,include:f(),analysis:r,unsupportedActivePaths:a,rawAvailable:o,activeTabLabel:E?S.find(t=>t.key===e.activeSection)?.label:void 0,openRaw:n&&o?()=>e.onFormModeChange(`raw`):void 0,rawDraftPending:l,formMode:u,categories:b,...v(),showSetup:!(!v().setupSchema||e.activeSection&&e.activeSection!==`wizard`),topTabs:S,hasRawChanges:ee,rawDiff:C,configBusy:w,formBusy:T,mutationAllowed:te,showSectionTabs:E,showToolbar:D,showValidityWarning:O,showLead:D||e.settingsLayout===`accordion`||O||!!v().channelGroup}}),b=V(()=>({completion:e.schemaRead}),{equals:(e,t)=>e.completion===t.completion}),x=V(()=>!!e.schema),S=V(()=>{let e=x();return b().completion?.then(t=>{if(!t.ok&&!e)throw Error(t.error);return t.ok?void 0:t.error})}),ee=()=>x()?bn(S):S();function C(){ft().catch(()=>void 0);let t=V(()=>Nr(e.formValue,[],e.uiHints)),[n,r]=Sn(!1),[i,a]=Sn(!1),o=Vn(function*(t,n,i){i===e.presentationRetired()&&(r(!0),a(t===`save`)),yield Promise.race([n,i])}),l=async t=>{let n=e.presentationRetired(),r=t===`save`?e.onSave():t===`discard`?e.onRawDiscard():e.onOpenFile?.();return await Promise.resolve(),o(t,r,n)},u=()=>n()||y().configBusy,d=()=>i()||e.saving;return J(_r,{get children(){return[K(()=>K(()=>!!y().hasRawChanges)()?(()=>{var t=sc(),n=t.firstChild,r=n.firstChild,i=n.nextSibling;return t.addEventListener(`toggle`,e=>{let t=e.currentTarget.open;c().rawDiffOpen!==t&&(c().rawDiffOpen=t,t||(c().rawDiffCache=void 0),s())}),G(r,()=>L(`configView.viewPendingChangesRaw`)),G(i,J(B,{get each(){return y().rawDiff},get fallback(){var e=cc();return G(e,()=>L(`configView.rawDiffUnavailable`)),e},children:t=>(()=>{var n=lc(),r=n.firstChild,i=r.nextSibling.firstChild,a=i.nextSibling.nextSibling;return G(r,()=>js(t.path)),G(i,()=>Rs(t.path,t.from,e.uiHints,c().rawRevealed)),G(a,()=>Rs(t.path,t.to,e.uiHints,c().rawRevealed)),n})()})),Y(()=>c().rawDiffOpen,e=>{q(t,`open`,e)}),t})():null),(()=>{var n=oc(),r=n.firstChild.firstChild,i=r.firstChild,a=i.nextSibling,o=r.nextSibling,f=o.firstChild,p=f.firstChild,m=p.nextSibling;return G(r,(()=>{var t=K(()=>!!(e.onOpenFile&&e.openFileAllowed!==!1));return()=>t()?(()=>{var e=uc(),t=e.firstChild,n=t.nextSibling;return e._$$click=()=>void l(`open`),G(e,J(z,{name:`fileText`}),t),G(e,()=>L(`configView.open`),n),Y(()=>u(),t=>{q(e,`disabled`,t)}),e})():null})(),i),i._$$click=()=>void l(`discard`),G(i,()=>L(`configView.rawDiscard`)),a._$$click=()=>void l(`save`),G(a,(()=>{var e=K(()=>!!d());return()=>e()?[dc(),K(()=>L(`common.saving`))]:L(`common.save`)})()),G(f,()=>L(`configView.rawConfig`),p),G(f,(()=>{var n=K(()=>t()>0);return()=>n()?[(()=>{var n=fc();return G(n,()=>nc(t(),c().rawRevealed,e.raw)),n})(),(()=>{var e=pc();return e._$$click=()=>{c().rawRevealed=!c().rawRevealed,s()},G(e,J(z,{get name(){return c().rawRevealed?`eye`:`eyeOff`}})),Y(()=>({e:!!c().rawRevealed,t:L(`configView.toggleRawRedaction`),a:c().rawRevealed?`true`:`false`}),({e:t,t:n,a:r},i)=>{t!==i?.e&&e.classList.toggle(`active`,t),n!==i?.t&&q(e,`aria-label`,n),r!==i?.a&&q(e,`aria-pressed`,r)}),e})()]:null})(),m),G(o,(()=>{var n=K(()=>t()>0&&!c().rawRevealed);return()=>n()?J(Mt,{tone:`info`,style:{"margin-top":`12px`},get children(){return L(t()===1?`configView.sensitiveHidden`:`configView.sensitiveHiddenPlural`,{count:String(t())})}}):(()=>{var t=mc();t._$$input=t=>e.onRawChange(t.currentTarget.value);var n=st(()=>e.raw);return(typeof n==`function`||Array.isArray(n))&&In(()=>n,t),Y(()=>({e:L(`configView.rawConfig`),t:L(`configView.rawConfig`),a:u()||!y().mutationAllowed}),({e,t:n,a:r},i)=>{e!==i?.e&&q(t,`aria-label`,e),n!==i?.t&&q(t,`placeholder`,n),r!==i?.a&&q(t,`disabled`,r)}),t})()})(),null),Y(()=>({e:u()||!y().hasRawChanges,t:!e.connected||!y().mutationAllowed||u()||!y().hasRawChanges,a:d()?`true`:`false`}),({e,t,a:n},r)=>{e!==r?.e&&q(i,`disabled`,e),t!==r?.t&&q(a,`disabled`,t),n!==r?.a&&q(a,`aria-busy`,n)}),n})()]}})}function w(){let t=J(ha,{get schema(){return y().editorSchema},get progressive(){return e.progressive},get uiHints(){return e.uiHints},get value(){return e.formValue},get embedded(){return e.embeddedEditor===!0||y().showSetup},get rawAvailable(){return y().rawAvailable},get repeatedHeadings(){return[e.navRootLabel,y().activeTabLabel]},get onOpenRaw(){return y().openRaw},get disabled(){return y().formBusy||!e.formValue||!y().mutationAllowed},get unsupportedPaths(){return y().analysis.unsupportedPaths},get secretFields(){return e.secretFields},get onPatch(){return e.onFormPatch},get onRemove(){return e.onFormRemove},get activeSection(){return e.activeSection},activeSubsection:null,get showAdvanced(){return e.forceShowAdvanced===!0||e.showAdvancedSettings},get forceAdvancedSection(){return e.forceAdvancedSection},onShowAdvanced:()=>e.onAppearanceChange({showAdvancedSettings:!0}),get onHideAdvanced(){return e.forceShowAdvanced?void 0:()=>e.onAppearanceChange({showAdvancedSettings:!1})},get sectionActions(){return K(()=>e.activeSection===`env`)()?(()=>{var e=uc(),t=e.firstChild,n=t.nextSibling;return e._$$click=()=>{c().envRevealed=!c().envRevealed,s()},G(e,J(z,{get name(){return c().envRevealed?`eyeOff`:`eye`}}),t),G(e,()=>L(`configView.peek`),n),Y(()=>({e:!!c().envRevealed,t:c().envRevealed?`true`:`false`,a:L(c().envRevealed?`configView.hideEnvValues`:`configView.revealEnvValues`)}),({e:t,t:n,a:r},i)=>{t!==i?.e&&e.classList.toggle(`active`,t),n!==i?.t&&q(e,`aria-pressed`,n),r!==i?.a&&q(e,`title`,r)}),e})():void 0},get showSectionDocs(){return e.showSectionDocs},get sectionTitle(){return e.sectionTitle},get sectionPrelude(){return e.sectionPrelude},get curatedSections(){return e.curatedSections},get revealSensitive(){return K(()=>e.activeSection===`env`)()&&c().envRevealed},maskSensitive:!0,isSensitivePathRevealed:e=>di(c(),e),onToggleSensitivePath:e=>{mi(c(),e),s()}}),n=xn(()=>e.renderSection);return K(()=>n?n(t):t)}return[K(()=>K(()=>!!y().showLead)()?(()=>{var t=gc(),n=t.firstChild,r=n.nextSibling,a=r.nextSibling,o=a.nextSibling;return G(t,(()=>{var t=K(()=>!!y().showToolbar);return()=>t()?(()=>{var t=_c(),n=t.firstChild,r=n.nextSibling;return G(t,(()=>{var t=K(()=>!!y().showModeToggle);return()=>t()?J(Cr,{mode:`buttons`,get value(){return y().formMode},get onChange(){return e.onFormModeChange},get onReselect(){return e.onFormModeChange},get options(){return[{value:`form`,label:L(`configView.form`),disabled:e.schemaLoading||!e.schema||y().rawDraftPending,title:y().rawDraftPending?L(`configView.rawDraftPendingFormTitle`):y().unsupportedActivePaths.length?L(`configView.formUnsafeTitle`):``},{value:`raw`,label:L(`configView.raw`),disabled:!y().rawAvailable,title:L(y().rawAvailable?`configView.rawTitle`:`configView.rawUnavailableTitle`)}]}}):null})(),n),G(t,(()=>{var t=K(()=>!!y().showSectionTabs);return()=>t()?J(Jr,{id:`config-sections`,get active(){return e.activeSection??`root`},get tabs(){return y().topTabs.map(e=>({value:e.key??`root`,label:e.label}))},get ariaLabel(){return L(`common.settingsSections`)},panelId:`config-section-panel`,onSelect:t=>e.onSectionChange(t===`root`?null:t),onActivate:i}):null})(),r),t})():null})(),n),G(t,(()=>{var t=K(()=>e.settingsLayout===`accordion`);return()=>t()?J(Ys,{get activeSection(){return e.activeSection},get onSectionChange(){return e.onSectionChange},get categories(){return y().categories},resetContentScroll:i}):null})(),r),G(t,J(H,{get when(){return K(()=>y().formMode===`form`)()?y().channelGroup:void 0},children:t=>(()=>{var n=vc(),r=n.firstChild,a=r.firstChild;return G(a,()=>L(`configView.channelSettings`)),G(r,J(zr,{get value(){return t().key??``},onChange:t=>{e.onSubsectionChange(t.currentTarget.value||null),i()},get options(){return y().channelGroups.map(e=>({value:e.key??``,label:e.label}))}}),null),n})()}),a),G(t,(()=>{var e=K(()=>!!y().showValidityWarning);return()=>e()?(()=>{var e=yc(),t=e.firstChild,n=t.nextSibling;return G(e,J(z,{name:`alertTriangle`,class:`config-validity-warning__icon`}),t),G(t,()=>L(`configView.invalidConfig`)),n._$$click=()=>{c().validityDismissed=!0,s()},G(n,()=>L(`configView.dismissWarning`)),e})():null})(),o),t})():null),(()=>{var i=hc(),a=i.firstChild,o=a.nextSibling;return In(()=>e=>r=e,i),G(i,J(Sa,{config:e,get displayReady(){return y().displayReady},get fallback(){return t()},get children(){return K(()=>e.activeSection===`__appearance__`)()?K(()=>!!y().includeVirtualSections)()?J(ds,e):null:K(()=>e.activeSection===`__notifications__`)()?K(()=>!!y().includeVirtualSections)()?J(ga,e):null:K(()=>y().formMode===`form`)()?[K(()=>K(()=>!!(y().unsupportedActivePaths.length>0&&y().openRaw))()?(()=>{var e=Sc();return G(e,J(Mt,{tone:`info`,get children(){return[J(oa,{get paths(){return y().unsupportedActivePaths}}),` `,(()=>{var e=xc();return e._$$click=()=>y().openRaw?.(),G(e,()=>L(`configView.openRawEditor`)),e})()]}})),e})():null),K(()=>K(()=>!!(y().includeVirtualSections&&e.activeSection===null&&y().include?.has(`__appearance__`)))()?J(ds,e):null),J(U,{fallback:(t,n)=>J(xa,{get message(){return ze(t())},onRetry:()=>{e.onRetrySchema?.(),n()}}),get children(){return J(Z,{get on(){return K(()=>!!x())()?void 0:b()},get fallback(){return t()},get children(){return[J(H,{get when(){return ee()},children:t=>J(xa,{get message(){return t()},onRetry:()=>e.onRetrySchema?.()})}),(()=>{var e=bc();return G(e,(()=>{var e=K(()=>!!On(S));return()=>e()?L(`common.loading`):``})()),e})(),J(w,{}),K(()=>K(()=>!!y().showSetup)()?J(_a,{get schema(){return y().setupSchema},config:e,get disabled(){return y().formBusy||!e.formValue||!y().mutationAllowed}}):null)]}})}})]:J(C,{})}}),a),G(i,(()=>{var t=K(()=>e.issues.length>0);return()=>t()?(()=>{var t=Sc();return G(t,J(Mt,{tone:`danger`,get children(){return J(U,{fallback:n,get children(){return J(Z,{get fallback(){return n()},get children(){return J(ma,{class:`code-block`,get value(){return e.issues}})}})}})}})),t})():null})(),o),Y(()=>({e:y().showSectionTabs?`tabpanel`:`region`,t:y().formMode===`form`&&e.schemaLoading?`true`:void 0,a:y().showSectionTabs?`config-sections-tab-${e.activeSection??`root`}`:void 0,o:y().showSectionTabs?void 0:L(`common.settingsSections`)}),({e,t,a:n,o:r},a)=>{e!==a?.e&&q(i,`role`,e),t!==a?.t&&q(i,`aria-busy`,t),n!==a?.a&&q(i,`aria-labelledby`,n),r!==a?.o&&q(i,`aria-label`,r)}),i})()]}var ac,oc,sc,cc,lc,uc,dc,fc,pc,mc,hc,gc,_c,vc,yc,bc,xc,Sc;function Cc(){return(Cc=e((()=>{X(),W(),Fr(),qr(),$t(),Rt(),xt(),Rr(),wr(),$n(),Ae(),je(),I(),mn(),Pe(),As(),Ws(),va(),tc(),rc(),Da(),la(),gi(),ac=Q(`<pre class=code-block>`),oc=Q(`<div class=settings-group><div class="settings-row settings-row--stacked"><div class=config-raw-actions><button class="btn btn--sm"></button><button class="btn btn--sm primary"></button></div><div class="field config-raw-field"><span style=display:flex;align-items:center;gap:8px><!><!>`),sc=Q(`<details class=config-diff><summary class=config-diff__summary><span></span><svg class=config-diff__chevron viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><polyline points="9 6 15 12 9 18"></polyline></svg></summary><div class=config-diff__content>`),cc=Q(`<div class=config-diff__item>`),lc=Q(`<div class=config-diff__item><div class=config-diff__path></div><div class=config-diff__values><span class=config-diff__from></span><span class=config-diff__arrow>→</span><span class=config-diff__to>`),uc=Q(`<button class="btn btn--sm"><!><!>`),dc=Q(`<span class=btn__spinner aria-hidden=true>`),fc=Q(`<span class=settings-count>`),pc=Q(`<button class="btn btn--icon config-raw-toggle">`),mc=Q(`<textarea>`),hc=Q(`<div id=config-section-panel class=config-content><!><!>`),gc=Q(`<div class=config-lead><!><!><!><!>`),_c=Q(`<div class=config-toolbar><!><!>`),vc=Q(`<div class=config-toolbar><label class=field><span>`),yc=Q(`<div class=config-validity-warning><span class=config-validity-warning__text></span><button class="btn btn--sm">`),bc=Q(`<span class=sr-only role=status>`),xc=Q(`<button type=button class="btn btn--sm">`),Sc=Q(`<div class=config-content-callout>`),nn(Qn),zn([`click`,`input`])})))()}export{Da as a,ua as c,ya as i,fa as l,Cc as n,va as o,xa as r,pa as s,ic as t,wi as u};