Liferay.Loader.define("document-library-web@6.0.77/document_library/js/FileEntryPicker",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=a("@frontend-taglib-clay$clayui/button"),r=u(a("@frontend-taglib-clay$clayui/form")),n=f(a("@frontend-taglib-clay$clayui/icon")),i=f(a("liferay!frontend-js-react-web$classnames")),c=(f(a("liferay!frontend-js-react-web$prop-types")),u(a("liferay!frontend-js-react-web$react")));function f(e){return e&&e.__esModule?e:{default:e}}function o(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return o=function(){return e},e}function u(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=o();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=l?Object.getOwnPropertyDescriptor(e,r):null;n&&(n.get||n.set)?Object.defineProperty(a,r,n):a[r]=e[r]}return a.default=e,t&&t.set(e,a),a}var d=({maxFileSize:e,namespace:t,validExtensions:a})=>{const f=Number(e),o="".concat(t,"file"),[u,d]=(0,c.useState)(""),[s,y]=(0,c.useState)(""),[m,p]=(0,c.useState)(!1);return(0,c.useEffect)((()=>{y(u?u.replace(/^.*[\\]/,""):"")}),[u]),c.default.createElement(r.default.Group,{className:(0,i.default)({"has-error":m})},c.default.createElement("label",{className:"btn btn-secondary",htmlFor:o},Liferay.Language.get("select-file")),s&&c.default.createElement(c.default.Fragment,null,c.default.createElement("small",{className:"inline-item inline-item-after"},c.default.createElement("strong",null,s)),c.default.createElement(l.ClayButtonWithIcon,{borderless:!0,displayType:"secondary",monospaced:!0,onClick:()=>d(""),symbol:"times-circle-full"})),c.default.createElement(r.ClayInput,{accept:a,className:"d-none",id:o,name:o,onChange:({target:e})=>{e.files[0].size>f?(p(!0),d("")):(p(!1),d(e.value),window["".concat(t,"updateFileNameAndTitle")]())},type:"file",value:u}),m&&c.default.createElement(r.default.FeedbackGroup,null,c.default.createElement(r.default.FeedbackItem,null,c.default.createElement(n.default,{className:"mr-1",symbol:"exclamation-full"}),Liferay.Util.sub(Liferay.Language.get("please-enter-a-file-with-a-valid-file-size-no-larger-than-x"),Liferay.Util.formatStorage(f,{addSpaceBeforeSuffix:!0})))))};t.default=d}}));
//# sourceMappingURL=FileEntryPicker.js.map