Liferay.Loader.define("@liferay/analytics-settings-web@5.0.47/js/components/table/utils",["module","exports","require","frontend-js-web","../../utils/filter"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.serializeTableRequestParams=function serializeTableRequestParams({filter:{type:e,value:t},keywords:r,pagination:{page:n,pageSize:o}}){let c={page:n,pageSize:o,sort:"".concat(t,":").concat(e)};r&&(c={keywords:r,page:1,pageSize:o,sort:"".concat(t,":").concat(e)});const a=Object.keys(c).map((e=>[e,String(c[e])])),s=new URLSearchParams(a);return decodeURIComponent(s.toString())},t.getOrderBy=function getOrderBy({type:e}){return e===o.OrderBy.Asc?o.OrderBy.Desc:o.OrderBy.Asc},t.getOrderBySymbol=function getOrderBySymbol({type:e}){return e===o.OrderBy.Asc?"order-list-up":"order-list-down"},t.getResultsLanguage=function getResultsLanguage(e){if(e.length>1)return(0,n.sub)(Liferay.Language.get("x-results-for").toLowerCase(),e.length);return(0,n.sub)(Liferay.Language.get("x-result-for").toLowerCase(),e.length)},t.getGlobalChecked=function getGlobalChecked(e){return!!Object.values(e).length&&Object.values(e).every((({checked:e})=>e))},t.updateFormattedItems=function updateFormattedItems(e,t){return Object.values(e).reduce(((e,r)=>r.disabled?_objectSpread(_objectSpread({},e),{},{[r.id]:r}):_objectSpread(_objectSpread({},e),{},{[r.id]:_objectSpread(_objectSpread({},r),{},{checked:t})})),{})},t.getFormattedItems=function getFormattedItems(e){return e.reduce(((e,t)=>_objectSpread(_objectSpread({},e),{},{[t.id]:t})),{})},t.getIds=function getIds(e,t){const r=[...t];return Object.values(e).forEach((e=>{r.length?r.forEach(((t,n)=>{t!==Number(e.id)||e.checked?t!==Number(e.id)&&e.checked&&r.push(Number(e.id)):r.splice(n,1)})):e.checked&&r.push(Number(e.id))})),[...new Set(r)]};var n=r("frontend-js-web"),o=r("../../utils/filter");function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}}}));
//# sourceMappingURL=utils.js.map