Liferay.Loader.define("document-library-web@6.0.77/document_library/js/DLManagementToolbarPropsTransformer",["module","exports","require","frontend-js-web","./digital-signature/DigitalSignatureUtil"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){let{additionalProps:{collectDigitalSignaturePortlet:t,downloadEntryURL:n,editEntryURL:c,folderConfiguration:a,openViewMoreFileEntryTypesURL:i,selectFileEntryTypeURL:u,selectFolderURL:s,trashEnabled:d,viewFileEntryTypeURL:g},portletNamespace:f}=e,y=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},c=Object.keys(e);for(o=0;o<c.length;o++)n=c[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(o=0;o<c.length;o++)n=c[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,["additionalProps","portletNamespace"]);const m=(e,t)=>{if(!e)return;const n=document.getElementById("".concat(f,"fm2"));if(!n)return;n.setAttribute("method","post");const o=n.querySelector("#".concat(f,"javax-portlet-action"));o&&o.setAttribute("value",e);const r=n.querySelector("#".concat(f,"cmd"));r&&r.setAttribute("value",e),submitForm(n,t,!1)};return l(l({},y),{},{onActionButtonClick(e,{item:l}){var i;const u=null==l||null===(i=l.data)||void 0===i?void 0:i.action;"checkin"===u?Liferay.componentReady("".concat(f,"DocumentLibraryCheckinModal")).then((e=>{e.open(((e,t)=>{const n=document.getElementById("".concat(f,"fm2"));if(!n)return;const o=n.querySelector("#".concat(f,"changeLog"));o&&o.setAttribute("value",t);const r=n.querySelector("#".concat(f,"versionIncrease"));r&&r.setAttribute("value",e),m("checkin",c)}))})):"checkout"===u?m("checkout",c):"collectDigitalSignature"===u?(0,r.collectDigitalSignature)(Liferay.SearchContainer.get(y.searchContainerId).select.getAllSelectedElements().get("value"),t):"deleteEntries"===u?(()=>{let e;d?e="move_to_trash":confirm(Liferay.Language.get("are-you-sure-you-want-to-delete-the-selected-entries"))&&(e="delete"),m(e,c)})():"download"===u?m("download",n):"editCategories"===u?(()=>{const e=Liferay.SearchContainer.get(y.searchContainerId);Liferay.componentReady("".concat(f,"EditCategoriesComponent")).then((t=>{var n;const o=null===(n=e.select)||void 0===n?void 0:n.get("bulkSelection"),r=e.select.getAllSelectedElements().get("value");t.open(r,o,a.defaultParentFolderId)}))})():"editTags"===u?(()=>{const e=Liferay.SearchContainer.get(y.searchContainerId);Liferay.componentReady("".concat(f,"EditTagsComponent")).then((t=>{var n;const o=null===(n=e.select)||void 0===n?void 0:n.get("bulkSelection"),r=e.select.getAllSelectedElements().get("value");t.open(r,o,a.defaultParentFolderId)}))})():"move"===u&&(()=>{const e=Liferay.SearchContainer.get(y.searchContainerId);let t=0;e.select&&(t=e.select.getAllSelectedElements().filter(":enabled").size());const n=1===t?Liferay.Language.get("select-destination-folder-for-x-item"):Liferay.Language.get("select-destination-folder-for-x-items");(0,o.openSelectionModal)({height:"480px",id:"".concat(f,"selectFolder"),onSelect(e){const t=e.folderid,n=document.getElementById("".concat(f,"fm2"));if(!n)return;n.setAttribute("action",c),n.setAttribute("enctype","multipart/form-data"),n.setAttribute("method","post");const o=n.querySelector("#".concat(f,"cmd"));o&&o.setAttribute("value","move");const r=n.querySelector("#".concat(f,"newFolderId"));r&&r.setAttribute("value",t),submitForm(n,c,!1)},selectEventName:"".concat(f,"selectFolder"),size:"lg",title:Liferay.Util.sub(n,[t]),url:s})})()},onFilterDropdownItemClick(e,{item:t}){var n;"openDocumentTypesSelector"===(null==t||null===(n=t.data)||void 0===n?void 0:n.action)&&(0,o.openSelectionModal)({onSelect(e){if(e){const t=(0,o.addParams)("".concat(f,"fileEntryTypeId=").concat(e.value),g);(0,o.navigate)(t)}},selectEventName:"".concat(f,"selectFileEntryType"),title:Liferay.Language.get("select-document-type"),url:u})},onShowMoreButtonClick(){(0,o.openModal)({title:Liferay.Language.get("more"),url:i})}})};var o=n("frontend-js-web"),r=n("./digital-signature/DigitalSignatureUtil");function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}}}));
//# sourceMappingURL=DLManagementToolbarPropsTransformer.js.map