'use strict';
import _0x5ca88f from 'lodash.debounce';
import { apiGet } from '../../../../fd-toolbox/api/api-client.js';
import { searchResultParams } from '../../../../fd-toolbox/constants/search-result-constants.js';
import { apiPathNames } from '../../../../fd-toolbox/api/api-path-names.js';
import { searchableFilters } from '../../../fd-component-toolbox/search/filter-names-constants.js';
import { getCache, setCache } from '../../../../fd-toolbox/cache/cache.js';
import { cacheKeys } from '../../../../fd-toolbox/constants/cache-keys.js';
import { resourceNames } from '../../../../fd-toolbox/resources/resource-names.js';

var __defProp=Object['defineProperty'],__name=(_0x262e91,_0x39a25)=>__defProp(_0x262e91,'name',{'value':_0x39a25,'configurable':!![]});const notFoundImg='/images/search-not-found-result.webp';const search=_0x5ca88f(async(_0x2982d0,_0x4e9461,_0x587501,_0x1fb320)=>{const _0x1b2597=_0x2982d0['trim']()['toLowerCase']();if(!_0x1b2597){_0x587501([]),_0x1fb320([]);return;}const _0x2fc909=_0x4e9461['join'](','),_0x23ccc0=await apiGet(apiPathNames['searchResult'],void(0x9a9*-0x3+-0x2181*0x1+-0xba*-0x56),[{'name':searchResultParams['querySearch'],'value':_0x1b2597},{'name':searchResultParams['filterSearch'],'value':_0x2fc909}]);_0x23ccc0['data']&&(_0x587501(_0x23ccc0['data']['searchableResources']??[]),_0x1fb320(_0x23ccc0['data']['screens']??[]));},0x2414*0x1+-0x1069*-0x1+-0x3289);function getSearchResultContainerId(_0x4eb5cb){return _0x4eb5cb+resourceNames['searchResult'];}__name(getSearchResultContainerId,'getSearchResultContainerId');async function initSearchFilters(_0x5b8d04,_0x5808e3){const _0x1cb62b=await fetchSearchableResourceNames(),_0x278dc1=[..._0x1cb62b,searchableFilters['screens']];_0x5b8d04(_0x278dc1),_0x5808e3(_0x278dc1);}__name(initSearchFilters,'initSearchFilters');async function fetchSearchableResourceNames(){let _0x1fbc0a=getCache({'key':cacheKeys['searchableResources'],'isGlobal':!![],'useShortTermStorage':!![]});if(_0x1fbc0a)return _0x1fbc0a;const _0x23307a=await apiGet(apiPathNames['searchableResource']);return _0x23307a['data']&&setCache({'key':cacheKeys['searchableResources'],'data':_0x23307a['data'],'isGlobal':!![],'useShortTermStorage':!![]}),_0x23307a['data']??[];}__name(fetchSearchableResourceNames,'fetchSearchableResourceNames');

export { getSearchResultContainerId, initSearchFilters, notFoundImg, search };
