import{d as e,l as t,s as n}from"./hooks.module-BrXTvcfS.js";import{Dt as r,at as i}from"./content_renderer-DOj8g78V.js";import{a}from"./i18n-BaLR3UdQ.js";import{t as o}from"./options-CDXBc9UM.js";import{t as s}from"./jsxRuntime.module-Cao1NCKs.js";import{J as c}from"./hooks-ClTXKdUl.js";import{t as l}from"./Modal-hBkTa-Ee.js";import{t as u}from"./Button-Du0dYm4Z.js";import{t as d}from"./FormFileUpload-r12zFD32.js";import{t as f}from"./FormCheckbox-B6Pj6_Zs.js";import{t as p}from"./FormGroup-DqPd4bBP.js";e();function m(){let[e,m]=n(),[h,g]=n(null),[_,v]=n(o.is(`compressImages`)),[y,b]=n(!1),[x,S]=n(void 0),[C,w]=n(!1);return c(`showUploadAttachmentsDialog`,({noteId:e})=>{m(e),w(!0)}),t(()=>{e&&r.getNoteTitle(e).then(e=>S(a(`upload_attachments.files_will_be_uploaded`,{noteTitle:e})))},[e]),s(l,{className:`upload-attachments-dialog`,size:`lg`,title:a(`upload_attachments.upload_attachments_to_note`),footer:s(u,{text:a(`upload_attachments.upload`),kind:`primary`,disabled:!h||y}),onSubmit:async()=>{if(!h||!e)return;b(!0);let t=Array.from(h);await i.uploadFiles(`attachments`,e,t,{shrinkImages:_}),b(!1),w(!1)},onHidden:()=>{w(!1),g(null)},show:C,children:[s(p,{name:`files`,label:a(`upload_attachments.choose_files`),description:x,children:s(d,{onChange:g,multiple:!0})}),s(p,{name:`shrink-images`,label:a(`upload_attachments.options`),children:s(f,{hint:a(`upload_attachments.tooltip`),label:a(`upload_attachments.shrink_images`),currentValue:_,onChange:v})})]})}export{m as default};