import{a as e,l as t}from"./preact.module-CNakwbc9.js";import{d as n,s as r}from"./hooks.module-BrXTvcfS.js";import{a as i}from"./i18n-BaLR3UdQ.js";import{t as a}from"./server-BXh06Wz_.js";import{t as o}from"./jsxRuntime.module-Cao1NCKs.js";import{J as s}from"./hooks-ClTXKdUl.js";import{t as c}from"./Modal-hBkTa-Ee.js";import{t as l}from"./Button-Du0dYm4Z.js";import{t as u}from"./FormTextBox-BLQGoABI.js";import{t as d}from"./FormCheckbox-B6Pj6_Zs.js";import{t as f}from"./FormGroup-DqPd4bBP.js";import{t as p}from"./FormRadioGroup-CxQQUk-2.js";n(),t();function m(){let[t,n]=r(),[m,h]=r(`title`),[g,_]=r(`asc`),[v,y]=r(!1),[b,x]=r(!1),[S,C]=r(``),[w,T]=r(!1);s(`sortChildNotes`,({node:e,noteId:t})=>{let r=t??e?.data.noteId;r&&(n(r),T(!0))});async function E(){await a.put(`notes/${t}/sort-children`,{sortBy:m,sortDirection:g,foldersFirst:v,sortNatural:b,sortLocale:S}),T(!1)}return o(c,{className:`sort-child-notes-dialog`,title:i(`sort_child_notes.sort_children_by`),size:`lg`,maxWidth:500,onSubmit:E,onHidden:()=>T(!1),show:w,footer:o(e,{children:[o(l,{text:i(`modal.cancel`),onClick:()=>T(!1)}),o(l,{text:i(`sort_child_notes.sort`),keyboardShortcut:`Enter`})]}),children:[o(`h5`,{children:i(`sort_child_notes.sorting_criteria`)}),o(p,{name:`sort-by`,values:[{value:`title`,label:i(`sort_child_notes.title`)},{value:`dateCreated`,label:i(`sort_child_notes.date_created`)},{value:`dateModified`,label:i(`sort_child_notes.date_modified`)}],currentValue:m,onChange:h}),o(`br`,{}),o(`h5`,{children:i(`sort_child_notes.sorting_direction`)}),o(p,{name:`sort-direction`,values:[{value:`asc`,label:i(`sort_child_notes.ascending`)},{value:`desc`,label:i(`sort_child_notes.descending`)}],currentValue:g,onChange:_}),o(`br`,{}),o(`h5`,{children:i(`sort_child_notes.folders`)}),o(d,{label:i(`sort_child_notes.sort_folders_at_top`),name:`sort-folders-first`,currentValue:v,onChange:y}),o(`br`,{}),o(`h5`,{children:i(`sort_child_notes.natural_sort`)}),o(d,{name:`sort-natural`,label:i(`sort_child_notes.sort_with_respect_to_different_character_sorting`),currentValue:b,onChange:x}),o(f,{name:`sort-locale`,className:`form-check`,label:i(`sort_child_notes.natural_sort_language`),description:i(`sort_child_notes.the_language_code_for_natural_sort`),children:o(u,{currentValue:S,onChange:C})})]})}export{m as default};