Liferay.Loader.define("journal-web@5.0.105/js/ElementsDefaultPropsTransformer",["module","exports","require","frontend-js-web","./modals/openDeleteArticleModal"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function propsTransformer(t){let{actions:r,additionalProps:{trashEnabled:o},items:n,portletNamespace:a}=t,i=function _objectWithoutProperties(e,t){if(null==e)return{};var r,o,n=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}(t,["actions","additionalProps","items","portletNamespace"]);const bindAction=t=>{var r;const n=e[null===(r=t.data)||void 0===r?void 0:r.action],i=_objectSpread({},t);return"function"==typeof n&&(i.onClick=r=>{r.preventDefault(),n.call(e,{itemData:t.data,portletNamespace:a,trashEnabled:o})}),Array.isArray(t.items)&&(i.items=t.items.map(bindAction)),i};return _objectSpread(_objectSpread({},i),{},{actions:null==r?void 0:r.map(bindAction),items:null==n?void 0:n.map(bindAction)})};var o=r("frontend-js-web"),n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r("./modals/openDeleteArticleModal"));function ownKeys(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 _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}const e={compareVersions({itemData:e,portletNamespace:t}){(0,o.openSelectionModal)({onSelect:r=>{let n=e.redirectURL;n=(0,o.addParams)("".concat(t,"sourceVersion=").concat(r.sourceversion),n),n=(0,o.addParams)("".concat(t,"targetVersion=").concat(r.targetversion),n),location.href=n},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,n.default)({onDelete:()=>{this.send(e.deleteURL)}})},deleteArticleTranslations({itemData:e,portletNamespace:t}){(0,o.openSelectionModal)({buttonAddLabel:Liferay.Language.get("delete"),multiple:!0,onSelect:r=>{(null==r?void 0:r.length)&&(0,o.openConfirmModal)({message:Liferay.Language.get("are-you-sure-you-want-to-delete-the-selected-entries"),onConfirm:o=>{if(o){const o=document.hrefFm;if(!o)return;const n=document.createElement("input");n.name="".concat(t,"rowIds"),n.value=r.map((e=>e.value)),o.appendChild(n),submitForm(o,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,o.openModal)({title:Liferay.Language.get("permissions"),url:e.permissionsURL})},preview({itemData:e}){(0,o.openModal)({iframeBodyCssClass:"",title:e.title,url:e.previewURL})},publishArticleToLive({itemData:e}){(0,o.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,o.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