'use strict';
'use client';
import { relationTypes } from '../../../fd-toolbox/enums/enums.js';
import { isNullOrUndefined } from '../../../fd-toolbox/functions/value-checking-functions.js';
import { getFlagArrayForNumberValueByMaxFlagValue } from '../../../fd-toolbox/collections/internal-enums.js';
import { isFlagsEnum } from '../core/property-types.js';
import { emptyString } from '../../../fd-toolbox/constants/constants.js';
import { wellKnownMetaProps } from '../../../fd-toolbox-core/constants/meta-constants.js';
import { isString } from '../../../fd-toolbox/types/ensure-type.js';
import { getObjectValues } from '../../../fd-toolbox/lib/utils.js';
import { oDataComparisonTypes, oDataFilterTypes, oDataLogicalOperationTypes } from '../../../fd-toolbox/odata/odata-enums.js';

var __defProp=Object['defineProperty'],__name=(_0x37f3ab,_0x145afd)=>__defProp(_0x37f3ab,'name',{'value':_0x145afd,'configurable':!![]});function isRelationField(_0x359b02){return !isNullOrUndefined(_0x359b02['relation']);}__name(isRelationField,'isRelationField');function isManyToOneBrowserField(_0xfa9e28){return _0xfa9e28['relation']['type']===relationTypes['manyToOne'];}__name(isManyToOneBrowserField,'isManyToOneBrowserField');function isOneToManyBrowserField(_0x1fc803){return _0x1fc803['relation']?.['type']===relationTypes['oneToMany'];}__name(isOneToManyBrowserField,'isOneToManyBrowserField');function isManyToManyBrowserField(_0x4d1799){return _0x4d1799['relation']?.['type']===relationTypes['manyToMany'];}__name(isManyToManyBrowserField,'isManyToManyBrowserField');function isIdProperty(_0x2979a4){return _0x2979a4['name']===wellKnownMetaProps['id'];}__name(isIdProperty,'isIdProperty');function getPropertyMetas(_0x89df75){return getObjectValues(_0x89df75);}__name(getPropertyMetas,'getPropertyMetas');function setFlagEnumValues(_0xd482ff,_0x3b7aea,_0x143bfc){const _0x1ff94c=getPropertyMetas(_0xd482ff)['filter'](_0x5032f9=>isFlagsEnum(_0x5032f9['type'],_0x5032f9['typeFormat']));for(const _0x15f7f8 of _0x1ff94c){const _0x521c39=Number(_0x3b7aea(_0x15f7f8['name'])),_0x3297d2=Math['max'](..._0x15f7f8['enumerationValues']),_0x59e189=getFlagArrayForNumberValueByMaxFlagValue(_0x521c39,_0x3297d2);_0x143bfc(_0x15f7f8['name'],_0x59e189);}}__name(setFlagEnumValues,'setFlagEnumValues');function getRequiredLabel(_0x5d7bf5,_0x2e4794){if(_0x5d7bf5)return _0x2e4794+'\x20*';return _0x2e4794;}__name(getRequiredLabel,'getRequiredLabel');function getRelationResourceId(_0x373e55,_0x579cb6){let _0x16261c;return _0x373e55['relation']?_0x373e55['relation']['type']!==relationTypes['manyToOne']?_0x16261c=_0x579cb6['id']:_0x16261c=_0x579cb6[_0x373e55['name']]:_0x16261c=_0x579cb6['id'],isString(_0x16261c)?_0x16261c:'';}__name(getRelationResourceId,'getRelationResourceId');function setSelectValueFromForm(_0x2289d6,_0x229bde,_0x47e6c9){const _0x3a7311=_0x2289d6['getValues'](_0x47e6c9);_0x229bde(isNullOrUndefined(_0x3a7311)?emptyString:String(_0x3a7311));}__name(setSelectValueFromForm,'setSelectValueFromForm');function setFormValue(_0x21f18b,_0x2c6a6f,_0x5c9bda){const _0x2c9ab2=_0x5c9bda===emptyString?void(0x248d+-0x53*-0x47+-0x5*0xbea):_0x5c9bda;_0x21f18b['setValue'](_0x2c6a6f,_0x2c9ab2);}__name(setFormValue,'setFormValue');function onMultiBrowserChange(_0x522fc7,_0x239417,_0x43d9f0,_0x1a7b07){const _0x140af2=_0x239417['map'](_0x31e9a8=>_0x31e9a8['id'])['join'](',');_0x522fc7(_0x43d9f0['name'],_0x140af2),_0x1a7b07?.(_0x140af2,_0x43d9f0['name']);}__name(onMultiBrowserChange,'onMultiBrowserChange');function onBrowserChange(_0x34eb36,_0x288867,_0x80445d,_0x4bd3bb){_0x34eb36(_0x80445d['name'],_0x288867),_0x4bd3bb?.(_0x288867,_0x80445d['name']);}__name(onBrowserChange,'onBrowserChange');function onEditorChange(_0x2b4dd7,_0x4bfd67,_0x1344c9,_0x1b41d2){_0x2b4dd7['setValue'](_0x4bfd67,_0x1344c9),_0x2b4dd7['trigger'](_0x4bfd67),_0x1b41d2(_0x1344c9);}__name(onEditorChange,'onEditorChange');function getViewMultiListFiltersForManyToManyBrowserField(_0x47ef01,_0x66152f){const _0x1bd6fb=[{'leftSide':_0x47ef01['relation']['manyToManyInfo']['manyToManyFirstPropertyName'],'rightSide':_0x66152f,'type':oDataFilterTypes['guid'],'comparisonType':oDataComparisonTypes['equal']}];return _0x47ef01['relation']['manyToManyInfo']['isMirrorManyToManyResource']&&_0x1bd6fb['push']({'leftSide':_0x47ef01['relation']['manyToManyInfo']['manyToManySecondPropertyName'],'rightSide':_0x66152f,'type':oDataFilterTypes['guid'],'logicalOperationType':oDataLogicalOperationTypes['or'],'comparisonType':oDataComparisonTypes['equal']}),_0x1bd6fb;}__name(getViewMultiListFiltersForManyToManyBrowserField,'getViewMultiListFiltersForManyToManyBrowserField');

export { getPropertyMetas, getRelationResourceId, getRequiredLabel, getViewMultiListFiltersForManyToManyBrowserField, isIdProperty, isManyToManyBrowserField, isManyToOneBrowserField, isOneToManyBrowserField, isRelationField, onBrowserChange, onEditorChange, onMultiBrowserChange, setFlagEnumValues, setFormValue, setSelectValueFromForm };
