/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD */ var ne=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Se=(c,d)=>{for(var e in d)ne(c,e,{get:d[e],enumerable:!0})},Fe=(c,d,e,n)=>{if(d&&typeof d=="object"||typeof d=="function")for(let a of be(d))!De.call(c,a)&&a!==e&&ne(c,a,{get:()=>d[a],enumerable:!(n=ke(d,a))||n.enumerable});return c};var xe=c=>Fe(ne({},"__esModule",{value:!0}),c);var Ae={};Se(Ae,{default:()=>ee});module.exports=xe(Ae);var y=require("obsidian");var G={name:"",folder:"",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"",icon:"file",indicatorColor:"#64748b"},M={calendar:{firstDayOfWeek:1,showNoteIndicators:!0,indicatorMode:"systems",dailyIndicatorColor:"#3b82f6"},daily:{folder:"periodic/daily",templateFile:"Templates/Daily note",nameFormat:"YYYY-MM-DD",typeProperty:"daily-note"},reusePeriodicNoteTabs:!1,weekly:{folder:"periodic/weekly",templateFile:"Templates/Weekly note",nameFormat:"GGGG-[W]WW",typeProperty:"weekly-note"},monthly:{folder:"periodic/monthly",templateFile:"Templates/Monthly note",nameFormat:"YYYY-MM",typeProperty:"monthly-note"},quarterly:{folder:"periodic/quarterly",templateFile:"Templates/Quarterly note",nameFormat:"YYYY-[Q]Q",typeProperty:"quarterly-note"},yearly:{folder:"periodic/yearly",templateFile:"Templates/Yearly note",nameFormat:"YYYY",typeProperty:"yearly-note"},dateSystems:[{id:"journal",name:"Journal",folder:"periodic/journal",nameFormat:"YYYY-MM-DD - [Journal]",templateFile:"",typeProperty:"journal",icon:"book-open",indicatorColor:"#22c55e"},{id:"meetings",name:"Meeting",folder:"periodic/meetings",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"meeting",icon:"users",indicatorColor:"#a855f7"}],recentFiles:{maxItems:50,show:"all",omittedPaths:[],omittedTags:[],types:[]},display:{rowSize:26,rowSpacing:2,indentSize:16,fontSize:13,iconSize:16,calendarCellSize:32}};var f=require("obsidian");var me="{title}";function V(c){let d=c.indexOf(me);return d<0?{before:c,after:"",hasTitle:!1}:{before:c.slice(0,d),after:c.slice(d+me.length),hasTitle:!0}}function ae(c,d){if(!d)return!0;let e=d.endsWith("/")?d:`${d}/`;return c.startsWith(e)}function ie(c,d,e,n){return n?!d||c.length|#^[\]]/g;function ge(c){return c.replace(Te,"-").replace(/\s+/g," ").trim()}function W(c){let{before:d}=V(c),e=d.replace(/\[[^\]]*\]/g,"");return/[YMDQGWEwdgeo]/.test(e)}var h=require("obsidian");var B=require("obsidian");function ye(c,d,e){let n=(0,B.moment)({year:c,month:d,day:1}),a=(0,B.moment)(n).endOf("month"),t=(0,B.moment)(n).subtract((n.day()-e+7)%7,"days"),i=(0,B.moment)().startOf("day"),r=[],s=(0,B.moment)(t);for(;s.isBefore(a)||s.month()===d;){let o=[];for(let l=0;l<7;l++)o.push({date:(0,B.moment)(s),dayOfMonth:s.date(),isToday:s.isSame(i,"day"),isCurrentMonth:s.month()===d,isoWeekNumber:s.isoWeek()}),s.add(1,"day");if(r.push({weekNumber:o[0].isoWeekNumber,days:o}),r.length>=6)break}return r}function Ee(c,d){return d==="opened"?c.openedAt:d==="changed"||c.openedAt===void 0?c.changedAt:c.changedAt===void 0?c.openedAt:Math.max(c.openedAt,c.changedAt)}function R(c,d){let e=[];for(let n of c){let a=Ee(n,d);a!==void 0&&e.push({entry:n,key:a})}return e.sort((n,a)=>a.key-n.key),e.map(n=>n.entry)}function j(c,d){let e=new Set([...R(c,"opened").slice(0,d),...R(c,"changed").slice(0,d)]);return R(c,"all").filter(n=>e.has(n))}var E="waypoint-view";function Me(c){return c.dragManager}var O=class extends h.ItemView{constructor(e,n){super(e);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view");let e=this.plugin.settings.display;this.contentEl.style.setProperty("--wp-row-size",e.rowSize+"px"),this.contentEl.style.setProperty("--wp-row-spacing",e.rowSpacing+"px"),this.contentEl.style.setProperty("--wp-indent-size",e.indentSize+"px"),this.contentEl.style.setProperty("--wp-font-size",e.fontSize+"px"),this.contentEl.style.setProperty("--wp-icon-size",e.iconSize+"px"),this.contentEl.style.setProperty("--wp-cal-cell-size",e.calendarCellSize+"px");let n=this.contentEl.createDiv({cls:"waypoint-lists"});this.renderFavorites(n),this.renderRecentFiles(n),this.renderCalendar()};this.currentDisplayMonth=(0,h.moment)().month();this.currentDisplayYear=(0,h.moment)().year();this.dragId=null;this.dropZones=new WeakMap;this.selectedDate=null;this.plugin=n}getViewType(){return E}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}showDate(e){this.currentDisplayMonth=e.month(),this.currentDisplayYear=e.year(),this.selectedDate=e.clone(),this.redraw()}renderCalendar(){var le;let n=this.contentEl.createDiv({cls:"waypoint-section waypoint-calendar-section"}).createDiv({cls:"waypoint-calendar"}),a=(0,h.moment)(),t=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),i=n.createDiv({cls:"waypoint-calendar-top"}),r=i.createDiv({cls:"waypoint-calendar-breadcrumb"}),s=t.format("[Q]Q"),o=r.createSpan({cls:"waypoint-clickable",text:s});o.addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",t)}),o.addEventListener("mousedown",b=>{b.button===1&&(b.preventDefault(),this.plugin.openPeriodNote("quarter",t,this.app.workspace.getLeaf("tab")))});let l=t.clone().locale("en").format("MMM"),p=r.createSpan({cls:"waypoint-clickable",text:l});p.addEventListener("click",()=>{this.plugin.openPeriodNote("month",t)}),p.addEventListener("mousedown",b=>{b.button===1&&(b.preventDefault(),this.plugin.openPeriodNote("month",t,this.app.workspace.getLeaf("tab")))});let u=t.format("YYYY"),D=r.createSpan({cls:"waypoint-clickable",text:u});D.addEventListener("click",()=>{this.plugin.openPeriodNote("year",t)}),D.addEventListener("mousedown",b=>{b.button===1&&(b.preventDefault(),this.plugin.openPeriodNote("year",t,this.app.workspace.getLeaf("tab")))});let S=i.createDiv({cls:"waypoint-calendar-today-group"}),I=S.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(I,"chevron-left"),I.addEventListener("click",()=>this.navigateMonth(-1)),S.createEl("button",{cls:"waypoint-calendar-today-btn",text:"Today"}).addEventListener("click",()=>{this.currentDisplayMonth=(0,h.moment)().month(),this.currentDisplayYear=(0,h.moment)().year(),this.selectedDate=null,this.redraw()});let g=S.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(g,"chevron-right"),g.addEventListener("click",()=>this.navigateMonth(1));let F=S.createEl("button",{cls:"waypoint-calendar-nav-btn waypoint-calendar-pick-btn"});(0,h.setIcon)(F,"calendar-search"),(0,h.setTooltip)(F,"Go to date");let m=S.createEl("input",{type:"date",cls:"waypoint-calendar-pick-input"});m.tabIndex=-1,m.value=((le=this.selectedDate)!=null?le:a).format("YYYY-MM-DD"),m.addEventListener("change",()=>{let b=(0,h.moment)(m.value,"YYYY-MM-DD",!0);b.isValid()&&this.showDate(b)}),F.addEventListener("click",()=>{try{m.showPicker()}catch(b){m.click()}});let v=n.createEl("table"),w=v.createEl("thead").createEl("tr");w.createEl("th",{text:""});let k=["S","M","T","W","T","F","S"],A=this.plugin.settings.calendar.firstDayOfWeek;for(let b=0;b<7;b++){let Y=(A+b)%7;w.createEl("th",{text:k[Y]})}let N=v.createEl("tbody"),re=ye(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek),te=this.plugin.settings.calendar.showNoteIndicators&&this.plugin.settings.calendar.indicatorMode==="systems"?this.plugin.getDateSystemIndicators(re.reduce((b,Y)=>b.concat(Y.days.map(z=>z.date)),[])):null;for(let b of re){let Y=N.createEl("tr"),z=Y.createEl("td",{cls:"waypoint-weeknum"});z.setText(String(b.weekNumber));let ce=b.days[0].date;z.addEventListener("click",()=>{this.plugin.openPeriodNote("week",ce)}),z.addEventListener("mousedown",T=>{T.button===1&&(T.preventDefault(),this.plugin.openPeriodNote("week",ce,this.app.workspace.getLeaf("tab")))});for(let T of b.days){let C=Y.createEl("td",{cls:"waypoint-day"});if(C.setText(String(T.dayOfMonth)),T.isCurrentMonth||C.addClass("other-month"),T.isToday&&C.addClass("today"),this.selectedDate&&T.date.isSame(this.selectedDate,"day")&&C.addClass("is-selected"),this.plugin.settings.calendar.showNoteIndicators){let L=T.date.format("YYYY-MM-DD");if(this.plugin.settings.calendar.indicatorMode==="any")this.plugin.hasNoteForDate(L)&&C.addClass("has-note");else{let de=(te==null?void 0:te.get(L))||[];if(de.length>0){let we=C.createDiv({cls:"waypoint-day-indicators"});for(let pe of de){let he=we.createSpan({cls:"waypoint-day-indicator"});he.style.setProperty("--waypoint-indicator-color",pe.color),(0,h.setTooltip)(he,pe.name)}}}}C.addEventListener("click",()=>{this.plugin.openPeriodNote("day",T.date)}),C.addEventListener("mousedown",L=>{L.button===1&&(L.preventDefault(),this.plugin.openPeriodNote("day",T.date,this.app.workspace.getLeaf("tab")))}),C.addEventListener("contextmenu",L=>{L.preventDefault(),L.stopPropagation(),this.showDayContextMenu(L,T.date)})}}}navigateMonth(e){let n=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth}).add(e,"month");this.currentDisplayMonth=n.month(),this.currentDisplayYear=n.year(),this.selectedDate=null,this.redraw()}showDayContextMenu(e,n){let a=new h.Menu;a.addItem(t=>t.setTitle(n.format("dddd, MMMM D, YYYY")).setIsLabel(!0));for(let t of this.plugin.findDateSystemNotes(n)){let i=t.multiple||t.notes.length===0;if(t.notes.length+(i?1:0)===0)continue;a.addSeparator();for(let s of t.notes)a.addItem(o=>o.setTitle(s.label).setIcon(t.system.icon).onClick(l=>this.focusFile(s.file,h.Keymap.isModEvent(l))));if(!i)continue;let r=t.system.name.toLowerCase();a.addItem(s=>s.setTitle(t.multiple?`New ${r} note\u2026`:`New ${r} note`).setIcon("plus").onClick(o=>this.createDateSystemNote(t,n,h.Keymap.isModEvent(o))))}a.showAtPosition({x:e.clientX,y:e.clientY})}createDateSystemNote(e,n,a){if(!e.multiple){this.plugin.openDateSystemNote(e.system,n,{leaf:a?this.app.workspace.getLeaf(a):void 0});return}let t=e.system.name;new K(this.app,{title:`New ${t.toLowerCase()} note`,placeholder:`${t} with\u2026`,cta:"Create"},i=>{this.plugin.openDateSystemNote(e.system,n,{title:i,leaf:a?this.app.workspace.getLeaf(a):void 0})}).open()}renderRecentFiles(e){var P;let n=this.plugin.settings.recentFiles,a=e.createDiv({cls:"waypoint-section waypoint-recent-files"}),t=a.createDiv({cls:"waypoint-section-header"});t.createSpan({text:"Recent Files"});let i=t.createDiv({cls:"waypoint-recent-show"}),r=[{value:"all",label:"all",tooltip:"Opened or changed"},{value:"opened",label:"opened",tooltip:"Files you opened"},{value:"changed",label:"changed",tooltip:"Files that changed, by you or in the background"}];for(let g of r){let F=i.createSpan({cls:`waypoint-recent-show-option${n.show===g.value?" is-active":""}`,text:g.label});(0,h.setTooltip)(F,g.tooltip),F.addEventListener("click",()=>{n.show!==g.value&&(n.show=g.value,this.plugin.saveSettings(),this.redraw())})}let s=R(this.plugin.recentFiles,n.show);if(s.length===0){a.createDiv({cls:"nav-file",text:"No recent files"});return}let o=g=>{var v,x;let F=this.app.vault.getFileByPath(g),m=F?(x=(v=this.app.metadataCache.getFileCache(F))==null?void 0:v.frontmatter)==null?void 0:x.type:null;return typeof m=="string"?m:null},l=n.types.filter(g=>g.type),p=new Map(l.filter(g=>g.icon).map(g=>[g.type,g.icon])),u=p.size>0,D=this.app.workspace.getActiveFile(),S=a.createDiv({cls:"nav-folder mod-root"}),I=S.createDiv({cls:"nav-folder-children"});for(let g of s){let F=I.createDiv({cls:"tree-item nav-file"}),m=F.createDiv({cls:"tree-item-self is-clickable nav-file-title"});if(u){let w=m.createDiv({cls:"waypoint-recent-icon"}),k=p.get((P=o(g.path))!=null?P:"");k&&(0,h.setIcon)(w,k)}if(m.createDiv({cls:"tree-item-inner nav-file-title-content"}).setText(g.basename),m.createDiv({cls:"tree-item-spacer"}),g.changedInBackground){let w=m.createDiv({cls:"waypoint-recent-changed"});(0,h.setTooltip)(w,"Changed in the background")}let x=m.createDiv({cls:"waypoint-recent-remove"});(0,h.setIcon)(x,"x"),x.addEventListener("click",w=>{w.stopPropagation(),this.plugin.recentFiles=this.plugin.recentFiles.filter(k=>k.path!==g.path),this.plugin.persistRecentFiles(),this.redraw()}),(0,h.setTooltip)(F,g.path),D&&g.path===D.path&&m.addClass("is-active"),m.setAttr("draggable","true"),m.addEventListener("dragstart",w=>{let k=this.app.metadataCache.getFirstLinkpathDest(g.path,"");if(k){let A=Me(this.app),N=A.dragFile(w,k);A.onDragStart(w,N)}}),m.addEventListener("mouseover",w=>{this.app.workspace.trigger("hover-link",{event:w,source:E,hoverParent:S,targetEl:F,linktext:g.path})}),m.addEventListener("contextmenu",w=>{let k=new h.Menu;k.addItem(N=>N.setSection("action").setTitle("Open in new tab").setIcon("file-plus").onClick(()=>this.focusFile(g,"tab"))),k.addItem(N=>N.setSection("action").setTitle("Add to bookmarks").setIcon("bookmark").onClick(()=>{this.plugin.addBookmark(g.path,g.basename,"file"),new h.Notice(`Bookmarked: ${g.basename}`)}));let A=this.app.vault.getAbstractFileByPath(g.path);A&&this.app.workspace.trigger("file-menu",k,A,"link-context-menu"),k.showAtPosition({x:w.clientX,y:w.clientY})}),m.addEventListener("click",w=>{let k=h.Keymap.isModEvent(w);this.focusFile(g,k)}),m.addEventListener("mousedown",w=>{w.button===1&&(w.preventDefault(),this.focusFile(g,"tab"))})}}focusFile(e,n){let a=this.app.vault.getFiles().find(t=>t.path===e.path);a?this.app.workspace.getLeaf(n).openFile(a):(new h.Notice("Cannot find file"),this.plugin.recentFiles=this.plugin.recentFiles.filter(t=>t.path!==e.path),this.plugin.persistRecentFiles(),this.redraw())}renderFavorites(e){let n=e.createDiv({cls:"waypoint-section waypoint-favorites"}),a=n.createDiv({cls:"waypoint-section-header"});a.setText("Waypoint Bookmarks");let t=a.createEl("button",{cls:"waypoint-header-more"});if((0,h.setIcon)(t,"more-horizontal"),(0,h.setTooltip)(t,"Add bookmark"),t.addEventListener("click",i=>{let r=new h.Menu;r.addItem(s=>{s.setTitle("Add current file").setIcon("file-plus").onClick(()=>{let o=this.app.workspace.getActiveFile();o&&this.plugin.addBookmark(o.path,o.basename,"file")})}),r.addItem(s=>{s.setTitle("Add as parent note").setIcon("folder-plus").onClick(()=>{let o=this.app.workspace.getActiveFile();if(!o)return;let l=this.plugin.addBookmark(o.path,o.basename,"group","");l.filePath=o.path,this.plugin.saveWaypointData(),this.redraw()})}),r.addItem(s=>{s.setTitle("New group").setIcon("folder-plus").onClick(()=>{this.plugin.addBookmark("","New Group","group","")})}),r.addSeparator(),r.addItem(s=>{s.setTitle("Add separator").setIcon("minus").onClick(()=>{this.plugin.addBookmark("","","separator")})}),r.addItem(s=>{s.setTitle("Add spacer").setIcon("space").onClick(()=>{this.plugin.addBookmark("","","spacer")})}),r.showAtPosition({x:i.clientX,y:i.clientY})}),this.plugin.waypointData.bookmarks.length===0){n.createDiv({cls:"waypoint-bookmark-item",text:"No bookmarks"});return}this.renderBookmarkList(n,this.plugin.waypointData.bookmarks,0)}renderBookmarkList(e,n,a){for(let t=0;t{l.stopPropagation(),l.preventDefault(),this.showBookmarkContextMenu(l,i)});continue}if(i.type==="spacer"){let o=e.createDiv({cls:"waypoint-bookmark-item waypoint-bookmark-spacer"});o.setAttr("draggable","true"),o.setAttr("data-bm-id",i.id),o.style.paddingLeft=`${8+a*16}px`,o.style.cursor="grab",this.attachBookmarkDragHandlers(o,e,i,!1),o.addEventListener("contextmenu",l=>{l.stopPropagation(),l.preventDefault(),this.showBookmarkContextMenu(l,i)});continue}let r=i.type==="group",s=e.createDiv({cls:`waypoint-bookmark-item${r?" waypoint-bookmark-group":""}${i.collapsed?" collapsed":""}`});if(s.setAttr("draggable","true"),s.setAttr("data-bm-id",i.id),r||(s.style.paddingLeft=`${8+a*16}px`),this.attachBookmarkDragHandlers(s,e,i,!0),r){let o=s.createDiv({cls:"waypoint-bm-icon"});i.icon&&(0,h.setIcon)(o,i.icon);let l=s.createDiv({cls:"waypoint-bm-label",text:i.label}),p=s.createDiv({cls:"waypoint-bm-chevron"});(0,h.setIcon)(p,"chevron-down"),p.addEventListener("click",D=>{D.stopPropagation(),this.plugin.updateBookmark(i.id,{collapsed:!i.collapsed})}),s.addEventListener("click",D=>{if(i.filePath){let S=this.app.vault.getFileByPath(i.filePath);if(S){let I=h.Keymap.isModEvent(D);this.app.workspace.getLeaf(I).openFile(S);return}}this.plugin.updateBookmark(i.id,{collapsed:!i.collapsed})}),s.addEventListener("mousedown",D=>{if(D.button===1&&i.filePath){D.preventDefault();let S=this.app.vault.getFileByPath(i.filePath);S&&this.app.workspace.getLeaf("tab").openFile(S)}});let u=e.createDiv({cls:`waypoint-bookmark-children${i.collapsed?" collapsed":""}`});i.children&&i.children.length>0&&this.renderBookmarkList(u,i.children,a+1)}else{let o=s.createDiv({cls:"waypoint-bm-icon"});i.icon&&(0,h.setIcon)(o,i.icon);let l=s.createDiv({cls:"waypoint-bm-label",text:i.label});if(i.children&&i.children.length>0){let p=s.createDiv({cls:"waypoint-bm-chevron"});(0,h.setIcon)(p,"chevron-down"),p.addEventListener("click",u=>{u.stopPropagation(),this.plugin.updateBookmark(i.id,{collapsed:!i.collapsed})}),i.collapsed&&(s.addClass("collapsed"),p.style.transform="rotate(-90deg)")}if((0,h.setTooltip)(s,i.filePath),s.addEventListener("click",p=>{if(i.filePath){let u=this.app.vault.getFileByPath(i.filePath);if(u){let D=h.Keymap.isModEvent(p);this.app.workspace.getLeaf(D).openFile(u)}else new h.Notice("File not found"),this.plugin.removeBookmark(i.id)}}),s.addEventListener("mousedown",p=>{if(p.button===1&&i.filePath){p.preventDefault();let u=this.app.vault.getFileByPath(i.filePath);u&&this.app.workspace.getLeaf("tab").openFile(u)}}),i.children&&i.children.length>0){let p=e.createDiv({cls:`waypoint-bookmark-children${i.collapsed?" collapsed":""}`});this.renderBookmarkList(p,i.children,a+1)}}s.addEventListener("contextmenu",o=>{o.stopPropagation(),o.preventDefault(),this.showBookmarkContextMenu(o,i)})}}showBookmarkContextMenu(e,n){let a=new h.Menu;if(n.type==="separator"||n.type==="spacer"){a.addItem(t=>t.setTitle("Remove").setIcon("trash").onClick(()=>this.plugin.removeBookmark(n.id))),a.showAtPosition({x:e.clientX,y:e.clientY});return}n.type==="file"?(a.addItem(t=>t.setTitle("Open in new tab").setIcon("file-plus").onClick(()=>{let i=this.app.vault.getFileByPath(n.filePath);i&&this.app.workspace.getLeaf("tab").openFile(i)})),a.addSeparator(),a.addItem(t=>t.setTitle("Rename").setIcon("pencil").onClick(()=>this.promptRename(n))),a.addItem(t=>t.setTitle("Change icon").setIcon("image").onClick(()=>this.promptIcon(n))),a.addSeparator(),a.addItem(t=>t.setTitle("Remove").setIcon("trash").onClick(()=>this.plugin.removeBookmark(n.id)))):n.type==="group"&&(n.filePath&&(a.addItem(t=>t.setTitle("Open in new tab").setIcon("file-plus").onClick(()=>{let i=this.app.vault.getFileByPath(n.filePath);i&&this.app.workspace.getLeaf("tab").openFile(i)})),a.addSeparator()),a.addItem(t=>t.setTitle("Rename").setIcon("pencil").onClick(()=>this.promptRename(n))),a.addItem(t=>t.setTitle("Change icon").setIcon("image").onClick(()=>this.promptIcon(n))),a.addSeparator(),a.addItem(t=>t.setTitle("Add child bookmark").setIcon("file-plus").onClick(()=>{let i=this.app.workspace.getActiveFile();if(!i){new h.Notice("No active file");return}let r={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:"file",label:i.basename,filePath:i.path,icon:"",children:[],collapsed:!1,indent:n.indent+1};n.children.push(r),this.plugin.saveWaypointData(),this.redraw()})),a.addItem(t=>t.setTitle("Add child note").setIcon("folder-plus").onClick(()=>{let i=this.app.workspace.getActiveFile();if(!i){new h.Notice("No active file");return}let r={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:"group",label:i.basename,filePath:i.path,icon:"",children:[],collapsed:!1,indent:n.indent+1};n.children.push(r),this.plugin.saveWaypointData(),this.redraw()})),a.addItem(t=>t.setTitle("New sub-group").setIcon("folder-plus").onClick(()=>{let i={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:"group",label:"New Group",filePath:"",icon:"",children:[],collapsed:!1,indent:n.indent+1};n.children.push(i),this.plugin.saveWaypointData(),this.redraw()})),a.addSeparator(),a.addItem(t=>t.setTitle("Remove").setIcon("trash").onClick(()=>this.plugin.removeBookmark(n.id)))),a.showAtPosition({x:e.clientX,y:e.clientY})}attachBookmarkDragHandlers(e,n,a,t){let i=()=>{e.removeClass("waypoint-bm-drop-line"),e.removeClass("waypoint-bm-drop-below"),e.removeClass("waypoint-bm-drop-into")};e.addEventListener("dragstart",r=>{this.dragId=a.id,r.dataTransfer.effectAllowed="move",r.dataTransfer.setData("text/plain",a.id),e.addClass("waypoint-bm-dragging")}),e.addEventListener("dragend",()=>{this.dragId=null,n.querySelectorAll(".waypoint-bm-dragging, .waypoint-bm-drop-line, .waypoint-bm-drop-below, .waypoint-bm-drop-into").forEach(r=>{r.removeClass("waypoint-bm-dragging"),r.removeClass("waypoint-bm-drop-line"),r.removeClass("waypoint-bm-drop-below"),r.removeClass("waypoint-bm-drop-into")})}),e.addEventListener("dragenter",r=>{r.preventDefault(),!(!this.dragId||this.dragId===a.id)&&this.showDropIndicator(e,r,t)}),e.addEventListener("dragover",r=>{r.preventDefault(),!(!this.dragId||this.dragId===a.id)&&this.showDropIndicator(e,r,t)}),e.addEventListener("dragleave",i),e.addEventListener("drop",r=>{var l,p;r.preventDefault(),this.dragId=null,i();let s=(l=r.dataTransfer)==null?void 0:l.getData("text/plain");if(!s||s===a.id)return;let o=this.dropZones.get(e);t&&(o!=null&&o.into)?a.type==="group"?this.moveBookmarkToGroup(s,a.id):this.createParentNoteAndMove(s,a.id):this.moveBookmarkToPosition(s,a.id,(p=o==null?void 0:o.above)!=null?p:!1)})}showDropIndicator(e,n,a){let t=e.parentElement;t&&t.querySelectorAll(".waypoint-bm-drop-line, .waypoint-bm-drop-below, .waypoint-bm-drop-into").forEach(s=>{s.removeClass("waypoint-bm-drop-line"),s.removeClass("waypoint-bm-drop-below"),s.removeClass("waypoint-bm-drop-into")});let i=e.getBoundingClientRect(),r=n.clientY;if(a){let s=i.top+i.height*.25,o=i.top+i.height*.75;ro?(e.addClass("waypoint-bm-drop-line"),e.addClass("waypoint-bm-drop-below"),this.dropZones.set(e,{above:!1,into:!1})):(e.addClass("waypoint-bm-drop-into"),this.dropZones.set(e,{above:!1,into:!0}))}else{let s=r{let r=i.findIndex(s=>s.id===e);if(r>=0){let[s]=i.splice(r,1);return s}for(let s of i){let o=a(s.children);if(o)return o}return null},t=a(this.plugin.waypointData.bookmarks);if(t){if(n){let i=(r,s)=>r.id===s?!0:r.children.some(o=>i(o,s));if(t.id===n||i(t,n))return}if(n){let i=s=>{for(let o of s){if(o.id===n)return o;let l=i(o.children);if(l)return l}return null},r=i(this.plugin.waypointData.bookmarks);r&&(t.indent=r.indent+1,r.children.push(t))}else t.indent=0,this.plugin.waypointData.bookmarks.push(t);this.plugin.saveWaypointData(),this.redraw()}}createParentNoteAndMove(e,n){let a=s=>{let o=s.findIndex(l=>l.id===e);if(o>=0){let[l]=s.splice(o,1);return l}for(let l of s)if(l.children){let p=a(l.children);if(p)return p}return null},t=a(this.plugin.waypointData.bookmarks);if(!t)return;let i=s=>{for(let o of s){if(o.id===n)return o;if(o.children){let l=i(o.children);if(l)return l}}return null},r=i(this.plugin.waypointData.bookmarks);r&&(t.indent=r.indent+1,r.children.push(t),this.plugin.saveWaypointData(),this.redraw())}moveBookmarkToPosition(e,n,a){let t=o=>{let l=o.findIndex(p=>p.id===e);if(l>=0){let[p]=o.splice(l,1);return{item:p,parent:o}}for(let p of o)if(p.children){let u=t(p.children);if(u.item)return u}return{item:null,parent:[]}},{item:i}=t(this.plugin.waypointData.bookmarks);if(!i)return;let r=o=>{let l=o.findIndex(p=>p.id===n);if(l>=0)return{parent:o,idx:l};for(let p of o)if(p.children){let u=r(p.children);if(u)return u}return null},s=r(this.plugin.waypointData.bookmarks);if(!s)i.indent=0,this.plugin.waypointData.bookmarks.push(i);else{let o=a?s.idx:s.idx+1;s.parent.splice(o,0,i)}this.plugin.saveWaypointData(),this.redraw()}promptRename(e){new K(this.app,{title:"Rename bookmark",initialValue:e.label},n=>{n&&n.trim()&&this.plugin.updateBookmark(e.id,{label:n.trim()})}).open()}promptIcon(e){new H(this.app,e.icon,n=>{this.plugin.updateBookmark(e.id,{icon:n})}).open()}},K=class extends h.Modal{constructor(d,e,n){super(d),this.options=e,this.onSubmit=n}onOpen(){var t,i,r;this.titleEl.setText(this.options.title);let d=this.contentEl.createEl("input",{type:"text",value:(t=this.options.initialValue)!=null?t:"",placeholder:(i=this.options.placeholder)!=null?i:""});d.style.width="100%",d.style.marginBottom="12px",d.focus(),d.select();let e=this.contentEl.createDiv({cls:"modal-button-container"}),n=e.createEl("button",{text:"Cancel",cls:"mod-cta"});n.style.marginRight="8px",n.addEventListener("click",()=>this.close()),e.createEl("button",{text:(r=this.options.cta)!=null?r:"Save",cls:"mod-cta"}).addEventListener("click",()=>{this.onSubmit(d.value),this.close()}),d.addEventListener("keydown",s=>{s.key==="Enter"&&(this.onSubmit(d.value),this.close())})}onClose(){this.contentEl.empty()}},_=null;function Ie(){return _||(_=(async()=>{try{return await(await fetch("https://cdn.jsdelivr.net/npm/lucide-static@0.517.0/tags.json")).json()}catch(c){try{return await(await fetch("https://lucide.dev/api/tags")).json()}catch(d){return _=null,Pe}}})()),_}var H=class extends h.Modal{constructor(e,n,a){super(e);this.allIcons=[];this.tagsMap={};this.loaded=!1;this.selected=n,this.onSubmit=a}async onOpen(){let e=this.contentEl;e.style.display="flex",e.style.flexDirection="column",e.style.gap="10px",this.titleEl.setText("Change icon");let n=e.createDiv({cls:"waypoint-icon-preview"});n.style.display="flex",n.style.alignItems="center",n.style.gap="10px",n.style.padding="12px 16px",n.style.borderRadius="8px",n.style.background="var(--background-secondary)",n.style.minHeight="48px";let a=n.createSpan();a.style.display="flex",this.selected&&(0,h.setIcon)(a,this.selected);let t=n.createSpan();t.style.fontWeight="var(--font-medium)",t.style.fontSize="var(--font-ui-medium)",t.setText(this.selected||"No icon");let i=e.createEl("input",{type:"text",placeholder:"Type to search (e.g. arrow, chart, home)..."});Object.assign(i.style,{width:"100%",boxSizing:"border-box",padding:"8px 10px",borderRadius:"6px",border:"1px solid var(--background-modifier-border)",background:"var(--background-primary)",color:"var(--text-normal)",fontSize:"var(--font-ui-medium)"}),i.focus();let r=e.createDiv({cls:"waypoint-icon-grid"});r.style.display="grid",r.style.gridTemplateColumns="repeat(auto-fill, minmax(52px, 1fr))",r.style.gap="4px",r.style.maxHeight="320px",r.style.overflowY="auto",r.style.padding="2px 0";let s=e.createDiv();s.style.display="flex",s.style.justifyContent="space-between",s.style.alignItems="center",s.style.fontSize="var(--font-ui-smaller)",s.style.color="var(--text-muted)",s.style.padding="0 4px";let o=s.createSpan();o.setText("Loading\u2026"),this.loadIcons().then(()=>{this.loaded=!0,o.setText(this.allIcons.length+" icons"),p(i.value)});let l,p=P=>{if(r.empty(),!this.loaded){r.createDiv({text:"Loading\u2026"});return}let g=P.toLowerCase().trim(),F=g?this.allIcons.filter(m=>{if(m.includes(g))return!0;let v=this.tagsMap[m];return v?v.some(x=>x.includes(g)):!1}).slice(0,80):this.allIcons.slice(0,80);if(F.length===0){let m=r.createDiv();m.style.gridColumn="1 / -1",m.style.textAlign="center",m.style.color="var(--text-muted)",m.style.padding="20px",m.setText('No icons match "'+P+'"');return}for(let m of F){let v=r.createDiv();v.setAttr("data-icon",m),v.style.display="flex",v.style.alignItems="center",v.style.justifyContent="center",v.style.aspectRatio="1",v.style.borderRadius="6px",v.style.cursor="var(--cursor-link, pointer)",v.style.transition="background 80ms",v.setAttr("title",m),m===this.selected?(v.style.background="var(--interactive-accent)",v.style.color="var(--text-on-accent)"):v.style.color="var(--text-muted)";let x=v.createSpan();x.style.display="flex",(0,h.setIcon)(x,m),v.addEventListener("mouseenter",()=>{m!==this.selected&&(v.style.background="var(--background-modifier-hover)")}),v.addEventListener("mouseleave",()=>{m!==this.selected&&(v.style.background="")}),v.addEventListener("click",()=>{this.selected=m,p(P),a.empty(),(0,h.setIcon)(a,m),t.setText(m),r.querySelectorAll("div[data-icon]").forEach(w=>{let k=w;k.getAttr("data-icon")===m?(k.style.background="var(--interactive-accent)",k.style.color="var(--text-on-accent)"):(k.style.background="",k.style.color="var(--text-muted)")})})}o.setText(F.length+" of "+this.allIcons.length+" icons")};i.addEventListener("input",()=>{window.clearTimeout(l),l=window.setTimeout(()=>p(i.value),60)}),i.addEventListener("keydown",P=>{P.key==="Escape"&&this.close()});let u=e.createDiv({cls:"modal-button-container"});u.createEl("button",{text:"No icon",cls:"waypoint-icon-clear"}).addEventListener("click",()=>{this.onSubmit(""),this.close()}),u.createEl("button",{text:"Cancel"}).addEventListener("click",()=>this.close());let I=u.createEl("button",{text:"Save",cls:"mod-cta"});I.style.marginLeft="8px",I.addEventListener("click",()=>{this.onSubmit(this.selected),this.close()})}onClose(){this.contentEl.empty()}async loadIcons(){let e=await Ie();this.tagsMap=e,this.allIcons=Object.keys(e).sort()}},Pe={file:[],folder:[],star:[],heart:[],bookmark:[],flag:[],pin:[],tag:[],book:[],"book-open":[],library:[],calendar:[],"calendar-days":[],clock:[],home:[],inbox:[],mail:[],search:[],settings:[],cog:[],user:[],users:[],zap:[],sparkles:[],target:[],link:[],globe:[],edit:[],pencil:[],anchor:[],award:[],bell:[],"bell-ring":[],brain:[],briefcase:[],camera:[],"chart-bar":[],"chart-line":[],"chart-pie":[],check:[],"check-circle":[],"chevron-down":[],"chevron-left":[],"chevron-right":[],"chevron-up":[],circle:[],clipboard:[],code:[],command:[],compass:[],copy:[],"credit-card":[],crown:[],database:[],download:[],"external-link":[],eye:[],"eye-off":[],"file-text":[],filter:[],fingerprint:[],flashlight:[],"folder-open":[],"folder-plus":[],gift:[],"git-branch":[],"git-commit":[],"git-merge":[],"git-pull-request":[],github:[],grid:[],hash:[],headphones:[],image:[],info:[],key:[],layers:[],layout:[],"life-buoy":[],"link-2":[],list:[],loader:[],lock:[],"log-in":[],"log-out":[],map:[],"map-pin":[],maximize:[],megaphone:[],menu:[],"message-circle":[],"message-square":[],mic:[],minimize:[],moon:[],"more-horizontal":[],"more-vertical":[],"mouse-pointer":[],move:[],music:[],navigation:[],"navigation-2":[],package:[],palette:[],paperclip:[],pause:[],phone:[],play:[],plus:[],"plus-circle":[],power:[],printer:[],radio:[],"refresh-cw":[],repeat:[],"rotate-ccw":[],"rotate-cw":[],rss:[],save:[],scissors:[],screen:[],send:[],server:[],share:[],"share-2":[],shield:[],"shield-off":[],"shopping-bag":[],"shopping-cart":[],shuffle:[],sidebar:[],slack:[],slash:[],sliders:[],smartphone:[],smile:[],speaker:[],square:[],"stop-circle":[],sun:[],sunrise:[],sunset:[],swords:[],table:[],tablet:[],terminal:[],thermometer:[],"thumbs-down":[],"thumbs-up":[],"toggle-left":[],"toggle-right":[],tool:[],trash:[],"trash-2":[],trello:[],"trending-down":[],"trending-up":[],triangle:[],truck:[],tv:[],twitter:[],type:[],umbrella:[],unlock:[],upload:[],"user-check":[],"user-minus":[],"user-plus":[],"user-x":[],video:[],"video-off":[],voicemail:[],volume:[],"volume-1":[],"volume-2":[],"volume-x":[],watch:[],wifi:[],"wifi-off":[],wind:[],x:[],"x-circle":[],"x-square":[],youtube:[],"zap-off":[],"zoom-in":[],"zoom-out":[],"arrow-down":[],"arrow-left":[],"arrow-right":[],"arrow-up":[],airplay:[],"alarm-clock":[],archive:[],armchair:[],atom:[],baby:[],backpack:[],badge:[],"badge-check":[],ban:[],banknote:[],barcode:[],bath:[],battery:[],"battery-charging":[],beer:[],bike:[],bird:[],bluetooth:[],bolt:[],bone:[],"bookmark-plus":[],bot:[],box:[],bug:[],building:[],bus:[],cake:[],calculator:[],car:[],"clipboard-check":[],cloud:[],"cloud-download":[],"cloud-lightning":[],"cloud-rain":[],"cloud-sun":[],"cloud-upload":[],clover:[],coffee:[],coins:[],contact:[],cookie:[],"corner-down-left":[],"corner-down-right":[],"corner-up-left":[],"corner-up-right":[],crosshair:[],"dice-1":[],"dice-6":[],"dollar-sign":[],"door-open":[],drama:[],droplet:[],drum:[],egg:[],equal:[],euro:[],factory:[],fan:[],feather:[],film:[],fish:[],flame:[],flask:[],flower:[],frown:[],fuel:[],gamepad:[],gauge:[],gem:[],ghost:[],glasses:[],"graduation-cap":[],hammer:[],"hard-drive":[],haze:[],"help-circle":[],"ice-cream":[],infinity:[],italic:[],"japanese-yen":[],keyboard:[],knife:[],lamp:[],landmark:[],languages:[],laptop:[],laugh:[],leaf:[],lightbulb:[],"list-plus":[],magnet:[],"mail-plus":[],meh:[],microscope:[],milestone:[],"minimize-2":[],monitor:[],mountain:[],mouse:[],network:[],newspaper:[],"package-check":[],"package-search":[],"paint-bucket":[],parking:[],"party-popper":[],"pen-tool":[],percent:[],"person-standing":[],"picture-in-picture-2":[],plane:[],plug:[],podcast:[],pointer:[],"pound-sterling":[],puzzle:[],"qr-code":[],rabbit:[],radar:[],rainbow:[],rocket:[],"roller-coaster":[],route:[],ruler:[],sailboat:[],scale:[],scan:[],school:[],ship:[],shirt:[],"shopping-basket":[],shovel:[],sigma:[],siren:[],skull:[],snowflake:[],soup:[],space:[],sparkle:[],stamp:[],store:[],subscript:[],superscript:[],syringe:[],tent:[],"tent-tree":[],"test-tube":[],theater:[],timer:[],train:[],"tree-deciduous":[],"tree-pine":[],trophy:[],typing:[],utensils:[],vibrate:[],wallet:[],wand:[],warehouse:[],waves:[],webcam:[],wheat:[],wine:[],wrench:[]};var Q=class extends f.AbstractInputSuggest{constructor(e,n){super(e,n);this.inputEl=n}getSuggestions(e){let n=e.toLowerCase();return this.app.vault.getMarkdownFiles().filter(a=>a.path.toLowerCase().includes(n)).slice(0,200)}renderSuggestion(e,n){n.setText(e.path.replace(/\.md$/,""))}selectSuggestion(e){this.setValue(e.path.replace(/\.md$/,"")),this.inputEl.trigger("input"),this.close()}},U=class extends f.PluginSettingTab{constructor(e,n,a,t){super(e,n);this.activeTab="calendar";this.plugin=n,this.settings=a,this.onSettingsChange=t}display(){let{containerEl:e}=this;e.empty();let n=e.createDiv({cls:"waypoint-settings-tabs"}),a=[{key:"calendar",label:"Calendar"},{key:"periodic",label:"Periodic Notes"},{key:"systems",label:"Date systems"},{key:"recent",label:"Recent Files"},{key:"display",label:"Display"},{key:"about",label:"About"}];for(let i of a)n.createEl("button",{cls:`waypoint-settings-tab${this.activeTab===i.key?" is-active":""}`,text:i.label}).addEventListener("click",()=>{this.activeTab=i.key,this.display()});let t=e.createDiv({cls:"waypoint-settings-content"});switch(this.activeTab){case"calendar":this.renderCalendarTab(t);break;case"periodic":this.renderPeriodicTab(t);break;case"systems":this.renderSystemsTab(t);break;case"recent":this.renderRecentTab(t);break;case"display":this.renderDisplayTab(t);break;case"about":this.renderAboutTab(t);break}}renderCalendarTab(e){new f.Setting(e).setName("First day of week").setDesc("Which day the calendar week starts on.").addDropdown(n=>{n.addOption("0","Sunday").addOption("1","Monday").setValue(String(this.settings.calendar.firstDayOfWeek)).onChange(a=>{this.settings.calendar.firstDayOfWeek=parseInt(a,10),this.saveAndRefresh()})}),new f.Setting(e).setName("Show note indicators").setDesc("Show a dot on days that have existing notes.").addToggle(n=>{n.setValue(this.settings.calendar.showNoteIndicators).onChange(a=>{this.settings.calendar.showNoteIndicators=a,this.saveAndRefresh()})}),new f.Setting(e).setName("Indicator style").setDesc("Show one neutral dot for any dated note, or one coloured dot for each configured date system.").addDropdown(n=>{n.addOption("any","Single dot").addOption("systems","Colour by note system").setValue(this.settings.calendar.indicatorMode).onChange(a=>{this.settings.calendar.indicatorMode=a,this.saveAndRefresh()})}),new f.Setting(e).setName("Daily indicator colour").setDesc("Colour for daily-note dots when using \u201CColour by note system\u201D.").addColorPicker(n=>{n.setValue(this.settings.calendar.dailyIndicatorColor).onChange(a=>{this.settings.calendar.dailyIndicatorColor=a,this.saveAndRefresh()})})}renderPeriodicTab(e){new f.Setting(e).setName("Use existing tabs").setDesc("If a periodic note is already open, switch to its tab instead of opening it again.").addToggle(n=>{n.setValue(this.settings.reusePeriodicNoteTabs).onChange(a=>{this.settings.reusePeriodicNoteTabs=a,this.saveAndRefresh()})}),this.addPeriodNoteSettings(e,"Daily",this.settings.daily),this.addPeriodNoteSettings(e,"Weekly",this.settings.weekly),this.addPeriodNoteSettings(e,"Monthly",this.settings.monthly),this.addPeriodNoteSettings(e,"Quarterly",this.settings.quarterly),this.addPeriodNoteSettings(e,"Yearly",this.settings.yearly)}addPeriodNoteSettings(e,n,a){new f.Setting(e).setHeading().setName(n),new f.Setting(e).setName("Folder").setDesc(`Folder path for ${n.toLowerCase()} notes.`).addText(t=>{t.setPlaceholder("periodic/daily"),t.setValue(a.folder),t.onChange(i=>{a.folder=i,this.saveAndRefresh()})}),new f.Setting(e).setName("Name format").setDesc(`Date format for ${n.toLowerCase()} note filenames (moment.js format).`).addText(t=>{t.setPlaceholder("yyyy-MM-dd"),t.setValue(a.nameFormat),t.onChange(i=>{a.nameFormat=i,this.saveAndRefresh()})}),new f.Setting(e).setName("Template file").setDesc("Path to the template file. The .md extension is optional.").addText(t=>{t.setPlaceholder("Templates/Daily note"),t.setValue(a.templateFile),new Q(this.app,t.inputEl),t.onChange(i=>{a.templateFile=i,this.saveAndRefresh()})}),new f.Setting(e).setName("Type property").setDesc("Value for the 'type' frontmatter property.").addText(t=>{t.setPlaceholder("daily-note"),t.setValue(a.typeProperty),t.onChange(i=>{a.typeProperty=i,this.saveAndRefresh()})})}renderSystemsTab(e){let n=new DocumentFragment;n.createDiv({text:"A date system is a folder of notes whose filenames start with a date. Each one appears in the calendar's right-click menu for that day."}),n.createDiv({text:"The daily note is configured under Periodic Notes and always comes first in that menu."}),n.createDiv({text:"Name format is a moment.js format. Literal words need bracket escaping, e.g. YYYY-MM-DD - [Journal]."}),n.createDiv({text:"Include {title} for systems that hold many notes per date, such as meetings: the text before the token finds the existing notes, and the token marks where a typed title goes. Without it, a date has exactly one note."}),new f.Setting(e).setHeading().setName("Date systems").setDesc(n),this.settings.dateSystems.forEach((a,t,i)=>{new f.Setting(e).setHeading().setName(a.name||"Untitled system").addExtraButton(s=>{s.setIcon("arrow-up").setTooltip("Move up").setDisabled(t===0).onClick(async()=>{if(t===0)return;let o=i[t-1];i[t-1]=i[t],i[t]=o,await this.saveAndRefresh(),this.display()})}).addExtraButton(s=>{s.setIcon("arrow-down").setTooltip("Move down").setDisabled(t===i.length-1).onClick(async()=>{if(t===i.length-1)return;let o=i[t+1];i[t+1]=i[t],i[t]=o,await this.saveAndRefresh(),this.display()})}).addExtraButton(s=>{s.setIcon("trash").setTooltip("Delete this date system").onClick(async()=>{i.splice(t,1),await this.saveAndRefresh(),this.display()})}),this.addSystemTextSetting(e,"Name","Label shown in the calendar right-click menu.",a,"name","Journal"),this.addSystemTextSetting(e,"Folder","Folder these notes live in.",a,"folder","periodic/journal");let r=this.addSystemTextSetting(e,"Name format","Filename format (moment.js format). Include {title} for many notes per date.",a,"nameFormat","YYYY-MM-DD - {title}");a.nameFormat&&!W(a.nameFormat)&&r.descEl.createDiv({cls:"waypoint-settings-warning",text:"This name format has no date placeholder, so it will never match or create dated notes."}),this.addSystemTextSetting(e,"Template file","Path to the template file. The .md extension is optional.",a,"templateFile","resources/template/journal",!0),this.addSystemTextSetting(e,"Type property","Fallback value for the 'type' frontmatter property, used when no template is found.",a,"typeProperty","journal-note"),this.addSystemTextSetting(e,"Icon","Lucide icon name for the menu item. Browse names at lucide.dev.",a,"icon","book-open"),new f.Setting(e).setName("Indicator colour").setDesc("Colour for this system\u2019s dot when using \u201CColour by note system\u201D.").addColorPicker(s=>{s.setValue(a.indicatorColor).onChange(o=>{a.indicatorColor=o,this.saveAndRefresh()})})}),new f.Setting(e).addButton(a=>a.setButtonText("Add date system").setCta().onClick(async()=>{this.settings.dateSystems.push(Object.assign({id:`ds-${Date.now()}-${Math.random().toString(36).slice(2,6)}`},G)),await this.saveAndRefresh(),this.display()}))}addSystemTextSetting(e,n,a,t,i,r,s){return new f.Setting(e).setName(n).setDesc(a).addText(o=>{o.setPlaceholder(r),o.setValue(t[i]),s&&new Q(this.app,o.inputEl),o.onChange(l=>{t[i]=l,this.saveAndRefresh()})})}renderRecentTab(e){new f.Setting(e).setName("Max items").setDesc("How many recently opened files, and separately how many recently changed files, to keep. A burst of synced changes cannot push out the files you opened.").addText(t=>{t.inputEl.setAttr("type","number"),t.inputEl.setAttr("placeholder","50"),t.setValue(String(this.settings.recentFiles.maxItems)),t.inputEl.onblur=()=>{let i=parseInt(t.getValue(),10);!isNaN(i)&&i>0&&(this.settings.recentFiles.maxItems=i,this.saveAndRefresh())}});let n=new DocumentFragment;n.appendText("Regex patterns for paths to exclude. One per line."),new f.Setting(e).setName("Omitted paths").setDesc(n).addTextArea(t=>{t.inputEl.setAttr("rows",4),t.setPlaceholder(`^archives/ \\.png$`),t.setValue(this.settings.recentFiles.omittedPaths.join(` `)),t.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=t.getValue().split(` `).filter(i=>i.trim()),this.saveAndRefresh()}});let a=new DocumentFragment;a.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new f.Setting(e).setName("Omitted tags").setDesc(a).addTextArea(t=>{t.inputEl.setAttr("rows",4),t.setPlaceholder(`ignore archive`),t.setValue(this.settings.recentFiles.omittedTags.join(` `)),t.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=t.getValue().split(` `).filter(i=>i.trim()),this.saveAndRefresh()}}),this.renderRecentTypes(e)}renderRecentTypes(e){let n=this.settings.recentFiles.types;new f.Setting(e).setHeading().setName("File types").setDesc("Frontmatter `type` values. A type's icon shows beside matching recent files."),n.forEach((a,t)=>{new f.Setting(e).addText(i=>{i.setPlaceholder("meeting"),i.setValue(a.type),i.inputEl.onblur=()=>{let r=i.getValue().trim();r!==a.type&&(a.type=r,this.saveAndRefresh())}}).addExtraButton(i=>{i.setIcon(a.icon||"image-off").setTooltip(a.icon?`Icon: ${a.icon}`:"Choose icon").onClick(()=>{new H(this.app,a.icon,r=>{a.icon=r,this.saveAndRefresh(),this.display()}).open()})}).addExtraButton(i=>{i.setIcon("trash").setTooltip("Remove this type").onClick(()=>{n.splice(t,1),this.saveAndRefresh(),this.display()})})}),new f.Setting(e).addButton(a=>{a.setButtonText("Add type").onClick(()=>{n.push({type:"",icon:""}),this.display()})})}renderDisplayTab(e){new f.Setting(e).setHeading().setName("Bookmarks"),this.addSliderSetting(e,"Row size","Height of bookmark items.",this.settings.display,"rowSize",18,40,1,"px"),this.addSliderSetting(e,"Row spacing","Gap between bookmark items.",this.settings.display,"rowSpacing",0,12,1,"px"),this.addSliderSetting(e,"Indent size","Indent per nesting depth.",this.settings.display,"indentSize",8,32,2,"px"),this.addSliderSetting(e,"Font size","Label font size.",this.settings.display,"fontSize",10,18,1,"px"),this.addSliderSetting(e,"Icon size","Bookmark icon size.",this.settings.display,"iconSize",12,24,1,"px"),new f.Setting(e).setHeading().setName("Calendar"),this.addSliderSetting(e,"Cell size","Height of calendar day cells.",this.settings.display,"calendarCellSize",20,48,2,"px"),new f.Setting(e).addButton(n=>n.setButtonText("Reset to defaults").onClick(()=>{this.settings.display={...M.display},this.saveAndRefresh(),this.display()}))}addSliderSetting(e,n,a,t,i,r,s,o,l){let p=new f.Setting(e).setName(n).setDesc(`${a} (${t[i]}${l})`);p.addSlider(u=>{u.setLimits(r,s,o).setValue(t[i]).setDynamicTooltip().onChange(D=>{t[i]=D,p.setDesc(`${a} (${D}${l})`),this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveSettings(),this.onSettingsChange()}renderAboutTab(e){let n=this.plugin.manifest.version,a=e.createDiv();a.style.display="flex",a.style.alignItems="center",a.style.gap="12px",a.style.marginBottom="16px";let t=a.createDiv();t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.width="48px",t.style.height="48px",t.style.borderRadius="12px",t.style.background="var(--interactive-accent)",t.style.color="var(--text-on-accent)",t.style.fontSize="24px",(0,f.setIcon)(t,"compass");let i=a.createDiv(),r=i.createEl("h2",{text:"Waypoint Sidebar"});r.style.margin="0",r.style.lineHeight="1.2";let s=i.createDiv({text:`v${n}`});s.style.color="var(--text-muted)",s.style.fontSize="var(--font-ui-small)";let o=e.createDiv();o.style.marginBottom="20px",o.style.lineHeight="1.6",o.style.color="var(--text-normal)",o.innerHTML=["

Waypoint is a sidebar plugin that brings three essential panels into one view:

",'
    ',"
  • Calendar \u2014 a monthly grid for your periodic notes (daily, weekly, monthly, quarterly, yearly). Click any day, week, or month to open or create the corresponding note.
  • ","
  • Recent Files \u2014 a list of recently opened and changed files with type icons, drag-and-drop, and right-click actions.
  • ","
  • Bookmarks \u2014 custom bookmarks with icons, groups, nesting, and drag-and-drop reordering. Separate from Obsidian's native bookmarks.
  • ","
",'

Made by Olivier. Licensed under MIT.

'].join(` `)}};var J=require("obsidian"),Z=class extends J.Modal{constructor(e,n,a){super(e);this.initialDate=n;this.onSubmit=a}onOpen(){this.titleEl.setText("Open date");let e=this.contentEl.createEl("input",{type:"date",value:this.initialDate.format("YYYY-MM-DD")});e.style.width="100%",e.style.marginBottom="12px",e.focus();let n=()=>{let t=(0,J.moment)(e.value,"YYYY-MM-DD",!0);t.isValid()&&(this.close(),this.onSubmit(t))};e.addEventListener("keydown",t=>{t.key==="Enter"&&n()});let a=this.contentEl.createDiv({cls:"modal-button-container"});a.createEl("button",{text:"Cancel"}).addEventListener("click",()=>this.close()),a.createEl("button",{text:"Open",cls:"mod-cta"}).addEventListener("click",n)}onClose(){this.contentEl.empty()}};function se(c,d,e){return!c||!d?null:c===d?e:c.startsWith(d+"/")?e+c.slice(d.length):null}var ee=class extends y.Plugin{constructor(){super(...arguments);this.recentFiles=[];this.savePromise=Promise.resolve();this.markdownBasenames=new Set;this.dateSystemIndicators=null;this.dateSystemIndicatorKey="";this.indicatorModeMigrated=!1;this.previouslyActive=null;this.activePath=null}async onload(){console.debug("Waypoint: loading plugin v"+this.manifest.version);let e=await this.loadData(),n=this.applySettings(e);this.applyWaypointData(e),n&&this.persistAll(),this.registerView(E,s=>new O(s,this)),this.addSettingTab(new U(this.app,this,this.settings,()=>{this.enforceRecentFilesLimit(),this.invalidateDateSystemIndicators(),this.redrawAll()})),this.addCommand({id:"waypoint-open-view",name:"Open Waypoint sidebar",callback:async()=>{let s=this.app.workspace.getLeavesOfType(E);if(s.length>0)await this.app.workspace.revealLeaf(s[0]);else{let o=this.app.workspace.getLeftLeaf(!1);o&&(await o.setViewState({type:E}),await this.app.workspace.revealLeaf(o))}}}),this.addCommand({id:"waypoint-add-bookmark",name:"Add current file as Waypoint bookmark",callback:async()=>{let s=this.app.workspace.getActiveFile();if(!s){new y.Notice("No active file");return}this.addBookmark(s.path,s.basename,"file"),new y.Notice(`Bookmarked: ${s.basename}`)}}),this.addCommand({id:"waypoint-go-to-daily",name:"Go to daily note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"d"}],callback:async()=>{await this.openPeriodNote("day",(0,y.moment)())}}),this.addCommand({id:"waypoint-go-to-weekly",name:"Go to weekly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"w"}],callback:async()=>{await this.openPeriodNote("week",(0,y.moment)())}}),this.addCommand({id:"waypoint-go-to-monthly",name:"Go to monthly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"m"}],callback:async()=>{await this.openPeriodNote("month",(0,y.moment)())}}),this.addCommand({id:"waypoint-go-to-quarterly",name:"Go to quarterly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"q"}],callback:async()=>{await this.openPeriodNote("quarter",(0,y.moment)())}}),this.addCommand({id:"waypoint-go-to-yearly",name:"Go to yearly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"y"}],callback:async()=>{await this.openPeriodNote("year",(0,y.moment)())}}),this.addCommand({id:"waypoint-open-date",name:"Open daily note for a date\u2026",callback:()=>{new Z(this.app,(0,y.moment)(),s=>{this.showDateInViews(s),this.openPeriodNote("day",s)}).open()}});let a=["next","prev"],t=["daily","weekly","monthly","quarterly","yearly"],i={next:"Next",prev:"Previous"};for(let s of t)for(let o of a){let l=`waypoint-go-to-${o}-${s}`,p=`${i[o]} ${s} note`;this.addCommand({id:l,name:p,callback:async()=>{await this.navigatePeriodNote(o)}})}this.registerEvent(this.app.workspace.on("file-open",s=>{s&&this.onFileOpen(s)})),this.registerEvent(this.app.vault.on("create",s=>this.onVaultCreate(s))),this.registerEvent(this.app.vault.on("delete",s=>this.onVaultDelete(s))),this.registerEvent(this.app.vault.on("rename",(s,o)=>this.onRename(s,o))),this.registerEvent(this.app.vault.on("modify",s=>this.onFileChange(s))),this.app.workspace.onLayoutReady(()=>{if(this.buildMarkdownIndex(),this.app.workspace.getLeavesOfType(E).length===0){let o=this.app.workspace.getLeftLeaf(!1);o&&o.setViewState({type:E})}else this.broadcastRedraw()});let r=new Date().toDateString();this.registerInterval(window.setInterval(()=>{let s=new Date().toDateString();s!==r&&(r=s,this.redrawAll())},6e5))}async onunload(){this.app.workspace.detachLeavesOfType(E)}applySettings(e){var r,s;let n=(e==null?void 0:e.settings)||{};this.settings=Object.assign({},M,n),this.settings.recentFiles=Object.assign({},M.recentFiles,n.recentFiles||{});let a=this.settings.recentFiles;this.settings.recentFiles.types=Array.isArray((r=n.recentFiles)==null?void 0:r.types)?n.recentFiles.types.map(o=>({...o})):[],delete a.filterTags,delete a.showTypeFilter,delete a.updateOn,this.settings.calendar=Object.assign({},M.calendar,n.calendar||{}),this.settings.display=Object.assign({},M.display,n.display||{});for(let o of Ce)this.settings[o]=Object.assign({},M[o],n[o]||{});this.settings.dateSystems=Array.isArray(n.dateSystems)?n.dateSystems.map(o=>{let l=M.dateSystems.find(p=>p.id===o.id);return Object.assign({},l||G,o)}):M.dateSystems.map(o=>Object.assign({},o));let t=(e==null?void 0:e.indicatorModeMigrated)===!0,i=!1;return!t&&((s=n.calendar)==null?void 0:s.indicatorMode)==="any"&&(this.settings.calendar.indicatorMode="systems",i=!0),this.indicatorModeMigrated=!0,i}applyWaypointData(e){var r,s;let n=(e==null?void 0:e.waypointData)||{};this.waypointData={bookmarks:Array.isArray(n.bookmarks)?n.bookmarks:[],recentFiles:Array.isArray(n.recentFiles)?n.recentFiles:[]};let t=((s=(r=e==null?void 0:e.settings)==null?void 0:r.recentFiles)==null?void 0:s.updateOn)==="file-edit"?"changedAt":"openedAt",i=this.waypointData.recentFiles.length;this.recentFiles=j(this.waypointData.recentFiles.map((o,l)=>o.openedAt===void 0&&o.changedAt===void 0?{...o,[t]:i-l}:o),this.settings.recentFiles.maxItems),this.waypointData.recentFiles=this.recentFiles}persistAll(){let e=this.savePromise.then(()=>(this.waypointData.recentFiles=this.recentFiles,this.saveData({settings:this.settings,waypointData:this.waypointData,indicatorModeMigrated:this.indicatorModeMigrated})));return this.savePromise=e.catch(()=>{}),e}async saveSettings(){await this.persistAll()}async saveWaypointData(){await this.persistAll()}enforceRecentFilesLimit(){let e=j(this.recentFiles,this.settings.recentFiles.maxItems);e.length!==this.recentFiles.length&&(this.recentFiles=e,this.persistRecentFiles())}persistRecentFiles(){this.waypointData.recentFiles=this.recentFiles,window.clearTimeout(this.recentFilesSaveTimer),this.recentFilesSaveTimer=window.setTimeout(()=>{this.saveWaypointData()},300)}onFileOpen(e){this.activePath&&this.activePath!==e.path&&(this.previouslyActive={path:this.activePath,until:Date.now()+Le}),this.activePath=e.path,this.recordRecentFile(e,"opened")}onFileChange(e){e instanceof y.TFile&&this.recordRecentFile(e,"changed",this.isBackgroundChange(e))}isBackgroundChange(e){var a;if(((a=this.app.workspace.getActiveFile())==null?void 0:a.path)===e.path)return!1;let n=this.previouslyActive;return!(n&&n.path===e.path&&Date.now()r.path===e.path),i=n==="changed"&&t!==void 0&&this.recentFiles[0]===t&&R(this.recentFiles,"changed")[0]===t&&!(a&&!t.changedInBackground);t||(t={path:e.path,basename:e.basename},this.recentFiles.push(t)),n==="opened"?(t.openedAt=Date.now(),delete t.changedInBackground):(t.changedAt=Date.now(),a&&(t.changedInBackground=!0)),this.recentFiles=j(this.recentFiles,this.settings.recentFiles.maxItems),this.persistRecentFiles(),i||this.broadcastRedraw()}isOmittedFromRecentFiles(e){for(let r of this.settings.recentFiles.omittedPaths)try{if(new RegExp(r).test(e.path))return!0}catch(s){}let n=this.settings.recentFiles.omittedTags;if(n.length===0)return!1;let a=this.app.metadataCache.getFileCache(e),t=(a?(0,y.getAllTags)(a):null)||[];if(t.length===0)return!1;let i=t.map(r=>r.replace(/^#/,""));for(let r of n)try{let s=new RegExp(r);if(i.some(o=>s.test(o)))return!0}catch(s){}return!1}onRename(e,n){this.invalidateDateSystemIndicators();let a=this.syncIndexForRename(e,n),t=!1;for(let r of this.recentFiles){let s=se(r.path,n,e.path);s!==null&&(r.path=s,r.basename=ve(s),t=!0)}let i=r=>{for(let s of r){if(s.filePath){let o=se(s.filePath,n,e.path);o!==null&&(s.filePath=o,t=!0)}s.children&&i(s.children)}};i(this.waypointData.bookmarks),t&&(this.waypointData.recentFiles=this.recentFiles,this.persistAll()),(t||a)&&this.broadcastRedraw()}onVaultCreate(e){e instanceof y.TFile&&e.extension==="md"&&(this.markdownBasenames.add(e.basename),this.invalidateDateSystemIndicators()),this.app.workspace.layoutReady&&this.onFileChange(e),this.broadcastRedraw()}onVaultDelete(e){e instanceof y.TFile&&e.extension==="md"&&(this.removeFromMarkdownIndex(e.basename,e.path),this.invalidateDateSystemIndicators()),this.broadcastRedraw()}buildMarkdownIndex(){this.markdownBasenames.clear();for(let e of this.app.vault.getMarkdownFiles())this.markdownBasenames.add(e.basename)}invalidateDateSystemIndicators(){this.dateSystemIndicators=null,this.dateSystemIndicatorKey=""}removeFromMarkdownIndex(e,n){return!this.markdownBasenames.has(e)||this.app.vault.getMarkdownFiles().some(t=>t.basename===e&&t.path!==n)?!1:(this.markdownBasenames.delete(e),!0)}syncIndexForRename(e,n){if(!(e instanceof y.TFile))return!1;let a=!1,t=ve(n);return n.toLowerCase().endsWith(".md")&&(t!==e.basename||e.extension!=="md")&&(a=this.removeFromMarkdownIndex(t,n)),e.extension==="md"&&!this.markdownBasenames.has(e.basename)&&(this.markdownBasenames.add(e.basename),a=!0),a}hasNoteForDate(e){return this.markdownBasenames.has(e)}addBookmark(e,n,a="file",t=""){let r={id:`bm-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:a,label:n,filePath:a==="file"?e:"",icon:t,children:[],collapsed:!1,indent:0};return this.waypointData.bookmarks.push(r),this.saveWaypointData(),this.broadcastRedraw(),r}removeBookmark(e){let n=a=>{let t=a.findIndex(i=>i.id===e);if(t>=0)return a.splice(t,1),!0;for(let i of a)if(i.children&&n(i.children))return!0;return!1};n(this.waypointData.bookmarks),this.saveWaypointData(),this.broadcastRedraw()}updateBookmark(e,n){let a=i=>{for(let r of i){if(r.id===e)return r;if(r.children){let s=a(r.children);if(s)return s}}return null},t=a(this.waypointData.bookmarks);t&&(Object.assign(t,n),this.saveWaypointData(),this.broadcastRedraw())}periodAsDateSystem(e){let n=X[e],a=this.settings[n.key];return{id:n.key,name:n.label,folder:a.folder,nameFormat:a.nameFormat,templateFile:a.templateFile,typeProperty:a.typeProperty,icon:"calendar",indicatorColor:this.settings.calendar.dailyIndicatorColor}}dateSystems(){return[this.periodAsDateSystem("day"),...this.settings.dateSystems]}findDateSystemNotes(e){let n=this.dateSystems().map(a=>{let t=V(a.nameFormat);return{result:{system:a,notes:[],multiple:t.hasTitle},before:$(e,t.before),after:$(e,t.after),hasTitle:t.hasTitle,skip:!W(a.nameFormat)}});for(let a of this.app.vault.getMarkdownFiles())for(let t of n){if(t.skip)continue;let i=t.result.system;ae(a.path,i.folder)&&ie(a.basename,t.before,t.after,t.hasTitle)&&t.result.notes.push({file:a,label:t.hasTitle?ue(a.basename,t.before,t.after):i.name})}for(let a of n)a.result.notes.sort((t,i)=>t.file.basename.localeCompare(i.file.basename));return n.filter(a=>!a.skip).map(a=>a.result)}getDateSystemIndicators(e){var s;let n=e.map(o=>o.format("YYYY-MM-DD")),a=this.dateSystems().filter(o=>W(o.nameFormat)).map(o=>{let l=V(o.nameFormat);return{system:o,hasTitle:l.hasTitle,dates:e.map((p,u)=>({dateStr:n[u],before:$(p,l.before),after:$(p,l.after)}))}}),t=JSON.stringify({dates:n,systems:a.map(({system:o})=>[o.id,o.name,o.folder,o.nameFormat,o.indicatorColor])});if(this.dateSystemIndicators&&this.dateSystemIndicatorKey===t)return this.dateSystemIndicators;let i=new Map;for(let o of n)i.set(o,new Set);for(let o of this.app.vault.getMarkdownFiles())for(let l of a)if(ae(o.path,l.system.folder))for(let p of l.dates)ie(o.basename,p.before,p.after,l.hasTitle)&&((s=i.get(p.dateStr))==null||s.add(l.system.id));let r=new Map;for(let o of n){let l=i.get(o);r.set(o,a.filter(({system:p})=>l==null?void 0:l.has(p.id)).map(({system:p})=>({id:p.id,name:p.name,color:p.indicatorColor})))}return this.dateSystemIndicatorKey=t,this.dateSystemIndicators=r,r}async openDateSystemNote(e,n,a){if(!W(e.nameFormat)){new y.Notice(`Waypoint: ${e.name||"This"} name format needs a date placeholder.`);return}let t=V(e.nameFormat),i=$(n,t.before),r=$(n,t.after),s;if(t.hasTitle){let u=ge((a==null?void 0:a.title)||"");if(!u){new y.Notice(`Waypoint: a ${e.name.toLowerCase()} note needs a title.`);return}s=i+u+r}else s=i+r;let o=e.folder?`${e.folder}/${s}.md`:`${s}.md`,l=this.app.vault.getFileByPath(o);if(!l&&(l=await this.createDatedNote(o,e,n),!l))return;if(a!=null&&a.reuseExistingLeaf&&!a.leaf){let u=this.app.workspace.getLeavesOfType("markdown").find(D=>{var S;return((S=D.getViewState().state)==null?void 0:S.file)===l.path});if(u){await this.app.workspace.revealLeaf(u),this.app.workspace.setActiveLeaf(u,{focus:!0});return}}await((a==null?void 0:a.leaf)||this.app.workspace.getLeaf(!1)).openFile(l)}async openPeriodNote(e,n,a){await this.openDateSystemNote(this.periodAsDateSystem(e),n,{leaf:a,reuseExistingLeaf:this.settings.reusePeriodicNoteTabs})}async createDatedNote(e,n,a){let t=n.name.toLowerCase(),i=e.lastIndexOf("/"),r=i<0?"":e.slice(0,i);try{await this.ensureFolderExists(r)}catch(u){return new y.Notice(`Waypoint: could not create the folder "${r}" for the ${t} note. ${oe(u)} Check Settings \u2192 Waypoint Sidebar \u2192 Periodic Notes.`,q),null}let s=n.templateFile,o=this.resolveTemplateFile(s),l;if(o)try{l=await this.app.vault.read(o)}catch(u){return new y.Notice(`Waypoint: could not read the template "${o.path}" for the ${t} note. `+oe(u),q),null}else l=`--- type: ${n.typeProperty} date: ${a.format("YYYY-MM-DD")} --- `;let p;try{p=await this.app.vault.create(e,l)}catch(u){return new y.Notice(`Waypoint: could not create the ${t} note at "${e}". ${oe(u)}`,q),null}return s&&!o?new y.Notice(`Created ${t} note: ${p.basename} Template "${s}" was not found, so a basic note was created instead.`,q):new y.Notice(`Created ${t} note: ${p.basename}`),p}async ensureFolderExists(e){if(!e||this.app.vault.getAbstractFileByPath(e)instanceof y.TFolder)return;let n="";for(let a of e.split("/"))if(a&&(n=n?`${n}/${a}`:a,!(this.app.vault.getAbstractFileByPath(n)instanceof y.TFolder)))try{await this.app.vault.createFolder(n)}catch(t){if(!(this.app.vault.getAbstractFileByPath(n)instanceof y.TFolder))throw t}}resolveTemplateFile(e){if(!e)return null;let n=e.toLowerCase().endsWith(".md")?e:`${e}.md`;return this.app.vault.getFileByPath(n)}detectPeriodType(e){for(let n of fe){let a=this.settings[X[n].key].nameFormat;if(!a)continue;let t=(0,y.moment)(e,a,!0);if(t.isValid())return{period:n,date:t}}return null}async navigatePeriodNote(e){let n=this.app.workspace.getActiveFile();if(!n){new y.Notice("No active file");return}let a=this.detectPeriodType(n.basename);if(!a){let o=fe.map(l=>`${X[l].label.toLowerCase()} "${this.settings[X[l].key].nameFormat}"`).join(", ");new y.Notice(`Waypoint: "${n.basename}" does not match any configured periodic note format. Expected one of: ${o}.`,q);return}let{period:t,date:i}=a,r=e==="next"?1:-1,s=t==="quarter"?i.clone().add(r*3,"months"):i.clone().add(r,`${t}s`);await this.openPeriodNote(t,s)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let e=this.app.workspace.getLeavesOfType(E);for(let n of e)n.view instanceof O&&n.view.redraw()}showDateInViews(e){for(let n of this.app.workspace.getLeavesOfType(E))n.view instanceof O&&n.view.showDate(e)}},Ce=["daily","weekly","monthly","quarterly","yearly"],X={day:{key:"daily",label:"Daily"},week:{key:"weekly",label:"Weekly"},month:{key:"monthly",label:"Monthly"},quarter:{key:"quarterly",label:"Quarterly"},year:{key:"yearly",label:"Yearly"}},fe=["day","week","month","quarter","year"];function ve(c){return c.slice(c.lastIndexOf("/")+1).replace(/\.[^/.]+$/,"")}var q=1e4,Le=5e3;function oe(c){return c instanceof Error?c.message:String(c)}function $(c,d){return d?c.format(d):""}