Liferay.Loader.define("fragment-web@4.0.73/js/FragmentEntryDropdownPropsTransformer",["module","exports","require","@liferay/frontend-js-react-web","frontend-js-web","./CopyFragmentModal","./openDeleteFragmentModal"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function propsTransformer(t){let{actions:r,additionalProps:{fragmentCollections:n},portletNamespace:a}=t,o=function _objectWithoutProperties(e,t){if(null==e)return{};var r,n,a=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(t,["actions","additionalProps","portletNamespace"]);const transformAction=t=>{var r;return"group"===t.type?_objectSpread(_objectSpread({},t),{},{items:null===(r=t.items)||void 0===r?void 0:r.map(transformAction)}):_objectSpread(_objectSpread({},t),{},{onClick(r){var o;const i=null===(o=t.data)||void 0===o?void 0:o.action;i&&(r.preventDefault(),e[i](t.data,a,n))}})};return _objectSpread(_objectSpread({},o),{},{actions:(r||[]).map(transformAction)})};var n=r("@liferay/frontend-js-react-web"),a=r("frontend-js-web"),o=_interopRequireDefault(r("./CopyFragmentModal")),i=_interopRequireDefault(r("./openDeleteFragmentModal"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}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}const e={copyFragmentEntry({copyFragmentEntryURL:e,fragmentCollectionId:t,fragmentEntryId:r},n){const o=document.getElementById("".concat(n,"fragmentEntryFm"));o&&((0,a.setFormValues)(o,{fragmentCollectionId:t,fragmentEntryIds:r}),submitForm(o,e))},copyToFragmentEntry({copyFragmentEntryURL:e,fragmentEntryId:t},r,a){(0,n.render)(o.default,{copyFragmentEntriesURL:e,fragmentCollections:a,fragmentEntryIds:[t],portletNamespace:r},document.createElement("div"))},deleteDraftFragmentEntry({deleteDraftFragmentEntryURL:e}){(0,a.openConfirmModal)({message:Liferay.Language.get("are-you-sure-you-want-to-delete-this"),onConfirm:t=>{t&&submitForm(document.hrefFm,e)}})},deleteFragmentEntry({deleteFragmentEntryURL:e}){(0,i.default)({onDelete:()=>{submitForm(document.hrefFm,e)}})},deleteFragmentEntryPreview({deleteFragmentEntryPreviewURL:e}){submitForm(document.hrefFm,e)},moveFragmentEntry({fragmentEntryId:e,moveFragmentEntryURL:t,selectFragmentCollectionURL:r},n){(0,a.openSelectionModal)({onSelect:r=>{if(r){const o=document.getElementById("".concat(n,"fragmentEntryFm"));o&&(0,a.setFormValues)(o,{fragmentCollectionId:r.id,fragmentEntryIds:e}),submitForm(o,t)}},selectEventName:"".concat(n,"selectFragmentCollection"),title:Liferay.Language.get("select-fragment-set"),url:r})},renameFragmentEntry({fragmentEntryId:e,fragmentEntryName:t,updateFragmentEntryURL:r},n){(0,a.openSimpleInputModal)({dialogTitle:Liferay.Language.get("rename-fragment"),formSubmitURL:r,idFieldName:"id",idFieldValue:e,mainFieldLabel:Liferay.Language.get("name"),mainFieldName:"name",mainFieldPlaceholder:Liferay.Language.get("name"),mainFieldValue:t,namespace:n})},updateFragmentEntryPreview({fragmentEntryId:e,itemSelectorURL:t},r){(0,a.openSelectionModal)({onSelect:t=>{if(t){const n=JSON.parse(t.value),o=document.getElementById("".concat(r,"fragmentEntryPreviewFm"));o&&((0,a.setFormValues)(o,{fileEntryId:n.fileEntryId,fragmentEntryId:e}),submitForm(o))}},selectEventName:"".concat(r,"changePreview"),title:Liferay.Language.get("fragment-thumbnail"),url:t})}}}}));
//# sourceMappingURL=FragmentEntryDropdownPropsTransformer.js.map