Liferay.Loader.define("journal-web@5.0.100/js/ElementsDefaultPropsTransformer",["module","exports","require","frontend-js-web","./modals/openDeleteArticleModal"],(function(e,t,r){var a;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){let{actions:r,additionalProps:{trashEnabled:a},items:n,portletNamespace:o}=t,i=function(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r,a,n={},o=Object.keys(e);for(a=0;a<o.length;a++)r=o[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)r=o[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}(t,["actions","additionalProps","items","portletNamespace"]);const l=t=>{var r;const n=e[null===(r=t.data)||void 0===r?void 0:r.action],i=s({},t);return"function"==typeof n&&(i.onClick=r=>{r.preventDefault(),n.call(e,{itemData:t.data,portletNamespace:o,trashEnabled:a})}),Array.isArray(t.items)&&(i.items=t.items.map(l)),i};return s(s({},i),{},{actions:null==r?void 0:r.map(l),items:null==n?void 0:n.map(l)})};var n=r("frontend-js-web"),o=(a=r("./modals/openDeleteArticleModal"))&&a.__esModule?a:{default:a};function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){l(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(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={compareVersions({itemData:e,portletNamespace:t}){(0,n.openSelectionModal)({onSelect:r=>{let a=e.redirectURL;a=(0,n.addParams)("".concat(t,"sourceVersion=").concat(r.sourceversion),a),a=(0,n.addParams)("".concat(t,"targetVersion=").concat(r.targetversion),a),location.href=a},selectEventName:"".concat(t,"selectVersionFm"),title:Liferay.Language.get("compare-versions"),url:e.compareVersionsURL})},copyArticle({itemData:e}){this.send(e.copyArticleURL)},delete({itemData:e,trashEnabled:t}){t?this.send(e.deleteURL):(0,o.default)({onDelete:()=>{this.send(e.deleteURL)}})},deleteArticleTranslations({itemData:e,portletNamespace:t}){(0,n.openSelectionModal)({buttonAddLabel:Liferay.Language.get("delete"),multiple:!0,onSelect:r=>{(null==r?void 0:r.length)&&(0,n.openConfirmModal)({message:Liferay.Language.get("are-you-sure-you-want-to-delete-the-selected-entries"),onConfirm:a=>{if(a){const a=document.hrefFm;if(!a)return;const n=document.createElement("input");n.name="".concat(t,"rowIds"),n.value=r.map((e=>e.value)),a.appendChild(n),submitForm(a,e.deleteArticleTranslationsURL)}}})},title:Liferay.Language.get("delete-translations"),url:e.selectArticleTranslationsURL})},discardArticleDraft({itemData:e}){this.send(e.discardArticleDraftURL)},expireArticles({itemData:e}){this.send(e.expireURL)},permissions({itemData:e}){(0,n.openModal)({title:Liferay.Language.get("permissions"),url:e.permissionsURL})},preview({itemData:e}){(0,n.openModal)({iframeBodyCssClass:"",title:e.title,url:e.previewURL})},publishArticleToLive({itemData:e}){(0,n.openConfirmModal)({message:Liferay.Language.get("are-you-sure-you-want-to-publish-the-selected-web-content"),onConfirm:t=>t&&this.send(e.publishArticleURL)})},publishFolderToLive({itemData:e}){(0,n.openConfirmModal)({message:Liferay.Language.get("are-you-sure-you-want-to-publish-the-selected-folder"),onConfirm:t=>t&&this.send(e.publishFolderURL)})},send(e){submitForm(document.hrefFm,e)},subscribeArticle({itemData:e}){this.send(e.subscribeArticleURL)},unsubscribeArticle({itemData:e}){this.send(e.unsubscribeArticleURL)}}}}));
//# sourceMappingURL=ElementsDefaultPropsTransformer.js.map