import{d as e,s as t,t as n}from"./hooks.module-BrXTvcfS.js";import{Dt as r,H as i}from"./content_renderer-DOj8g78V.js";import{a}from"./i18n-BaLR3UdQ.js";import{t as o}from"./jsxRuntime.module-Cao1NCKs.js";import{J as s,X as c}from"./hooks-ClTXKdUl.js";import{n as l}from"./note_autocomplete-BT55HtG6.js";import{t as u}from"./Modal-hBkTa-Ee.js";import{t as d}from"./Button-Du0dYm4Z.js";import{t as f}from"./NoteAutocomplete-Cpc7J_0A.js";import{t as p}from"./FormGroup-DqPd4bBP.js";import{t as m}from"./FormRadioGroup-CxQQUk-2.js";e();function h(){let e=n(null),[r,i]=t(null),[h,_]=c(`includeNoteDefaultBoxSize`),[v,y]=t(h),[b,x]=t(!1);s(`showIncludeNoteDialog`,({editorApi:t})=>{e.current=t,y(h),x(!0)});let S=n(null);return o(u,{className:`include-note-dialog`,title:a(`include_note.dialog_title`),size:`lg`,onShown:()=>l(S.current),onHidden:()=>x(!1),onSubmit:async()=>{!r?.notePath||!e.current||(x(!1),await g(r.notePath,e.current,v),v!==h&&_(v))},footer:o(d,{text:a(`include_note.button_include`),keyboardShortcut:`Enter`}),show:b,children:[o(p,{name:`note`,label:a(`include_note.label_note`),children:o(f,{placeholder:a(`include_note.placeholder_search`),onChange:i,inputRef:S,opts:{hideGoToSelectedNoteButton:!0,allowCreatingNotes:!0}})}),o(p,{name:`include-note-box-size`,label:a(`include_note.box_size_prompt`),children:o(m,{name:`include-note-box-size`,currentValue:v,onChange:y,values:[{label:a(`include_note.box_size_small`),value:`small`},{label:a(`include_note.box_size_medium`),value:`medium`},{label:a(`include_note.box_size_full`),value:`full`},{label:a(`include_note.box_size_expandable`),value:`expandable`}]})})]})}async function g(e,t,n){let a=r.getNoteIdFromUrl(e);if(!a)return;let o=await i.getNote(a);[`image`,`canvas`,`mermaid`].includes(o?.type??``)?t.addImage(a):t.addIncludeNote(a,n)}export{h as default};