'use strict';
import { getObjectValues } from '../../../../fd-toolbox/lib/utils.js';
import { baseResourceProps } from '../../../../fd-toolbox/base-resource/props/base-resource-props.js';
import { withIdProps } from '../../../../fd-toolbox-core/types/resource-with-id.js';
import { isNullOrUndefined } from '../../../../fd-toolbox/functions/value-checking-functions.js';
import { restoreComponentState, saveComponentState } from '../../state/base-state-functions.js';
import { resourceFilterInitFilterInputs, resourceFilterShouldSetAndDisableUserIdFilter } from '../../services/resource-filters.js';
import { withUserIdProps } from '../../../../fd-toolbox/types/with-user-id.js';

var __defProp=Object['defineProperty'],__name=(_0x4c4348,_0x40be59)=>__defProp(_0x4c4348,'name',{'value':_0x40be59,'configurable':!![]});async function initResourceFilterList(_0x5dc5f6,_0x259265,_0x536169,_0x5c52fe,_0x43e1d5,_0x2f9e69,_0x1e748e,_0x4cf83c,_0xbef870,_0x43b43a){if(_0x4cf83c){const _0x568bbc=createFilterPropertyMetas(getObjectValues(_0x4cf83c['properties']),_0xbef870);_0x536169(_0x568bbc),setPropertyMetasFilterInputsAndFilterKeys(_0x5dc5f6,_0x259265,_0x568bbc,_0x5c52fe,{'customFilters':[]},_0x43e1d5,_0x4cf83c,_0x2f9e69,_0x1e748e,_0xbef870);const _0xf620e2=Object['values'](_0x1e748e)['every'](_0x31fa29=>_0x31fa29?.['filter']?.['rightSide']==='');!_0xf620e2&&_0x43b43a?.();}}__name(initResourceFilterList,'initResourceFilterList');function createFilterPropertyMetas(_0x69ea21,_0x1c8b8a){const _0x351699={};for(const _0x2810c7 of _0x69ea21){_0x2810c7['name']!==baseResourceProps['createdDate']&&(_0x2810c7['name']===baseResourceProps['modifiedDate']||_0x2810c7['isDisplayable']&&_0x2810c7['name']!==withIdProps['id']&&(isNullOrUndefined(_0x2810c7['relation'])||!_0x2810c7['relation']['isExpandProperty']))&&(_0x351699[_0x2810c7['name']]=_0x2810c7);}return _0x1c8b8a?.['length']&&createRelationFilterPropertyMetas(_0x351699,_0x1c8b8a),_0x351699;}__name(createFilterPropertyMetas,'createFilterPropertyMetas');function setPropertyMetasFilterInputsAndFilterKeys(_0x1771c9,_0x345a15,_0x55dd1a,_0x301e22,_0x143c18,_0x4948b5,_0x247778,_0x5b3e77,_0x4bd30e,_0x4c4128){_0x301e22(getFilteredAndOtherPropertyMetas(_0x143c18,_0x55dd1a,_0x247778['properties'])),initFilterInputs(_0x1771c9,_0x345a15,_0x55dd1a,_0x4948b5,_0x247778,_0x143c18,_0x5b3e77,_0x4bd30e,_0x4c4128);}__name(setPropertyMetasFilterInputsAndFilterKeys,'setPropertyMetasFilterInputsAndFilterKeys');function createRelationFilterPropertyMetas(_0x406ccf,_0x3c2b2b){for(const _0x24f1ba of _0x3c2b2b){_0x24f1ba['name']!==baseResourceProps['createdDate']&&(_0x24f1ba['name']===baseResourceProps['modifiedDate']||_0x24f1ba['isDisplayable']&&_0x24f1ba['name']!==withIdProps['id'])&&(_0x406ccf[_0x24f1ba['name']]=_0x24f1ba);}}__name(createRelationFilterPropertyMetas,'createRelationFilterPropertyMetas');function getFilteredAndOtherPropertyMetas(_0x58db88,_0x3ea55b,_0x1a483b){const _0x38bfe0={};if(_0x58db88['customFilters'])for(const _0x403af9 of _0x58db88['customFilters']){if(!_0x3ea55b[_0x403af9['propertyName']]){const _0x1def6b=_0x1a483b[_0x403af9['propertyName']];_0x1def6b&&(_0x38bfe0[_0x1def6b['name']]=_0x1def6b);}}return {..._0x3ea55b,..._0x38bfe0};}__name(getFilteredAndOtherPropertyMetas,'getFilteredAndOtherPropertyMetas');function initFilterInputs(_0x585ce4,_0x1ef2cf,_0xfd803e,_0x30be0d,_0x457c47,_0x40dfc8,_0x56a3dc,_0x2b9153,_0x2a34ec){let _0x41f3f8;!_0x30be0d['length']&&restoreComponentState(_0x585ce4,_0x54fa5c=>{if(!_0x54fa5c)return;_0x41f3f8=_0x54fa5c;}),(!_0x41f3f8||_0x2a34ec?.['length']&&!_0x2a34ec['every'](_0x481e07=>_0x41f3f8?.[_0x481e07['name']]))&&(_0x41f3f8=resourceFilterInitFilterInputs(_0xfd803e,_0x30be0d,_0x457c47,_0x40dfc8['customFilters'],_0x2a34ec),_0x41f3f8[withUserIdProps['userId']]&&resourceFilterShouldSetAndDisableUserIdFilter(_0x457c47)&&(_0x41f3f8[withUserIdProps['userId']]['disabled']=!![]),!_0x2b9153&&saveComponentState(_0x585ce4,_0x41f3f8)),_0x2b9153&&saveComponentState(_0x585ce4,_0x41f3f8),_0x1ef2cf(_0x41f3f8),_0x56a3dc(Object['keys'](_0x41f3f8));}__name(initFilterInputs,'initFilterInputs');

export { initResourceFilterList };
