'use strict';
import { isNumberArray } from '../../../fd-toolbox/types/ensure-type.js';
import { cssPropertyNames } from '../../../base-repo/constants/internal-common-strings.js';

var __defProp=Object['defineProperty'],__name=(_0x436a1b,_0x24409c)=>__defProp(_0x436a1b,'name',{'value':_0x24409c,'configurable':!![]});const minWidthStyleProperty='minWidth';function calculateSizing(_0x2a20b7,_0x505e4b,_0x4ab0dd){const _0xf47c80=_0x4ab0dd?.['gap']??-0xadc+-0x3f8+0xed4,{columnsMap:_0x26c1b5,fitResult:_0x2edbdc}=processColumnsInput(_0x2a20b7,_0x505e4b,_0xf47c80,_0x4ab0dd?.['columnOptions']),_0x211f87={'count':_0x2edbdc['count'],'usedWidth':_0x2edbdc['used'],'remainingWidth':Math['max'](0x1f28+0x48f*0x2+0x80e*-0x5,_0x505e4b-_0x2edbdc['used'])};Object['keys'](_0x26c1b5)['length']>-0x14eb+-0x1*0x1558+-0x1f*-0x15d&&(_0x211f87['columnPercents']=calculateColumnPercents(_0x26c1b5));if(_0x4ab0dd?.['isSmallScreen']!==void(-0x16d9+-0x15d2+-0x5*-0x8ef)){const _0x23c72c=Object['values'](_0x26c1b5)['reduce']((_0x22d7ff,_0x16fe9c)=>_0x22d7ff+_0x16fe9c,-0x2d7+0x12b0+-0x1*0xfd9);_0x211f87['containerStyles']=calculateContainerStyles(_0x23c72c||_0x2edbdc['used']/(0x20bc+-0x1aea+-0x5c2),_0x4ab0dd['isSmallScreen'],_0x4ab0dd['minWidthPx']??-0x142d+-0x3f*-0x47+0x2b4,_0x4ab0dd['targetWidthPx']??0x8*0x1ca+-0x199*0x1+-0xcb7,_0x4ab0dd['adaptiveWidth']??![]);}return _0x211f87;}__name(calculateSizing,'calculateSizing');function calculateFit(_0x526544,_0x383ebc,_0x244c47){let _0x364891=0x86*0x3d+-0x2f*0x6b+-0xc49*0x1,_0x480434=-0x3*0x1f+-0x1ccb+-0x74a*-0x4;for(const _0x4d2a4b of _0x526544){const _0x4b9063=typeof _0x4d2a4b==='number'&&_0x4d2a4b>-0x13cd+0x5f3+0xdda?_0x4d2a4b:-0x10*0x18a+0x186d+0x33,_0x384b68=_0x4b9063+_0x244c47;if(_0x364891+_0x384b68<=_0x383ebc)_0x364891+=_0x384b68,_0x480434++;else break;}return {'count':_0x480434,'used':_0x364891};}__name(calculateFit,'calculateFit');function calculateColumnWidths(_0x1f598f,_0x12db49){const _0x278a0a={};for(const _0x7d8245 of _0x1f598f){let _0x56f926=_0x12db49['minPercentage'];_0x7d8245['displayName']&&_0x7d8245['displayName']!==''&&(_0x56f926=_0x7d8245['displayName']['length']*_0x12db49['symbolWidth']+_0x12db49['additionalWidth'],_0x56f926<_0x12db49['minPixels']/(0x1af2+-0x7*-0x3e3+0x3d*-0xe3)&&(_0x56f926=_0x12db49['minPixels']/(0x11e*-0x22+0x1a5a*0x1+0xbb2))),_0x7d8245['name']&&(_0x278a0a[_0x7d8245['name']]=_0x56f926);}return _0x278a0a;}__name(calculateColumnWidths,'calculateColumnWidths');function calculateColumnPercents(_0x374a9f){const _0x4638fd=Object['values'](_0x374a9f)['reduce']((_0x1a0315,_0x459080)=>_0x1a0315+_0x459080,0x189*0xf+0x4*0x163+-0x1c93);if(_0x4638fd===0x2e4*0xa+-0x29*-0xb3+-0x121*0x33)return Object['fromEntries'](Object['keys'](_0x374a9f)['map'](_0xcc01f5=>[_0xcc01f5,-0x1*0x26e3+-0x1ab*0xa+0x1*0x3791]));return Object['fromEntries'](Object['entries'](_0x374a9f)['map'](([_0x1234ff,_0x9ae835])=>[_0x1234ff,_0x9ae835/_0x4638fd*(-0xb71*0x2+-0x32+-0x1*-0x1778)]));}__name(calculateColumnPercents,'calculateColumnPercents');function calculateContainerStyles(_0x5785f8,_0x52190e,_0xaaa025,_0x3df309,_0xc5e8cc){const _0x4b6642={};return _0xc5e8cc?_0x52190e?(_0x4b6642[cssPropertyNames['width']]='90vw',_0x4b6642[minWidthStyleProperty]=_0xaaa025/(0xda*-0x19+0x3cf+0x118b)+'rem'):_0x4b6642[minWidthStyleProperty]=_0x3df309/(-0x2*-0xf4c+0x66e*0x3+-0x7*0x71e)+'rem':_0x4b6642[minWidthStyleProperty]=_0x5785f8+'rem',_0x4b6642;}__name(calculateContainerStyles,'calculateContainerStyles');function processColumnsInput(_0x1108c7,_0x3554ac,_0x468db2,_0x13f833){let _0x282407={},_0x56358e={'count':0x0,'used':0x0};if(_0x1108c7['length']>-0x61*0x45+0xcc5+0xd60){if(isNumberArray(_0x1108c7))_0x56358e=calculateFit(_0x1108c7,_0x3554ac,_0x468db2);else {if(_0x13f833){_0x282407=calculateColumnWidths(_0x1108c7,_0x13f833);const _0x25e002=Object['values'](_0x282407);_0x56358e=calculateFit(_0x25e002,_0x3554ac,_0x468db2);}}}const _0x45adb5={'columnsMap':_0x282407,'fitResult':_0x56358e};return _0x45adb5;}__name(processColumnsInput,'processColumnsInput');

export { calculateSizing };
