Liferay.Loader.define("fragment-web@4.0.73/js/FragmentCompositionDropdownPropsTransformer",["module","exports","require","frontend-js-web","./openDeleteFragmentModal"],(function(e,t,o){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function propsTransformer(t){let{actions:o,portletNamespace:n}=t,r=function _objectWithoutProperties(e,t){if(null==e)return{};var o,n,r=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(t,["actions","portletNamespace"]);const transformAction=t=>{var o;return"group"===t.type?_objectSpread(_objectSpread({},t),{},{items:null===(o=t.items)||void 0===o?void 0:o.map(transformAction)}):_objectSpread(_objectSpread({},t),{},{onClick(o){var r;const i=null===(r=t.data)||void 0===r?void 0:r.action;i&&(o.preventDefault(),e[i](t.data,n))}})};return _objectSpread(_objectSpread({},r),{},{actions:(o||[]).map(transformAction)})};var n=o("frontend-js-web"),r=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(o("./openDeleteFragmentModal"));function ownKeys(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}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={deleteFragmentComposition({deleteFragmentCompositionURL:e}){(0,r.default)({onDelete:()=>{submitForm(document.hrefFm,e)}})},deleteFragmentCompositionPreview({deleteFragmentCompositionPreviewURL:e}){submitForm(document.hrefFm,e)},moveFragmentComposition({fragmentCompositionId:e,moveFragmentCompositionURL:t,selectFragmentCollectionURL:o},r){(0,n.openSelectionModal)({onSelect:o=>{if(o){const i=document.getElementById("".concat(r,"fragmentEntryFm"));i&&(0,n.setFormValues)(i,{fragmentCollectionId:o.id,fragmentCompositionId:e}),submitForm(i,t)}},selectEventName:"".concat(r,"selectFragmentCollection"),title:Liferay.Language.get("select-fragment-set"),url:o})},renameFragmentComposition({fragmentCompositionId:e,fragmentCompositionName:t,renameFragmentCompositionURL:o},r){(0,n.openSimpleInputModal)({dialogTitle:Liferay.Language.get("rename-fragment"),formSubmitURL:o,idFieldName:"id",idFieldValue:e,mainFieldLabel:Liferay.Language.get("name"),mainFieldName:"name",mainFieldPlaceholder:Liferay.Language.get("name"),mainFieldValue:t,namespace:r})},updateFragmentCompositionPreview({fragmentCompositionId:e,itemSelectorURL:t},o){(0,n.openSelectionModal)({onSelect:t=>{if(t){const r=JSON.parse(t.value),i=document.getElementById("".concat(o,"fragmentCompositionPreviewFm"));i&&((0,n.setFormValues)(i,{fileEntryId:r.fileEntryId,fragmentCompositionId:e}),submitForm(i))}},selectEventName:"".concat(o,"changePreview"),title:Liferay.Language.get("fragment-thumbnail"),url:t})}}}}));
//# sourceMappingURL=FragmentCompositionDropdownPropsTransformer.js.map