Liferay.Loader.define("@liferay/document-library-web@6.0.154/document_library/js/DDMFolderSelector",["module","exports","require","@frontend-taglib-clay$clayui/alert","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","frontend-js-web","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/alert")),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),n=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),o=a("frontend-js-web"),c=_interopRequireWildcard(a("liferay!frontend-js-react-web$react"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=r?Object.getOwnPropertyDescriptor(e,l):null;n&&(n.get||n.set)?Object.defineProperty(a,l,n):a[l]=e[l]}return a.default=e,t&&t.set(e,a),a}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=({copyActionURL:e,fileShortcutId:t,itemType:a,portletNamespace:i,redirect:u,selectionModalURL:d,sourceFileEntryId:f,sourceFileName:y,sourceFolderId:p,sourceFolderName:s,sourceRepositoryId:g})=>{const[m,b]=(0,c.useState)(!0),[L,I]=(0,c.useState)(""),[h,E]=(0,c.useState)(-1),[_,R]=(0,c.useState)(-1);return c.default.createElement(n.default,{onSubmit:r=>{r.preventDefault();const l=(0,o.objectToFormData)("folder"===a?{["".concat(i,"sourceRepositoryId")]:g,["".concat(i,"sourceFolderId")]:p,["".concat(i,"destinationParentFolderId")]:h,["".concat(i,"destinationRepositoryId")]:_}:{["".concat(i,"fileEntryId")]:f,["".concat(i,"fileShortcutId")]:t,["".concat(i,"destinationFolderId")]:h,["".concat(i,"destinationRepositoryId")]:_});(0,o.fetch)(e,{body:l,method:"POST"}).then((e=>e.json())).then((({errorMessage:e})=>{e?(0,o.openToast)({message:e,title:Liferay.Language.get("error"),type:"danger"}):(0,o.navigate)(u)})).catch((e=>{(0,o.openToast)({message:e.message,title:Liferay.Language.get("error"),type:"danger"})}))}},c.default.createElement(r.default,{className:"c-mb-4",displayType:"warning",title:Liferay.Language.get("alert")},Liferay.Language.get("document-library-copy-folder-help")),c.default.createElement(n.default.Group,null,c.default.createElement("label",{htmlFor:"".concat(i,"copyFromInput")},Liferay.Language.get("copy-from")),c.default.createElement(n.ClayInput,{className:"c-mb-3",disabled:!0,id:"".concat(i,"copyFromInput"),placeholder:s||y,type:"text"}),c.default.createElement("label",{htmlFor:"".concat(i,"copyToInput")},Liferay.Language.get("copy-to")),c.default.createElement(n.ClayInput.Group,null,c.default.createElement(n.ClayInput.GroupItem,null,c.default.createElement(n.ClayInput,{disabled:!0,id:"".concat(i,"copyToInput"),placeholder:L,type:"text"})),c.default.createElement(n.ClayInput.GroupItem,{shrink:!0},c.default.createElement(l.default,{displayType:"secondary",onClick:e=>{e.preventDefault(),(0,o.openSelectionModal)({onSelect(e){e&&(I(e.foldername),E(e.folderid),R(e.repositoryid),b(!1))},selectEventName:"".concat(i,"folderSelected"),title:(0,o.sub)(Liferay.Language.get("select-x"),"folder"),url:d})}},Liferay.Language.get("select"))))),c.default.createElement(l.default.Group,{spaced:!0},c.default.createElement(l.default,{disabled:m,displayType:"primary",type:"submit"},Liferay.Language.get("copy")),c.default.createElement(l.default,{displayType:"secondary",onClick:()=>(0,o.navigate)(u)},Liferay.Language.get("cancel"))))};t.default=_default}}));
//# sourceMappingURL=DDMFolderSelector.js.map