import{r as e}from"./chunk-QTnfLwEv.js";import{n as t}from"./index-7yDgay5u.js";import{o as n,t as r}from"./jsx-runtime-DHSfUA5-.js";import{P as i,l as a}from"./test.id-DxQrYxPk.js";import{t as o}from"./diaryService-CNt2_Lb5.js";import{t as s}from"./navigationService-BNBSAd9W.js";import{t as c}from"./useSuccessToast-CW8oLO3e.js";import{t as l}from"./HeaderPage-CPQpvQQw.js";import{t as u}from"./TextInputRow-DqOYjq7o.js";var d=e(n(),1),f=r();function p(){let e=i(o),n=i(s),r=c(),[p,m]=(0,d.useState)(``),h=p.trim(),g=h.length>0;return(0,f.jsx)(l,{pageTestId:a.page,contentTestId:a.content,header:{title:t(`diary.create`,`New notebook`),showBack:!0,right:{type:`button`,label:t(`common.save`,`Save`),disabled:!g,testId:a.save,onClick:()=>{if(!g)return;let i;try{i=e.addNotebook(h)}catch{r({message:t(`diary.name.duplicate`,`A notebook with this name already exists`),icon:`none`,testId:a.duplicateToast});return}n.navigate({path:`/diary/${i}`,replace:!0})}}},children:(0,f.jsx)(u,{id:`notebookName`,testId:a.nameInput,autoFocus:!0,placeholder:t(`diary.name`,`Notebook name`),value:p,onChange:m})})}export{p as DiariesNewPage};
//# sourceMappingURL=new-DBXJQHHe.js.map