"use strict";(globalThis.webpackChunkhelpgent=globalThis.webpackChunkhelpgent||[]).push([[417],{17798:(e,t,n)=>{n.r(t),n.d(t,{default:()=>i});var l=n(51609),s=n(86087),a=n(88282),r=n(27723),u=n(44428);function i(){const{settingsState:e}=(0,a.s)(),[t,n]=(0,s.useState)([]),[i,c]=(0,s.useState)("");function o(e,t){for(const n of t){if("submenu"===n.type){const t=o(e,n.submenu);if(t)return t;continue}if("menu"===n.type){const t=n.fields&&n.fields.includes(e);let l=!1;if(n.fieldGroups&&(l=n.fieldGroups.filter(t=>t.fields&&t.fields.includes(e)).length),t||l)return n}}return null}function f(){c(""),n([])}return(0,l.createElement)("div",{className:"helpgent-settings-panel-search"},(0,l.createElement)("input",{type:"text",value:i,onChange:function(t){c(t.target.value),n([]),t.target.value&&function(t){(function(t){const l=Object.keys(e.fields);for(const s of l){if(!e.fields[s].label)continue;if(!(0,u.nN)(t,e.fields[s].label))continue;const l=o(s,e.menus);if(!l)return;const a=(0,u.vn)(e.rootRoutePath+"/"+l.path),r={label:e.fields[s].label,link:`#/${a}?field=${s}`,breadcrumb:(0,u.Tq)(a)};n(e=>[...e,r])}})(t=t.toLowerCase()),function(t){const l=e=>{for(const n of e){if("submenu"===n.type){if((0,u.nN)(t,n.label))return n;const e=l(n.submenu);if(e)return e;continue}if("menu"===n.type&&(0,u.nN)(t,n.label))return n}return null},s=l(e.menus);if(!s)return;let a="submenu"===s.type&&s.grandChildPath?s.grandChildPath:s.path;a=(0,u.vn)(e.rootRoutePath+"/"+a);const r={label:s.label,link:`#/${a}`,breadcrumb:(0,u.Tq)(a)};n(e=>[...e,r])}(t)}(t.target.value)},className:"helpgent-settings-panel-search-input",placeholder:(0,r.__)("Search settings here...","helpgent")}),(0,l.createElement)("div",{className:"helpgent-settings-panel-search-results"},t.map(e=>(0,l.createElement)("a",{href:e.link,onClick:f,className:"helpgent-settings-panel-search-result-link"},(0,l.createElement)("p",{className:"helpgent-settings-panel-search-result-label"},e.label),(0,l.createElement)("p",{className:"helpgent-settings-panel-search-result-breadcrumb"},e.breadcrumb)))))}}}]);