Liferay.Loader.define("@liferay/document-library-web@6.0.163/document_library/js/DLFolderSelector",["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")),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),l=_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 n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=r?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(a,n,l):a[n]=e[n]}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:u,redirect:i,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),[v,j]=(0,c.useState)(""),[S,F]=(0,c.useState)("");return(0,c.useEffect)((()=>{F(-1===_||void 0===g||g===_?L:"(".concat(v,") ").concat(L))}),[v,_,L,g]),c.default.createElement(l.default,{onSubmit:r=>{r.preventDefault();const n=(0,o.objectToFormData)("folder"===a?{["".concat(u,"sourceRepositoryId")]:g,["".concat(u,"sourceFolderId")]:p,["".concat(u,"destinationParentFolderId")]:h,["".concat(u,"destinationRepositoryId")]:_}:{["".concat(u,"fileEntryId")]:f,["".concat(u,"fileShortcutId")]:t,["".concat(u,"destinationFolderId")]:h,["".concat(u,"destinationRepositoryId")]:_});(0,o.fetch)(e,{body:n,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)(i)})).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(l.default.Group,null,c.default.createElement("label",{htmlFor:"".concat(u,"copyFromInput")},Liferay.Language.get("copy-from")),c.default.createElement(l.ClayInput,{className:"c-mb-3",disabled:!0,id:"".concat(u,"copyFromInput"),placeholder:s||y,type:"text"}),c.default.createElement("label",{htmlFor:"".concat(u,"copyToInput")},Liferay.Language.get("copy-to")),c.default.createElement(l.ClayInput.Group,null,c.default.createElement(l.ClayInput.GroupItem,null,c.default.createElement(l.ClayInput,{disabled:!0,id:"".concat(u,"copyToInput"),placeholder:S,type:"text"})),c.default.createElement(l.ClayInput.GroupItem,{shrink:!0},c.default.createElement(n.default,{displayType:"secondary",onClick:e=>{e.preventDefault(),(0,o.openSelectionModal)({onSelect(e){e&&(I(e.foldername),E(e.folderid),R(e.repositoryid),j(e.repositoryname),b(!1))},selectEventName:"".concat(u,"folderSelected"),title:(0,o.sub)(Liferay.Language.get("select")),url:d})}},Liferay.Language.get("select"))))),c.default.createElement(n.default.Group,{spaced:!0},c.default.createElement(n.default,{disabled:m,displayType:"primary",type:"submit"},Liferay.Language.get("copy")),c.default.createElement(n.default,{displayType:"secondary",onClick:()=>(0,o.navigate)(i)},Liferay.Language.get("cancel"))))};t.default=_default}}));
//# sourceMappingURL=DLFolderSelector.js.map