UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 3 kB
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{Gr as t,Ju as n,Yr as r,ec as i,li as a,oi as o,qs as s}from"./_4____________________________.js";import{AT as c,CE as l,ET as u,TE as d,Xk as f,Zk as p,vE as m,yE as h}from"./_2_____________________________.js";import{n as g,t as _}from"./en-settings-DEvavpke.js";import{a as v,o as y}from"./settings-targets-bvwku6ua.js";import{i as b,n as x,r as S,t as C}from"./config-form.tiers-MvbiZwtM.js";import{T as w,h as T}from"./config-form-utils-runtime-CqcGJa6w.js";import{n as E,o as D,r as O}from"./config-form.search-Z0jyQfrJ.js";import{n as k,t as A}from"./en-profile-edyrJlYL.js";import{n as j,t as M}from"./settings-model-NIDYQJwk.js";import{i as N,r as P}from"./setup-schema-DK0FbwGW.js";function F(e,t){let n=R[e],r=t.properties;if(!n||!r)return t;let i=new Set(n);return{...t,properties:Object.fromEntries(Object.entries(r).filter(([e])=>i.has(e)))}}function I(e){if(!e.query.trim())return[];let t=D(e.query),o=t.tags.length===0&&t.text?L.filter(t=>(e.identityAvailable||!t.requiresIdentity)&&(e.multipleProfiles||!t.requiresMultipleProfiles)&&(e.nativeDeviceSettings||!t.requiresNativeDeviceSettings)&&r(t.routeId,e.canAdmin!==!1,e.nativeDeviceSettings)).map(t=>{let n=e.nativeDeviceSettings?.snapshot??null,r=a(t.labelKey),i=n?Object.entries(t.nativeSearchKeys??{}).filter(([,e])=>e(n)).map(([e])=>e):[];return Object.assign({routeId:t.routeId},t.search===void 0?{}:{search:t.search},{hash:t.hash,label:r,searchText:[r,...[...t.searchKeys,...i].filter(e=>f().lobsterdex||e!==`configView.appearance.tabIcon.lobsterdex`).map(e=>a(e)),t.aliases??``].join(` `)})}).filter(e=>c(e.searchText,t.text)):[],s=n(e.schema)?e.schema:null;if(!s||w(s)!==`object`||!s.properties)return o;let l=z.get(s),u=e.openclawIdEnabled===!0;(!l||l.hints!==e.uiHints||l.openclawIdEnabled!==u)&&(l={hints:e.uiHints,openclawIdEnabled:u,sections:new Map},z.set(s,l));let p=e.value??{};for(let[t,n]of Object.entries(s.properties)){let a=h(t);if(!r(a,e.canAdmin!==!1,e.nativeDeviceSettings))continue;let s=l.sections.get(t);if(!s){let r=d(t===`wizard`?N(n):F(a,n),t,u);s={schema:r,tiers:x({schema:r,path:[t],hints:e.uiHints})},l.sections.set(t,s)}let{schema:f,tiers:m}=s,g=S[t],_=n=>!!(n&&O({key:t,schema:n,value:p[t],hints:e.uiHints,query:e.query,label:g?.label,description:g?.description,textMatcher:c})),v=_(m.common),y=_(m.advanced);if(!v&&!y)continue;let b=encodeURIComponent(t),C=`#config-section-${b}`;o.push({routeId:a,label:g?.label??f.title??t,...a===`memory`?{pathname:i(`settings`,e.basePath),...y?{search:`?advanced=1`}:{},hash:C}:a===`plugin-settings`?{search:`?tab=advanced`,hash:`#plugin-settings-advanced`}:{search:`?section=${b}${y||t===`wizard`?`&advanced=1`:``}`,hash:C}})}return o}var L,R,z;function B(){return(B=e((()=>{t(),s(),p(),b(),E(),C(),o(),A(),_(),T(),u(),j(),l(),y(),P(),g(),k(),L=Object.values(v),R={memory:m,"plugin-settings":M,updates:[`channel`,`checkOnStart`,`auto`]},z=new WeakMap})))()}B();export{I as findSettingsSearchBlocks};