Liferay.Loader.define("document-library-web@6.0.77/document_library/js/digital-signature/DigitalSignatureUtil",["module","exports","require","frontend-js-web"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.collectDigitalSignature=async function(t,n){const i=await(0,a.fetch)((0,a.createResourceURL)(themeDisplay.getLayoutRelativeControlPanelURL(),{p_p_id:n,p_p_resource_id:"/digital_signature/get_invalid_file_extensions"}),{body:(0,a.objectToFormData)({["_".concat(n,"_fileEntryIds")]:t}),method:"POST"}),l=await i.json(),o=l.map((({fileEntryId:e})=>e)),r=t.filter((e=>!o.includes(Number(e)))),c=r.length>e;if(l.length||c)return g({crossedFileCountLimit:c,digitalSignaturePortlet:n,invalidFileExtensions:l,validFileExtensionEntryIds:r});s(n,t.length>1?t.join(","):t[0])};var a=n("frontend-js-web");const e=10,i={cancel:Liferay.Language.get("cancel"),continue:Liferay.Language.get("continue"),deselected:Liferay.Language.get("deselected"),maximum_files_message:Liferay.Util.sub(Liferay.Language.get("maximum-of-x-files-per-envelope"),e)},l=e=>"".concat(Liferay.Util.sub(Liferay.Language.get("these-file-extensions-are-not-supported-by-docusign-and-have-been-x"),c(i.deselected)),'\n\n\t<p class="mt-2">').concat(Liferay.Util.sub(Liferay.Language.get("please-x-or-x-to-choose-new-documents"),c(i.continue),c(i.cancel)),"</p>\n\t\n\t<ul>\n\t\t").concat(e.map((({fileName:e})=>'<li class="font-weight-bold">'.concat(e,"</li>"))).join(" "),"\n\t</ul>"),o=t=>'<div class="alert alert-warning">\n\t\t'.concat(Liferay.Util.sub(Liferay.Language.get("you-have-exceeded-the-maximum-amount-of-x-files-allowed-per-envelope"),e),"\n\n\t\t").concat(t?'<div class="mt-2">'.concat(Liferay.Util.sub(Liferay.Language.get("please-x-or-x-to-remove-files-in-your-envelope"),c(i.continue),c(i.cancel)),"</div>"):"","\n\t</div>"),r=(e,t)=>{let n="";return e&&(n+=o(0===t.length)),t.length&&(n+=l(t)),n},s=(e,t)=>(0,a.navigate)((0,a.createPortletURL)(themeDisplay.getLayoutRelativeControlPanelURL(),{backURL:window.location.href,fileEntryId:t,mvcRenderCommandName:"/digital_signature/collect_digital_signature",p_p_id:e}).toString()),c=e=>"<strong>".concat(e.toLowerCase(),"</strong>"),g=({crossedFileCountLimit:t,digitalSignaturePortlet:n,invalidFileExtensions:i,validFileExtensionEntryIds:l})=>(0,a.openModal)({bodyHTML:r(t,i),buttons:[{displayType:"secondary",label:Liferay.Language.get("cancel"),type:"cancel"},{label:Liferay.Language.get("continue"),onClick:()=>s(n,l),type:"button"}],status:"warning",title:0===i.length?Liferay.Util.sub(Liferay.Language.get("maximum-of-x-files-per-envelope"),e):Liferay.Language.get("file-extensions-not-supported")})}}));
//# sourceMappingURL=DigitalSignatureUtil.js.map