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