Liferay.Loader.define("asset-categories-admin-web@5.0.63/js/ActionsComponentPropsTransformer",["module","exports","require","frontend-js-web","./openDeleteVocabularyModal"],(function(e,t,r){var o;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){let{additionalProps:{deleteVocabulariesURL:r,redirectURL:o,viewVocabulariesURL:a},items:n,portletNamespace:l}=t;return c(c({},function(e,t){if(null==e)return{};var r,o,a=function(e,t){if(null==e)return{};var r,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(t,["additionalProps","items","portletNamespace"])),{},{items:n.map((t=>c(c({},t),{},{onClick(n){var c;const i=null===(c=t.data)||void 0===c?void 0:c.action;i&&(n.preventDefault(),e[i]({deleteVocabulariesURL:r,portletNamespace:l,redirectURL:o,viewVocabulariesURL:a}))}})))})};var a=r("frontend-js-web"),n=(o=r("./openDeleteVocabularyModal"))&&o.__esModule?o:{default:o};function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const e={deleteVocabularies({deleteVocabulariesURL:e,portletNamespace:t,redirectURL:r,viewVocabulariesURL:o}){(0,a.openSelectionModal)({buttonAddLabel:Liferay.Language.get("delete"),multiple:!0,onSelect:o=>{o.length&&(0,n.default)({multiple:!0,onDelete:()=>{(0,a.fetch)(e,{body:(0,a.objectToFormData)({["".concat(t,"rowIds")]:o.map((e=>e.value)).join(",")}),method:"POST"}).then((e=>{if(console.log("responseeee: "+e),e.ok)return e.json();s()})).then((e=>{console.log("dataaaaaaa: "+e),e.success?((0,a.navigate)(r),(0,a.openToast)({message:Liferay.Language.get("your-request-completed-successfully"),type:"success"})):s(e.errorMessage)})).catch((()=>{s()}))}})},title:Liferay.Language.get("delete-vocabulary"),url:o})}},s=e=>{(0,a.openToast)({message:e||Liferay.Language.get("an-unexpected-error-occurred"),type:"danger"})}}}));
//# sourceMappingURL=ActionsComponentPropsTransformer.js.map