Liferay.Loader.define("@liferay/content-dashboard-web@2.0.83/js/ContentDashboardManagementToolbarPropsTransformer",["module","exports","require","frontend-js-web"],(function(e,t,o){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function propsTransformer(t){let{portletNamespace:o}=t,l=function _objectWithoutProperties(e,t){if(null==e)return{};var o,a,l=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var o,a,l={},r=Object.keys(e);for(a=0;a<r.length;a++)o=r[a],t.indexOf(o)>=0||(l[o]=e[o]);return l}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)o=r[a],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(l[o]=e[o])}return l}(t,["portletNamespace"]);return _objectSpread(_objectSpread({},l),{},{onFilterDropdownItemClick(t,{item:l={}}){const{data:r}=l;if(!Object.keys(r).length)return;const{action:n,dialogTitle:c,selectEventName:i,selectItemURL:s,multiple:d,size:u=e.size}=r;var p;"selectAssetCategory"===n?(p=r,(0,a.openSelectionModal)({buttonAddLabel:Liferay.Language.get("select"),height:"70vh",iframeBodyCssClass:"",multiple:!0,onSelect:e=>{if(e){const t=Object.keys(e).filter((t=>!e[t].unchecked));let l=null==p?void 0:p.redirectURL;t.forEach((t=>{l=(0,a.addParams)("".concat(o,"assetCategoryId=").concat(e[t].categoryId),l)})),(0,a.navigate)(l)}},selectEventName:"".concat(o,"selectedAssetCategory"),size:"md",title:null==p?void 0:p.dialogTitle,url:null==p?void 0:p.selectAssetCategoryURL})):"selectAssetTag"===n?(e=>{(0,a.openSelectionModal)({buttonAddLabel:Liferay.Language.get("select"),height:"70vh",multiple:!0,onSelect:t=>{if(t){const l=t.map((e=>e.value));let r=null==e?void 0:e.redirectURL;l.forEach((e=>{r=(0,a.addParams)("".concat(o,"assetTagId=").concat(e),r)})),(0,a.navigate)(r)}},selectEventName:"".concat(o,"selectedAssetTag"),size:"lg",title:null==e?void 0:e.dialogTitle,url:null==e?void 0:e.selectTagURL})})(r):"selectAuthor"===n?(e=>{(0,a.openSelectionModal)({buttonAddLabel:Liferay.Language.get("select"),height:"70vh",multiple:!0,onSelect:t=>{if(t){let l=null==e?void 0:e.redirectURL;t.forEach((e=>{l=(0,a.addParams)("".concat(o,"authorIds=").concat(e.id),l)})),(0,a.navigate)(l)}},selectEventName:"".concat(o,"selectedAuthorItem"),size:"lg",title:null==e?void 0:e.dialogTitle,url:null==e?void 0:e.selectAuthorURL})})(r):"selectContentDashboardItemSubtype"===n?(e=>{(0,a.openSelectionModal)({buttonAddLabel:Liferay.Language.get("select"),height:"70vh",multiple:!0,onSelect:t=>{let l=null==e?void 0:e.redirectURL;t.forEach((e=>{l=(0,a.addParams)("".concat(o,"contentDashboardItemSubtypePayload=").concat(JSON.stringify(e)),l)})),(0,a.navigate)(l)},selectEventName:"".concat(o,"selectedContentDashboardItemSubtype"),size:"md",title:null==e?void 0:e.dialogTitle,url:null==e?void 0:e.selectContentDashboardItemSubtypeURL})})(r):"selectScope"===n?(e=>{(0,a.openSelectionModal)({height:"70vh",id:"".concat(o,"selectedScopeIdItem"),onSelect:t=>{(0,a.navigate)((0,a.addParams)("".concat(o,"scopeId=").concat(t.groupid),null==e?void 0:e.redirectURL))},selectEventName:"".concat(o,"selectedScopeIdItem"),size:"lg",title:null==e?void 0:e.dialogTitle,url:null==e?void 0:e.selectScopeURL})})(r):(0,a.openSelectionModal)({buttonAddLabel:e.buttonAddLabel,height:e.modalHeight,iframeBodyCssClass:e.iframeBodyCssClass,multiple:"true"===d,onSelect:e=>_handleOnSelect({data:r,portletNamespace:o,selection:e}),selectEventName:o+i,size:u,title:c,url:s})}})};var a=o("frontend-js-web");function ownKeys(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,a)}return o}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(o),!0).forEach((function(t){_defineProperty(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function _defineProperty(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const e={buttonAddLabel:Liferay.Language.get("select"),iframeBodyCssClass:"",modalHeight:"70vh",size:"md"},_isObjectStrict=e=>"object"==typeof e&&!Array.isArray(e)&&null!==e&&!Object.prototype.hasOwnProperty.call(e,"currentTarget"),_getRedirectURLWithParams=({data:e,portletNamespace:t,selection:o})=>{const{itemValueKey:l,redirectURL:r,urlParamName:n}=e;return[o].reduce(((e,t)=>e.concat(t)),[]).reduce(((e,o)=>{let r;return r=l?o[l]:"string"==typeof o?o:JSON.stringify(o),(0,a.addParams)("".concat(t).concat(n,"=").concat(r),e)}),r)},_handleOnSelect=({data:e,portletNamespace:t,selection:o})=>{_isObjectStrict(o)&&(o=Object.values(o).filter((e=>!e.unchecked))),(0,a.navigate)(_getRedirectURLWithParams({data:e,portletNamespace:t,selection:o}))}}}));
//# sourceMappingURL=ContentDashboardManagementToolbarPropsTransformer.js.map