import{G as e,H as t}from"./content_renderer-DOj8g78V.js";import"./src-UeATgcQ9.js";import{c as n,i as r,s as i,t as a,u as o}from"./task_states-40T2foIO.js";import{a as s}from"./i18n-BaLR3UdQ.js";import{i as c}from"./toast-C6WyPqyA.js";var l=`task-states-validation`,u=null;function d(e){let t=e.map(e=>`${e.id}:${e.reason}`).sort().join(`,`);if(t!==u){if(u=t,e.length===0){c.closePersistent(l);return}c.showPersistent({id:l,icon:`bx bx-list-check`,title:s(`text-editor.task-state-dropped-title`),message:s(`text-editor.task-state-dropped-message`,{count:e.length}),notesHeading:s(`text-editor.task-state-dropped-heading`),notes:e.filter(e=>e.id).map(e=>({noteId:e.id,description:s(`text-editor.validation-errors.${e.reason}`)})),wide:!0,timeout:6e4,buttons:[{text:s(`text-editor.task-state-dropped-configure`),onClick:({dismissToast:e})=>{p(),e()}}]})}}async function f(){let e=await t.getNote(n);if(!e)return a;let{valid:s,errors:c}=o((await e.getChildNotes()).map(e=>e.noteId===`_taskStateNone`?i:e.noteId===`_taskStateDone`?r:e.isArchived?null:{id:e.noteId,name:e.getLabelValue(`stateId`)??``,title:e.title,markdownSymbol:e.getLabelValue(`markdownSymbol`)??``,isCompleted:e.getLabelValue(`isCompleted`)===`true`,color:e.getLabelValue(`color`)??``,icon:e.getLabelValue(`iconClass`)??``,isHidden:e.getLabelValue(`isHidden`)===`true`}).filter(e=>e!==null));return d(c),s.length?s:a}function p(){e.triggerCommand(`openInTreePopup`,{noteIdOrPath:n,hoistedNoteId:n})}export{p as n,f as t};