import{F as e}from"./content_renderer-CoENEE63.js";import{n as t,s as n}from"./options-CDt8ZGCW.js";import{r}from"./experimental_features-3wqZ4yO-.js";var i=[{type:`text`,mime:`text/html`,title:n(`note_types.text`),icon:`bx-note`},{type:`spreadsheet`,mime:`application/json`,title:n(`note_types.spreadsheet`),icon:`bx-table`,isBeta:!0,isNew:!0},{type:`book`,mime:``,title:n(`note_types.book`),icon:`bx-book`},{type:`canvas`,mime:`application/json`,title:n(`note_types.canvas`),icon:`bx-pen`},{type:`mermaid`,mime:`text/mermaid`,title:n(`note_types.mermaid-diagram`),icon:`bx-selection`},{type:`mindMap`,mime:`application/json`,title:n(`note_types.mind-map`),icon:`bx-sitemap`},{type:`noteMap`,mime:``,title:n(`note_types.note-map`),icon:`bxs-network-chart`,static:!0},{type:`relationMap`,mime:`application/json`,title:n(`note_types.relation-map`),icon:`bxs-network-chart`},{type:`llmChat`,mime:`application/json`,title:n(`note_types.llm-chat`),icon:`bx-message-square-dots`,isBeta:!0},{type:`render`,mime:``,title:n(`note_types.render-note`),icon:`bx-extension`},{type:`search`,title:n(`note_types.saved-search`),icon:`bx-file-find`,static:!0},{type:`webView`,mime:``,title:n(`note_types.web-view`),icon:`bx-globe-alt`},{type:`code`,mime:`text/plain`,title:n(`note_types.code`),icon:`bx-code`},{type:`code`,mime:`text/x-markdown`,title:n(`note_types.markdown`),icon:`bxl-markdown`,isNew:!0},{type:`contentWidget`,mime:``,title:n(`note_types.widget`),reserved:!0},{type:`doc`,mime:``,title:n(`note_types.doc`),reserved:!0},{type:`file`,title:n(`note_types.file`),reserved:!0},{type:`image`,title:n(`note_types.image`),reserved:!0},{type:`launcher`,mime:``,title:n(`note_types.launcher`),reserved:!0}],a=3,o=1e3*60*60*24,s={title:n(`note_types.new-feature`),className:`new-note-type-badge`},c={title:n(`note_types.beta-feature`)},l={kind:`separator`},u=new Map,d;async function f(e){return[...p(e),...await h(null,e,!1),...await h(n(`note_types.collections`),e,!0),...await m(e)]}function p(e){return i.filter(e=>!e.reserved&&e.type!==`book`).filter(e=>e.type!==`llmChat`||r(`llm`)).map(t=>{let n={title:t.title,command:e,type:t.type,mime:t.mime,uiIcon:`bx ${t.icon}`,badges:[]};return t.isNew&&n.badges?.push(s),t.isBeta&&n.badges?.push(c),n})}async function m(r){let i=await t.get(`search-templates`),a=await e.getNotes(i);if(a.length===0)return[];let o=[{title:n(`note_type_chooser.templates`),kind:`header`}];for(let e of a){let t={title:e.title,uiIcon:e.getIcon(),command:r,type:e.type,templateNoteId:e.noteId};await g(e.noteId)&&(t.badges=[s]),o.push(t)}return o}async function h(t,n,r){let i=await e.getNote(`_templates`);if(!i)return console.warn(`Unable to find template root.`),[];let a=await i.getChildNotes();if(a.length===0)return[];let o=[];t?o.push({title:t,kind:`header`}):o.push(l);for(let e of a){if(e.hasLabel(`collection`)!==r||!e.hasLabel(`template`))continue;let t={title:e.title,uiIcon:e.getIcon(),command:n,type:e.type,templateNoteId:e.noteId};await g(e.noteId)&&(t.badges=[s]),o.push(t)}return o}async function g(e){if(d===void 0)try{let e=await t.get(`notes/root`);`dateCreated`in e&&(d=new Date(e.dateCreated))}catch(e){console.error(e)}let n=u.get(e);if(n===void 0)try{let r=await t.get(`notes/${e}`);`dateCreated`in r&&(n=new Date(r.dateCreated),u.set(e,n))}catch(e){console.error(e)}return n?d&&n.getTime()-d.getTime()<3e4?!1:(new Date().getTime()-n.getTime())/o<=a:!1}var _={getNoteTypeItems:f};export{_ as n,i as t};