Liferay.Loader.define("@liferay/document-library-web@6.0.110/document_library/js/file-size-limit/FileSizeMimetypes",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/layout","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","liferay!document-library-web$uuid/v4","../../css/file_size_mimetypes.scss"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=o(a("@frontend-taglib-clay$clayui/button")),n=d(a("@frontend-taglib-clay$clayui/form")),r=o(a("@frontend-taglib-clay$clayui/icon")),i=o(a("@frontend-taglib-clay$clayui/layout")),u=(o(a("liferay!frontend-js-react-web$prop-types")),d(a("liferay!frontend-js-react-web$react"))),c=o(a("liferay!document-library-web$uuid/v4"));function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=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=f();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=l?Object.getOwnPropertyDescriptor(e,n):null;r&&(r.get||r.set)?Object.defineProperty(a,n,r):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}function o(e){return e&&e.__esModule?e:{default:e}}a("../../css/file_size_mimetypes.scss");const e="".concat(Liferay.Language.get("error-colon")," ").concat(Liferay.Language.get("please-enter-a-valid-number")),s=({handleAddClick:t,handleRemoveClick:a,index:c,mimeType:f="",portletNamespace:d,size:o=""})=>{const[m,s]=(0,u.useState)("");return u.default.createElement(i.default.Row,{className:"size-limit-row"},u.default.createElement(i.default.Col,{md:"6"},u.default.createElement("label",{htmlFor:"mimeType"},Liferay.Language.get("mime-type-field-label"),u.default.createElement("span",{className:"inline-item-after",title:Liferay.Language.get("mime-type-help-message")},u.default.createElement(r.default,{symbol:"question-circle-full"}))),u.default.createElement(n.ClayInput,{defaultValue:f,id:"mimeType",name:"".concat(d,"mimeType_").concat(c),type:"text"})),u.default.createElement(i.default.Col,{className:m?"has-error":"",md:"6"},u.default.createElement("label",{htmlFor:"size"},Liferay.Language.get("maximum-file-size"),u.default.createElement("span",{className:"inline-item-after",title:Liferay.Language.get("maximum-file-size-help-message")},u.default.createElement(r.default,{symbol:"question-circle-full"}))),u.default.createElement(n.ClayInput,{defaultValue:o,id:"size",name:"".concat(d,"size_").concat(c),onChange:({target:t})=>{s(t.validity.valid&&Number(t.value)>=0?"":e)},type:"number"}),c>0&&u.default.createElement(l.default,{"aria-label":Liferay.Language.get("remove"),className:"dm-field-repeatable-delete-button",onClick:()=>a(c),small:!0,title:Liferay.Language.get("remove"),type:"button"},u.default.createElement(r.default,{symbol:"hr"})),u.default.createElement(l.default,{className:"dm-field-repeatable-add-button",onClick:()=>t(c),small:!0,title:Liferay.Language.get("add"),type:"button"},u.default.createElement(r.default,{symbol:"plus"})),m&&u.default.createElement(n.default.FeedbackGroup,null,u.default.createElement(n.default.FeedbackItem,null,u.default.createElement(n.default.FeedbackIndicator,{symbol:"exclamation-full"}),m))))};var m=({description:e=Liferay.Language.get("file-size-mime-type-description"),portletNamespace:t,sizeList:a})=>{const l=()=>({id:(0,c.default)(),mimeType:"",size:""}),n=e=>{const t=[...i];t.splice(e+1,0,l()),f(t)},r=e=>{const t=[...i];t.splice(e,1),f(t)},[i,f]=(0,u.useState)(a&&a.length?a:[l()]);return u.default.createElement(u.default.Fragment,null,u.default.createElement("p",{className:"text-muted"},Liferay.Language.get(e)),i.map(((e,a)=>u.default.createElement(s,{handleAddClick:n,handleRemoveClick:r,index:a,key:e.id,mimeType:e.mimeType,portletNamespace:t,size:e.size}))))};t.default=m}}));
//# sourceMappingURL=FileSizeMimetypes.js.map